/* Farmilyne — field-green POS theme */
@font-face { font-family: 'Bricolage'; src: url('/vendor/fonts/bricolage.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Public Sans'; src: url('/vendor/fonts/public-sans.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #17271f;
  --ink-2: #2b3d33;
  --muted: #5f6e64;
  --paper: #f3f6f0;
  --surface: #ffffff;
  --line: #dce3d6;
  --line-2: #eaefe6;
  --leaf: #2f7d4a;
  --leaf-deep: #1f5c35;
  --leaf-wash: #e6f1e8;
  --turmeric: #e4a11b;
  --turmeric-wash: #fdf4de;
  --danger: #b83227;
  --danger-wash: #fbe9e7;
  --info: #2d6a8a;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(23, 39, 31, .06), 0 4px 16px rgba(23, 39, 31, .06);
  --shadow-pop: 0 12px 40px rgba(23, 39, 31, .18);
  --display: 'Bricolage', 'Segoe UI', system-ui, sans-serif;
  --body: 'Public Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --sidebar: 232px;
  --t: 160ms cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--body); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
a { color: var(--leaf-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #dfe8e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { padding: 4px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-name { font-family: var(--display); font-weight: 750; font-size: 1.05rem; color: #fff; letter-spacing: .01em; line-height: 1.05; }
.brand-name small { display: block; font-weight: 500; font-size: .72rem; color: #9fb5a6; letter-spacing: .08em; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-s); color: #c6d4ca; text-decoration: none;
  font-weight: 500; transition: background var(--t), color var(--t);
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--leaf); color: #fff; }
.nav a.active .icon { color: var(--turmeric); }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 6px; }
.whoami { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 10px 0; font-size: .85rem; }
.whoami strong { color: #fff; display: block; font-weight: 600; }
.whoami .loc { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 99px; background: rgba(228,161,27,.16); color: var(--turmeric); font-weight: 600; font-size: .75rem; }
.whoami button { background: none; border: 0; color: #9fb5a6; padding: 6px 0 0; cursor: pointer; font-size: .82rem; text-decoration: underline; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar-mobile { display: none; }
.content { padding: 26px 30px 16px; flex: 1; animation: pageIn .3s cubic-bezier(.2,.8,.2,1); }
@keyframes pageIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.footer { padding: 14px 30px 20px; color: var(--muted); font-size: .8rem; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Controls ---------- */
.btn, a.btn { text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--t), border-color var(--t), transform 80ms;
}
.btn:hover { border-color: #bcc8b8; background: #fafcf8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn.primary:hover { background: var(--leaf-deep); border-color: var(--leaf-deep); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: .85rem; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.lg { height: 48px; font-size: 1.02rem; padding: 0 22px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .78rem; }
.input, select.input, textarea.input {
  height: 38px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); padding: 0 11px; width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
}
textarea.input { height: auto; padding: 8px 11px; }
.input:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(47,125,74,.14); }
.input[readonly] { background: var(--line-2); }
.input.num { text-align: right; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(184,50,39,.12); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--leaf); }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-form .full { grid-column: 1 / -1; }

/* ---------- Cards / panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 18px 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.filters .field { width: 150px; }
.filters .field.wide { width: 230px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-weight: 600; font-size: .78rem; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: #fafbf8; position: sticky; top: 0; white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data th .sort-ind { opacity: .5; margin-left: 3px; }
table.data td.code { white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr { transition: background var(--t); }
table.data tbody tr:hover { background: #f8faf6; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #fafbf8; }
.code { font-weight: 600; color: var(--leaf-deep); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--line-2); color: var(--ink-2); }
.pill.ok { background: var(--leaf-wash); color: var(--leaf-deep); }
.pill.off { background: #eeeeee; color: #6b6b6b; }
.pill.warn { background: var(--turmeric-wash); color: #8a5c00; }
.pill.admin { background: #e3eef4; color: var(--info); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; align-items: center; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: #b5c3b8; margin-bottom: 8px; }
.empty strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, #edf1ea 25%, #f6f8f4 37%, #edf1ea 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- Autocomplete ---------- */
.ac { position: relative; }
.ac-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); max-height: 320px; overflow-y: auto; padding: 4px; margin: 0; list-style: none;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.ac-list li { padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.ac-list li[aria-selected="true"] { background: var(--leaf-wash); }
.ac-list li.ac-empty { color: var(--muted); cursor: default; }
.ac-main { flex: 1; min-width: 0; }
.ac-main b { font-weight: 600; }
.ac-sub { font-size: .78rem; color: var(--muted); }
.ac-price { font-weight: 700; font-family: var(--display); }
mark { background: #fbe7b6; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- Bill screen ---------- */
.bill { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.bill-head { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; padding: 16px 18px; }
.bill-head > .field:nth-child(-n+3) { grid-column: span 2; }
.bill-head > .field:nth-child(n+4) { grid-column: span 3; }
.bill-head .input[readonly] { font-variant-numeric: tabular-nums; }
@media (min-width: 1560px) { .bill-head { grid-template-columns: 1.2fr 1fr .7fr 1.2fr 1.3fr; } .bill-head > .field { grid-column: auto !important; } }
.bill-entry { padding: 14px 18px; border-top: 1px solid var(--line-2); background: #fbfcf9; display: flex; gap: 10px; align-items: flex-end; }
.bill-entry .ac { flex: 1; }
.bill-entry .input { height: 46px; font-size: 1.02rem; }
.bill-entry .ac .icon { position: absolute; left: 13px; top: 14px; color: var(--muted); }
.bill-entry .ac .input { padding-left: 40px; }
.kbd { display: inline-block; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .72rem; font-weight: 600; color: var(--muted); background: #fff; }
.hints { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); padding: 8px 18px 12px; }
table.lines th, table.lines td { padding: 7px 6px; }
table.lines th:first-child, table.lines td:first-child { padding-left: 14px; color: var(--muted); }
table.lines td:last-child { padding-right: 10px; }
table.lines td { font-size: .9rem; white-space: nowrap; }
table.lines td.line-item { white-space: normal; min-width: 150px; }
table.lines .qty { width: 66px; height: 34px; }
@keyframes rowIn { from { background: var(--turmeric-wash); } to { background: transparent; } }
.line-item b { display: block; font-weight: 600; }
.line-item small { color: var(--muted); }

/* Receipt panel — the tear-off slip */
.receipt { position: sticky; top: 18px; }
.slip {
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-l) var(--radius-l) 0 0;
  box-shadow: var(--shadow); padding: 20px 22px 18px; position: relative;
}
.slip::after {
  content: ''; position: absolute; left: -1px; right: -1px; bottom: -10px; height: 10px;
  background: linear-gradient(-45deg, transparent 6px, var(--surface) 0) 0 0 / 12px 10px repeat-x,
              linear-gradient(45deg, transparent 6px, var(--surface) 0) 0 0 / 12px 10px repeat-x;
  filter: drop-shadow(0 1px 0 var(--line));
}
.slip-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: .9rem; color: var(--ink-2); }
.slip-row.minus span:last-child { color: var(--leaf-deep); }
.slip-rule { border-top: 1px dashed #c9d3c4; margin: 10px 0; }
.grand { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 2px; }
.grand { gap: 10px; }
.grand span:first-child { font-weight: 600; white-space: nowrap; }
.grand-amt { font-family: var(--display); font-size: clamp(1.6rem, 2.4vw, 2.3rem); white-space: nowrap; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.grand-amt.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { color: var(--leaf); } }
.pay { margin-top: 22px; padding: 16px 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay .input { height: 44px; font-size: 1.05rem; font-weight: 600; }
.credit-box { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: var(--radius-s); background: var(--turmeric-wash); }
.credit-box.zero { background: var(--leaf-wash); }
.credit-box b { font-family: var(--display); font-size: 1.2rem; }
.pay-error { color: var(--danger); font-size: .84rem; margin-top: 8px; font-weight: 600; }
.pay-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); animation: kpiIn .4s both; }
.kpi:nth-child(2) { animation-delay: 40ms; } .kpi:nth-child(3) { animation-delay: 80ms; } .kpi:nth-child(4) { animation-delay: 120ms; }
.kpi:nth-child(5) { animation-delay: 160ms; } .kpi:nth-child(6) { animation-delay: 200ms; }
@keyframes kpiIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.kpi .k-label { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kpi .k-label .icon { width: 16px; height: 16px; color: var(--leaf); }
.kpi .k-value { font-family: var(--display); font-size: 1.6rem; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi.hero { background: var(--ink); color: #fff; border-color: var(--ink); grid-column: span 2; }
.kpi.hero .k-label { color: #a9bdb0; } .kpi.hero .k-label .icon { color: var(--turmeric); }
.kpi.hero .k-value { font-size: 2.3rem; }
.kpi.hero .k-sub { color: #c6d4ca; font-size: .85rem; margin-top: 4px; }
.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.chart-box { padding: 16px 18px; }
.chart-box h3 { margin-bottom: 12px; }
.chart-canvas { position: relative; height: 260px; }

/* ---------- Reports ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 0 12px; }
.tabs button { background: none; border: 0; padding: 12px 12px 10px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--leaf); }

/* ---------- Modal / toast ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(23,39,31,.42); display: flex; align-items: flex-start; justify-content: center; z-index: 100;
  padding: 6vh 16px 16px; overflow-y: auto; animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-pop); width: 100%; max-width: 560px; animation: rise .18s var(--t); }
.modal.wide { max-width: 980px; }
@keyframes rise { from { transform: translateY(10px) scale(.99); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fafbf8; border-radius: 0 0 var(--radius-l) var(--radius-l); }
.success-hero { text-align: center; padding: 10px 0 4px; }
.success-hero .tick { width: 58px; height: 58px; border-radius: 50%; background: var(--leaf-wash); color: var(--leaf); display: inline-flex; align-items: center; justify-content: center; animation: tick .35s var(--t); }
.success-hero .tick .icon { width: 30px; height: 30px; stroke-width: 2.4; }
@keyframes tick { from { transform: scale(.6); opacity: 0; } }
.success-hero .inv-no { font-family: var(--display); font-size: 1.6rem; font-weight: 750; margin-top: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.summary-grid div { background: var(--paper); border-radius: var(--radius-s); padding: 8px 10px; text-align: left; }
.summary-grid small { display: block; color: var(--muted); font-size: .75rem; }
.summary-grid b { font-family: var(--display); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 11px 14px; border-radius: var(--radius);
  background: var(--ink); color: #fff; box-shadow: var(--shadow-pop); animation: toastIn .2s var(--t); font-size: .9rem;
}
.toast.error { background: var(--danger); }
.toast.ok .icon { color: #9fe0b1; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toastInOld { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(rgba(246, 243, 236, .35), rgba(246, 243, 236, .35)), #f6f3ec url('/img/login-bg.svg') center / cover no-repeat; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 32px 30px 24px; box-shadow: 0 2px 4px rgba(23, 39, 31, .05), 0 18px 48px rgba(23, 39, 31, .12); }
.login-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.login-logo img { display: block; max-width: 250px; max-height: 112px; width: auto; height: auto; }
.login-logo-text { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 750; font-size: 1.5rem; color: var(--ink); }
.login-logo-text svg { width: 36px; height: 36px; }
.login-card h2 { font-size: 1.35rem; margin-bottom: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.login-error { background: var(--danger-wash); color: var(--danger); padding: 9px 12px; border-radius: var(--radius-s); font-size: .88rem; font-weight: 600; }
.login-foot { margin-top: 24px; font-size: .8rem; color: var(--muted); text-align: center; }

/* ---------- Invoice view ---------- */
.inv-view { font-size: .9rem; }
#print-root { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .bill { grid-template-columns: minmax(0, 1fr); }
  .receipt { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .pay { margin-top: 0; }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .22s var(--t); }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .topbar-mobile { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
  .topbar-mobile .brand-name { font-size: .95rem; }
  .topbar-mobile button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
  .content { padding: 18px 14px 10px; }
  .footer { padding: 12px 14px 18px; }
  .receipt { grid-template-columns: 1fr; }
  .bill-head { grid-template-columns: 1fr 1fr; }
  .bill-head > .field { grid-column: auto !important; }
  .login-card { padding: 26px 20px 20px; }
  .grid-form { grid-template-columns: 1fr; }
  .kpi.hero { grid-column: auto; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filters .field, .filters .field.wide { width: calc(50% - 5px); }
}
/* ---------- Motion and feedback effects ---------- */
.btn, .nav a, .tabs button { position: relative; overflow: hidden; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .22; transform: scale(0); animation: ripple .55s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.btn { transition: background .15s, border-color .15s, box-shadow .15s, transform .1s; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(47,125,74,.28); }
/* Pulsing ring drawn with box-shadow, so the button's own clipping (needed for the ripple) cannot hide it */
.fx-pulse { animation: pulseRing 1.4s ease-out infinite; }
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(47,125,74,.9), 0 0 0 0 rgba(47,125,74,.5); }
  70% { box-shadow: 0 0 0 12px rgba(47,125,74,0), 0 0 0 22px rgba(47,125,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,125,74,0), 0 0 0 0 rgba(47,125,74,0); }
}
.special-btn.fx-pulse { animation-name: pulseRingAmber; }
@keyframes pulseRingAmber {
  0% { box-shadow: 0 0 0 0 rgba(228,161,27,.9), 0 0 0 0 rgba(228,161,27,.5); }
  70% { box-shadow: 0 0 0 12px rgba(228,161,27,0), 0 0 0 22px rgba(228,161,27,0); }
  100% { box-shadow: 0 0 0 0 rgba(228,161,27,0), 0 0 0 0 rgba(228,161,27,0); }
}
.fx-pop { animation: fxPop .42s ease-out; }
@keyframes fxPop { 0% { transform: scale(1); } 35% { transform: scale(.92); } 70% { transform: scale(1.07); } 100% { transform: scale(1); } }
.fx-shake { animation: fxShake .42s ease-in-out; }
@keyframes fxShake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.fx-flash, tr.fx-flash td { animation: fxFlash 1.25s ease-out; }
@keyframes fxFlash { 0%, 25% { background: #ffe9a8; } 100% { background: transparent; } }
.fx-spin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fx-row-in { animation: rowCascade .32s ease-out both; }
@keyframes rowCascade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fx-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }
/* Sliding highlight behind the active menu item */
.nav { position: relative; }
.nav a { z-index: 1; transition: color .2s, background .2s; }
.nav a.active { background: transparent; }
.nav-ind { position: absolute; left: 0; top: 0; border-radius: 10px; background: var(--leaf); transition: transform .32s cubic-bezier(.2,.8,.2,1), height .32s, width .32s, opacity .2s; pointer-events: none; z-index: 0; }
/* Gliding underline under the active tab */
.tabs { position: relative; }
.tabs button[aria-selected="true"] { border-bottom-color: transparent; }
.tab-ind { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--leaf); border-radius: 2px; transition: transform .3s cubic-bezier(.2,.8,.2,1), width .3s; pointer-events: none; }
/* Cards and rows respond to the pointer */
.kpi, .chart-box { transition: transform .18s, box-shadow .18s; }
.kpi:hover, .chart-box:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(23,39,31,.08); }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: #f6f9f3; }
.modal { animation: zoomIn .22s cubic-bezier(.2,.8,.2,1); }
@keyframes zoomIn { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.leaving { opacity: 0; transform: translateX(40px); transition: all .22s; }
.modal .success-mark { animation: fxPop .5s ease-out .05s both; }
.sound-toggle { background: none; border: 0; color: #a9bdb0; font: inherit; font-size: .8rem; cursor: pointer; padding: 0; margin-left: 10px; text-decoration: underline; }
/* Similar item names shown under the name field */
.similar { margin-top: 6px; font-size: .78rem; color: var(--muted); }
.similar ul { list-style: none; margin: 3px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.similar li { background: #fdf6e3; color: #7a5a12; border: 1px solid #f0d99a; border-radius: 6px; padding: 1px 7px; animation: rowCascade .2s ease-out both; }
.similar li.same { background: #fdecec; color: var(--danger); border-color: #f3b9b9; font-weight: 600; }
.similar .inactive { opacity: .7; font-style: italic; }
@media (prefers-reduced-motion: reduce) {
  .ripple, .fx-confetti { display: none; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
table.data td.wide-cell { min-width: 170px; }

/* Reports: every column left-aligned, columns separated by lines */
table.report-table th, table.report-table td, table.report-table .num { text-align: left; }
table.report-table th, table.report-table td { border: 1px solid var(--line-2); }
table.report-table thead th { background: #f4f6f1; border-bottom: 1px solid var(--line); }
table.report-table tfoot td { border-top: 2px solid var(--line); }

/* Roles & permissions matrix */
table.perm-matrix th.perm-name, table.perm-matrix td.perm-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 230px; text-align: left; }
table.perm-matrix td.perm-name small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; margin-top: 2px; max-width: 34ch; }
table.perm-matrix th.perm-role { text-align: center; vertical-align: bottom; min-width: 128px; text-transform: none; letter-spacing: 0; }
table.perm-matrix th, table.perm-matrix td { border-right: 1px solid var(--line-2); }
.perm-role-name { font-family: var(--display); font-weight: 700; font-size: .95rem; color: var(--ink); }
.perm-role-meta { font-size: .75rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px; }
.perm-role-meta svg { width: 12px; height: 12px; }
.perm-role-actions { display: flex; justify-content: center; gap: 2px; margin-top: 4px; }
table.perm-matrix td.perm-cell { text-align: center; }
table.perm-matrix td.perm-cell input { width: 18px; height: 18px; accent-color: var(--leaf); cursor: pointer; }
table.perm-matrix td.perm-cell input:disabled { cursor: not-allowed; opacity: .6; }
.perm-savebar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; background: #fdf6e3; border-top: 1px solid #f0d99a; font-weight: 600; z-index: 3; }

/* ---------- Priority 1 update ---------- */
/* Messages: action button (Undo) and a shrinking timer bar */
.toast { position: relative; overflow: hidden; }
.toast-action { margin-left: auto; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: 3px 10px; font: inherit; font-weight: 700; cursor: pointer; }
.toast-action:hover { background: rgba(255,255,255,.24); }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255,255,255,.55); transform-origin: left; animation: toastTimer var(--toast-ms, 3200ms) linear forwards; }
@keyframes toastTimer { to { transform: scaleX(0); } }
/* Friendlier empty pages */
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 12px; color: var(--muted); text-align: center; }
.empty strong { color: var(--ink); font-size: 1rem; }
.empty-leaf { width: 54px; height: 54px; margin-bottom: 4px; }
.empty-leaf .lf1 { transform-origin: 24px 28px; animation: leafL 3.2s ease-in-out infinite; }
.empty-leaf .lf2 { transform-origin: 24px 23px; animation: leafR 3.2s ease-in-out infinite; }
@keyframes leafL { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-9deg); } }
@keyframes leafR { 0%,100% { transform: rotate(0); } 50% { transform: rotate(9deg); } }
/* Collapsible sidebar: icons only */
.brand { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.collapse-btn { background: none; border: 0; color: #a9bdb0; cursor: pointer; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; transition: transform .3s, background .2s; }
.collapse-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.collapse-btn .icon { width: 18px; height: 18px; }
.sidebar { transition: width .3s cubic-bezier(.2,.8,.2,1), transform .22s var(--t); }
.shell { transition: grid-template-columns .3s cubic-bezier(.2,.8,.2,1); }
.shell.collapsed { --sidebar: 68px; }
.shell.collapsed .brand-name, .shell.collapsed .nav a span, .shell.collapsed .whoami { display: none; }
.shell.collapsed .brand { flex-direction: column; }
.shell.collapsed .collapse-btn { transform: rotate(180deg); }
.shell.collapsed .nav a { justify-content: center; padding-left: 0; padding-right: 0; }
.nav a { position: relative; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--turmeric); color: var(--ink); font-size: .72rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.shell.collapsed .nav-badge { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; font-size: .65rem; padding: 0 4px; }
/* Buttons with counts and states */
.btn .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: #fff; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }
.btn.active { background: #fdf6e3; border-color: var(--turmeric); color: #7a5a12; }
.btn.unverified { background: #fdecec; border-color: #f3b9b9; color: var(--danger); }
.btn.verified { background: #e8f4ec; border-color: #9fd0b0; color: var(--leaf-deep, #23603a); }
.special-btn.has-pending { background: #fdf6e3; border-color: var(--turmeric); color: #7a5a12; }
.special-btn .count { background: var(--turmeric); color: var(--ink); }
/* Billing banners */
.net-banner, .special-banner, .alert-strip, .bill-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: .92rem; animation: rowCascade .25s ease-out; }
.net-banner { background: #fdecec; color: var(--danger); border: 1px solid #f3b9b9; }
.special-banner, .bill-banner.special { background: #fdf6e3; color: #7a5a12; border: 1px solid #f0d99a; }
.bill-banner.cancelled { background: #fdecec; color: var(--danger); border: 1px solid #f3b9b9; }
.alert-strip { background: #fdf6e3; color: #7a5a12; border: 1px solid #f0d99a; }
.alert-strip .btn { margin-left: auto; }
.net-banner .icon, .special-banner .icon, .alert-strip .icon, .bill-banner .icon { flex: none; }
.hidden { display: none !important; }
/* Special price rates on the bill */
table.lines .rate { width: 86px; height: 32px; }
table.lines .std-rate { display: block; color: var(--muted); font-size: .72rem; margin-top: 2px; }
.new-price { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; background: #fdf6e3; border: 1px solid #f0d99a; color: #7a5a12; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pill.special { background: #fdf6e3; color: #7a5a12; margin-left: 6px; font-size: .7rem; }
.pill.special.rejected { background: #fdecec; color: var(--danger); }
.pill.special.approved { background: #e8f4ec; color: #23603a; }
.pill.special .icon { width: 11px; height: 11px; }
td.neg { color: var(--danger); font-weight: 600; }
/* Removing a line */
table.lines tbody tr.row-out { transition: opacity .24s, transform .24s; opacity: 0; transform: translateX(40px); }
/* Change calculator */
.change-calc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; margin-top: 10px; }
.change-out { padding: 8px 10px; border-radius: var(--radius); background: var(--line-2); display: flex; flex-direction: column; min-height: 58px; justify-content: center; transition: background .3s, color .3s; }
.change-out span { font-size: .78rem; color: var(--muted); }
.change-out b { font-family: var(--display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.change-out small { font-size: .72rem; }
.change-out.ok { background: #e8f4ec; color: #23603a; }
.change-out.short { background: #fdecec; color: var(--danger); }
/* Printed-slip effect on save */
.slip.slip-out { animation: slipOut .55s cubic-bezier(.5,0,.2,1) forwards; }
.slip.slip-in { animation: slipIn .5s cubic-bezier(.2,.8,.2,1); }
@keyframes slipOut { to { transform: translateY(-115%); opacity: 0; } }
@keyframes slipIn { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
.receipt { overflow: hidden; }
/* Held bills */
.held-list { display: flex; flex-direction: column; gap: 8px; }
.held-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font: inherit; transition: border-color .15s, transform .15s; }
.held-row:hover { border-color: var(--leaf); transform: translateY(-1px); }
.held-row .grow, .approval-row .grow { flex: 1; display: flex; flex-direction: column; }
.held-row .icon { color: var(--leaf); }
/* Cash page */
.cash-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 18px 6px; }
.cash-cards .kpi.hero { grid-column: auto; }
.cash-cards .kpi.wide { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cash-cards .kpi.wide .k-label { margin: 0; }
.closing-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.cash-cancelled { margin: 8px 18px 12px; padding: 10px 14px; border-radius: var(--radius); background: #fdecec; border: 1px solid #f3b9b9; color: var(--danger); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
tr.row-pending td { background: #fffaf0; }
tr.row-pending td:first-child { box-shadow: inset 3px 0 0 var(--turmeric); }
tr.row-rejected td { color: var(--muted); text-decoration: line-through; }
tr.row-rejected td:last-child, tr.row-rejected td:nth-last-child(2) { text-decoration: none; }
.approvals { border: 1px solid #f0d99a; background: #fffaf0; margin-bottom: 14px; }
.approval-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f3e6c4; flex-wrap: wrap; }
.approval-row:first-of-type { border-top: 0; }
.verif-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cash-expect { padding: 12px 14px; border-radius: var(--radius); background: var(--line-2); display: flex; flex-direction: column; }
.cash-expect b { font-family: var(--display); font-size: 1.6rem; }
.cash-expect small { color: var(--muted); }
.cash-cancel-note { color: var(--danger); font-size: .88rem; }
.cash-diff { padding: 8px 12px; border-radius: var(--radius); font-weight: 600; font-size: .9rem; }
.cash-diff.ok { background: #e8f4ec; color: #23603a; }
.cash-diff.plus { background: #e8f0fb; color: #1b4f8f; }
.cash-diff.minus { background: #fdecec; color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; }
@media (max-width: 900px) { .cash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .change-calc { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .collapse-btn { display: none; }
  .shell.collapsed { --sidebar: 260px; }
  .shell.collapsed .brand-name, .shell.collapsed .nav a span, .shell.collapsed .whoami { display: revert; }
  .shell.collapsed .nav a { justify-content: flex-start; padding-left: revert; padding-right: revert; }
}

/* ---------- v8: drawer handover, all-locations cash view ---------- */
.cash-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .cash-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .cash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi.holder .holder-name { font-size: 1.35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.holder.me { border-color: #9fd0b0; background: #f1f8f3; }
.kpi.holder.me .k-label .icon { color: var(--leaf); }
.kpi.holder.none { border-color: #f3b9b9; background: #fff6f5; }
.kpi.holder.none .k-label .icon { color: var(--danger); }
.closing-line .reclose { display: flex; align-items: center; gap: 6px; color: #8a5c00; font-weight: 600; margin-top: 4px; }
.closing-line .reclose .icon { width: 14px; height: 14px; }
.handover-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--leaf-wash); color: var(--leaf-deep); font-size: .88rem; line-height: 1.4; }
.handover-note .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.handovers { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.handovers li { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; }
.handovers li::before { content: ""; position: absolute; left: -20px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.handovers li.now::before { background: var(--leaf); border-color: var(--leaf); box-shadow: 0 0 0 4px var(--leaf-wash); }
.handovers .ho-time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 64px; }
.cash-all tbody tr.clickable { cursor: pointer; }
.cash-all tbody tr.clickable:hover td { background: var(--leaf-wash); }
.cash-all tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.cash-pick { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; }
.cash-pick .icon { width: 16px; height: 16px; }
.pill.muted { background: var(--line-2); color: var(--muted); }
.pill .icon { width: 12px; height: 12px; vertical-align: -2px; }

/* ---------- v8: bulk upload with Excel ---------- */
.bu-choose { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .bu-choose { grid-template-columns: 1fr; } }
.bu-card { border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.bu-card h3 { margin: 4px 0 0; font-family: var(--display); font-size: 1.2rem; }
.bu-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; flex: 1; }
.bu-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--leaf-wash); color: var(--leaf); }
.bu-ic.amber { background: var(--turmeric-wash); color: #8a5c00; }
.bu-ic .icon { width: 22px; height: 22px; }
.bu-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bu-note { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin: 14px 0 0; }
.bu-note .icon { width: 16px; height: 16px; flex: none; }
.bu-foot { display: contents; }
.bu-busy { display: grid; place-items: center; gap: 12px; padding: 40px 10px; text-align: center; }
.bu-busy p { margin: 0; font-weight: 600; }
.bu-spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--leaf-wash); border-top-color: var(--leaf); animation: buSpin .8s linear infinite; }
@keyframes buSpin { to { transform: rotate(360deg); } }
.bu-bar { width: min(360px, 90%); height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bu-bar i { display: block; height: 100%; background: var(--leaf); border-radius: inherit; transition: width .3s ease; }
.bu-head h3 { margin: 0 0 10px; font-family: var(--display); }
.bu-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.bu-summary .pill { font-size: .82rem; padding: 4px 10px; }
.bu-warn { display: flex; gap: 6px; align-items: center; margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--danger-wash); color: var(--danger); font-size: .87rem; }
.bu-warn .icon { width: 16px; height: 16px; flex: none; }
.bu-table { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.bu-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.bu-table td { font-size: .87rem; vertical-align: top; }
.bu-table tr.bu-reject td, .bu-table tr.bu-notsent td { background: #fff6f5; }
.bu-table tr.bu-created td, .bu-table tr.bu-updated td { background: #f4faf5; }
.bu-result { text-align: center; padding: 10px 10px 18px; }
.bu-result h3 { margin: 10px 0 4px; font-family: var(--display); font-size: 1.35rem; }
.bu-result p { margin: 0 auto; max-width: 560px; color: var(--muted); }
.bu-mark { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; }
.bu-mark.bad { background: var(--danger-wash); color: var(--danger); }
.bu-mark.bad .icon { width: 32px; height: 32px; }
.bu-mark.good { background: none; }
.bu-tick { width: 64px; height: 64px; }
.bu-tick circle { fill: var(--leaf); stroke: none; transform-origin: center; animation: tickPop .35s ease-out both; }
.bu-tick path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: tickDraw .45s .3s ease-out forwards; }
@keyframes tickPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes tickDraw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .bu-tick circle, .bu-spinner { animation: none; } .bu-tick path { animation: none; stroke-dashoffset: 0; } }
.bu-check { margin-top: 4px; color: #8a5c00; font-weight: 600; font-size: .82rem; display: flex; gap: 5px; align-items: flex-start; }
.bu-check .icon { width: 13px; height: 13px; flex: none; margin-top: 2px; }
/* v9: click-to-sort report headings */
.report-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.report-table th.sortable:hover { color: var(--leaf-deep); }
.report-table th .sort-arrow { display: inline-block; margin-left: 5px; font-size: .7em; opacity: .35; }
.report-table th.sorted .sort-arrow { opacity: 1; color: var(--leaf); }
.cancel-req-btn.has-pending { border-color: #f3b9b9; background: #fff6f5; color: var(--danger); }

/* ---------- v10: AI features ---------- */
.ai-row { display: flex; gap: 8px; }
.ai-row .input { flex: 1; }
.btn.ai-btn .icon, .briefing-head .icon, .ask-ic .icon { color: #7c5cc4; }
.aka { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.briefing { background: linear-gradient(135deg, #f6f2ff, #f1f8f3); border: 1px solid #ded4f5; border-radius: var(--radius-l); padding: 14px 18px; margin-bottom: 16px; transition: opacity .2s; }
.briefing.busy { opacity: .55; }
.briefing-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.briefing-head .muted { font-size: .8rem; }
.briefing-head .btn { margin-left: auto; }
.briefing p { margin: 8px 0 0; line-height: 1.55; max-width: 78ch; }
.ask-panel { padding: 14px 16px; margin-bottom: 16px; }
.ask-form { display: flex; gap: 10px; align-items: center; }
.ask-form .input { flex: 1; }
.ask-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #f1ecfd; flex: none; }
.ask-note { margin: 12px 0 8px; font-size: .92rem; line-height: 1.5; }
.ask-busy { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); }
.ai-setup { background: var(--turmeric-wash); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-size: .9rem; }
.ai-setup ol { margin: 6px 0 0; padding-left: 20px; line-height: 1.6; }

/* ---------- v11: logo ---------- */
.brand-logo { display: block; width: 168px; max-width: 100%; height: auto; animation: logoIn .6s ease-out both; transition: transform .25s ease, filter .25s ease; }
.brand-logo:hover { transform: translateY(-1px); filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.brand-icon { display: none; width: 36px; height: 36px; }
.shell.collapsed .brand-logo { display: none; }
.shell.collapsed .brand-icon { display: block; animation: logoIn .35s ease-out both; }
.topbar-logo { height: 30px; width: auto; display: block; }
@keyframes logoIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .brand-logo, .brand-icon { animation: none; } }
@media (max-width: 900px) { .shell.collapsed .brand-logo { display: block; } .shell.collapsed .brand-icon { display: none; } }

/* v13: busiest hours heatmap */
.heat-box { padding: 4px 18px 18px; }
.heat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 6px 0 12px; font-size: .85rem; }
.heat-head .seg { display: inline-flex; gap: 6px; }
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: .78rem; }
.heat th { font-weight: 600; color: var(--muted); padding: 2px 4px; white-space: nowrap; }
.heat tbody th { text-align: left; padding-right: 8px; }
.heat td { min-width: 44px; height: 34px; text-align: center; border-radius: 6px; border: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.heat-top { margin: 12px 0 0; font-size: .88rem; }
/* v13: stock page */
.qty-neg { color: #b3261e; font-weight: 700; }
.stock-note { margin: 0 18px 14px; padding: 10px 14px; border-radius: 10px; background: var(--turmeric-wash); color: #6b4a00; font-size: .88rem; }
.stock-note.ok { background: var(--leaf-wash); color: var(--leaf-deep); }
.opening-steps { display: grid; gap: 14px; padding: 4px 18px 18px; }
.opening-steps .step { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.opening-steps .step h3 { margin: 0 0 6px; font-size: 1rem; }
.opening-steps .step p { margin: 0 0 10px; color: var(--muted); font-size: .88rem; }
.opening-steps .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }

/* v14: purchases */
.pu-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pu-lines .input { height: 34px; }
.pu-lines td { vertical-align: top; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li { margin: 3px 0; }
.modal.wide:has(.pu-lines) { width: min(1240px, 96vw); max-width: none; }
.pu-lines th { white-space: nowrap; }

/* v15: conversion */
.modal.wide:has(.cv-cols) { width: min(1180px, 96vw); max-width: none; }
.cv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 8px; }
@media (max-width: 800px) { .cv-cols { grid-template-columns: 1fr; } }
.cv-h { font-size: .95rem; margin: 10px 0 6px; }
.cv-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; margin-bottom: 8px; }
.cv-line .cv-info { grid-column: 1 / -1; margin-top: -4px; }
.cv-del-space { display: inline-block; width: 34px; } /* v20: keeps lines aligned where the empty last line has no remove button */
.cv-unit { min-width: 34px; font-size: .85rem; }
.cv-lg { display: grid; grid-template-columns: 130px 130px 1fr; gap: 12px; align-items: start; margin-top: 14px; }
@media (max-width: 800px) { .cv-lg { grid-template-columns: 1fr 1fr; } .cv-check { grid-column: 1 / -1; } }
.cv-check { background: var(--line-2); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.cv-check p { margin: 4px 0; }
.cv-warn { color: #8a5c00; }
.cv-sum { margin: 12px 0; }
.cv-earlier { margin-top: 10px; font-size: .88rem; }

/* v16: transfers */
tr.row-late td:first-child { box-shadow: inset 3px 0 0 var(--turmeric); }
.stock-card { padding: 16px 18px; margin-bottom: 18px; }
.stock-card h3 { margin: 0 0 10px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.stock-card .sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.stock-card .sc-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stock-card .sc-box b.big { display: block; font-size: 1.4rem; margin: 2px 0; }
.stock-card .sc-box.warn { border-color: var(--turmeric); background: var(--turmeric-wash); }
.stock-card ul { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; }

/* v17: sales returns and write-offs */
.seg-row { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 4px; }
.wo-line { display: grid; grid-template-columns: 1fr auto 130px 1fr auto; gap: 6px; align-items: center; margin-bottom: 8px; }
.wo-line .cv-info { grid-column: 1 / -1; margin-top: -4px; }
@media (max-width: 800px) { .wo-line { grid-template-columns: 1fr auto; } }

/* v18: stock count and reorder */
.sc-progress { display: flex; flex-direction: column; gap: 4px; min-width: 200px; font-size: .88rem; }
.sc-bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.sc-bar i { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .3s; }
.sc-sheet .input { height: 34px; }
tr.sc-done td:first-child { box-shadow: inset 3px 0 0 var(--leaf); }
tr.row-short td { background: #fff4f2; }
tr.row-excess td { background: #f3f9f4; }
tr.muted-row td { color: var(--muted); }
.ro-foot { display: flex; gap: 12px; align-items: center; padding: 12px 18px; flex-wrap: wrap; }
.ro-foot .input { flex: 1; min-width: 200px; }

/* v19: cash notices (changes made by others) */
.cash-notice { border: 1px solid var(--turmeric); background: var(--turmeric-wash); border-radius: 10px; padding: 10px 12px; font-size: .88rem; color: #5c3f00; margin: 8px 0; }
.cash-notice ul { margin: 6px 0; padding-left: 18px; }
.cash-notice li { margin: 3px 0; }
.cash-notice .plus { color: var(--leaf-deep); font-weight: 700; }
.cash-notice .minus { color: #b3261e; font-weight: 700; }

/* v21: financial year main filter */
.filters .field.fy-pick { width: auto; }
.fy-pick .fy-row { display: flex; align-items: center; gap: 6px; }
.fy-pick select { width: 138px; min-width: 138px; }
@media (max-width: 720px) { .filters .field.fy-pick { width: 100%; } .fy-pick select { flex: 1; width: auto; min-width: 0; } }
#pff select[name=by] { min-width: 170px; }
.filters .field:has(select[name=by]) { width: 180px; }
.fy-pick .fy-to { color: var(--muted, #6b7280); font-size: .85rem; }

/* v21: UPI payment QR after saving a bill */
.upi-pay { text-align: center; }
.upi-qr { width: 260px; height: 260px; margin: 0 auto 10px; display: grid; place-items: center; background: #fff; border-radius: 12px; border: 1px solid var(--line, #e5e7eb); padding: 6px; }
.upi-qr svg { width: 100%; height: 100%; display: block; }
.upi-amt { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.upi-pay .code { word-break: break-all; font-size: .8rem; }

/* v21: sold below cost */
a.kpi { text-decoration: none; color: inherit; cursor: pointer; }
.kpi.warn { border-color: #e7b4ad; background: #fdf3f1; }
.kpi.warn .k-label .icon { color: #b4412f; }
.kpi.hero.warn { background: #7a2418; border-color: #7a2418; color: #fff; }
.kpi.hero.warn .k-label, .kpi.hero.warn .k-label .icon { color: #f6d3cc; }
