:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17213f;
  background: #f4f7fb;
  --brand-navy: #1d2246;
  --brand-blue: #007dcc;
  --brand-cyan: #18b8c2;
  --brand-teal: #0c8f9b;
  --ink: #17213f;
  --muted: #657188;
  --line: #d9e3ef;
  --panel: rgba(255, 255, 255, 0.94);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(12, 143, 155, 0.14), transparent 340px),
    linear-gradient(90deg, rgba(29, 34, 70, 0.08), transparent 52%),
    #f4f7fb;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: -150px;
  right: -210px;
  z-index: -1;
  width: min(920px, 68vw);
  height: 620px;
  background: url("/assets/grafismo.png") no-repeat right top / contain;
  opacity: 0.18;
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  border: 1px solid rgba(29, 34, 70, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 253, 0.9)),
    #fff;
  box-shadow: 0 18px 42px rgba(29, 34, 70, 0.11);
  padding: 16px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(29, 34, 70, 0.12);
  padding: 6px;
  box-shadow: 0 10px 22px rgba(29, 34, 70, 0.08);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--brand-navy);
  font-size: clamp(1.85rem, 2.4vw, 2.8rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding-left: 12px;
  color: var(--brand-navy);
  font-size: 0.82rem;
  font-weight: 800;
}

.account-chip .ghost-button {
  min-height: 38px;
  border-width: 0 0 0 1px;
  border-radius: 0 6px 6px 0;
}

.auth-panel {
  display: grid;
  gap: 14px;
  max-width: 560px;
  margin: 12vh auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(29, 34, 70, 0.12);
  padding: 28px;
}

.auth-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.auth-button {
  width: fit-content;
}

.auth-error {
  border: 1px solid #e8bab3;
  border-radius: 6px;
  background: #fff1ef;
  color: #8f372d;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 800;
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand-blue), #0064aa);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button:hover {
  background: linear-gradient(135deg, #006dad, var(--brand-navy));
}

.ghost-button {
  background: #fff;
  color: var(--brand-navy);
  padding: 0 14px;
  border: 1px solid var(--line);
}

.ghost-button:hover {
  background: #f0f6ff;
}

.icon-button {
  min-width: 34px;
  min-height: 34px;
  background: #f4e8e6;
  color: #a13f32;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.hidden-input {
  display: none;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 8px 20px rgba(29, 34, 70, 0.06);
}

.view-tabs button {
  min-height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 800;
}

.view-tabs button.active {
  background: var(--brand-navy);
  color: #fff;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 28px;
  margin-bottom: 14px;
  border: 1px solid rgba(217, 227, 239, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #16a36a;
  box-shadow: 0 0 0 4px rgba(22, 163, 106, 0.14);
}

.status-indicator.warning .status-dot {
  background: #e5a400;
  box-shadow: 0 0 0 4px rgba(229, 164, 0, 0.16);
}

.status-indicator.danger .status-dot {
  background: #d94d3f;
  box-shadow: 0 0 0 4px rgba(217, 77, 63, 0.16);
}

.control-band,
.report-filter {
  display: grid;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 16px;
}

.control-band {
  gap: 12px;
}

.control-inputs {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr);
  gap: 10px;
  max-width: 720px;
}

.control-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 10px;
}

.report-filter {
  grid-template-columns: minmax(190px, 0.8fr) repeat(3, minmax(160px, 1fr));
}

label,
.metric {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
.metric {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

input,
select {
  width: 100%;
  padding: 0 11px;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 125, 204, 0.14);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--brand-blue);
}

.metric {
  justify-content: center;
  padding: 8px 12px;
}

.metric span {
  font-size: 0.72rem;
}

.metric strong {
  color: var(--brand-navy);
  font-size: 0.98rem;
}

.metric.factor {
  background: #eef7ff;
  border-color: #b9dcf6;
}

.metric.commission {
  background: #e8f8fb;
  border-color: #a5e0e5;
}

.metric.return {
  background: #fff1ef;
  border-color: #e8bab3;
}

.metric.pending {
  background: #fff1ef;
  border-color: #e8bab3;
}

.work-area {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.entry-panel,
.rules-panel,
.table-section,
.summary-panel,
.people-panel,
.users-panel,
.home-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 32px rgba(29, 34, 70, 0.08);
}

.readonly-note {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  padding: 12px 14px;
  font-size: 0.86rem;
  font-weight: 800;
}

.readonly-note.compact {
  margin-bottom: 0;
}

.entry-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px;
}

.entry-panel h2 {
  grid-column: 1 / -1;
}

.wide {
  grid-column: span 2;
}

.checkbox-label span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 11px;
  color: var(--ink);
}

.submit-button {
  align-self: end;
  width: 100%;
}

.rules-panel {
  padding: 16px;
}

.rule-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.rule-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.rule-row {
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  align-items: end;
  gap: 10px;
  padding: 6px 0;
}

.rule-row label {
  gap: 4px;
  font-size: 0.72rem;
}

.rule-row input {
  min-height: 34px;
  padding: 0 8px;
  font-size: 0.82rem;
}

.table-section {
  overflow: hidden;
  margin-bottom: 16px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-header span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.table-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.pending-table-section {
  border-color: #f0c2bd;
  background: #fffafb;
}

.pending-table-section .table-header {
  background: #fff4f4;
}

.pending-table-section th {
  background: #a64f5b;
}

.seller-pending-section {
  box-shadow: 0 14px 34px rgba(78, 35, 60, 0.12);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1840px;
  border-collapse: collapse;
}

.compact-table {
  min-width: 1180px;
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid #e5ebf2;
  text-align: right;
  white-space: nowrap;
  font-size: 0.8rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 800;
}

th:nth-child(1),
th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
td:nth-child(1),
td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
  text-align: left;
}

tbody tr {
  background: #fbfdff;
}

tbody tr:nth-child(even) {
  background: #f2f7fc;
}

.table-input {
  min-height: 32px;
  min-width: 88px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.table-input.numeric {
  width: 90px;
  text-align: right;
}

.client-edit {
  width: 220px;
}

.product-edit {
  width: 210px;
}

.paid-cell {
  text-align: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.status-pill.ok {
  border: 1px solid #b9d9cd;
  background: #e7f4ef;
  color: #237c6b;
}

.status-pill.blocked {
  border: 1px solid #efc77a;
  background: #fff7e8;
  color: #8a5c0d;
}

.return-table-section th {
  background: #7b4f5b;
}

.empty-cell {
  color: #69736c;
  text-align: left;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.payment-summary-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
}

.home-summary-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.summary-panel,
.people-panel,
.users-panel,
.home-panel {
  padding: 14px 16px;
}

.home-panel {
  margin-bottom: 16px;
}

.home-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.home-header h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.home-header p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.ploomes-form {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(160px, 0.35fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.import-message {
  margin: 14px 0 0;
  border: 1px solid #b7d9f0;
  border-radius: 6px;
  background: #eef7ff;
  color: var(--brand-navy);
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 800;
}

.ploomes-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.ploomes-summary > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.ploomes-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.ploomes-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.3rem;
}

.ploomes-summary .ploomes-alert {
  grid-column: 1 / -1;
  border-color: #efc77a;
  background: #fff7e8;
}

.ploomes-alert strong {
  margin: 0 0 4px;
  color: #7b5512;
  font-size: 0.86rem;
}

.summary-row,
.seller-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) repeat(3, minmax(92px, 0.7fr));
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  border-bottom: 1px solid #e5ebf2;
  color: #42516b;
  font-size: 0.84rem;
  text-align: right;
}

.summary-row strong,
.seller-row strong {
  color: var(--brand-navy);
  text-align: left;
}

.seller-row {
  border-radius: 6px;
  border: 0;
  border-bottom: 1px solid #e5ebf2;
  background: transparent;
  cursor: pointer;
}

.seller-row:hover {
  background: #eef7ff;
}

.empty-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.people-header {
  display: grid;
  grid-template-columns: minmax(180px, 0.3fr) minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.seller-form {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(120px, 0.55fr) minmax(150px, 0.7fr) auto;
  gap: 10px;
}

.users-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.users-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(130px, 0.8fr) minmax(120px, 0.55fr) minmax(150px, 0.7fr) minmax(110px, 0.5fr) auto;
  gap: 10px;
}

.user-table {
  min-width: 1120px;
}

.user-email {
  min-width: 240px;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.people-message {
  grid-column: 2;
  margin: -6px 0 0;
  border: 1px solid #b7d9f0;
  border-radius: 6px;
  background: #eef7ff;
  color: var(--brand-navy);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.seller-admin-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.seller-admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.seller-admin-card.selected {
  border-color: #93cbed;
  background: #eef7ff;
}

.seller-admin-head {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(130px, 0.55fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}

.goals-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.goals-grid label {
  gap: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.goals-grid label.current {
  color: var(--brand-blue);
}

.goals-grid input {
  min-height: 32px;
  padding: 0 7px;
  font-size: 0.78rem;
}

@media (max-width: 1180px) {
  .topbar,
  .work-area,
  .summary-grid,
  .home-header,
  .people-header,
  .seller-admin-list,
  .control-inputs,
  .report-filter,
  .users-header {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .people-message {
    grid-column: 1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1520px);
    padding-top: 18px;
  }

  .entry-panel,
  .ploomes-form,
  .seller-form,
  .seller-admin-head,
  .user-form {
    grid-template-columns: 1fr;
  }

  .ploomes-summary {
    grid-template-columns: 1fr;
  }

  .goals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide {
    grid-column: auto;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
