:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --ink: #1f2528;
  --muted: #697277;
  --line: #dfe4e6;
  --brand: #0f766e;
  --brand-soft: #e7f4f2;
  --dark: #111c1a;
  --dark-soft: #1a2b28;
  --amber: #9a5b13;
  --amber-soft: #fff6e6;
  --red: #b42318;
  --red-soft: #fff1f0;
  --green: #027a48;
  --green-soft: #ecfdf3;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--dark);
  background: var(--dark);
  color: #ffffff;
  padding: 18px 12px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 6px 16px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.brand-mark img {
  width: 32px;
  max-height: 28px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #b7c4c1;
  font-size: 12px;
}

.menu {
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d7e1de;
  padding: 0 10px 0 6px;
  text-align: left;
  cursor: pointer;
}

.menu-item[hidden] {
  display: none;
}

.menu-item .menu-icon {
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: transparent;
}

.menu-item.active {
  background: var(--dark-soft);
  color: #ffffff;
  font-weight: 700;
}

.menu-item.active .menu-icon {
  background: #f2d79a;
}

.menu-item.locked {
  color: #778783;
  cursor: not-allowed;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 6px 0;
}

.sidebar-footer span,
.hero-meta span,
.filter-label,
.metric span,
.table-header span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: #ffffff;
}

.sidebar-logout {
  width: 100%;
  min-height: 30px;
  margin-top: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-footer span {
  color: #9fb0ac;
}

.content {
  min-width: 0;
  padding: 18px 20px 24px;
}

.view[hidden] {
  display: none;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.15;
}

h2 {
  font-size: 15px;
}

.hero-copy p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}

.hero-meta {
  min-width: 176px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 12px;
}

.hero-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.toolbar,
.summary-grid,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.filter-group {
  display: grid;
  gap: 6px;
}

.period-buttons,
.date-range,
.status-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.date-range {
  justify-content: flex-end;
  align-items: flex-end;
}

.date-range label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.period-button,
.primary-button,
.status-filter-button,
.order-status-button,
.resultado-period-button,
.resultado-month-button,
.google-ads-period-button,
.meta-ads-period-button,
.meta-ads-account-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  cursor: pointer;
}

.period-button.active,
.primary-button,
.status-filter-button.active,
.order-status-button.active,
.resultado-period-button.active,
.resultado-month-button.active,
.google-ads-period-button.active,
.meta-ads-period-button.active,
.meta-ads-account-button.active {
  border-color: var(--dark);
  background: var(--dark);
  color: #ffffff;
}

.date-range input,
.search {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.date-range input {
  padding: 0 8px;
}

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

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

.metric {
  padding: 11px 14px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric.alert strong {
  color: var(--red);
}

.table-panel {
  overflow: hidden;
}

.table-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 360px);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.table-header span {
  display: block;
  margin-top: 3px;
}

.search {
  width: 100%;
  padding: 0 10px;
}

.message {
  margin: 10px 14px 0;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 8px 10px;
}

.status-filter {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.status-filter-button,
.order-status-button,
.resultado-period-button,
.resultado-month-button,
.google-ads-period-button,
.meta-ads-period-button,
.meta-ads-account-button {
  min-height: 28px;
  font-size: 12px;
}

.primary-button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

#marketingView .summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.google-ads-panel {
  margin-top: 10px;
}

.marketing-toolbar {
  margin-top: 14px;
}

.legacy-marketing-detail {
  display: none;
}

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

.result-card-section {
  margin-bottom: 10px;
}

.result-card-section h2 {
  margin: 0 0 7px;
}

.result-month-filter {
  grid-column: span 2;
}

.month-buttons {
  max-width: 620px;
}

.result-custom-range {
  justify-content: flex-start;
}

.result-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.legacy-result-summary,
.legacy-spend-source {
  display: none;
}

.result-panel {
  margin-top: 10px;
}

.result-table {
  min-width: 720px;
}

.updates-table {
  min-width: 780px;
}

.mini-table-wrap {
  border-top: 1px solid var(--line);
}

.meta-accounts-table {
  min-width: 640px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.orders-table {
  min-width: 900px;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf0f1;
  vertical-align: middle;
}

th {
  background: #fafafa;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  font-weight: 700;
}

td {
  color: var(--ink);
}

tbody tr:hover td {
  background: #fcfcfc;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sku {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.product {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.need-positive,
.balance-negative {
  color: var(--red);
  font-weight: 700;
}

.balance-positive {
  color: var(--green);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 6px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.order-number-button {
  border: 0;
  border-radius: 5px;
  background: var(--dark);
  color: #ffffff;
  min-height: 26px;
  padding: 0 8px;
  font-weight: 700;
  cursor: pointer;
}

.order-number-button:hover {
  background: var(--brand);
}

.release-button {
  min-height: 28px;
  border: 1px solid var(--dark);
  border-radius: 6px;
  background: var(--dark);
  color: #ffffff;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.release-button.active {
  border-color: var(--green);
  background: var(--green);
}

.release-button:hover {
  background: var(--brand);
  border-color: var(--brand);
}

.order-detail-cell {
  background: #f9fbfa;
  padding: 0 10px 10px;
}

.items-table {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.items-table td {
  padding: 7px 9px;
  background: #ffffff;
}

.items-table tr:last-child td {
  border-bottom: 0;
}

.warranty-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  padding: 14px;
}

.warranty-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.warranty-form input,
.warranty-form select,
.warranty-form textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 9px;
}

.warranty-form textarea {
  resize: vertical;
}

.wide-field {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
  align-content: end;
}

.checkbox-grid label,
.access-fieldset label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--ink);
}

.checkbox-grid input,
.access-fieldset input {
  width: auto;
  min-height: auto;
}

.access-fieldset {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.access-fieldset legend {
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}

.product-choice-list {
  display: grid;
  gap: 8px;
  width: 100%;
}

.product-choice-list label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(242, 215, 154, 0.22), transparent 32%),
    linear-gradient(135deg, #0b1714 0%, #102520 52%, #f4f1eb 52%, #ffffff 100%);
}

.login-shell {
  width: min(460px, 100%);
}

.login-card {
  border-radius: 8px;
  background: var(--surface);
  padding: 30px;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.24);
}

.login-brand {
  text-align: center;
}

.login-brand img {
  max-width: 210px;
  max-height: 74px;
  object-fit: contain;
  margin-bottom: 16px;
}

.login-help {
  margin: 8px 0 18px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.login-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.login-form input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.warranty-list-panel {
  margin-top: 10px;
}

.warranty-table {
  min-width: 980px;
}

.task-card-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.task-empty {
  margin: 0;
}

.task-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
}

.task-card p {
  margin: 0;
}

.task-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  resize: vertical;
}

.refunds-table {
  min-width: 1500px;
}

.compact-select {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 7px;
  font: inherit;
  font-size: 12px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .hero-panel,
  .toolbar,
  .table-header {
    grid-template-columns: 1fr;
  }

  .date-range {
    justify-content: flex-start;
  }

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

  .warranty-form {
    grid-template-columns: 1fr;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }
}
