/* Sale Station – app styles. --brand / --accent are set per business in base.html */
:root {
  --brand: #1f6feb;
  --accent: #0e9f6e;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --border: #e3e8ef;
  --text: #1b2430;
  --muted: #667085;
  --danger: #d92d20;
  --warning: #dc6803;
  --success: #079455;
  --sidebar-bg: #111827;
  --sidebar-text: #cbd5e1;
  --sidebar-active: rgba(255, 255, 255, .08);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-sidebar="light"] { --sidebar-bg: #ffffff; --sidebar-text: #344054; --sidebar-active: var(--surface-2); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1f2630; --border: #2a313c;
    --text: #e6edf3; --muted: #8b949e; --sidebar-bg: #010409; --sidebar-text: #c9d1d9;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b22; --surface-2: #1f2630; --border: #2a313c;
  --text: #e6edf3; --muted: #8b949e; --sidebar-bg: #010409; --sidebar-text: #c9d1d9;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
img { max-width: 100%; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); padding: 16px 12px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; border-right: 1px solid var(--border); }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; color: inherit; }
.sidebar .brand img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; }
.sidebar .brand .logo-fallback { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; }
.nav-section { margin: 14px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: inherit; font-weight: 500; }
.nav a:hover { background: var(--sidebar-active); text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.nav .ico { width: 18px; text-align: center; opacity: .8; }
.nav .soon { margin-left: auto; font-size: 10px; opacity: .6; border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2, .card-head h3 { margin: 0; }
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.grid-main-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-sidebar, .grid-main-aside { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; text-decoration: none !important; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand); filter: brightness(.92); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
.btn-block { width: 100%; }
form.inline { display: inline; }

label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.input, select.input, textarea.input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type="color"].input { padding: 2px; height: 38px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: middle; }
.field { margin-bottom: 14px; }
.field.check { display: flex; gap: 10px; align-items: flex-start; }
.field.check label { margin: 0; }
.help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.errorlist { color: var(--danger); margin: 4px 0 0; padding: 0; list-style: none; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.checks ul, ul.checks { list-style: none; padding: 0; margin: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact th, .table.compact td { padding: 7px 10px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge.warn, .badge.low { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.badge.danger, .badge.out { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.info, .badge.over { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.qty-pos { color: var(--success); font-weight: 600; }
.qty-neg { color: var(--danger); font-weight: 600; }

.messages { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.alert { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.alert.success { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.alert.error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.alert.warning { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }
.alert.info { border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }

.trial-banner { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border-bottom: 1px solid var(--border); padding: 6px 24px; font-size: 13px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.side-nav a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.side-nav a.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.side-nav a:hover { text-decoration: none; background: var(--surface); }
.side-nav .nav-section { color: var(--muted); opacity: 1; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-bottom: 10px; }
.bar-row .progress { grid-column: 1 / -1; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--text); }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; z-index: 30; }
.dropdown .menu a, .dropdown .menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text);
  background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown .menu a:hover, .dropdown .menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown .menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; }

.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: inline-grid; place-items: center; color: var(--muted); font-size: 11px; }
.barcode-svg svg { max-width: 220px; height: auto; background: #fff; border-radius: 4px; }

.picker { position: relative; }
.picker-results { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 20; max-height: 320px; overflow-y: auto; }
.picker-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; color: var(--text); }
.picker-results button:hover { background: var(--surface-2); }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px dashed var(--brand); border-radius: 8px; margin-top: 6px; }

.variant-table input.input { min-width: 90px; padding: 6px 8px; }

/* ---------- Public pages ---------- */
.public-nav { display: flex; align-items: center; gap: 16px; padding: 16px 32px; max-width: 1200px; margin: 0 auto; }
.public-nav .brand { font-weight: 800; font-size: 18px; color: var(--text); display: flex; gap: 8px; align-items: center; }
.hero { max-width: 1100px; margin: 0 auto; padding: 64px 32px 32px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; }
.hero p { font-size: 18px; color: var(--muted); max-width: 680px; margin: 12px auto 24px; }
.section { max-width: 1100px; margin: 0 auto; padding: 32px; }
.feature h3 { margin-top: 6px; }
.price { font-size: 30px; font-weight: 800; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 720px; }
@media (max-width: 600px) { .public-nav, .hero, .section { padding-left: 16px; padding-right: 16px; } }

@media print {
  .sidebar, .topbar, .no-print, .trial-banner { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
.grid > .card + .card { margin-top: 0; }
