/* =====================================================================
   Erp9i — Application  ·  Medicine / Pharma theme
   Solid colours only (no gradients), clean medical palette.
   ===================================================================== */
:root {
    /* Medical palette */
    --brand:        #0f766e;   /* primary teal  */
    --brand-dark:   #0b5b54;
    --brand-light:  #e6f4f1;
    --accent:       #0891b2;   /* cyan accent   */
    --ok:           #16a34a;   /* pharma green  */
    --ok-light:     #e8f6ec;
    --warn:         #d97706;
    --warn-light:   #fdf2e2;
    --danger:       #dc2626;
    --danger-light: #fdecec;
    --info:         #2563eb;
    --info-light:   #e8eefc;

    --bg:        #eef2f6;
    --surface:   #ffffff;
    --ink:       #1f2933;
    --muted:     #64748b;
    --line:      #e2e8f0;

    --header-h:  64px;
    --footer-h:  60px;
    --sidebar-w: 260px;

    --radius:    12px;
    --shadow:    0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
}

html, body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); }

/* ---------- Blazor framework bits (kept from template) ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--ok); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 0.8rem; }

#blazor-error-ui {
    color-scheme: light only;
    background: var(--warn-light);
    border-top: 3px solid var(--warn);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.8rem 1.4rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem 1rem 1rem 1rem;
    color: white;
    border-radius: 8px;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* =====================================================================
   Authentication pages (login / change password / forgot)
   ===================================================================== */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--brand);            /* solid, no gradient */
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem 2.25rem;
    box-shadow: 0 24px 60px rgba(2, 22, 20, 0.30);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.auth-brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.75rem; }

.auth-logo {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--brand);            /* solid */
    color: #fff;
    font-weight: 700; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: 0.5px; flex-shrink: 0;
}

.auth-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.auth-subtitle { font-size: 0.85rem; color: var(--muted); margin: 0.15rem 0 0; }

.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label { font-size: 0.8rem; font-weight: 600; color: #334155; }

.field-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--ink);
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field-input:focus {
    outline: none;
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.field-show {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.78rem; color: var(--muted);
    margin-top: 0.1rem; cursor: pointer; font-weight: 500;
}

.auth-btn {
    margin-top: 0.25rem;
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 10px;
    background: var(--brand);            /* solid */
    color: #fff;
    font-size: 0.95rem; font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}
.auth-btn:hover:not(:disabled) { background: var(--brand-dark); }
.auth-btn:active:not(:disabled) { transform: translateY(1px); }
.auth-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.auth-alert { padding: 0.65rem 0.85rem; border-radius: 10px; font-size: 0.85rem; }
.auth-alert-error   { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.auth-alert-success { background: var(--ok-light);     color: #15803d;       border: 1px solid #bbf7d0; }
.auth-alert-info    { background: var(--info-light);   color: var(--info);   border: 1px solid #bfdbfe; }

.auth-links { display: flex; justify-content: space-between; margin-top: 0.25rem; }
.auth-links a { font-size: 0.82rem; font-weight: 500; }
.auth-foot { margin: 1.75rem 0 0; text-align: center; font-size: 0.72rem; color: #94a3b8; }

/* =====================================================================
   ERP SHELL — fixed header, left sidebar, content, fixed footer
   ===================================================================== */
.erp-shell { min-height: 100vh; }

/* ---- Header (fixed, a little thicker) ---- */
.erp-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--brand);            /* solid teal */
    color: #fff;
    display: flex; align-items: center;
    padding: 0 1.25rem;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}
.erp-hamburger {
    display: none;
    width: 40px; height: 40px; border-radius: 10px; margin-right: 0.5rem;
    border: none; background: rgba(255,255,255,0.12); color: #fff;
    font-size: 1.25rem; cursor: pointer;
    align-items: center; justify-content: center;
    transition: background 0.15s;
}
.erp-hamburger:hover { background: rgba(255,255,255,0.22); }

.erp-brand { display: flex; align-items: center; gap: 0.7rem; min-width: calc(var(--sidebar-w) - 56px); }
.erp-brand-logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: #fff; color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem; letter-spacing: 0.5px;
}
.erp-brand-name { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.erp-brand-tag  { font-size: 0.68rem; opacity: 0.85; letter-spacing: 0.3px; }

.erp-header-spacer { flex: 1; }

.erp-header-actions { display: flex; align-items: center; gap: 0.4rem; }
.erp-iconbtn {
    width: 40px; height: 40px; border-radius: 10px;
    border: none; background: rgba(255,255,255,0.12); color: #fff;
    cursor: pointer; font-size: 1.05rem; position: relative;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.erp-iconbtn:hover { background: rgba(255,255,255,0.22); }
.erp-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--danger); color: #fff;
    border-radius: 9px; font-size: 0.68rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--brand);
}
.erp-user { display: flex; align-items: center; gap: 0.6rem; margin-left: 0.5rem; }
.erp-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: #fff; color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem;
}
.erp-user-meta { line-height: 1.15; }
.erp-user-name { font-size: 0.85rem; font-weight: 600; }
.erp-user-role { font-size: 0.68rem; opacity: 0.9; }
.erp-signout {
    border: 1px solid rgba(255,255,255,0.4); background: transparent; color: #fff;
    border-radius: 8px; padding: 0.35rem 0.7rem; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.erp-signout:hover { background: rgba(255,255,255,0.18); }

/* header profile (popover, right side) */
.erp-profile { position: relative; margin-left: 0.4rem; }
.erp-profile-trigger {
    display: flex; align-items: center; gap: 0.55rem;
    background: rgba(255,255,255,0.12); border: none; color: #fff;
    border-radius: 10px; padding: 0.28rem 0.6rem 0.28rem 0.32rem;
    cursor: pointer; transition: background 0.15s;
}
.erp-profile-trigger:hover { background: rgba(255,255,255,0.22); }
.erp-profile-meta { line-height: 1.15; text-align: left; }
.erp-profile-name { font-size: 0.85rem; font-weight: 600; }
.erp-profile-role { font-size: 0.68rem; opacity: 0.9; }
.erp-profile-caret { font-size: 0.75rem; opacity: 0.9; transition: transform 0.2s; }
.erp-profile.open .erp-profile-caret { transform: rotate(180deg); }

.erp-profile-popover {
    display: none;
    position: absolute;
    top: calc(100% + 10px); right: 0;
    width: 260px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    padding: 0.5rem;
    z-index: 400;
    animation: popIn 0.14s ease;
}
.erp-profile.open .erp-profile-popover { display: block; }
.erp-profile-popover .spp-name,
.erp-profile-popover .spp-role { color: var(--ink); }

/* ---- Sidebar (fixed, left) ---- */
.erp-sidebar {
    position: fixed; top: var(--header-h); bottom: var(--footer-h); left: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow: visible;            /* let the profile popover escape the sidebar */
    z-index: 150;
    display: flex; flex-direction: column;
    transition: transform 0.22s ease;
}

/* profile (popover) */
.side-profile { position: relative; border-bottom: 1px solid var(--line); }
.side-profile-trigger {
    width: 100%;
    cursor: pointer;
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.8rem 1rem;
    background: none; border: none; text-align: left;
    transition: background 0.12s;
}
.side-profile-trigger:hover { background: #f1f5f9; }

.spm-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem; flex-shrink: 0;
}
.spm-avatar.lg { width: 46px; height: 46px; font-size: 1.05rem; }
.spm-meta { flex: 1; min-width: 0; }
.spm-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spm-role { font-size: 0.72rem; color: var(--muted); }
.spm-caret { color: var(--muted); transition: transform 0.2s; font-size: 0.8rem; }
.side-profile.open .spm-caret { transform: rotate(180deg); }

/* the floating popover */
.side-profile-popover {
    display: none;
    position: absolute;
    top: calc(100% - 6px); left: 10px; right: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    padding: 0.5rem;
    z-index: 400;
    animation: popIn 0.14s ease;
}
.side-profile.open .side-profile-popover { display: block; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.spp-head { display: flex; gap: 0.7rem; align-items: center; padding: 0.55rem 0.65rem 0.4rem; }
.spp-name { font-weight: 700; font-size: 0.92rem; }
.spp-role { font-size: 0.74rem; color: var(--muted); margin-bottom: 0.35rem; }
.spp-divider { height: 1px; background: var(--line); margin: 0.35rem 0; }

.side-profile-popover a,
.side-profile-popover button,
.erp-profile-popover a,
.erp-profile-popover button {
    width: 100%;
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.55rem 0.7rem; margin: 0.05rem 0;
    border-radius: 8px;
    font-size: 0.85rem; font-weight: 500; color: #334155;
    text-decoration: none; text-align: left;
    background: none; border: none; cursor: pointer;
}
.side-profile-popover a:hover,
.side-profile-popover button:hover,
.erp-profile-popover a:hover,
.erp-profile-popover button:hover { background: #f1f5f9; text-decoration: none; }
.side-profile-popover form,
.erp-profile-popover form { margin: 0; }
.side-profile-popover i,
.erp-profile-popover i { width: 18px; text-align: center; color: #64748b; }
.side-profile-popover .signout,
.erp-profile-popover .signout { color: var(--danger); }
.side-profile-popover .signout:hover,
.erp-profile-popover .signout:hover { background: var(--danger-light); }
.side-profile-popover .signout i,
.erp-profile-popover .signout i { color: var(--danger); }

.side-chip {
    display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
    font-size: 0.64rem; font-weight: 700; letter-spacing: 0.3px;
}
.side-chip.admin { background: var(--ok-light); color: #15803d; }
.side-chip.party { background: var(--warn-light); color: var(--warn); }

/* nav */
.side-nav { padding: 0.5rem 0.6rem 1rem; flex: 1; overflow-y: auto; }
.side-group {
    font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: #94a3b8;
    padding: 0.85rem 0.6rem 0.3rem;
}
.side-nav a {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.58rem 0.75rem; margin: 0.1rem 0;
    border-radius: 9px; color: #334155; font-size: 0.875rem; font-weight: 500;
    text-decoration: none; transition: background 0.12s, color 0.12s;
    border-left: 3px solid transparent;
}
.side-nav a:hover { background: #f1f5f9; text-decoration: none; }
.side-nav a.active {
    background: var(--brand-light); color: var(--brand);
    font-weight: 600; border-left-color: var(--brand);
}
.side-nav a.active .side-ico { color: var(--brand); }
.side-ico { font-size: 1.05rem; width: 20px; text-align: center; color: #64748b; }

.side-foot {
    padding: 0.85rem 1.1rem; border-top: 1px solid var(--line);
    font-size: 0.72rem; color: var(--muted); display: flex; align-items: center; gap: 0.4rem;
}

/* ---- Data tables + pagination (list pages) ---- */
.toolbar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar .search {
    display: flex; align-items: center; gap: 0.5rem;
    background: #fff; border: 1px solid #cbd5e1; border-radius: 9px; padding: 0.45rem 0.75rem;
    flex: 1; max-width: 360px;
}
.toolbar .search input { border: none; outline: none; width: 100%; font-size: 0.88rem; background: transparent; }
.search-btn {
    border: none; background: var(--brand); color: #fff;
    border-radius: 7px; width: 34px; height: 30px; flex-shrink: 0;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.search-btn:hover { background: var(--brand-dark); }
.search-btn i { color: #fff; }

.data-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
}
/* On narrow screens keep tables readable and horizontally scrollable so the
   last column (action icons) is never clipped. */
@media (max-width: 900px) {
    .data-table { min-width: 720px; }
    .orders-table { min-width: 1040px; }
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table thead th {
    text-align: left; padding: 0.8rem 1rem;
    background: #f8fafc; color: #475569; font-weight: 600;
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .muted { color: var(--muted); }

.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.pill.ok { background: var(--ok-light); color: #15803d; }
.pill.warn { background: var(--warn-light); color: var(--warn); }
.pill.info { background: var(--info-light); color: var(--info); }

.pager {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.8rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 0.6rem;
}
.pager-info { font-size: 0.8rem; color: var(--muted); }
.pager-btns { display: flex; align-items: center; gap: 0.3rem; }
.pager-btns a, .pager-btns span {
    min-width: 34px; height: 34px; padding: 0 0.6rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 0.82rem; color: #334155; text-decoration: none; background: #fff;
}
.pager-btns a:hover { background: #f1f5f9; text-decoration: none; }
.pager-btns a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager-btns .disabled { opacity: 0.4; pointer-events: none; }
.empty-row td { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ---- Main content ---- */
.erp-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    margin-bottom: var(--footer-h);
    padding: 1.5rem 1.75rem 2.5rem;
    min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

/* Party / no-sidebar mode: content uses the full width. */
.erp-shell.no-sidebar .erp-main { margin-left: 0; }

/* Party top navigation (in the header, replaces the sidebar) */
.erp-topnav { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap;
    position: absolute; left: 50%; transform: translateX(-50%); }
.erp-topnav a {
    color: #fff; opacity: 0.92; text-decoration: none;
    padding: 0.4rem 0.75rem; border-radius: 8px;
    font-size: 0.85rem; font-weight: 500; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 0.4rem;
}
.erp-topnav a:hover { background: rgba(255,255,255,0.16); text-decoration: none; }
.erp-topnav a.active { background: rgba(255,255,255,0.24); opacity: 1; font-weight: 600; }

/* ---- Footer (fixed) ---- */
.erp-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    min-height: var(--footer-h);
    background: #0f172a; color: #cbd5e1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 1.25rem;
    font-size: 0.78rem;
    z-index: 200;
}
.erp-footer-company { line-height: 1.35; }
.erp-footer-company .fc-name { color: #fff; font-weight: 700; }
.erp-footer-company .fc-meta { color: #94a3b8; font-size: 0.72rem; }

/* live clock — blinking, simple solid colour */
.erp-clock { text-align: right; line-height: 1.2; }
.erp-clock .clk-time { font-size: 0.82rem; font-weight: 600; color: #4ade80;
    letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.clk-blink { animation: clkblink 1s steps(1) infinite; }
@keyframes clkblink { 50% { opacity: 0; } }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-head p { color: var(--muted); margin: 0.25rem 0 0; font-size: 0.9rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem 1.25rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(14px);
    animation: cardIn 0.5s ease forwards;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.25s; }
.stat-card:nth-child(4) { animation-delay: 0.35s; }
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }

.stat-card .stat-ico {
    width: 44px; height: 44px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; margin-bottom: 0.85rem;
}
.stat-ico.teal  { background: var(--brand-light); color: var(--brand); }
.stat-ico.green { background: var(--ok-light);    color: var(--ok); }
.stat-ico.blue  { background: var(--info-light);  color: var(--info); }
.stat-ico.amber { background: var(--warn-light);  color: var(--warn); }

.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; }
.stat-card .stat-bar { height: 4px; border-radius: 4px; background: #eef2f6; margin-top: 0.9rem; overflow: hidden; }
.stat-card .stat-bar > span { display: block; height: 100%; border-radius: 4px; width: 0; transition: width 1.1s ease; }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    opacity: 0;
    transform: translateY(14px);
    animation: cardIn 0.5s ease forwards;
    animation-delay: 0.4s;
}
.panel h3 { font-size: 1.05rem; margin: 0 0 0.85rem; }

.panel-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.1rem; }

.act-row {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.7rem 0; border-bottom: 1px solid var(--line);
}
.act-row:last-child { border-bottom: none; }
.act-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.act-text { font-size: 0.85rem; }
.act-text small { color: var(--muted); }
.act-time { margin-left: auto; font-size: 0.74rem; color: var(--muted); white-space: nowrap; }

/* generic buttons / cards used by master pages */
.btn-solid {
    background: var(--brand); color: #fff; border: none;
    border-radius: 9px; padding: 0.6rem 1.1rem; font-weight: 600; font-size: 0.88rem;
    cursor: pointer; transition: background 0.15s;
}
.btn-solid:hover { background: var(--brand-dark); }
.btn-ghost {
    background: #fff; color: var(--brand); border: 1px solid var(--brand);
    border-radius: 9px; padding: 0.6rem 1.1rem; font-weight: 600; font-size: 0.88rem; cursor: pointer;
}

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.5rem;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

.field .req { color: var(--danger); }

/* optional login fields — revealed by the "Create a login" checkbox */
.login-fields { display: none; }
.fs-body:has(.login-toggle:checked) .login-fields { display: grid; }

/* Sales / Purchase tabs on Create Order */
.order-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.order-tab {
    padding: 0.55rem 1.2rem; border-radius: 10px 10px 0 0;
    background: #eef2f6; color: #475569; text-decoration: none;
    font-weight: 600; font-size: 0.9rem; border: 1px solid var(--line); border-bottom: none;
    display: inline-flex; align-items: center; gap: 0.5rem;
}
.order-tab:hover { background: #fff; text-decoration: none; }
.order-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* grouped form sections (sub-cards with a tinted header) */
.form-section {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 1.1rem;
    overflow: hidden;
    background: #fff;
}
.form-section .fs-head {
    background: var(--brand-light);
    color: var(--brand);
    padding: 0.6rem 0.95rem;
    font-size: 0.82rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
    border-bottom: 1px solid #d7ece8;
}
.form-section .fs-head i { font-size: 0.95rem; }
.form-section .fs-body { padding: 1rem 0.95rem; }

/* denser inputs so more fields show at a glance */
.party-form .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.7rem 1rem;
}
.party-form .field-label { font-size: 0.74rem; margin-bottom: 0.1rem; }
.party-form .field-input { padding: 0.5rem 0.7rem; font-size: 0.85rem; border-radius: 8px; }

.form-actions {
    position: sticky; bottom: 0;
    display: flex; gap: 0.6rem;
    padding-top: 1rem; margin-top: 0.5rem;
}

/* radio button group */
.radio-row { display: flex; gap: 0.6rem; align-items: center; padding-top: 0.2rem; flex-wrap: wrap; }
.radio-opt {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-size: 0.88rem; color: #334155; cursor: pointer;
    border: 1px solid #cbd5e1; border-radius: 8px;
    padding: 0.45rem 0.85rem; background: #f8fafc;
    transition: border-color 0.15s, background 0.15s;
}
.radio-opt:hover { border-color: var(--brand); }
.radio-opt input[type=radio] { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; margin: 0; }
.radio-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-light); color: var(--brand); font-weight: 600; }

/* checkbox grid (item options/flags) */
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; }
.check-opt {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.86rem; color: #334155; cursor: pointer;
    border: 1px solid #cbd5e1; border-radius: 8px;
    padding: 0.5rem 0.8rem; background: #f8fafc;
    transition: border-color 0.15s, background 0.15s;
}
.check-opt:hover { border-color: var(--brand); }
.check-opt input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; margin: 0; }
.check-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-light); color: var(--brand); font-weight: 600; }

.edit-banner {
    display: flex; align-items: center; gap: 0.6rem;
    background: var(--brand-light); border: 1px solid #d7ece8;
    border-radius: 10px; padding: 0.6rem 0.9rem; margin-bottom: 1.1rem;
    font-size: 0.88rem; color: #334155;
}

/* row action buttons in list tables */
.row-actions { display: flex; gap: 0.35rem; justify-content: center; }
.row-action {
    width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: #fff; color: var(--brand);
    cursor: pointer; text-decoration: none;
}
.row-action:hover { background: var(--brand-light); text-decoration: none; }
.row-action.edit { color: var(--warn); }
.row-action.edit:hover { background: var(--warn-light); }

/* party / record detail view */
.detail-head {
    display: flex; align-items: center; gap: 1rem;
    padding-bottom: 1.1rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line);
}
.detail-avatar {
    width: 60px; height: 60px; border-radius: 14px;
    background: var(--brand-light); color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.3rem; flex-shrink: 0;
}
.detail-title { font-size: 1.25rem; font-weight: 700; }
.detail-sub { color: var(--muted); font-size: 0.85rem; margin-top: 0.1rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.code-chip {
    background: var(--brand); color: #fff; font-weight: 700;
    font-size: 0.72rem; padding: 0.15rem 0.6rem; border-radius: 6px; letter-spacing: 0.5px;
}

.detail-section { margin-top: 1.4rem; }
.detail-section h4 {
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--muted); margin: 0 0 0.7rem;
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem 1.5rem; }
.detail-item { display: flex; flex-direction: column; gap: 0.15rem; }
.detail-item .dl { font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.detail-item .dv { font-size: 0.9rem; color: var(--ink); }

/* delivery status track timeline */
.track-timeline { border-left: 2px solid var(--line); padding-left: 0; margin-left: 6px; }
.track-item { display: flex; gap: 0.7rem; padding: 0.35rem 0 0.35rem 0.9rem; position: relative; }
.track-dot { position: absolute; left: -7px; top: 0.6rem; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.track-stage { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.track-remarks { font-size: 0.82rem; color: #334155; }
.track-time { font-size: 0.72rem; color: var(--muted); }

/* payment summary boxes */
.pay-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }
.pay-box { border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem; background: #fff; }
.pay-box .pay-val { font-size: 1.35rem; font-weight: 800; color: var(--ink); margin-top: 0.2rem; }
.pay-box.ok { background: var(--ok-light); border-color: #bbf7d0; }
.pay-box.ok .pay-val { color: #15803d; }
.pay-box.due { background: var(--danger-light); border-color: #fecaca; }
.pay-box.due .pay-val { color: var(--danger); }

/* ===================== Dialogs / modals ===================== */
.erp-modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(2, 6, 23, 0.55);
    z-index: 500;
    padding: 2rem 1rem;
    overflow-y: auto;
}
.erp-modal.open { display: flex; align-items: flex-start; justify-content: center; }
.erp-modal-dialog {
    background: #fff; border-radius: 14px;
    width: 100%; max-width: 720px; margin: auto;
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
    animation: popIn 0.16s ease;
    overflow: hidden;
}
.erp-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.2rem; color: #fff;
}
.erp-modal-head.teal { background: var(--brand); }
.erp-modal-head.green { background: var(--ok); }
.erp-modal-head.blue { background: var(--info); }
.erp-modal-head.slate { background: #475569; }
.erp-modal-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.erp-modal-x { background: rgba(255,255,255,0.18); border: none; color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.erp-modal-x:hover { background: rgba(255,255,255,0.32); }
.erp-modal-body { padding: 1.2rem; }
.erp-modal-foot { padding: 0.9rem 1.2rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 0.6rem; background: #f8fafc; }

/* ===================== A4 print document ===================== */
.print-toolbar {
    display: flex; gap: 0.6rem; justify-content: center;
    padding: 1rem; background: var(--bg); position: sticky; top: 0; z-index: 10;
}
.print-sheet {
    width: 210mm; min-height: 297mm; margin: 1rem auto 2rem;
    background: #fff; color: #1f2933; padding: 14mm 14mm 12mm;
    box-shadow: 0 6px 28px rgba(15, 23, 42, 0.18);
    font-size: 12px;
}

.doc-head { display: flex; justify-content: space-between; gap: 1.5rem; border-bottom: 2px solid var(--brand); padding-bottom: 10px; }
.doc-company { font-size: 18px; font-weight: 800; color: var(--brand); }
.doc-company-meta { font-size: 11px; color: #475569; margin-top: 2px; }
.doc-title-box { text-align: right; min-width: 230px; }
.doc-title { font-size: 16px; font-weight: 800; letter-spacing: 1px; color: #0f172a; margin-bottom: 4px; }
.doc-meta { margin-left: auto; font-size: 11px; border-collapse: collapse; }
.doc-meta td { padding: 1px 0; }
.doc-meta td:first-child { color: #64748b; padding-right: 12px; text-align: right; }

.doc-parties { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.doc-party { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.doc-party-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; font-weight: 700; }
.doc-party-name { font-size: 12px; font-weight: 700; color: #0f172a; margin-top: 2px; }

.doc-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 11px; }
.doc-table thead th {
    background: var(--brand); color: #fff; text-align: left; padding: 6px 7px; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.doc-table tbody td { padding: 5px 7px; border-bottom: 1px solid #eef2f6; }
.doc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-table th.num { text-align: right; }

.doc-bottom { display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 12px; }
.doc-remarks { font-size: 11px; max-width: 60%; }
.doc-totals { border-collapse: collapse; min-width: 240px; font-size: 12px; }
.doc-totals td { padding: 4px 8px; }
.doc-totals td:first-child { color: #64748b; }
.doc-totals td.num { text-align: right; font-weight: 600; }
.doc-totals tr.grand td { border-top: 2px solid var(--brand); font-size: 14px; font-weight: 800; color: var(--brand); padding-top: 6px; }
.doc-totals tr.due td { color: var(--danger); font-weight: 700; }

.doc-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 40px; font-size: 11px; color: #64748b; }
.doc-sign { text-align: right; }

@media print {
    @page { size: A4; margin: 10mm; }
    html, body { background: #fff !important; }
    .print-toolbar { display: none !important; }
    .print-sheet { width: auto; min-height: auto; margin: 0; padding: 0; box-shadow: none; }
    #blazor-error-ui { display: none !important; }
}

.notice {
    display: flex; gap: 0.8rem; align-items: flex-start;
    background: var(--info-light); border: 1px solid #bfdbfe; color: #1e40af;
    border-radius: var(--radius); padding: 1rem 1.15rem; font-size: 0.88rem;
}

/* off-canvas backdrop */
.erp-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(2, 6, 23, 0.45);
    z-index: 140;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .erp-hamburger { display: inline-flex; }
    .erp-brand { min-width: auto; }
    .erp-brand-tag { display: none; }

    .erp-sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 28px rgba(0, 0, 0, 0.18);
    }
    body.sidebar-open .erp-sidebar { transform: translateX(0); }
    body.sidebar-open .erp-backdrop { display: block; }

    .erp-main { margin-left: 0; }
    .panel-grid { grid-template-columns: 1fr; }
    .erp-profile-meta { display: none; }
}

/* ============================================================
   Order Cart builder (Create Order) — medicine theme
   ============================================================ */
.oc-loading {
    display: flex; align-items: center; gap: 0.6rem;
    color: var(--muted); font-size: 0.9rem; padding: 2rem 0;
}
.oc-spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--brand-light); border-top-color: var(--brand);
    display: inline-block; animation: oc-spin 0.7s linear infinite;
}
.oc-spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes oc-spin { to { transform: rotate(360deg); } }

/* Search bar */
.oc-searchbar {
    display: flex; align-items: center; gap: 0.6rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 0.6rem 0.95rem; margin-bottom: 1rem;
}
.oc-searchbar > .bi { color: var(--brand); font-size: 1rem; }
.oc-search {
    flex: 1; border: none; outline: none; background: transparent;
    font-size: 0.92rem; color: var(--ink);
}
.oc-search-count { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.oc-toggle { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap;
    border: 1px solid var(--line); background: #fff; color: #475569; border-radius: 8px;
    padding: 0.4rem 0.7rem; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.12s; }
.oc-toggle:hover:not(:disabled) { background: #f1f5f9; }
.oc-toggle.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.oc-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* Two-column layout */
.oc-grid {
    display: grid; grid-template-columns: 1fr 360px; gap: 1.1rem; align-items: start;
}

/* Catalog card */
.oc-catalog { padding: 0; overflow: hidden; }
.oc-catalog-head {
    background: var(--brand-light); color: var(--brand);
    padding: 0.65rem 1rem; font-size: 0.82rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid #d7ece8;
}
.oc-catalog-head .oc-hint { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 0.72rem; }
.oc-table-wrap { max-height: 560px; overflow-y: auto; }
.oc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.oc-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: #f8fafc; color: var(--muted);
    text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
    padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); font-weight: 700;
}
.oc-table thead th.num { text-align: right; }

/* ============================ Party dashboard ============================ */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.dash-head h1 { font-size: 1.5rem; font-weight: 800; margin: 0; color: #0f172a; }
.dash-head p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }

.dash-filter { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.85rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04); }
.dash-field { display: flex; flex-direction: column; gap: 0.25rem; }
.dash-field label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--muted); }
.dash-field input { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.55rem;
    font-size: 0.85rem; font-family: inherit; color: #0f172a; }
.dash-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }

/* KPI tiles */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.1rem; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.05); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.kpi-ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.05rem; }
.kpi-tag { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); background: #f1f5f9; padding: 0.18rem 0.5rem; border-radius: 999px; }
.kpi-value { font-size: 1.7rem; font-weight: 800; color: #0f172a; line-height: 1.1; }
.kpi-label { font-size: 0.82rem; color: #475569; font-weight: 600; margin-top: 0.15rem; }
.kpi-sub { font-size: 0.74rem; color: var(--muted); margin-top: 0.3rem; }

/* chart grid */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.dash-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.05); min-width: 0; }
.dash-span2 { grid-column: span 2; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.dash-card-head h3 { font-size: 0.98rem; font-weight: 700; margin: 0; color: #0f172a; }
.dash-link { font-size: 0.8rem; color: var(--brand); text-decoration: none; font-weight: 600; }
.dash-link:hover { text-decoration: underline; }
.dash-muted { font-size: 0.76rem; color: var(--muted); }
.dash-empty { padding: 3rem 0; text-align: center; color: var(--muted); font-size: 0.85rem; }
.chart-box { width: 100%; min-height: 280px; }

.dash-legend { display: flex; gap: 0.9rem; font-size: 0.78rem; color: #475569; }
.dash-legend .dot, .donut-legend .dot { display: inline-block; width: 9px; height: 9px;
    border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; }

.dash-svg { width: 100%; height: 220px; display: block; }
.dash-axis { display: flex; justify-content: space-between; margin-top: 0.4rem;
    font-size: 0.68rem; color: var(--muted); }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.donut-svg { width: 160px; height: 160px; flex-shrink: 0; }
.donut-num { font-size: 1.5rem; font-weight: 800; fill: #0f172a; }
.donut-cap { font-size: 0.6rem; fill: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; }
.donut-legend li { display: flex; align-items: center; font-size: 0.82rem; padding: 0.28rem 0; }
.donut-legend .dl-label { color: #334155; flex: 1; }
.donut-legend .dl-val { color: var(--muted); font-weight: 600; }

/* top-item bars */
.bar-list { display: flex; flex-direction: column; gap: 0.85rem; }
.bar-row { display: flex; flex-direction: column; gap: 0.3rem; }
.bar-meta { display: flex; justify-content: space-between; font-size: 0.8rem; gap: 0.5rem; }
.bar-name { color: #334155; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-qty { color: var(--muted); font-weight: 700; flex-shrink: 0; }
.bar-track { height: 9px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #14b8a6); }

/* recent orders table */
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dash-table thead th { text-align: left; font-size: 0.68rem; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--muted); font-weight: 700;
    padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
.dash-table thead th.num, .dash-table td.num { text-align: right; }
.dash-table tbody td { padding: 0.55rem 0.6rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.dash-table tbody tr:last-child td { border-bottom: none; }

@media (max-width: 1100px) {
    .dash-kpis { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
    .dash-span2 { grid-column: span 1; }
}
@media (max-width: 560px) {
    .dash-kpis { grid-template-columns: 1fr; }
}

/* clickable order code → opens the order's item details */
.order-code-link { color: var(--brand); text-decoration: none; }
.order-code-link:hover { text-decoration: underline; }

/* ---- Uploaded invoice list (50x50 thumbnail → opens full size) ---- */
.inv-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.inv-list li { display: flex; align-items: center; gap: 0.7rem; padding: 0.4rem; border: 1px solid var(--line);
    border-radius: 10px; background: #fff; }
.inv-list li:hover { background: #f8fafc; }
.inv-thumb { width: 50px; height: 50px; flex-shrink: 0; border-radius: 8px; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; background: #f1f5f9;
    border: 1px solid var(--line); text-decoration: none; }
.inv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-thumb i { font-size: 1.4rem; color: #dc2626; }
.inv-thumb:hover { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15,118,110,0.15); }
.inv-meta { min-width: 0; flex: 1; }
.inv-name { display: block; font-size: 0.82rem; font-weight: 600; color: var(--brand);
    text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-name:hover { text-decoration: underline; }
.inv-date { font-size: 0.72rem; color: var(--muted); margin-top: 0.1rem; }

/* ---- Party mapping: parent groups with children beneath ---- */
.map-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1rem; }
.map-group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow-sm); overflow: hidden; }
.map-parent { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem;
    background: #ecfdf5; border-bottom: 1px solid var(--line); }
.map-parent-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem; flex-shrink: 0; }
.map-parent-name { font-weight: 700; color: #0f172a; font-size: 0.95rem; flex: 1; }
.map-count { font-size: 0.7rem; font-weight: 700; color: var(--brand); background: #fff;
    border: 1px solid #99f6e4; border-radius: 999px; padding: 0.15rem 0.55rem; white-space: nowrap; }
.map-children { list-style: none; margin: 0; padding: 0.35rem 0.5rem; }
.map-children li { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.6rem;
    border-radius: 8px; font-size: 0.86rem; }
.map-children li:hover { background: #f8fafc; }
.map-branch { color: #94a3b8; font-size: 0.85rem; flex-shrink: 0; }
.map-child-name { color: #334155; font-weight: 600; flex: 1; }
.map-date { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }

/* ---- Orders table polish (scoped, doesn't affect other lists) ---- */
.orders-table tbody tr { transition: background 0.12s ease; }
.orders-table tbody tr:nth-child(even) { background: #fcfdfe; }
.orders-table tbody tr:hover { background: #f0fdfa; }
.orders-table tbody td { padding-top: 0.85rem; padding-bottom: 0.85rem; vertical-align: middle; }

/* order code as a tidy monospace link */
.orders-table .order-code-link strong { font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, monospace;
    font-size: 0.8rem; letter-spacing: 0.2px; }

/* customer name + "To:" sub-line */
.orders-table td .muted { margin-top: 0.15rem; }

/* emphasise money columns; TOTAL strongest */
.orders-table td.num { font-variant-numeric: tabular-nums; }
.orders-table td.num strong { color: #0f172a; font-weight: 700; }

/* status as a badge with a leading dot in the status colour */
.orders-table .pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.7rem; }
.orders-table .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* order list filter bar (search + date range + customer/supplier) */
.order-filter { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: wrap; }
.order-filter .of-search { border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.6rem;
    font-size: 0.85rem; font-family: inherit; min-width: 200px; align-self: flex-end; }
.order-filter .of-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }
.of-field { display: flex; flex-direction: column; gap: 0.25rem; }
.of-field label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.of-field input, .of-field select { border: 1px solid var(--line); border-radius: 8px; padding: 0.42rem 0.55rem;
    font-size: 0.85rem; font-family: inherit; color: #0f172a; background: #fff; min-width: 140px; }
.of-field input:focus, .of-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }

/* Orders toolbar: export buttons pushed to the far right, wrapping below on narrow screens */
.order-export { display: flex; align-items: flex-end; gap: 0.5rem; margin-left: auto; }
.order-export .btn-excel, .order-export .btn-pdf { text-decoration: none; }

/* ---- Target vs Achievement mini bar chart (dashboard) ---- */
.tgt-chart { display: flex; flex-direction: column; gap: 0.7rem; padding: 0.2rem 0; }
.tgt-row { display: grid; grid-template-columns: 68px 1fr 54px; align-items: center; gap: 0.6rem; }
.tgt-month { font-size: 0.74rem; font-weight: 700; color: var(--muted); }
.tgt-track { display: flex; flex-direction: column; gap: 4px; }
.tgt-bar { height: 9px; border-radius: 5px; min-width: 2px; transition: width 0.4s ease; }
.tgt-bar.tgt-t { background: #99f6e4; }
.tgt-bar.tgt-a { background: #0f766e; }
.tgt-pct { text-align: right; }
.tgt-legend { display: flex; gap: 1rem; font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.tgt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 3px; }
.tgt-dot.tgt-t { background: #99f6e4; }
.tgt-dot.tgt-a { background: #0f766e; }
@media (max-width: 720px) { .panel .tgt-chart + div { grid-column: 1; } }

/* ===================== Order row action buttons ===================== */
.row-actions { display: flex; gap: 0.3rem; flex-wrap: nowrap; align-items: center; justify-content: flex-end; white-space: nowrap; }
.ra-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; border: 1px solid var(--line);
    background: #fff; color: #475569; border-radius: 7px; padding: 0.26rem 0.5rem; font-size: 0.73rem;
    font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background 0.12s; }
.ra-btn:hover { background: #f1f5f9; text-decoration: none; }
.ra-btn.primary { color: var(--brand); border-color: #99f6e4; }
.ra-btn.info    { color: #1d4ed8; border-color: #bfdbfe; }
.ra-btn.ok      { color: #15803d; border-color: #bbf7d0; }
.ra-btn.success { background: var(--ok); color: #fff; border-color: var(--ok); }
.ra-btn.success:hover { filter: brightness(0.96); background: var(--ok); }
.ra-btn.icon-info { color: #0ea5e9; border-color: #bae6fd; }
.ra-btn i { font-size: 0.92em; }

/* Large (header) variant — uniform size, matches .btn-ghost height */
.row-actions-lg { gap: 0.5rem; flex-wrap: wrap; }
.ra-btn.ra-lg { padding: 0.6rem 0.95rem; font-size: 0.86rem; border-radius: 9px; gap: 0.4rem; }
.ra-btn.ra-lg i { font-size: 1em; }

/* order status timeline (StatusInfoDialog) */
.status-timeline { list-style: none; margin: 0; padding: 0.2rem 0 0.4rem; }
.status-timeline li { display: flex; gap: 0.8rem; padding: 0 0 1rem; position: relative; }
.status-timeline li:not(:last-child)::before { content: ""; position: absolute; left: 8px; top: 18px;
    bottom: 0; width: 2px; background: #e2e8f0; }
.status-timeline li.done:not(:last-child)::before { background: var(--ok); }
.st-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; z-index: 1; margin-top: 1px;
    display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.7rem; font-weight: 700; }
.status-timeline li.done .st-dot    { background: var(--ok); }
.status-timeline li.next .st-dot    { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.status-timeline li.pending .st-dot { background: #cbd5e1; }
.st-stage { font-weight: 700; color: #0f172a; font-size: 0.86rem; }
.status-timeline li.pending .st-stage { color: #94a3b8; font-weight: 600; }
.st-remarks { color: #475569; font-size: 0.8rem; margin-top: 0.1rem; }
.st-time { color: var(--muted); font-size: 0.72rem; margin-top: 0.15rem; }

/* status info summary cards */
.status-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 0.6rem;
    border-top: 1px solid var(--line); padding-top: 0.8rem; }
.ss-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; }
.ss-card h5 { margin: 0 0 0.45rem; font-size: 0.82rem; font-weight: 700; color: var(--brand); }
.ss-row { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 0.78rem; padding: 0.15rem 0; }
.ss-row span:first-child { color: var(--muted); }
.ss-row span:last-child { color: #0f172a; font-weight: 600; text-align: right; }
@media (max-width: 560px) { .status-summary { grid-template-columns: 1fr; } }

/* ============================ Stock pages ============================ */
.stock-toolbar { display: flex; align-items: flex-end; gap: 0.7rem; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04); margin-bottom: 1rem; }
.stock-toolbar select { border: 1px solid var(--line); border-radius: 8px; padding: 0.42rem 0.55rem;
    font-size: 0.85rem; font-family: inherit; color: #0f172a; background: #fff; min-width: 120px; }
.stock-toolbar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }

.stock-table-wrap { overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; }

/* ---- Stock Detail: export bar + total ---- */
.stock-export { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
    flex-wrap: wrap; margin-bottom: 0.9rem; }
.stock-total { font-size: 0.95rem; color: #334155; }
.stock-total strong { color: var(--brand); font-size: 1.05rem; }
.stock-export-form { display: flex; align-items: flex-end; gap: 0.6rem;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.85rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04); }
.stock-export-form .dash-field label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--muted); }
.stock-export-form select { border: 1px solid var(--line); border-radius: 8px; padding: 0.42rem 0.6rem;
    font-size: 0.85rem; font-family: inherit; color: #0f172a; background: #fff; min-width: 130px; cursor: pointer; }
.stock-export-form select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }
.btn-excel { display: inline-flex; align-items: center; gap: 0.4rem; border: none; cursor: pointer;
    background: #15803d; color: #fff; border-radius: 8px; padding: 0.5rem 1rem; font-weight: 600; font-size: 0.86rem; }
.btn-excel:hover { background: #166534; }
.btn-pdf { display: inline-flex; align-items: center; gap: 0.4rem; border: none; cursor: pointer;
    background: #dc2626; color: #fff; border-radius: 8px; padding: 0.5rem 1rem; font-weight: 600; font-size: 0.86rem; }
.btn-pdf:hover { background: #b91c1c; }

/* ---- Stock Detail: freeze header (top), info columns (left) and total row (bottom) ---- */
.stock-pivot .info-1, .stock-pivot .info-head { min-width: 210px; max-width: 210px; }
.stock-pivot .info-2 { min-width: 120px; max-width: 120px; }
.stock-pivot .info-3 { min-width: 90px;  max-width: 90px; }

.stock-pivot thead th { position: sticky; z-index: 2; }
.stock-pivot thead tr:first-child th { top: 0; }
.stock-pivot thead tr:nth-child(2) th { top: 34px; }

.stock-pivot td.item-info { position: sticky; background: #fff; z-index: 3; }
.stock-pivot tbody tr:hover td.item-info { background: #f8fafc; }
.stock-pivot .info-1 { left: 0; }
.stock-pivot .info-2 { left: 210px; }
.stock-pivot .info-3 { left: 330px; }        /* 210 + 120 */
.stock-pivot .info-head { left: 0; }
.stock-pivot thead th.info-1, .stock-pivot thead th.info-2, .stock-pivot thead th.info-3,
.stock-pivot thead th.info-head { z-index: 4; }   /* header corner sits above both */

.stock-pivot tfoot td { position: sticky; bottom: 0; z-index: 2; background: #ecfdf5;
    border-top: 2px solid #99f6e4; }
.stock-pivot tfoot td.foot-label { left: 0; z-index: 4; text-align: right; font-weight: 700; color: #0f172a; }
.stock-pivot tfoot td.foot-val { font-weight: 600; color: #475569; white-space: nowrap; font-size: 0.78rem; }
.stock-pivot tfoot td.foot-grand { font-weight: 800; color: #0f766e; }
.stock-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.stock-table thead th { position: sticky; top: 0; z-index: 1;
    background: #f1f5f9; color: var(--muted); text-align: left; font-weight: 700;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.02em;
    padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stock-table thead th.num, .stock-table tbody td.num { text-align: right; }
.stock-table tbody td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.stock-table tbody tr:hover { background: #f8fafc; }
.stock-sub { color: var(--muted); font-size: 0.68rem; margin-top: 0.1rem; }
.stock-empty { text-align: center; color: var(--muted); padding: 1.6rem 0 !important; }

.stock-input { width: 100%; min-width: 70px; border: 1px solid var(--line); border-radius: 6px;
    padding: 0.25rem 0.4rem; font-size: 0.82rem; text-align: right; font-family: inherit; }
.stock-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15,118,110,0.12); }
.stock-input:disabled { background: #f8fafc; color: #94a3b8; }

/* derived, non-editable discount amount */
.stock-table td.disc-val { color: var(--muted); white-space: nowrap; }
/* secondary discount line — summary bands and dashboard cards */
.disc-note { color: var(--muted); font-size: 0.76rem; font-weight: 400; }

.stock-actions { display: flex; justify-content: flex-end; margin: 1rem 0; }

/* monthly pivot — wide, scrollable, one value per line */
.stock-pivot .month-header { text-align: center; background: #e2e8f0; color: #0f172a;
    border-left: 2px solid #cbd5e1; font-size: 0.78rem; letter-spacing: 0.04em; padding: 0.55rem 0.5rem; }
.stock-pivot .sub-header { text-align: center; font-size: 0.66rem; background: #f8fafc;
    min-width: 80px; padding: 0.45rem 0.55rem; white-space: nowrap; }
.stock-pivot td.item-info { white-space: nowrap; font-weight: 600; color: #0f172a; }
.stock-pivot td.num { text-align: center; min-width: 80px; white-space: nowrap;
    padding: 0.5rem 0.6rem; line-height: 1.3; }
.stock-pivot td.num .stock-sub { white-space: nowrap; }
.stock-pivot td.non-zero { background: rgba(15,118,110,0.07); font-weight: 700; color: #0f766e; }
.oc-table thead th.qtycol { text-align: center; width: 150px; }
.oc-table tbody td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.oc-table tbody td.num { text-align: right; }
.oc-table tbody tr:hover { background: #f8fafc; }
.oc-table tbody tr.in-cart { background: var(--brand-light); }
.oc-table tbody tr.in-cart:hover { background: #ddf0ec; }
.oc-empty { text-align: center; color: var(--muted); padding: 1.5rem 0 !important; }
.oc-pname { font-weight: 600; color: var(--ink); }
.oc-psub { font-size: 0.72rem; color: var(--muted); }
.oc-pack { color: var(--muted); font-size: 0.8rem; }
.oc-rate { font-weight: 600; color: var(--ink); }
.oc-total { font-weight: 700; color: var(--brand-dark); }
.oc-line-disc { color: var(--danger); font-size: 0.68rem; margin-top: 2px; }

.oc-input {
    width: 70px; text-align: right; padding: 0.3rem 0.45rem;
    border: 1px solid var(--line); border-radius: 7px; font-size: 0.82rem; color: var(--ink);
}
.oc-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); }

/* Quantity stepper */
.oc-stepper {
    display: inline-flex; align-items: center; border: 1px solid var(--line);
    border-radius: 8px; overflow: hidden; background: #fff;
}
.oc-stepper button {
    border: none; background: #f1f5f9; color: var(--brand);
    width: 30px; height: 32px; cursor: pointer; font-size: 0.9rem;
    display: inline-flex; align-items: center; justify-content: center; transition: background 0.12s;
}
.oc-stepper button:hover { background: var(--brand); color: #fff; }
.oc-stepper input {
    width: 52px; text-align: center; border: none; outline: none;
    font-size: 0.85rem; color: var(--ink); -moz-appearance: textfield;
}
.oc-stepper input::-webkit-outer-spin-button,
.oc-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Summary card */
.oc-summary { padding: 0; position: sticky; top: calc(var(--header-h) + 12px); overflow: hidden; }
.oc-summary-head {
    background: var(--brand); color: #fff;
    padding: 0.7rem 1rem; font-size: 0.9rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
}
.oc-summary-body { padding: 1rem; }
.oc-field { display: block; margin-bottom: 0.8rem; }
.oc-field > span { display: block; font-size: 0.74rem; color: var(--muted); font-weight: 600; margin-bottom: 0.25rem; }
.oc-field .req { color: var(--danger); }
.oc-readonly { background: #f1f5f9; color: var(--ink); }
.oc-tocompany {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--ok-light); color: #15803d; font-weight: 600; font-size: 0.85rem;
    padding: 0.55rem 0.75rem; border-radius: 9px; margin-bottom: 0.8rem;
}
.oc-disc-input { display: flex; align-items: center; gap: 0.4rem; }
.oc-disc-input .field-input { text-align: right; }
.oc-disc-input > span { color: var(--muted); font-weight: 600; }

/* Cart list inside summary */
.oc-cart-list {
    border: 1px dashed var(--line); border-radius: 10px;
    padding: 0.4rem; margin-bottom: 0.8rem; max-height: 220px; overflow-y: auto;
}
.oc-cart-empty { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 1rem 0; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.oc-cart-empty .bi { font-size: 1.4rem; opacity: 0.5; }
.oc-cart-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.3rem; border-bottom: 1px solid var(--line); }
.oc-cart-row:last-child { border-bottom: none; }
.oc-cart-info { flex: 1; min-width: 0; }
.oc-cart-name { font-weight: 600; font-size: 0.82rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-cart-meta { font-size: 0.7rem; color: var(--muted); }
.oc-cart-amt { font-weight: 700; font-size: 0.82rem; color: var(--brand-dark); white-space: nowrap; }
.oc-cart-del { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 0.2rem; border-radius: 6px; }
.oc-cart-del:hover { color: var(--danger); background: var(--danger-light); }

/* Totals */
.oc-totals { border-top: 1px solid var(--line); padding-top: 0.7rem; margin-bottom: 0.5rem; }
.oc-trow { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--ink); padding: 0.18rem 0; }
.oc-trow span:first-child { color: var(--muted); }
.oc-trow .neg { color: var(--danger); }
.oc-grand {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 2px solid var(--line); margin-top: 0.5rem; padding-top: 0.7rem;
    font-size: 1.05rem; font-weight: 800; color: var(--brand-dark);
}
.oc-submit { width: 100%; margin-top: 0.9rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.oc-submit:disabled { opacity: 0.7; cursor: not-allowed; }

@media (max-width: 980px) {
    .oc-grid { grid-template-columns: 1fr; }
    .oc-summary { position: static; }
}
