/* =====================================================================
   Shop components — form grids, tables, cards, notes, KPI tiles, auth pages.
   (Copied from the Hospital HMS / College ERP design system, never imported.)
   RULES (same design system as the College ERP):
   * colours come from the theme tokens (--acc-*, --surface, --ink, --line),
     so Classic / Ivory / Midnight and dark mode all work with no extra CSS;
   * plain class names, never Tailwind utilities (the Tailwind build is a
     frozen file — a missing class renders as NOTHING);
   * status colours: emerald ok · rose danger · amber warning · sky info.
   ===================================================================== */

/* ---- generic building blocks ---- */
.sh-card{background:var(--surface);border:1px solid var(--line);border-radius:.85rem;
    box-shadow:0 1px 2px rgba(15,23,42,.04);padding:1.1rem 1.2rem}
.sh-card h2{font-size:.95rem;font-weight:700;margin:0 0 .75rem;color:var(--ink)}
.sh-card h2 .sub{font-weight:400;color:#64748b;font-size:.8rem;margin-left:.35rem}
.sh-grid{display:grid;gap:1rem}
.sh-grid.cols-2{grid-template-columns:repeat(auto-fit,minmax(min(20rem,100%),1fr))}
.sh-grid.cols-3{grid-template-columns:repeat(auto-fit,minmax(min(15rem,100%),1fr))}
.sh-grid.cols-4{grid-template-columns:repeat(auto-fit,minmax(min(9.5rem,100%),1fr))}
.sh-stack>*+*{margin-top:1rem}
.sh-row{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center}
.sh-row.between{justify-content:space-between}
.sh-muted{color:#64748b;font-size:.8rem}
.sh-small{font-size:.8rem}
.sh-mono{font-family:Consolas,"Cascadia Mono",monospace;letter-spacing:.02em}
.sh-hr{border:0;border-top:1px solid var(--line);margin:1rem 0}
.sh-note{border:1px solid var(--line);background:var(--surface-2);border-radius:.6rem;
    padding:.7rem .9rem;font-size:.82rem;color:#475569}
.sh-note.warn{border-color:#fcd34d;background:#fffbeb;color:#92400e}
.sh-note.danger{border-color:#fda4af;background:#fff1f2;color:#9f1239}
.sh-note.ok{border-color:#6ee7b7;background:#ecfdf5;color:#065f46}
html[data-theme="dark"] .sh-note.warn{background:#3a2a06;color:#fde68a;border-color:#92400e}
html[data-theme="dark"] .sh-note.danger{background:#3b0d18;color:#fecdd3;border-color:#9f1239}
html[data-theme="dark"] .sh-note.ok{background:#052e22;color:#a7f3d0;border-color:#065f46}

/* ---- forms: labelled grid, phone-friendly ---- */
.sh-form{display:grid;gap:.85rem 1rem;grid-template-columns:repeat(auto-fit,minmax(min(14rem,100%),1fr))}
.sh-form .span-2{grid-column:span 2}
.sh-form .span-all{grid-column:1/-1}
@media (max-width:640px){.sh-form .span-2{grid-column:1/-1}}
.sh-field{display:flex;flex-direction:column;gap:.25rem;font-size:.85rem;min-width:0}
.sh-field>span{color:#64748b;font-size:.78rem;font-weight:500}
.sh-field>span b{color:#e11d48;font-weight:700}
.sh-field input,.sh-field select,.sh-field textarea,.sh-input{width:100%;border:1px solid #cbd5e1;
    border-radius:.5rem;padding:.5rem .65rem;font-size:.9rem;background:var(--surface);color:var(--ink)}
.sh-field input:focus,.sh-field select:focus,.sh-field textarea:focus,.sh-input:focus{
    outline:2px solid var(--acc-400,#2dd4bf);outline-offset:0;border-color:var(--acc-500,#14b8a6)}
html[data-theme="dark"] .sh-field input,html[data-theme="dark"] .sh-field select,
html[data-theme="dark"] .sh-field textarea,html[data-theme="dark"] .sh-input{border-color:#334155;background:#0b1220}
.sh-field .inline{display:flex;gap:.4rem}
.sh-field .inline>*{flex:1;min-width:0}
.sh-check{display:inline-flex;align-items:center;gap:.4rem;font-size:.85rem;cursor:pointer}
.sh-legend{grid-column:1/-1;font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;
    color:var(--acc-700,#0f766e);font-weight:700;border-bottom:1px solid var(--line);padding-bottom:.3rem;margin-top:.4rem}
.sh-actions{display:flex;flex-wrap:wrap;gap:.6rem;justify-content:flex-end;margin-top:1rem}

/* ---- tables ---- */
.sh-table{width:100%;border-collapse:collapse;font-size:.85rem}
.sh-table th{text-align:left;font-size:.7rem;text-transform:uppercase;letter-spacing:.05em;color:#64748b;
    font-weight:600;padding:.55rem .6rem;border-bottom:1px solid var(--line);background:var(--surface-2)}
.sh-table td{padding:.55rem .6rem;border-bottom:1px solid var(--line);vertical-align:top}
.sh-table tr:hover td{background:var(--surface-2)}
.sh-table .num{text-align:right;font-variant-numeric:tabular-nums}
.sh-table .dim td{opacity:.55}
.sh-table a.row-link{color:var(--acc-700,#0f766e);font-weight:600;text-decoration:none}
.sh-table a.row-link:hover{text-decoration:underline}

/* ---- tabs inside a chart ---- */
.sh-tabs{display:flex;gap:.25rem;border-bottom:1px solid var(--line);overflow-x:auto;margin:1rem 0 1rem}
.sh-tabs a{padding:.55rem .9rem;font-size:.85rem;font-weight:600;color:#64748b;text-decoration:none;
    border-bottom:2px solid transparent;white-space:nowrap}
.sh-tabs a.on{color:var(--acc-700,#0f766e);border-bottom-color:var(--acc-600,#0d9488)}

.money-strip{display:grid;gap:.6rem;grid-template-columns:repeat(auto-fit,minmax(min(9rem,100%),1fr))}
.money-strip>div{border:1px solid var(--line);border-radius:.6rem;padding:.5rem .7rem;background:var(--surface-2)}
.money-strip .l{font-size:.68rem;text-transform:uppercase;letter-spacing:.05em;color:#64748b;font-weight:600}
.money-strip .v{font-size:1.15rem;font-weight:800;font-variant-numeric:tabular-nums;color:var(--ink)}
.money-strip .v.due{color:#be123c}
.money-strip .v.back{color:#047857}
.legend{display:flex;flex-wrap:wrap;gap:.8rem;font-size:.75rem;color:#64748b}
.legend i{display:inline-block;width:.8rem;height:.8rem;border-radius:.2rem;margin-right:.3rem;vertical-align:-1px}

/* ---- KPI tiles (dashboard) ---- */
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:.85rem;padding:.9rem 1rem}
.kpi .l{font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;color:#64748b;font-weight:600}
.kpi .v{font-size:1.65rem;font-weight:800;color:var(--ink);margin-top:.1rem;font-variant-numeric:tabular-nums}
.kpi .s{font-size:.75rem;color:#64748b}
.kpi.accent{border-left:4px solid var(--acc-600,#0d9488)}

/* ---- "Start here" checklist ---- */
.start-list{list-style:none;margin:0;padding:0}
.start-list li{display:flex;align-items:center;gap:.6rem;padding:.55rem 0;border-bottom:1px dashed var(--line);font-size:.87rem}
.start-list li:last-child{border-bottom:0}
.start-list .n{width:1.5rem;height:1.5rem;border-radius:9999px;background:var(--acc-600,#0d9488);color:#fff;
    font-size:.75rem;font-weight:700;display:flex;align-items:center;justify-content:center;flex:none}

/* ---- setup / login pages (no sidebar) ---- */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1.5rem;background:#0f172a}
.auth-card{background:var(--surface);border-radius:1.1rem;box-shadow:0 20px 50px rgba(0,0,0,.35);padding:1.6rem;width:100%}
.auth-brand{text-align:center;margin-bottom:1.2rem}
.auth-brand img{width:6.5rem;height:6.5rem;object-fit:contain;border-radius:1rem;padding:.4rem;background:#fff;
    box-shadow:0 6px 18px rgba(0,0,0,.25)}
.auth-brand h1{color:#2dd4bf;font-weight:800;font-size:1.25rem;margin:.7rem 0 0}
.auth-brand p{color:#94a3b8;font-size:.85rem;margin:.2rem 0 0}

@media print{
  .sh-card{box-shadow:none}
}

/* compact row actions inside tables (never force a sideways scroll) */
.btn-xs{padding:.2rem .5rem!important;font-size:.72rem!important;line-height:1.1!important}
.row-actions{display:flex;flex-wrap:wrap;gap:.25rem;justify-content:flex-end}

/* ---- items & stock (shop) ---- */
.item-filters{display:grid;gap:.6rem .8rem;align-items:end;
    grid-template-columns:minmax(14rem,2.4fr) repeat(4,minmax(8rem,1fr)) auto}
@media (max-width:1100px){.item-filters{grid-template-columns:repeat(auto-fit,minmax(min(11rem,100%),1fr))}
  .item-filters .item-q{grid-column:1/-1}}
.item-filter-btns{display:flex;gap:.4rem;flex-wrap:wrap}
.item-table td{vertical-align:middle}
.stk-qty{font-weight:700;font-variant-numeric:tabular-nums}
.stk-qty.zero{color:#94a3b8;font-weight:500}
.stk-qty.minus{color:#be123c}
.stk-tag{display:inline-block;font-size:.62rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
    border-radius:9999px;padding:.05rem .45rem;margin-top:.15rem;border:1px solid transparent;white-space:nowrap}
.stk-tag.unv{background:#fffbeb;color:#b45309;border-color:#fde68a}
.stk-tag.ver{background:#ecfdf5;color:#047857;border-color:#a7f3d0}
.stk-tag.new{background:var(--surface-3);color:#475569;border-color:var(--line)}
html[data-theme="dark"] .stk-tag.unv{background:#3a2a06;color:#fcd34d;border-color:#92400e}
html[data-theme="dark"] .stk-tag.ver{background:#052e22;color:#6ee7b7;border-color:#065f46}
html[data-theme="dark"] .stk-tag.new{color:#cbd5e1}

/* ---- bill screen (shop) ---- */
.bill-wrap{display:flex;flex-direction:column;gap:1rem}
.bill-top{display:grid;gap:1rem;grid-template-columns:auto 1fr;align-items:start}
@media (max-width:760px){.bill-top{grid-template-columns:1fr}}
.bill-type{display:flex;flex-direction:column;gap:.35rem}
.bill-type label{display:flex;align-items:center;gap:.45rem;border:1px solid var(--line);border-radius:.6rem;
    padding:.45rem .8rem;cursor:pointer;font-weight:600;font-size:.88rem;white-space:nowrap}
.bill-type label:has(input:checked){border-color:var(--acc-600,#0d9488);background:var(--acc-50,#f0fdfa);color:var(--acc-800,#115e59)}
html[data-theme="dark"] .bill-type label:has(input:checked){background:rgba(45,212,191,.12);color:var(--acc-300,#5eead4)}
.bill-type label:has(input:disabled){opacity:.5;cursor:not-allowed}
.bill-chip{display:flex;justify-content:space-between;align-items:center;gap:.6rem;border:1px solid var(--line);
    border-left:4px solid var(--acc-600,#0d9488);border-radius:.6rem;padding:.55rem .8rem;background:var(--surface-2)}
.bill-row2{display:grid;gap:.6rem;grid-template-columns:repeat(auto-fit,minmax(min(12rem,100%),1fr));margin-top:.5rem}
.bill-search{font-size:1.05rem!important;padding:.65rem .8rem!important}
.bill-drop{position:absolute;left:0;right:0;top:100%;z-index:30;background:var(--surface);border:1px solid var(--line);
    border-radius:.6rem;box-shadow:0 12px 30px rgba(15,23,42,.18);max-height:22rem;overflow-y:auto;margin-top:.2rem}
.bill-opt{display:block;width:100%;text-align:left;border:0;background:transparent;padding:.5rem .75rem;font-size:.85rem;
    color:var(--ink);cursor:pointer;border-bottom:1px solid var(--line)}
.bill-opt:hover,.bill-opt.on{background:var(--acc-50,#f0fdfa)}
html[data-theme="dark"] .bill-opt:hover,html[data-theme="dark"] .bill-opt.on{background:rgba(45,212,191,.12)}
.bill-opt span{color:#64748b;font-size:.78rem}
.bill-opt .bill-opt-r{float:right;color:var(--ink);font-weight:600;margin-left:.6rem}
.bill-opt .bill-opt-r.low{color:#be123c}
.bill-lines td{vertical-align:middle}
.bill-in{width:100%;max-width:6.5rem;text-align:right;border:1px solid #cbd5e1;border-radius:.4rem;padding:.3rem .45rem;
    font-variant-numeric:tabular-nums;background:var(--surface);color:var(--ink)}
html[data-theme="dark"] .bill-in{border-color:#334155;background:#0b1220}
.bill-x{border:0;background:transparent;color:#94a3b8;cursor:pointer;font-size:.95rem}
.bill-x:hover{color:#be123c}
.bill-err{color:#be123c;font-size:.75rem;font-weight:600}
.bill-warn{color:#b45309;font-size:.75rem}
.bill-bottom{display:grid;gap:1rem;grid-template-columns:minmax(0,1.6fr) minmax(16rem,1fr)}
@media (max-width:860px){.bill-bottom{grid-template-columns:1fr}}
.bill-pay{display:grid;gap:.6rem;grid-template-columns:repeat(3,minmax(0,1fr))}
@media (max-width:520px){.bill-pay{grid-template-columns:1fr}}
.bill-totals>div{display:flex;justify-content:space-between;padding:.3rem 0;font-size:.9rem;font-variant-numeric:tabular-nums}
.bill-totals>div span{color:#64748b}
.bill-totals .grand{border-top:1px solid var(--line);margin-top:.3rem;padding-top:.6rem;font-size:1.5rem}
.bill-totals .grand b{color:var(--acc-700,#0f766e)}
/* bill-type marker tags (owner: GST-billed data can be filtered out) */
.doc-tag{display:inline-block;font-size:.66rem;font-weight:700;letter-spacing:.03em;text-transform:uppercase;
    border-radius:9999px;padding:.08rem .5rem;border:1px solid transparent;white-space:nowrap}
.doc-tag.retail{background:var(--surface-3);color:#475569;border-color:var(--line)}
.doc-tag.gst{background:#eef2ff;color:#3730a3;border-color:#c7d2fe}
.doc-tag.conv{background:#f5f3ff;color:#6d28d9;border-color:#ddd6fe}
.doc-tag.cancel{background:#fff1f2;color:#be123c;border-color:#fecdd3}
html[data-theme="dark"] .doc-tag.gst{background:#1e1b4b;color:#c7d2fe;border-color:#3730a3}
html[data-theme="dark"] .doc-tag.conv{background:#2e1065;color:#ddd6fe;border-color:#6d28d9}
html[data-theme="dark"] .doc-tag.cancel{background:#3b0d18;color:#fda4af;border-color:#9f1239}
html[data-theme="dark"] .doc-tag.retail{color:#cbd5e1}

/* the hidden attribute must win over component display rules */
[hidden]{display:none!important}
.doc-tag.wait{background:#fffbeb;color:#b45309;border-color:#fde68a}
html[data-theme="dark"] .doc-tag.wait{background:#3a2a06;color:#fcd34d;border-color:#92400e}
