:root {
  --brand: #6f263d;
  --brand-dark: #50172b;
  --brand-soft: #f8edf1;
  --ink: #211923;
  --subtle: #716772;
  --muted: #968c96;
  --canvas: #f7f4f2;
  --surface: #fff;
  --line: #e9e2df;
  --success: #327257;
  --warning: #9b6816;
  --danger: #a83e48;
  --shadow: 0 10px 30px rgba(57, 29, 40, 0.07);
  --radius: 20px;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "Manrope", system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
}
.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 10px;
}
.skip-link:focus {
  top: 1rem;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 72px;
  padding: 0.75rem max(1rem, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(233, 226, 223, 0.85);
  backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font: 800 1.15rem var(--font-display);
  box-shadow: 0 8px 18px rgba(111, 38, 61, 0.18);
}
.brand strong,
.brand span {
  display: block;
}
.brand strong {
  font: 700 0.94rem var(--font-display);
}
.brand div > span {
  color: var(--subtle);
  font-size: 0.75rem;
}
.icon-button {
  min-height: 46px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button:hover {
  border-color: #cfb0ba;
  background: var(--brand-soft);
}
.icon-button:active {
  transform: scale(0.97);
}
.icon-button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-actions form {
  margin: 0;
}
.icon-button.quiet {
  color: var(--subtle);
}
.shell {
  width: min(100%, 1440px);
  margin: auto;
  padding: 1.25rem 1rem 4rem;
}
.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0 1.5rem;
}
.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.intro h1,
.section-heading h2,
.panel-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.035em;
}
.intro h1 {
  font-size: clamp(1.8rem, 7vw, 3rem);
}
.intro > div > p:last-child,
.section-heading > p {
  margin: 0.25rem 0 0;
  color: var(--subtle);
  font-size: 0.85rem;
}
.status-chip {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #dce9e3;
  border-radius: 999px;
  background: #f2f8f5;
  color: var(--success);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-chip span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-panel {
  min-height: 170px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.status-panel strong,
.status-panel p {
  display: block;
  margin: 0;
}
.status-panel p {
  margin-top: 0.2rem;
  color: var(--subtle);
  font-size: 0.85rem;
}
.status-panel.error {
  flex-direction: column;
  text-align: center;
  border-color: #efced2;
  background: #fff8f8;
}
.status-panel.error strong {
  color: var(--danger);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #eadce1;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}
section {
  margin-bottom: 2rem;
}
.section-heading,
.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.section-heading h2,
.panel-heading h2 {
  font-size: 1.1rem;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.kpi-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(57, 29, 40, 0.035);
}
.kpi-card.primary {
  grid-column: 1/-1;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border: 0;
  box-shadow: 0 14px 30px rgba(111, 38, 61, 0.2);
}
.kpi-label {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 700;
}
.primary .kpi-label {
  color: #ead6dc;
}
.kpi-value {
  display: block;
  margin: 0.35rem 0 0.25rem;
  font: 800 clamp(1.15rem, 5.5vw, 1.85rem) / 1.15 var(--font-display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-note {
  color: var(--subtle);
  font-size: 0.72rem;
}
.primary .kpi-note {
  color: #efdce2;
}
.chart-grid {
  display: grid;
  gap: 0.75rem;
}
.chart-card,
.panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 22px rgba(57, 29, 40, 0.035);
}
.chart-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.chart-meta strong {
  font: 700 0.9rem var(--font-display);
}
.chart-meta span {
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}
.chart-box {
  height: 190px;
}
.insight-grid {
  display: grid;
  gap: 0.75rem;
}
.daily-grid {
  display: grid;
  gap: 0.75rem;
}
.panel-heading > span {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 800;
}
.product-list {
  display: grid;
}
.product-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid var(--line);
}
.product-row:last-child {
  border: 0;
}
.rank {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--canvas);
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
}
.product-copy {
  min-width: 0;
}
.product-copy strong,
.product-copy span {
  display: block;
}
.product-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}
.product-copy span {
  color: var(--subtle);
  font-size: 0.7rem;
}
.product-value {
  text-align: right;
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.product-value span {
  display: block;
  color: var(--success);
  font-size: 0.68rem;
}
.attention-list,
.transaction-list {
  display: grid;
  gap: 0.65rem;
}
.attention-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.attention-row:last-child {
  border: 0;
}
.attention-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}
.attention-row strong,
.attention-row span {
  display: block;
}
.attention-row strong {
  font-size: 0.82rem;
}
.attention-row div > span {
  color: var(--subtle);
  font-size: 0.7rem;
}
.payment-stack {
  display: flex;
  height: 12px;
  margin: 1rem 0 1.25rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.payment-segment + .payment-segment {
  border-left: 2px solid var(--surface);
}
.tone-0 { background: var(--brand); }
.tone-1 { background: #a66b7e; }
.tone-2 { background: #d49a5b; }
.tone-3 { background: #567c70; }
.tone-4 { background: #77718f; }
.payment-list {
  display: grid;
  gap: 0.7rem;
}
.payment-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.78rem;
}
.payment-list span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--subtle);
}
.payment-list i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.transaction-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}
.transaction-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--canvas);
}
.transaction-head strong,
.transaction-head span {
  display: block;
}
.transaction-head strong {
  font-size: 0.78rem;
}
.transaction-head span {
  color: var(--subtle);
  font-size: 0.68rem;
}
.transaction-head b,
.transaction-lines b {
  font-size: 0.74rem;
  white-space: nowrap;
}
.transaction-lines > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.75rem;
  border-top: 1px solid var(--line);
}
.transaction-lines strong,
.transaction-lines small {
  display: block;
}
.transaction-lines strong {
  font-size: 0.78rem;
}
.transaction-lines small {
  color: var(--subtle);
  font-size: 0.68rem;
}
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(circle at top, #f7e9ee, var(--canvas) 48%);
}
.login-shell {
  width: min(100%, 390px);
}
.login-shell > .brand-mark {
  margin: 0 auto -1rem;
  position: relative;
  z-index: 1;
}
.login-card {
  margin: 0;
  padding: 2.5rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login-card h1 {
  margin: 0;
  font: 800 1.6rem var(--font-display);
  letter-spacing: -0.04em;
}
.login-copy {
  margin: 0.5rem 0 1.25rem;
  color: var(--subtle);
  font-size: 0.85rem;
}
.login-card label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.login-card input {
  width: 100%;
  min-height: 50px;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  font: 600 1rem var(--font-body);
}
.login-error {
  margin: 0.55rem 0 0;
  color: var(--danger);
  font-size: 0.76rem;
}
.login-button {
  width: 100%;
  min-height: 50px;
  margin-top: 1rem;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.table-wrap {
  overflow: auto;
}
.data-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.data-table th {
  padding: 0.6rem;
  text-align: left;
  color: var(--subtle);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.data-table td {
  padding: 0.7rem 0.6rem;
  border-top: 1px solid var(--line);
}
.data-table th:last-child,
.data-table td:last-child {
  text-align: right;
}
.stock {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #eef6f2;
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 800;
}
.stock.low {
  background: #fff5df;
  color: var(--warning);
}
.stock.empty {
  background: #fff0f1;
  color: var(--danger);
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.category-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
}
.category-card h3 {
  margin: 0;
  color: var(--subtle);
  font-size: 0.72rem;
}
.category-card strong {
  display: block;
  margin: 0.3rem 0;
  font: 800 1rem var(--font-display);
}
.category-card p {
  margin: 0;
  color: var(--subtle);
  font-size: 0.7rem;
}
.bar {
  height: 5px;
  margin-top: 0.7rem;
  border-radius: 99px;
  background: #eee8e6;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}
.pattern-chart {
  height: 230px;
}
.empty {
  padding: 1.5rem 0.5rem;
  text-align: center;
  color: var(--subtle);
  font-size: 0.82rem;
}
:focus-visible {
  outline: 3px solid rgba(111, 38, 61, 0.3);
  outline-offset: 3px;
}
@media (min-width: 700px) {
  .topbar {
    padding-inline: 1.5rem;
  }
  .shell {
    padding: 1.75rem 1.5rem 5rem;
  }
  .status-chip {
    display: flex;
  }
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .kpi-card.primary {
    grid-column: auto;
  }
  .chart-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .insight-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .daily-grid {
    grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.5fr);
  }
  .panel-wide {
    grid-column: 1/-1;
  }
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 520px) {
  .topbar-actions .icon-button span {
    display: none;
  }
  .topbar-actions .icon-button {
    width: 46px;
    justify-content: center;
  }
}
@media (min-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .chart-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .insight-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .panel-wide {
    grid-column: auto;
  }
  .category-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
