/* POSly Cosmetics — beauty retail theme.
   Component classes match POSly Grocery so markup stays familiar; tokens and look are new. */
:root {
  --ink: #2b1f29;
  --ink-soft: #4d3f4a;
  --muted: #7d6c77;
  --line: rgba(61, 26, 53, 0.10);
  --line-strong: rgba(61, 26, 53, 0.18);
  --surface: #fffdfc;
  --surface-solid: #ffffff;
  --paper: #faf5f2;
  --paper-2: #f4ece9;
  --plum: #6b2d5c;
  --plum-deep: #3f1937;
  --plum-mid: #8a3f78;
  --rose: #c4577c;
  --rose-deep: #9e3a5d;
  --rose-soft: #fbe8ee;
  --blush: #f7dfe4;
  --champagne: #b8893f;
  --champagne-soft: #f7eddc;
  --success: #2e7a58;
  --success-soft: #e3f3ea;
  --danger: #b42b3a;
  --danger-soft: #fbe6e8;
  --warning: #a8701c;
  --warning-soft: #fbefd9;
  --shadow: 0 1px 2px rgba(63, 25, 55, 0.05), 0 10px 26px rgba(63, 25, 55, 0.06);
  --shadow-lg: 0 18px 44px rgba(63, 25, 55, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-brand: "Fraunces", Georgia, serif;
  --sidebar-w: 252px;
  --sidebar-collapsed: 76px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(196, 87, 124, 0.07), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(184, 137, 63, 0.07), transparent 50%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  min-height: 100vh;
  line-height: 1.5;
  letter-spacing: -0.008em;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--plum); text-decoration: none; }
a:hover { color: var(--rose-deep); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.025em; margin: 0 0 0.35em; }
:focus-visible { outline: 3px solid rgba(196, 87, 124, 0.45); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  position: fixed; inset: 0 auto 0 0;
  background:
    radial-gradient(400px 260px at 0% 0%, rgba(196, 87, 124, 0.26), transparent 60%),
    linear-gradient(180deg, #2c1027 0%, #3a1633 55%, #2a0f25 100%);
  color: #fbf1f5;
  padding: 1.1rem 0.85rem 1rem;
  display: flex; flex-direction: column;
  z-index: 40;
  box-shadow: 8px 0 28px rgba(42, 15, 37, 0.24);
  overflow: hidden;
  transition: width .2s ease, padding .2s ease;
}
.brand-link { display: flex; gap: 0.7rem; align-items: center; color: inherit; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: block; flex: 0 0 40px; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.brand-text strong { display: block; font-size: 1.04rem; font-family: var(--font-brand); font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; }
.brand-text small { color: rgba(251, 241, 245, 0.6); font-size: 0.68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.side-nav { margin-top: 1.15rem; display: flex; flex-direction: column; gap: 0.1rem; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-group { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.8rem; }
.nav-group-label { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(251, 241, 245, 0.42); padding: 0.15rem 0.7rem 0.35rem; white-space: nowrap; }
.side-nav a {
  display: flex; align-items: center; gap: 0.65rem;
  color: rgba(251, 241, 245, 0.8);
  padding: 0.56rem 0.7rem; border-radius: 11px;
  font-size: 0.88rem; font-weight: 550; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.side-nav a svg { flex: 0 0 20px; opacity: .9; }
.nav-label { overflow: hidden; display: flex; align-items: center; gap: .4rem; flex: 1; }
.side-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.side-nav a.is-active { background: linear-gradient(90deg, rgba(196, 87, 124, 0.38), rgba(196, 87, 124, 0.12)); color: #fff; box-shadow: inset 3px 0 0 #e58aa8; }
.side-foot { color: rgba(251, 241, 245, 0.4); font-size: 0.72rem; padding: 0.55rem 0.7rem 0; font-weight: 600; white-space: nowrap; }
.nav-badge { margin-left: auto; background: #e0587f; color: #fff; border-radius: 999px; padding: 0 7px; font-size: .66rem; font-weight: 700; }
.sidebar-backdrop { display: none; }
.app-main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }

@media (min-width: 861px) {
  .sidebar { width: var(--sidebar-collapsed); padding: 1.1rem 0.7rem; }
  .app-main { margin-left: var(--sidebar-collapsed); }
  .sidebar:hover, .sidebar:focus-within { width: var(--sidebar-w); padding: 1.1rem 0.85rem; }
  .sidebar:not(:hover):not(:focus-within) .brand-text,
  .sidebar:not(:hover):not(:focus-within) .nav-label,
  .sidebar:not(:hover):not(:focus-within) .nav-group-label,
  .sidebar:not(:hover):not(:focus-within) .side-foot { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
  .sidebar:not(:hover):not(:focus-within) .side-nav a,
  .sidebar:not(:hover):not(:focus-within) .brand-link { justify-content: center; padding-inline: 0.45rem; }
}

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem 0.85rem;
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 245, 242, 0.82);
  backdrop-filter: blur(14px);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1.35rem; margin: 0; letter-spacing: -0.03em; }
.topbar-title p { margin: 0.12rem 0 0; color: var(--muted); font-size: 0.86rem; }
.topbar-meta { display: flex; gap: 0.45rem; align-items: center; margin-left: auto; }
.shop-chip, .date-chip, .user-chip {
  background: var(--surface); border: 1px solid var(--line);
  padding: 0.38rem 0.75rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap;
}
.shop-chip { color: var(--plum); background: var(--rose-soft); border-color: rgba(196, 87, 124, 0.16); }
.topbar-user { display: flex; gap: 0.55rem; align-items: center; }
.nav-toggle { display: none; }
.content { padding: 0.85rem 1.5rem 2.5rem; }

/* ---------- Panels & stats ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem 1.2rem; min-width: 0; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.05rem; margin: 0; }
.panel-head p { margin: .15rem 0 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; margin-bottom: 1.15rem; }
.stat { padding: 1rem 1.1rem 1.05rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--plum); }
.stat.rose::before { background: var(--rose); }
.stat.gold::before { background: var(--champagne); }
.stat.danger::before { background: var(--danger); }
.stat.ok::before { background: var(--success); }
.stat .label { color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.stat .value { font-size: 1.5rem; margin-top: 0.35rem; letter-spacing: -0.035em; font-weight: 750; overflow-wrap: anywhere; }
.stat .hint { color: var(--muted); font-size: .76rem; margin-top: .15rem; }
.stat.rose .value { color: var(--rose-deep); }
.stat.gold .value { color: #7a5718; }
.stat.danger .value { color: var(--danger); }
.stat.ok .value { color: var(--success); }
a.stat { color: inherit; display: block; }
a.stat:hover { border-color: rgba(196, 87, 124, .35); }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 0; cursor: pointer; padding: 0.62rem 1rem; border-radius: 11px;
  font-family: var(--font-body); font-weight: 650; font-size: 0.88rem; letter-spacing: -0.01em;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  min-height: 40px; text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--plum); color: #fff; box-shadow: 0 8px 18px rgba(63, 25, 55, 0.22); }
.btn-primary:hover { background: var(--plum-deep); color: #fff; }
.btn-accent { background: linear-gradient(135deg, var(--rose) 0%, var(--plum-mid) 100%); color: #fff; box-shadow: 0 8px 20px rgba(158, 58, 93, 0.28); }
.btn-accent:hover { color: #fff; filter: brightness(1.05); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-ghost { background: #fff; border: 1px solid var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: rgba(196, 87, 124, .45); color: var(--plum); }
.btn-sm { padding: 0.36rem 0.68rem; font-size: 0.78rem; border-radius: 9px; min-height: 32px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--plum); cursor: pointer; padding: 0; font: inherit; font-weight: 600; }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.85rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0.85rem; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0.85rem; }
.form-group { margin-bottom: 0.85rem; min-width: 0; }
.form-group label { display: block; margin-bottom: 0.32rem; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }
.form-group small, .help { color: var(--muted); font-size: .76rem; display: block; margin-top: .25rem; }
.form-control {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 11px;
  padding: 0.64rem 0.8rem; font: inherit; color: var(--ink); outline: none; min-height: 42px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus { border-color: rgba(196, 87, 124, 0.6); box-shadow: 0 0 0 4px rgba(196, 87, 124, 0.14); }
.form-control.is-invalid { border-color: rgba(180, 43, 58, .5); background: #fff8f8; }
textarea.form-control { min-height: 90px; resize: vertical; }
input[type="color"].form-control { padding: .2rem; height: 42px; }
.check-inline { display: flex; align-items: center; gap: .5rem; margin: .35rem 0 .65rem; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--plum); }
fieldset.section { border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem .3rem; margin: 0 0 1rem; }
fieldset.section legend { font-weight: 750; font-size: .86rem; padding: 0 .4rem; color: var(--plum); }
.required::after { content: " *"; color: var(--rose); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data.compact { min-width: 0; }
table.data th, table.data td { text-align: left; padding: 0.66rem 0.78rem; border-bottom: 1px solid var(--line); font-size: 0.87rem; vertical-align: middle; }
table.data th { color: var(--muted); font-size: 0.69rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; background: #faf3f1; white-space: nowrap; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: rgba(196, 87, 124, 0.04); }
table.data tfoot td { font-weight: 750; background: #fcf8f6; }
.cell-sub { color: var(--muted); font-size: .76rem; }
.row-muted td { opacity: .55; }

.badge { display: inline-flex; align-items: center; gap: .25rem; padding: 0.16rem 0.52rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: rgba(125, 108, 119, 0.12); color: var(--ink-soft); }
.badge-info, .badge-rose { background: var(--rose-soft); color: var(--rose-deep); }

.alert { padding: 0.8rem 1rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid transparent; font-size: 0.9rem; }
.alert-success { background: var(--success-soft); border-color: rgba(46, 122, 88, 0.2); color: #1d5a40; }
.alert-error { background: var(--danger-soft); border-color: rgba(180, 43, 58, 0.22); color: #8a1f2b; }
.alert-info { background: var(--rose-soft); border-color: rgba(196, 87, 124, 0.18); color: #6b2a45; }
.alert-warn { background: var(--warning-soft); border-color: rgba(168, 112, 28, 0.22); color: #6f4a10; }
.alert ul { margin: .35rem 0 0 1rem; padding: 0; }

.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.02rem; margin-bottom: 0.3rem; }
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control { max-width: 260px; width: auto; flex: 1 1 160px; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.pagination { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination .page-meta { color: var(--muted); font-size: .85rem; }
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 9px; background: var(--rose-soft); display: block; }
.thumb-lg { width: 110px; height: 110px; border-radius: 14px; }
.thumb-empty { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, var(--rose-soft), var(--champagne-soft)); display: inline-block; }
.total-row { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.42rem; color: var(--ink-soft); font-size: 0.93rem; }
.total-row strong { color: var(--ink); }
.total-row.grand { font-size: 1.6rem; color: var(--ink); margin-top: 0.5rem; font-weight: 750; letter-spacing: -0.04em; }
.total-row.sub { font-size: .82rem; color: var(--muted); }
.divider { border: 0; border-top: 1px solid var(--line); margin: .8rem 0; }
.kbd { display: inline-block; padding: 0.06rem 0.38rem; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .55rem .9rem; font-weight: 650; font-size: .87rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.is-active { color: var(--plum); border-color: var(--rose); }

/* ---------- Cosmetics components ---------- */
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); vertical-align: -3px; flex: 0 0 16px; background: repeating-linear-gradient(45deg, #eee 0 3px, #fff 3px 6px); }
.swatch-lg { width: 28px; height: 28px; flex-basis: 28px; }
.shade-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; }
.chip-row { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .35rem; margin-bottom: .55rem; scrollbar-width: thin; }
.chip { flex: 0 0 auto; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-soft); border-radius: 999px; padding: .4rem .85rem; font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer; min-height: 36px; }
.chip.is-active { background: var(--plum); border-color: var(--plum); color: #fff; }
.expiry-pill { font-size: .68rem; font-weight: 700; border-radius: 999px; padding: .08rem .45rem; }
.expiry-pill.warn { background: var(--warning-soft); color: var(--warning); }
.expiry-pill.bad { background: var(--danger-soft); color: var(--danger); }
.variant-table input.form-control, .variant-table select.form-control { min-height: 38px; padding: .45rem .55rem; font-size: .85rem; }
.variant-table td { vertical-align: top; }
.variant-row-removed { opacity: .45; text-decoration: line-through; }
.field-hidden { display: none !important; }

/* ---------- Auth ---------- */
body.auth-body { background: var(--paper); }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.15fr minmax(360px, 0.95fr); }
.auth-hero {
  position: relative; padding: clamp(2.2rem, 5vw, 4.2rem);
  display: flex; flex-direction: column; justify-content: center; color: #fdf3f6; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, rgba(229, 138, 168, 0.32), transparent 58%),
    radial-gradient(ellipse 55% 45% at 88% 82%, rgba(184, 137, 63, 0.22), transparent 52%),
    linear-gradient(160deg, #2c1027 0%, #4a1d41 50%, #6b2d5c 100%);
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Ccircle cx='40' cy='40' r='6' fill='%23ffffff' fill-opacity='.05'/%3E%3Ccircle cx='0' cy='0' r='3' fill='%23ffffff' fill-opacity='.05'/%3E%3C/svg%3E");
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 520px; }
.auth-logo { width: 76px; height: 76px; border-radius: 22px; display: block; box-shadow: 0 14px 32px rgba(0,0,0,.3); margin-bottom: 1.4rem; }
.auth-brand { font-family: var(--font-brand); font-size: clamp(2.8rem, 6vw, 4.3rem); line-height: 0.96; letter-spacing: -0.03em; margin: 0 0 0.7rem; color: #fdf3f6; font-weight: 600; }
.auth-tagline { margin: 0 0 0.75rem; font-size: 1.12rem; font-weight: 600; color: #f6cfdc; max-width: 30ch; }
.auth-support { margin: 0 0 1.35rem; font-size: 0.98rem; color: rgba(253, 243, 246, 0.74); max-width: 38ch; line-height: 1.55; }
.auth-pills { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.auth-pill { border: 1px solid rgba(253, 243, 246, 0.2); background: rgba(255,255,255,0.07); color: rgba(253, 243, 246, 0.9); border-radius: 999px; padding: 0.32rem 0.75rem; font-size: 0.76rem; font-weight: 650; }
.auth-panel { display: grid; place-items: center; padding: clamp(1.5rem, 4vw, 2.5rem); background: radial-gradient(500px 280px at 80% 10%, rgba(196, 87, 124, 0.08), transparent 60%), var(--paper); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.8rem 1.7rem 1.55rem; box-shadow: var(--shadow-lg); }
.auth-card.has-error { border-color: rgba(180, 43, 58, 0.3); }
.auth-card-brand { display: flex; gap: 0.85rem; align-items: flex-start; margin-bottom: 1.25rem; }
.auth-card-logo { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px; }
.auth-card h2 { font-size: 1.45rem; margin: 0 0 0.15rem; line-height: 1.15; }
.auth-card .sub { color: var(--muted); margin: 0; font-size: 0.88rem; }
.auth-submit { margin-top: 0.4rem; padding: 0.82rem 1rem; font-size: 0.95rem; }
.auth-links { margin-top: 1rem; text-align: center; color: var(--muted); font-size: 0.86rem; }
.auth-single { max-width: 480px; margin: 2rem auto; padding: 0 1rem; }

/* ---------- POS ---------- */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: 1rem; align-items: start; }
.pos-search-bar { display: flex; gap: 0.55rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
.pos-search-bar .form-control { font-size: 1rem; min-height: var(--tap); }
#posBarcode { flex: 0 1 230px; }
#posSearch { flex: 1 1 200px; }
.pos-filters { display: flex; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.pos-filters select { flex: 1 1 160px; max-width: 240px; min-height: 40px; }
.product-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 0.65rem; max-height: calc(100vh - 270px); overflow: auto; padding: 2px .15rem 2px 2px; }
.product-tile {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 0.75rem; cursor: pointer; font: inherit; color: inherit; min-height: 118px;
  display: flex; flex-direction: column; gap: .2rem;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.product-tile:hover { transform: translateY(-2px); border-color: rgba(196, 87, 124, 0.4); box-shadow: var(--shadow); }
.product-tile:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.product-tile .tile-img { width: 100%; height: 76px; object-fit: cover; border-radius: 9px; margin-bottom: .25rem; background: var(--rose-soft); }
.product-tile .brand { font-size: .68rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--rose-deep); }
.product-tile .name { font-weight: 700; font-size: 0.86rem; line-height: 1.25; }
.product-tile .meta { color: var(--muted); font-size: 0.72rem; display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.product-tile .price { margin-top: auto; padding-top: .3rem; color: var(--plum); font-weight: 750; font-size: 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 .4rem; }
.product-tile .price .amt { white-space: nowrap; }
.product-tile .price small { color: var(--muted); font-weight: 600; font-size: .7rem; white-space: nowrap; }
.product-tile .swatches { display: flex; gap: 3px; flex-wrap: wrap; }
.product-tile .swatches .swatch { width: 12px; height: 12px; flex-basis: 12px; border-width: 1px; }

.cart-panel { display: flex; flex-direction: column; position: sticky; top: 5.2rem; max-height: calc(100vh - 5.8rem); padding: 1.1rem 1.15rem 0; overflow-y: auto; overscroll-behavior: contain; }
.cart-list { flex: 0 0 auto; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.cart-item .title { font-weight: 700; font-size: .93rem; line-height: 1.25; }
.cart-item .sub { color: var(--muted); font-size: .76rem; display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-top: .15rem; }
.cart-item .line-total { font-weight: 750; text-align: right; white-space: nowrap; }
.cart-item .line-total s { color: var(--muted); font-weight: 500; font-size: .76rem; display: block; }
.qty-row { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.45rem; flex-wrap: wrap; }
.qty-row .btn-sm { min-width: 40px; min-height: 38px; font-size: .95rem; }
.qty-row input.qty { width: 64px; text-align: center; padding: 0.4rem; border-radius: 9px; border: 1px solid var(--line-strong); font: inherit; font-weight: 700; min-height: 38px; }
.qty-row input.ldisc { width: 92px; padding: .4rem .5rem; border-radius: 9px; border: 1px solid var(--line-strong); font: inherit; font-size: .82rem; min-height: 38px; }
.cart-scroll { flex: 0 0 auto; padding-top: 0.8rem; border-top: 1px solid var(--line); }
body.pos-page .cart-panel .form-group { margin-bottom: 0.65rem; }
.cart-summary { flex: 0 0 auto; position: sticky; bottom: 0; padding: 0.7rem 0 0.9rem; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -10px 18px -14px rgba(63, 25, 55, .25); }
.cart-summary .total-row { margin-bottom: .25rem; }
.cart-summary .total-row.grand { margin: .3rem 0 .55rem; }
.seg-toggle { display: flex; gap: .35rem; flex-wrap: wrap; }
.seg-btn { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: .4rem .8rem; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; color: var(--ink-soft); min-height: 38px; }
.seg-btn.is-active { background: var(--plum); color: #fff; border-color: var(--plum); }
.discount-input-row { display: flex; gap: .5rem; align-items: center; }
.discount-input-row .form-control { flex: 1; }
.pay-method-row .seg-btn { flex: 1 1 auto; }
body.pos-page #checkoutBtn { min-height: 54px; font-size: 1.08rem; border-radius: 14px; }
.inline-add { display: flex; gap: .45rem; align-items: center; }
.inline-add .form-control { flex: 1; }
.shortcuts { color: var(--muted); font-size: 0.74rem; margin-top: 0.5rem; }
.pos-warnings { margin: .5rem 0 0; }
.pos-toast-stack { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 200; display: flex; flex-direction: column-reverse; gap: .5rem; pointer-events: none; max-width: min(340px, calc(100vw - 2.2rem)); }
.pos-toast { display: flex; align-items: center; gap: .5rem; background: var(--plum-deep); color: #fff; padding: .6rem .95rem; border-radius: 11px; font-size: .85rem; font-weight: 650; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.pos-toast.show { opacity: 1; transform: none; }
.pos-toast.warn { background: #7a4d10; }
.pos-toast .tick { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--rose); display: flex; align-items: center; justify-content: center; font-size: .72rem; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; max-height: 60vh; overflow: auto; }
.variant-option { text-align: left; border: 1px solid var(--line-strong); border-radius: 12px; padding: .6rem .7rem; background: #fff; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: .2rem; min-height: var(--tap); }
.variant-option:hover { border-color: var(--rose); }
.variant-option:disabled { opacity: .45; cursor: not-allowed; }
.variant-option .top { display: flex; gap: .4rem; align-items: center; font-weight: 700; font-size: .85rem; }

/* ---------- Modals ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(42, 15, 37, 0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-card { width: min(440px, 100%); max-height: 90vh; overflow: auto; background: var(--surface-solid); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.25rem 1.35rem; }
.modal-card.wide { width: min(760px, 100%); }
.modal-card h3 { margin: 0 0 .35rem; }
.modal-card .sub { color: var(--muted); margin: 0 0 1rem; font-size: .9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }

/* ---------- Charts / mix ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: .45rem; min-height: 160px; overflow-x: auto; padding-top: .5rem; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 36px; }
.bar-col .bar { width: 18px; background: linear-gradient(180deg, var(--rose), var(--plum)); border-radius: 6px 6px 2px 2px; }
.bar-col span { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.mix-track { height: 8px; background: rgba(61, 26, 53, .08); border-radius: 99px; margin: .2rem 0 .7rem; overflow: hidden; }
.mix-fill { height: 100%; border-radius: 99px; background: var(--plum); }
.mix-fill.mix-credit { background: var(--champagne); }
.mix-fill.mix-card { background: var(--rose); }
.mix-fill.mix-mixed { background: var(--plum-mid); }

/* ---------- Purchase lines / suggestions ---------- */
.purchase-row { border: 1px solid var(--line); border-radius: 12px; padding: .75rem; margin-bottom: .75rem; background: #fff; }
.prod-suggest { display: flex; flex-direction: column; gap: .25rem; margin-top: .35rem; max-height: 260px; overflow: auto; }
.suggest-item { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .45rem .6rem; cursor: pointer; font: inherit; display: flex; gap: .45rem; align-items: center; }
.suggest-item:hover { border-color: var(--rose); }
.clickable-row { cursor: pointer; }

/* ---------- Billing / add-ons (ported) ---------- */
.addon-back { margin: 0 0 1.1rem; color: var(--muted); font-size: .9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.billing-period { display: inline-flex; margin: 0 0 1.2rem; padding: 4px; background: var(--rose-soft); border-radius: 12px; }
.billing-period-btn, .addon-period-btn { border: 0; background: transparent; color: var(--ink-soft); font-weight: 700; padding: .45rem 1.1rem; border-radius: 10px; cursor: pointer; }
.billing-period-btn.is-active, .addon-period-btn.is-active { background: var(--plum); color: #fff; }
.addon-period { display: inline-flex; margin: .55rem 0 .15rem; padding: 3px; background: #f3e6ea; border-radius: 10px; }
.addon-period-btn { font-size: .75rem; padding: .28rem .7rem; border-radius: 8px; }
.billing-section-title { font-size: 1rem; margin: 1.1rem 0 .6rem; }
.billing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 1rem; }
.addon-card { display: block; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); }
.addon-card.is-selected { outline: 2px solid var(--plum); background: var(--rose-soft); }
.addon-card .addon-check { margin-right: 8px; }
.addon-card-head, .plan-card { display: block; cursor: pointer; }
.addon-price { font-size: 1.25rem; font-weight: 800; color: var(--plum); margin: .35rem 0; }
.addon-status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.branch-stepper { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.checkout-box { border: 1px solid var(--plum); border-radius: 14px; padding: 16px; background: var(--rose-soft); margin-top: 1.2rem; }
.checkout-lines { margin: 0 0 10px; padding-left: 1.1rem; }
.checkout-total { font-size: 1.5rem; font-weight: 800; color: var(--plum-deep); margin-bottom: 12px; }
.posly-mark { font-size: .72rem; line-height: 1.3; margin: 0 0 4px; }
.posly-mark a { color: inherit; text-decoration: none; font-weight: 600; }
.side-foot .posly-mark { opacity: .8; }
.posly-mark-print { text-align: center; margin-top: 6px; font-size: 10px; font-weight: 700; }
.posly-mark-print a { color: #000; text-decoration: none; }

/* ---------- Z-report (screen + print) ---------- */
.receipt { width: 80mm; max-width: 100%; font-family: "Consolas", "Courier New", ui-monospace, monospace; font-size: 12px; line-height: 1.35; padding: 12px; background: #fff; color: #111; }
.receipt h2 { font-size: 16px; text-align: center; margin: 0 0 4px; }
.receipt .center { text-align: center; }
.receipt .line { border-top: 1px dashed #999; margin: 8px 0; }
.receipt .total-row { font-size: 12px; margin: 0; padding: 2px 0; color: #111; }
.receipt .total-row.grand { font-size: 13px; font-weight: 700; }
@media print {
  body * { visibility: hidden !important; }
  .receipt, .receipt * { visibility: visible !important; }
  .receipt { position: absolute; left: 0; top: 0; width: 72mm; box-shadow: none !important; border: 0 !important; }
  .no-print { display: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .grid-2-even, .pos-layout { grid-template-columns: 1fr; }
  .cart-panel { position: static; max-height: none; }
  .cart-list { max-height: none; }
  .product-results { max-height: 52vh; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 2.2rem 1.5rem 1.75rem; }
  .auth-brand { font-size: clamp(2.4rem, 10vw, 3.2rem); }
}
@media (max-width: 860px) {
  .sidebar { width: var(--sidebar-w); transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(42, 15, 37, 0.5); z-index: 35; }
  .app-main { margin-left: 0; }
  .nav-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.45rem 0.75rem; cursor: pointer; min-height: 40px; font-size: 1.1rem; }
  .form-row, .form-row-3, .form-row-4, .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding-inline: 1rem; flex-wrap: wrap; }
  .topbar-meta { display: none; }
  .content { padding-inline: .85rem; }
  .user-chip { display: none; }
  .toolbar .form-control { max-width: none; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .product-results { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panel { padding: 1rem .9rem; }
}
