:root {
  --ink: #18221d;
  --muted: #66736b;
  --paper: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --line: #dfe5df;
  --purple: #531878;
  --purple-2: #6f2797;
  --purple-soft: #f1e8f7;
  --mint: #2f7c58;
  --mint-soft: #e1f3e9;
  --orange: #d3652a;
  --orange-soft: #fff0e6;
  --red: #b13a42;
  --red-soft: #fdebed;
  --yellow: #996b0b;
  --yellow-soft: #fff5d7;
  --shadow: 0 12px 36px rgba(25, 40, 31, 0.08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body { margin: 0; min-height: 100vh; background: var(--paper); }

body.auth-pending { overflow: hidden; }
body.auth-pending .app-shell { visibility: hidden; }

.login-screen {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 10%, #7d319d 0, #3a174d 38%, #1f1527 100%);
}
.login-screen.hidden { display: none; }
.login-card {
  width: min(100%, 430px); padding: 34px; border-radius: 24px; background: white;
  box-shadow: 0 28px 80px rgba(15, 8, 20, .35);
}
.login-brand { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--purple); color: white; font-size: 1.15rem; font-weight: 900; }
.login-eyebrow { margin: 20px 0 5px; color: var(--purple); font-size: .78rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.login-card h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.04em; }
.login-help { margin: 8px 0 22px; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 15px; }
.login-form .button { width: 100%; min-height: 48px; margin-top: 2px; }
.login-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: .85rem; font-weight: 700; }
.user-chip { align-self: center; max-width: 180px; overflow: hidden; color: var(--muted); font-size: .8rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }

button, input, select, textarea { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(83, 24, 120, 0.24);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: #23162d;
  color: white;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 24px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 14px; background: linear-gradient(145deg, #8f43b9, #50206d);
  font-weight: 850; letter-spacing: -.04em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand strong { display: block; font-size: 1rem; line-height: 1.2; }
.brand span { display: block; margin-top: 3px; color: #cdbfd5; font-size: .8rem; }

.nav-list { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  width: 100%; min-height: 46px; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 0; border-radius: 12px; background: transparent;
  color: #dcd3e2; text-align: left; font-weight: 650; font-size: .92rem;
}
.nav-item span { width: 24px; text-align: center; font-weight: 800; }
.nav-item:hover { background: rgba(255,255,255,.08); color: white; }
.nav-item.active { background: #fff; color: var(--purple); }
.settings-link { margin-top: auto; }

.main-content { min-width: 0; }
.topbar {
  min-height: 92px; display: flex; align-items: center; gap: 16px; padding: 18px 30px;
  border-bottom: 1px solid var(--line); background: rgba(246,247,244,.94);
  position: sticky; top: 0; z-index: 30; backdrop-filter: blur(10px);
}
.topbar h1 { margin: 1px 0 0; font-size: 1.65rem; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: capitalize; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; }
.menu-toggle { display: none; }

.view { max-width: 1480px; margin: 0 auto; padding: 26px 30px 48px; }

.button {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 750;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--purple); color: white; box-shadow: 0 7px 18px rgba(83,24,120,.18); }
.button-primary:hover { background: var(--purple-2); }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button-ghost { background: transparent; color: var(--purple); }
.button-danger { background: var(--red); color: white; }
.button-small { min-height: 34px; padding: 6px 10px; font-size: .82rem; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); }

.hero-strip {
  display: flex; align-items: center; gap: 22px; margin-bottom: 22px; padding: 22px 24px;
  border-radius: var(--radius); color: white;
  background: linear-gradient(118deg, #3a174d 0%, #641e83 64%, #7e3596 100%);
  overflow: hidden; position: relative;
}
.hero-strip::after {
  content: ""; position: absolute; right: -35px; top: -70px; width: 210px; height: 210px;
  border-radius: 50%; border: 34px solid rgba(255,255,255,.08);
}
.hero-strip h2 { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: -.025em; }
.hero-strip p { margin: 0; color: #e9dcef; }
.hero-strip .button { margin-left: auto; flex: 0 0 auto; background: white; color: var(--purple); z-index: 1; }

.demo-notice {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 16px 18px;
  border: 1px solid #d8c7e2; border-radius: 15px; background: var(--purple-soft);
}
.demo-notice-icon {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 50%; background: var(--purple); color: white; font-weight: 850;
}
.demo-notice h2 { margin: 0 0 3px; font-size: 1rem; }
.demo-notice p { margin: 0; color: #57475f; font-size: .87rem; }
.demo-notice .button { margin-left: auto; flex: 0 0 auto; }

.start-guide { margin-bottom: 22px; padding: 22px; border: 1px solid #cfe2d7; border-radius: var(--radius); background: #edf8f1; }
.start-guide-heading span { color: var(--mint); font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.start-guide-heading h2 { margin: 5px 0 5px; font-size: 1.25rem; }
.start-guide-heading p { margin: 0; color: var(--muted); }
.start-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.start-step {
  min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 15px; border: 1px solid #cfe2d7; border-radius: 13px; background: white; color: var(--ink); text-align: left;
}
.start-step:hover { border-color: #8fbea3; box-shadow: 0 6px 16px rgba(47,124,88,.08); }
.start-step > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--mint-soft); color: var(--mint); font-weight: 850; }
.start-step strong, .start-step small { display: block; }
.start-step small { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.start-step b { grid-column: 2; color: var(--mint); font-size: .8rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 4px 16px rgba(31,40,34,.035); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-card .stat-label { color: var(--muted); font-size: .83rem; font-weight: 700; }
.stat-card .stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); }
.stat-card strong { display: block; margin-top: 12px; font-size: 1.65rem; letter-spacing: -.045em; }
.stat-card small { display: block; margin-top: 4px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 18px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 20px rgba(25,40,31,.035); overflow: hidden; }
.panel-header { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 1.03rem; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.panel-header .button, .panel-header .field { margin-left: auto; }
.panel-body { padding: 18px 20px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-action {
  min-height: 92px; padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--ink); text-align: left;
}
.quick-action:hover { border-color: #bda5ca; background: var(--purple-soft); }
.quick-action span { display: block; margin-bottom: 8px; font-size: 1.35rem; }
.quick-action strong { font-size: .9rem; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 13px; min-height: 62px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { padding-bottom: 0; border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-main small { display: block; margin-top: 4px; color: var(--muted); }
.list-value { font-weight: 800; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.badge-purple { color: var(--purple); background: var(--purple-soft); }
.badge-green { color: var(--mint); background: var(--mint-soft); }
.badge-orange { color: var(--orange); background: var(--orange-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-yellow { color: var(--yellow); background: var(--yellow-soft); }
.badge-gray { color: #59625c; background: #edf0ed; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 260px; }
.toolbar .button-primary { margin-left: auto; }
.search { position: relative; }
.search input { padding-left: 40px; }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 10px; color: var(--muted); font-size: 1.1rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: #435047; font-size: .79rem; font-weight: 750; }
.field input, .field select, .field textarea, input.input, select.input {
  width: 100%; min-height: 43px; padding: 9px 12px; border: 1px solid #cfd8d1;
  border-radius: 10px; background: white; color: var(--ink);
}
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--purple); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-note { padding: 11px 13px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .82rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { padding: 11px 13px; color: var(--muted); background: #f4f6f3; font-size: .75rem; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 13px; border-top: 1px solid var(--line); font-size: .88rem; vertical-align: middle; }
tbody tr:hover { background: #fafbfa; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }

.order-board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 13px; overflow-x: auto; padding-bottom: 8px; }
.order-column { padding: 12px; border-radius: 15px; background: #ecefeb; min-height: 310px; }
.order-column-title { display: flex; align-items: center; justify-content: space-between; margin: 2px 2px 12px; font-size: .86rem; }
.order-column-title span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: white; font-size: .75rem; }
.order-card { margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 4px 10px rgba(22,32,26,.04); }
.order-card:last-child { margin-bottom: 0; }
.order-card-top { display: flex; justify-content: space-between; gap: 10px; }
.order-card h3 { margin: 0; font-size: .92rem; }
.order-card p { margin: 7px 0; color: var(--muted); font-size: .8rem; }
.order-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }

.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.product-picker { min-height: 540px; }
.category-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; white-space: nowrap; font-size: .8rem; font-weight: 700; }
.chip.active { background: var(--purple); color: white; border-color: var(--purple); }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.product-button { min-height: 104px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: white; text-align: left; }
.product-button:hover { border-color: #bda5ca; box-shadow: 0 5px 14px rgba(83,24,120,.08); }
.product-button:disabled { opacity: .48; cursor: not-allowed; }
.product-button strong { display: block; margin-bottom: 6px; line-height: 1.25; }
.product-button .price { display: block; color: var(--purple); font-weight: 850; }
.product-button small { display: block; margin-top: 7px; color: var(--muted); }

.cart { position: sticky; top: 110px; }
.cart-items { max-height: 330px; overflow-y: auto; }
.cart-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.cart-row:last-child { border-bottom: 0; }
.cart-row strong { font-size: .86rem; }
.cart-row small { display: block; color: var(--muted); margin-top: 3px; }
.qty-control { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.qty-control button { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.cart-summary { padding-top: 14px; margin-top: 10px; border-top: 1px solid var(--line); }
.summary-line { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; color: var(--muted); }
.summary-line.total { margin-top: 13px; color: var(--ink); font-size: 1.12rem; font-weight: 850; }
.cart-actions { display: grid; gap: 9px; margin-top: 15px; }

.empty { padding: 36px 18px; color: var(--muted); text-align: center; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 16px; background: var(--surface-2); font-size: 1.4rem; }
.empty strong { display: block; margin-bottom: 5px; color: var(--ink); }

.alert-list { display: grid; gap: 10px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 12px; background: var(--surface-2); }
.alert-item .alert-icon { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: white; }
.alert-item strong { display: block; font-size: .86rem; }
.alert-item small { color: var(--muted); }
.alert-item .button { margin-left: auto; }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(24,16,30,.58); z-index: 100; }
.modal { width: min(620px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: white; border-radius: 20px; box-shadow: 0 26px 70px rgba(16,9,20,.26); }
.modal-wide { width: min(900px, 100%); }
.modal-header { position: sticky; top: 0; display: flex; align-items: center; gap: 12px; padding: 18px 20px; background: white; border-bottom: 1px solid var(--line); z-index: 2; }
.modal-header h2 { margin: 0; font-size: 1.18rem; }
.modal-header .icon-button { margin-left: auto; }
.modal-body { padding: 20px; }
.modal-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 15px 20px; background: #fafbfa; border-top: 1px solid var(--line); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; padding: 4px; border-radius: 12px; background: #e9ede9; width: fit-content; }
.tab { min-height: 36px; padding: 7px 13px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 750; }
.tab.active { background: white; color: var(--ink); box-shadow: 0 2px 7px rgba(30,40,34,.08); }

.progress { height: 8px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: #e8ece8; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--purple); }

.chart { display: flex; align-items: end; gap: 10px; height: 190px; padding-top: 20px; }
.bar-group { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 8px; }
.bar { width: min(34px, 72%); min-height: 3px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #8d41b4, var(--purple)); }
.bar-group small { color: var(--muted); font-size: .72rem; }

.metric-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric-box { padding: 14px; border-radius: 13px; background: var(--surface-2); }
.metric-box span { display: block; color: var(--muted); font-size: .77rem; }
.metric-box strong { display: block; margin-top: 7px; font-size: 1.16rem; }

.acai-builder { padding: 15px; border: 1px dashed #b99ac9; border-radius: 14px; background: #fbf7fd; }
.acai-builder h3 { margin: 0 0 5px; color: var(--purple); }
.acai-builder p { margin: 0 0 13px; color: var(--muted); font-size: .83rem; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.option-card { position: relative; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card label { display: block; min-height: 70px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: white; cursor: pointer; }
.option-card input:checked + label { border-color: var(--purple); background: var(--purple-soft); box-shadow: inset 0 0 0 1px var(--purple); }
.option-card strong, .option-card small { display: block; }
.option-card small { margin-top: 4px; color: var(--muted); }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 150; display: grid; gap: 9px; }
.toast { min-width: 280px; max-width: 390px; padding: 13px 15px; border-radius: 12px; color: white; background: #202c24; box-shadow: var(--shadow); animation: slide-in .22s ease; }
.toast.error { background: var(--red); }
@keyframes slide-in { from { transform: translateY(10px); opacity: 0; } }

.mobile-backdrop { display: none; }
.muted { color: var(--muted); }
.positive { color: var(--mint); }
.negative { color: var(--red); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sale-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 270px; transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(20,13,25,.45); }
  .mobile-backdrop.open { display: block; }
  .menu-toggle { display: inline-grid; place-items: center; flex: 0 0 auto; }
  .topbar { padding: 14px 18px; min-height: 80px; }
  .view { padding: 20px 16px 38px; }
  .grid-2, .grid-equal, .sale-layout { grid-template-columns: 1fr; }
  .cart { position: static; }
  .order-board { grid-template-columns: repeat(4, 280px); }
  .start-steps { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar h1 { font-size: 1.3rem; }
  .topbar-actions .button { padding: 8px 11px; font-size: .82rem; }
  .hide-mobile { display: none; }
  .stat-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .stat-card strong { font-size: 1.45rem; }
  .hero-strip { align-items: flex-start; flex-direction: column; }
  .hero-strip .button { margin-left: 0; }
  .demo-notice { align-items: flex-start; flex-wrap: wrap; }
  .demo-notice .button { width: 100%; margin-left: 50px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-button { min-height: 112px; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { max-height: 94vh; border-radius: 20px 20px 0 0; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .button { flex: 1; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  .sidebar, .topbar, .toolbar, .button, .row-actions { display: none !important; }
  .app-shell { display: block; }
  .view { max-width: none; padding: 0; }
  .panel { box-shadow: none; border: 0; }
}
