/* ==========================================================
   დალოცვილი POS — design system
   Warm neutrals + logo amber. Light by default, dark optional.
   ========================================================== */

/* same type as the website: FiraGO for text, Archy EDT for titles; Noto stays as a glyph fallback */
@font-face { font-family: "FiraGO"; src: url("../fonts/firago-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("../fonts/firago-semibold.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("../fonts/firago-bold.woff2") format("woff2"); font-weight: 650 700; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("../fonts/firago-extrabold.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Archy EDT"; src: url("../fonts/archy-edt-bold.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face {
  font-family: "Noto Sans Georgian";
  src: url("../fonts/noto-georgian.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0589, U+10A0-10FF, U+1C90-1CBA, U+1CBD-1CBF, U+2D00-2D2F;
}
@font-face {
  font-family: "Noto Sans Georgian";
  src: url("../fonts/noto-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BE, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: "FiraGO", "Noto Sans Georgian", "Segoe UI", system-ui, sans-serif;
  --display: "Archy EDT", "FiraGO", "Noto Sans Georgian", sans-serif;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --surface-3: #f1ede6;
  --border: #e7e1d7;
  --border-strong: #d6cec1;
  --text: #1c1915;
  --text-2: #4a443c;
  --muted: #847a6d;
  --accent: #f5b301;          /* logo amber */
  --accent-hover: #e5a700;
  --accent-ink: #1c1915;      /* text on amber */
  --accent-soft: #fff5d9;
  --accent-text: #9a6b00;     /* amber readable on white */
  --ink: #17140f;             /* logo black */
  --good: #2f7a4d;
  --good-soft: #e6f3eb;
  --bad: #b4321f;
  --bad-soft: #fbe9e5;
  --warn: #a96800;
  --warn-soft: #fdf0d6;
  --info: #2c6a8f;
  --info-soft: #e3eff6;
  --shadow-sm: 0 1px 2px rgba(40, 30, 10, .06);
  --shadow: 0 1px 2px rgba(40, 30, 10, .05), 0 4px 16px rgba(40, 30, 10, .06);
  --shadow-lg: 0 8px 40px rgba(30, 20, 5, .18);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sidebar: 228px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12100d; --surface: #1b1814; --surface-2: #201c17; --surface-3: #29241e;
    --border: #2f2a23; --border-strong: #423b31; --text: #f2eee7; --text-2: #d3ccc0; --muted: #9d9384;
    --accent-soft: #3a2e10; --accent-text: #f5c040; --ink: #0b0a08;
    --good: #5fbf86; --good-soft: #17301f; --bad: #f07a63; --bad-soft: #3a1a14; --warn: #f0b44a; --warn-soft: #382a10;
    --info: #6fb2dc; --info-soft: #132b3a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 2px 12px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12100d; --surface: #1b1814; --surface-2: #201c17; --surface-3: #29241e;
  --border: #2f2a23; --border-strong: #423b31; --text: #f2eee7; --text-2: #d3ccc0; --muted: #9d9384;
  --accent-soft: #3a2e10; --accent-text: #f5c040; --ink: #0b0a08;
  --good: #5fbf86; --good-soft: #17301f; --bad: #f07a63; --bad-soft: #3a1a14; --warn: #f0b44a; --warn-soft: #382a10;
  --info: #6fb2dc; --info-soft: #132b3a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 2px 12px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.gap-lg { gap: 16px; }
.mt { margin-top: 12px; } .mt-lg { margin-top: 20px; } .mb { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.text-good { color: var(--good); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand b { display: block; font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: .03em; line-height: 1.15; }
.brand small { color: var(--muted); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a.active .ic { color: var(--accent-text); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--ink); color: var(--accent); font-weight: 700; font-size: 14px;
}
.me b { display: block; font-size: 13px; line-height: 1.2; }
.me small { color: var(--muted); font-size: 11.5px; }

.main { min-width: 0; padding: 24px 28px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 25px; font-weight: 700; letter-spacing: .02em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* rail (icon-only) sidebar: POS page and narrow screens */
.app.rail { --sidebar: 72px; }
.app.rail .brand b, .app.rail .brand small, .app.rail .nav span, .app.rail .me div, .app.rail .sidebar-foot .btn span { display: none; }
.app.rail .brand { justify-content: center; padding: 4px 0 16px; }
.app.rail .nav a { justify-content: center; padding: 12px 0; }
.app.rail .nav a.active::before { left: -12px; }
.app.rail .me { justify-content: center; padding: 6px 0; }
.app.rail .sidebar-foot .btn { justify-content: center; padding: 0; }
.nav a[data-tip], .sidebar-foot [data-tip] { position: relative; }
.app.rail [data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--ink); color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 50;
}
@media (max-width: 1280px) { .app:not(.no-rail) { --sidebar: 72px; } .app:not(.no-rail) .brand b, .app:not(.no-rail) .brand small, .app:not(.no-rail) .nav span, .app:not(.no-rail) .me div, .app:not(.no-rail) .sidebar-foot .btn span { display: none; } .app:not(.no-rail) .nav a, .app:not(.no-rail) .brand, .app:not(.no-rail) .me { justify-content: center; } .app:not(.no-rail) .nav a { padding: 12px 0; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: 62px; flex-direction: row; padding: 6px 8px; border-right: 0; border-top: 1px solid var(--border); }
  .sidebar .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { padding: 10px; } .nav a span { display: none; } .nav a.active::before { display: none; }
  .main { padding: 16px 16px 90px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .ic { color: var(--muted); }
.card-body { padding: 14px 20px 18px; }
.cards { display: grid; gap: 16px; }
.cards-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-ai { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
.span-2 { grid-column: span 2; }
@media (max-width: 1400px) { .cards-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .cards-4, .cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cards-2, .cards-ai { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
@media (max-width: 560px) { .cards-6, .cards-4, .cards-3 { grid-template-columns: 1fr 1fr; } }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi-label .ic { width: 15px; height: 15px; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 999px; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
.kpi.highlight { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.highlight .kpi-label, .kpi.highlight .kpi-foot { color: #bfb5a6; }
.kpi.highlight .kpi-value { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #2b261e; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-xl { height: 60px; padding: 0 22px; font-size: 17px; border-radius: 14px; font-weight: 650; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.kbd { font-size: 10.5px; font-weight: 600; padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .55; line-height: 1.3; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, select.input {
  height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; outline: none;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 70px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.invalid, .field .invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px var(--bad-soft) !important; }
select.input, .field select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23847a6d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input-lg { height: 48px; font-size: 16px; border-radius: 12px; }
.input-affix { position: relative; display: flex; align-items: center; }
/* as specific as the .field input rule above, so units (₾, ₾/კგ, %) never sit on top of the value */
.input-affix .input, .input-affix input:not([type="checkbox"]):not([type="radio"]) { padding-right: 52px; }
.input-affix .affix { position: absolute; right: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
.input-affix .prefix-ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-affix .prefix-ic + .input, .input-affix .prefix-ic + input:not([type="checkbox"]):not([type="radio"]) { padding-left: 40px; padding-right: 12px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-section { border-top: 1px dashed var(--border); padding-top: 14px; }
details.more > summary { cursor: pointer; color: var(--accent-text); font-weight: 550; list-style: none; display: flex; gap: 6px; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary .ic { transform: rotate(90deg); }
details.more > summary .ic { transition: transform .15s; width: 16px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 550; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-lg button { padding: 10px 16px; font-size: 14px; }

/* ---------- Chips, badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; color: var(--text-2);
  white-space: nowrap; transition: all .15s; font-size: 13px;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-dark { background: var(--ink); color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .r { text-align: right; }
.table-compact td { padding: 7px 10px; }
.table-compact th { padding: 8px 10px; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-cell b { font-weight: 600; display: block; }
.prod-cell small { color: var(--muted); font-size: 12px; }
.thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex-shrink: 0; border: 2px solid var(--border); border-left-width: 4px; background: var(--surface-3); }
.thumb-empty { display: grid; place-items: center; }
.detail-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; }

/* AI photo */
.bulk-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow-y: auto; }
.bulk-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: 12px; }
.bulk-row img, .bulk-row .ph { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.bulk-row.run { border-color: var(--accent); background: var(--accent-soft); }
.bulk-row small { display: block; color: var(--muted); font-size: 12px; }
.pf-photo-col { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.pf-ai { height: 28px; font-size: 12px; gap: 4px; padding: 0 8px; }
.pf-ai .ic { width: 14px; height: 14px; color: var(--accent-text); }
.ai-result img { width: 100%; max-width: 420px; aspect-ratio: 1; object-fit: cover; border-radius: 14px; margin: 4px auto 0; box-shadow: var(--shadow); }
.ai-wait { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 0; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* product form photo tile */
.pf-top { display: flex; gap: 14px; align-items: flex-start; }
.pf-photo { position: relative; width: 84px; height: 84px; flex-shrink: 0; margin-top: 4px; border-radius: 14px; border: 1.5px dashed var(--border-strong);
  background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); padding: 0; overflow: hidden; transition: border-color .15s; }
.pf-photo:hover, .pf-photo.drag { border-color: var(--accent); color: var(--text); }
.pf-photo small { font-size: 11px; }
.pf-photo.has { border-style: solid; border-color: var(--border); }
.pf-photo img { width: 100%; height: 100%; object-fit: cover; }
.pf-photo.busy { opacity: .5; pointer-events: none; }
.pf-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.pf-del .ic { width: 13px; height: 13px; }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 550; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { background: var(--surface-3); border-radius: 999px; font-size: 11px; padding: 0 7px; color: var(--text-2); }
.tab-panel { display: none; }
.tab-panel.on { display: block; animation: fade .2s var(--ease); }

/* ---------- Alerts / empty ---------- */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-good { background: var(--good-soft); color: var(--good); }
.alert-info { background: var(--info-soft); color: var(--info); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { width: 34px; height: 34px; stroke-width: 1.4; opacity: .6; }
.empty b { color: var(--text-2); font-weight: 600; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .meta { color: var(--muted); font-size: 12px; }
.insight { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.insight .ic { margin-top: 2px; }
.insight.good .ic { color: var(--good); } .insight.bad .ic { color: var(--bad); } .insight.warn .ic { color: var(--warn); } .insight.neutral .ic { color: var(--accent-text); }

.bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.bar.bad > i { background: var(--bad); }
.bar.warn > i { background: var(--warn); }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 15, 8, .42); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .2s var(--ease); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 10px; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.overlay.drawer-wrap { justify-content: flex-end; padding: 0; }
.drawer { background: var(--surface); width: 100%; max-width: 560px; height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .22s var(--ease); }
.drawer.wide { max-width: 820px; }
.drawer .modal-body { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: pop .2s var(--ease); font-size: 13.5px; }
.toast .ic { color: var(--accent); margin-top: 1px; }
.toast.bad .ic { color: #ff9a85; }
.toast.good .ic { color: #7fdca3; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .25s; }

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); padding: 32px 30px; }
.auth-card h1 { margin-top: 10px; font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: .03em; }
.auth-card .muted { margin: 4px 0 20px; }
.auth-logo { width: 84px; height: 84px; display: block; }

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Chart ---------- */
.chart-box { position: relative; height: 260px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ==========================================================
   POS
   ========================================================== */
body.page-pos { overflow: hidden; }
body.page-pos .main { padding: 0; height: 100vh; }
.pos { display: grid; grid-template-columns: 1fr 400px; height: 100vh; }
.pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px 18px 0; gap: 12px; }
.pos-top { display: flex; gap: 10px; align-items: center; }
.pos-search { position: relative; flex: 1; }
.pos-search > .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.pos-search input { width: 100%; height: 54px; border-radius: 14px; border: 1.5px solid var(--border-strong); background: var(--surface); padding: 0 110px 0 48px; font-size: 17px; outline: none; transition: border-color .15s, box-shadow .15s; }
.pos-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.pos-search .scan-hint { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.cat-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.cat-strip::-webkit-scrollbar { display: none; }
.cat-strip .chip { height: 38px; }
.pos-grid-wrap { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 16px; margin: 0 -4px; padding-left: 4px; padding-right: 4px; }
.pos-section-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 8px; text-transform: none; display: flex; align-items: center; gap: 6px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pcard {
  position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; min-height: 104px; padding: 12px 12px 10px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .08s, border-color .15s, box-shadow .15s; overflow: hidden;
}
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat, var(--border)); opacity: .9; }
.pcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.pcard:active { transform: scale(.98); }
.pcard.kb { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.pcard .ptop { display: flex; gap: 10px; align-items: flex-start; padding-right: 18px; min-width: 0; }
.pcard .pimg { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--surface-3); }
.pcard .pname { font-weight: 600; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .pprice { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.pcard .pprice b { font-size: 16px; font-weight: 700; }
.pcard .pprice small { color: var(--muted); font-size: 11.5px; }
.pcard .pstock { font-size: 11.5px; color: var(--muted); }
.pcard .pstock.low { color: var(--warn); font-weight: 600; }
.pcard .pstock.out { color: var(--bad); font-weight: 600; }
.pcard.out { opacity: .55; }
.pcard .pmode { position: absolute; top: 9px; right: 9px; color: var(--muted); }
.pcard .pmode .ic { width: 15px; height: 15px; }
.pcard .in-cart { position: absolute; top: 8px; right: 8px; background: var(--ink); color: var(--accent); border-radius: 999px; min-width: 22px; height: 22px; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }

.pos-right { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; position: relative; }
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
#btn-display { position: relative; }
#btn-display.on { color: var(--accent-text); background: var(--accent-soft); }
#btn-display.on::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.shift-pill { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 5px 10px; border-radius: 999px; background: var(--surface-3); cursor: pointer; border: 0; }
.shift-pill .live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.shift-pill.closed .live { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.cart-lines { flex: 1; overflow-y: auto; padding: 6px 10px; min-height: 0; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 8px; border-radius: 12px; border-bottom: 1px solid var(--border); animation: fade .2s; }
.cline.flash { animation: flash .6s; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.cline .cname { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.cline .cname small { font-weight: 500; color: var(--muted); }
.cline .ctotal { font-weight: 700; font-size: 15px; text-align: right; }
.cline .cqty { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.cline .cact { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.cline.short { background: var(--bad-soft); }
.qbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.qbtn:hover { background: var(--surface-3); }
.qbtn .ic { width: 15px; height: 15px; }
.qval { min-width: 54px; text-align: center; font-weight: 650; color: var(--text); cursor: pointer; border-radius: 6px; padding: 3px 4px; font-size: 13.5px; }
.qval:hover { background: var(--surface-3); }
.suggest-bar { margin: 6px 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; gap: 10px; font-size: 13px; animation: pop .2s; }
.suggest-bar .ic { color: var(--accent-text); }
.cart-foot { border-top: 1px solid var(--border); padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.totals { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.totals .row { justify-content: space-between; }
.grand { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; }
.grand span { font-size: 15px; font-weight: 600; color: var(--text-2); }
.grand b { font-size: 32px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pay-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-btns .btn-xl { flex-direction: column; gap: 2px; height: 64px; line-height: 1.15; }
.pay-btns .btn-xl small { font-size: 11px; font-weight: 500; opacity: .7; }
.cart-tools { display: flex; gap: 6px; }
.cart-tools .btn { flex: 1; }

/* payment / overlay panels inside the cart column */
.panel-over { position: absolute; inset: 0; background: var(--surface); z-index: 10; display: flex; flex-direction: column; animation: slide .18s var(--ease); }
.panel-over .ph { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-over .pb { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-over .pf { padding: 14px 16px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.pay-total { text-align: center; padding: 6px 0 2px; }
.pay-total small { color: var(--muted); font-size: 13px; }
.pay-total b { display: block; font-size: 40px; font-weight: 750; letter-spacing: -.02em; }
.quick-cash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-cash button { height: 48px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 650; font-size: 15px; cursor: pointer; }
.quick-cash button:hover { background: var(--surface-3); }
.quick-cash button.exact { background: var(--accent-soft); border-color: var(--accent); }
.change-box { border-radius: 14px; padding: 14px; text-align: center; background: var(--surface-3); }
.change-box small { color: var(--muted); }
.change-box b { display: block; font-size: 34px; font-weight: 750; }
.change-box.ok { background: var(--good-soft); } .change-box.ok b { color: var(--good); }
.change-box.short { background: var(--bad-soft); } .change-box.short b { color: var(--bad); }
.done-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0; }
.done-check { width: 64px; height: 64px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: grid; place-items: center; animation: pop .3s var(--ease); }
.done-check .ic { width: 34px; height: 34px; stroke-width: 2.5; }

/* qty popover (weight / volume) */
.qty-pop .presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qty-pop .presets button { height: 58px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-weight: 700; font-size: 16px; }
.qty-pop .presets button small { font-weight: 500; font-size: 12px; color: var(--muted); }
.qty-pop .presets button:hover { border-color: var(--accent); background: var(--accent-soft); }
.qty-pop .presets button.custom { color: var(--accent-text); }
.qty-pop .calc { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); }
.qty-pop .calc b { font-size: 26px; font-weight: 750; }
.qty-input { height: 60px !important; font-size: 26px !important; font-weight: 700; text-align: center; border-radius: 14px !important; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keypad button { height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 18px; font-weight: 650; cursor: pointer; }
.keypad button:hover { background: var(--surface-3); }

@media (max-width: 1100px) { .pos { grid-template-columns: 1fr 340px; } .pos-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }
@media (max-width: 760px) {
  body.page-pos { overflow: auto; }
  body.page-pos .main { height: auto; }
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos-left { height: 60vh; }
  .pos-right { min-height: 70vh; }
}

/* ---------- Autocomplete ---------- */
.ac-box { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; max-height: 300px; overflow-y: auto; padding: 4px; }
.ac-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ac-item b { font-weight: 550; }
.ac-item small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ac-item.on, .ac-item:hover { background: var(--accent-soft); }

/* ---------- Website editor ---------- */
.site-bar { position: sticky; top: 12px; z-index: 15; display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; box-shadow: var(--shadow); }
.site-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.site-sec > summary::-webkit-details-marker { display: none; }
.site-sec > summary .row { flex: 1; }
.site-sec > summary .ic { color: var(--muted); }
.site-sec > summary .chev { transition: transform .2s; }
.site-sec[open] > summary .chev { transform: rotate(180deg); }
.site-sec[open] > summary { border-bottom: 1px solid var(--border); }
.img-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.img-box img { height: 90px; border-radius: 8px; object-fit: cover; }
.feat-row { display: grid; grid-template-columns: 140px 34px 1fr 2fr 34px; gap: 8px; align-items: center; }
.feat-prev { display: grid; place-items: center; color: var(--accent-text); }
.pick-list { max-height: 280px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gal-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--surface-3); }
.gal-item img { width: 100%; height: 100%; object-fit: cover; }
.gal-act { position: absolute; inset: auto 0 0; display: flex; justify-content: center; gap: 4px; padding: 6px; background: linear-gradient(transparent, rgba(0,0,0,.55)); opacity: 0; transition: opacity .15s; }
.gal-item:hover .gal-act { opacity: 1; }
.gal-act .btn { background: rgba(255,255,255,.92); border: 0; color: #1c1915; }
.gal-add { aspect-ratio: 1; border: 1.5px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-weight: 550; }
.gal-add:hover { border-color: var(--accent); color: var(--text); }
.hours-tbl input[type=time] { height: 34px; width: 120px; }
.btn.pulse { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
@media (max-width: 760px) { .feat-row { grid-template-columns: 1fr 34px; } .feat-row .feat-prev { display: none; } }

/* ---------- Print ---------- */
@media print {
  .sidebar, .toasts, .no-print, .page-head .btn { display: none !important; }
  .app { display: block; } .main { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body { background: #fff; }
}
