/* ============================================================
   PharmaWorks Central — design system
   Brand: deep pine sidebar + teal accent, soft cards, stat tiles
   ============================================================ */

:root {
    --pw-primary: #0e8074;        /* teal — actions, active states */
    --pw-primary-strong: #0a6459;
    --pw-primary-soft: #e0f2ef;
    --pw-sidebar-bg: #0f2420;     /* deep pine */
    --pw-sidebar-hover: #1a3a34;
    --pw-sidebar-active: #14b8a6;
    --pw-sidebar-ink: #b7c9c4;
    --pw-content-bg: #f4f6f8;
    --pw-card-radius: 14px;
    --pw-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --pw-shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
    --pw-ink: #1a2b27;
    --pw-ink-muted: #64748b;
}

/* ---------- Dark theme (default) ---------- */
html[data-bs-theme="dark"] {
    --pw-content-bg: #101b18;
    --pw-ink: #e2ebe8;
    --pw-ink-muted: #8fa39d;
    --pw-primary-soft: #123f39;
    --pw-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --pw-shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    --bs-body-bg: #101b18;
    --bs-body-color: #e2ebe8;
}
html[data-bs-theme="dark"] body { background: var(--pw-content-bg); color: var(--pw-ink); }
html[data-bs-theme="dark"] .pw-topbar { background: #15211e; border-bottom-color: #1f2f2b; }
html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .stat-tile { background: #16241f; border-color: #22352f; }
html[data-bs-theme="dark"] .card-header { background: #16241f; border-bottom-color: #22352f; color: var(--pw-ink); }
html[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent; --bs-table-color: var(--pw-ink);
    --bs-table-hover-bg: #1b2c26; --bs-table-hover-color: var(--pw-ink);
    --bs-table-striped-bg: #182823;
}
html[data-bs-theme="dark"] .table thead th { background: #131f1b; border-bottom-color: #22352f; color: var(--pw-ink-muted); }
html[data-bs-theme="dark"] .table td { border-color: #1e2f29; }
html[data-bs-theme="dark"] .table-light td, html[data-bs-theme="dark"] .table-light th { background: #131f1b; color: var(--pw-ink); }
html[data-bs-theme="dark"] .bar-track { background: #24382f; }
html[data-bs-theme="dark"] .form-control, html[data-bs-theme="dark"] .form-select {
    background: #101b18; border-color: #2a3f38; color: var(--pw-ink);
}
html[data-bs-theme="dark"] .form-control::placeholder { color: #5d726c; }
html[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #a9bcb6; --bs-btn-border-color: #3a5049; }
html[data-bs-theme="dark"] .pw-user-chip { color: var(--pw-ink); }
html[data-bs-theme="dark"] .pw-avatar { background: #123f39; color: #6fd6c8; }
html[data-bs-theme="dark"] .text-muted { color: var(--pw-ink-muted) !important; }
html[data-bs-theme="dark"] .stat-icon.tint-teal  { background: #113a34; color: #4fd1c0; }
html[data-bs-theme="dark"] .stat-icon.tint-green { background: #12331c; color: #57c576; }
html[data-bs-theme="dark"] .stat-icon.tint-amber { background: #3a2a10; color: #e5a94e; }
html[data-bs-theme="dark"] .stat-icon.tint-blue  { background: #14263f; color: #6ea4f5; }
html[data-bs-theme="dark"] .auth-form { background: #101b18; }
html[data-bs-theme="dark"] .auth-card .card { background: #16241f; }
html[data-bs-theme="dark"] .alert-success { background: #12331c; border-color: #1c4a2a; color: #a9e5bb; }
html[data-bs-theme="dark"] .alert-danger { background: #3a1518; border-color: #572026; color: #f1aeb5; }
html[data-bs-theme="dark"] .breadcrumb .breadcrumb-item.active { color: var(--pw-ink-muted); }

html { font-size: 15px; }
body {
    background: var(--pw-content-bg);
    color: var(--pw-ink);
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- App shell: sidebar + main ---------- */
.pw-shell { display: flex; min-height: 100vh; }

.pw-sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--pw-sidebar-bg);
    color: var(--pw-sidebar-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.pw-brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.1rem 1.25rem .9rem;
    color: #fff; text-decoration: none;
}
.pw-brand:hover { color: #fff; }
.pw-brand-badge {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, #14b8a6, #0e8074);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 1.05rem;
}
.pw-brand-name { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.pw-brand-sub { font-size: .72rem; color: var(--pw-sidebar-ink); letter-spacing: .02em; }

.pw-nav-section {
    padding: 1rem 1.25rem .35rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: #5f7a73;
}
.pw-nav { list-style: none; margin: 0; padding: 0 .65rem; }
.pw-nav a {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .7rem; margin-bottom: 2px;
    color: var(--pw-sidebar-ink); text-decoration: none;
    border-radius: 9px; font-size: .92rem; font-weight: 500;
    transition: background .12s ease, color .12s ease;
}
.pw-nav a:hover { background: var(--pw-sidebar-hover); color: #fff; }
.pw-nav a.active {
    background: var(--pw-sidebar-hover); color: #fff;
    box-shadow: inset 3px 0 0 var(--pw-sidebar-active);
}
.pw-nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }

.pw-sidebar-footer {
    margin-top: auto; padding: 1rem 1.25rem;
    font-size: .72rem; color: #5f7a73; border-top: 1px solid #1c3630;
}

/* ---------- Sub-menus ---------- */
.pw-nav .pw-group-toggle { cursor: pointer; }
.pw-nav .pw-caret { margin-left: auto; transition: transform .15s ease; width: 14px; height: 14px; }
.pw-nav .pw-group-toggle[aria-expanded="true"] .pw-caret { transform: rotate(90deg); }
.pw-subnav { list-style: none; padding-left: 2.1rem; margin: 0 0 .2rem; }
.pw-subnav a {
    display: block; padding: .38rem .6rem; margin-bottom: 1px;
    color: var(--pw-sidebar-ink); text-decoration: none;
    border-radius: 8px; font-size: .86rem;
}
.pw-subnav a:hover { background: var(--pw-sidebar-hover); color: #fff; }
.pw-subnav a.active { color: #fff; background: var(--pw-sidebar-hover); box-shadow: inset 2px 0 0 var(--pw-sidebar-active); }

/* PharmaCORE module groups: Transactions / Setup sub-headings inside a group. */
.pw-modules { padding-top: .6rem; }
.pw-subnav-head {
    padding: .5rem .6rem .15rem;
    font-size: .64rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #5f7a73;
}
.pw-subnav-title { display: none; } /* the flyout's own heading, mini mode only */

/* ---------- Mini (collapsed) sidebar ---------- */
.pw-collapse-btn {
    border: none; background: none; color: var(--pw-sidebar-ink);
    width: 100%; text-align: left; display: flex; align-items: center; gap: .7rem;
    padding: .6rem 1.35rem; font-size: .85rem;
    border-top: 1px solid #1c3630;
}
.pw-collapse-btn:hover { color: #fff; background: var(--pw-sidebar-hover); }
.pw-collapse-btn svg { width: 18px; height: 18px; transition: transform .15s ease; }

@media (min-width: 992px) {
    .pw-shell.mini .pw-sidebar { width: 76px; }
    .pw-shell.mini .pw-brand-name, .pw-shell.mini .pw-brand-sub,
    .pw-shell.mini .pw-nav-section, .pw-shell.mini .pw-sidebar-footer,
    .pw-shell.mini .pw-nav a span.lbl, .pw-shell.mini .pw-caret,
    .pw-shell.mini .pw-subnav, .pw-shell.mini .pw-collapse-btn span { display: none; }
    .pw-shell.mini .pw-nav { padding: 0 .8rem; }
    .pw-shell.mini .pw-nav a { justify-content: center; padding: .65rem .5rem; }
    .pw-shell.mini .pw-brand { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
    .pw-shell.mini .pw-collapse-btn { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
    .pw-shell.mini .pw-collapse-btn svg { transform: rotate(180deg); }

    /* No room to unfold a group in 76px, so it opens as a flyout beside its icon. Fixed, not
       absolute: the sidebar scrolls (overflow-y: auto), which would clip anything absolute. */
    .pw-shell.mini .pw-group > .collapse { display: none !important; }
    .pw-shell.mini .pw-group.flyout > .collapse {
        display: block !important; height: auto !important;
        position: fixed; left: 76px; top: var(--pw-fly-top, 80px); z-index: 1050;
        width: 236px; max-height: calc(100vh - var(--pw-fly-top, 80px) - 12px); overflow-y: auto;
        background: var(--pw-sidebar-bg); border: 1px solid #1c3630; border-left: 0;
        border-radius: 0 10px 10px 0; box-shadow: var(--pw-shadow-lg); padding: .35rem;
    }
    .pw-shell.mini .pw-group.flyout .pw-subnav { display: block; padding-left: 0; margin: 0; }
    .pw-shell.mini .pw-subnav-title {
        display: block; padding: .4rem .6rem .45rem; margin-bottom: .2rem;
        color: #fff; font-weight: 600; font-size: .86rem; border-bottom: 1px solid #1c3630;
    }
}

/* Top bar breadcrumb: "Module › Screen", the way PharmaCORE titles its forms. */
.pw-crumb { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; }
.pw-crumb a { color: inherit; text-decoration: none; }
.pw-crumb a:hover { color: var(--pw-ink); text-decoration: underline; }
.pw-crumb-sep { margin: 0 .3rem; opacity: .6; }

/* ---------- Branch switcher ---------- */
.pw-branch-switch {
    max-width: 260px; border-radius: 9px;
    font-weight: 600; font-size: .88rem;
}

/* ---------- Main column ---------- */
.pw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.pw-topbar {
    background: #fff; border-bottom: 1px solid #e7ecef;
    padding: .65rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    position: sticky; top: 0; z-index: 1020;
}
.pw-topbar .btn-hamburger { border: none; background: none; padding: .25rem .4rem; display: none; }

.pw-user-chip {
    display: flex; align-items: center; gap: .6rem;
    text-decoration: none; color: var(--pw-ink);
}
.pw-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--pw-primary-soft); color: var(--pw-primary-strong);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}

.pw-content { padding: 1.5rem; flex: 1; }
.pw-page-title { font-weight: 700; margin-bottom: 1.1rem; font-size: 1.25rem; }
.pw-page-title .fw-light { color: var(--pw-ink-muted); font-weight: 400; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid #e9eef1;
    border-radius: var(--pw-card-radius);
    box-shadow: var(--pw-shadow);
}
.card-header {
    background: #fff; border-bottom: 1px solid #eef2f4;
    font-weight: 600; font-size: .92rem;
    border-top-left-radius: var(--pw-card-radius) !important;
    border-top-right-radius: var(--pw-card-radius) !important;
    padding: .8rem 1.1rem;
}
.card > .table { margin-bottom: 0; }
.card > .table-responsive { border-bottom-left-radius: var(--pw-card-radius); border-bottom-right-radius: var(--pw-card-radius); }

/* ---------- Stat tiles ---------- */
.stat-tile {
    background: #fff; border: 1px solid #e9eef1;
    border-radius: var(--pw-card-radius); box-shadow: var(--pw-shadow);
    padding: 1rem 1.15rem;
    display: flex; align-items: center; gap: .9rem;
    height: 100%;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.tint-teal   { background: #e0f2ef; color: #0e8074; }
.stat-icon.tint-green  { background: #e5f4e8; color: #1a7f37; }
.stat-icon.tint-amber  { background: #fdf1dc; color: #b45309; }
.stat-icon.tint-blue   { background: #e3edfb; color: #1d4ed8; }
.stat-label { font-size: .78rem; color: var(--pw-ink-muted); margin-bottom: .1rem; }
.stat-value { font-size: 1.45rem; font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: #f6faf9; font-size: .92rem; }
.table thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--pw-ink-muted); font-weight: 650;
    border-bottom: 1px solid #e7ecef; background: #fbfcfd;
    white-space: nowrap;
}
.table td { vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons / forms / badges ---------- */
.btn-primary {
    --bs-btn-bg: var(--pw-primary); --bs-btn-border-color: var(--pw-primary);
    --bs-btn-hover-bg: var(--pw-primary-strong); --bs-btn-hover-border-color: var(--pw-primary-strong);
    --bs-btn-active-bg: var(--pw-primary-strong); --bs-btn-active-border-color: var(--pw-primary-strong);
}
.btn-outline-primary {
    --bs-btn-color: var(--pw-primary); --bs-btn-border-color: var(--pw-primary);
    --bs-btn-hover-bg: var(--pw-primary); --bs-btn-hover-border-color: var(--pw-primary);
    --bs-btn-active-bg: var(--pw-primary-strong); --bs-btn-active-border-color: var(--pw-primary-strong);
}
.text-primary { color: var(--pw-primary) !important; }
.btn { border-radius: 9px; }
.form-control, .form-select { border-radius: 9px; }
.form-control:focus, .form-select:focus {
    border-color: var(--pw-primary);
    box-shadow: 0 0 0 .2rem rgba(14, 128, 116, .15);
}
.badge { font-weight: 600; border-radius: 6px; padding: .38em .6em; }

/* magnitude bars (analytics) */
.bar-track { background: #eaeff2; border-radius: 4px; height: 10px; min-width: 40px; }
.bar-fill { background: var(--pw-primary); border-radius: 4px; height: 10px; }

/* ---------- Auth pages (split hero) ---------- */
.auth-wrap { min-height: 100vh; display: flex; background: var(--pw-content-bg); }
.auth-hero {
    flex: 1.15; position: relative; overflow: hidden;
    background: linear-gradient(150deg, #0f2420 0%, #0e8074 85%, #14b8a6 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: center;
    padding: 4rem 3.5rem;
}

/* Artwork variant: light canvas showcasing the product hero image */
.auth-hero.auth-hero-art {
    background: linear-gradient(160deg, #f2f7f6 0%, #e6f1ef 55%, #dceceb 100%);
    color: var(--pw-ink);
    padding: 3rem;
    align-items: center;
}
html[data-bs-theme="dark"] .auth-hero.auth-hero-art {
    background: linear-gradient(160deg, #0f2420 0%, #13322c 60%, #10231f 100%);
}
.auth-hero-art .hero-shot {
    max-width: 100%; max-height: 76vh; width: auto;
    border-radius: 16px; box-shadow: 0 18px 48px rgba(15, 36, 32, .22);
    background: #fff;
}
.auth-hero-art .hero-caption {
    margin-top: 1.4rem; text-align: center;
    color: var(--pw-ink-muted); font-size: .8rem;
}
.auth-hero h1 { font-weight: 800; font-size: 2.1rem; letter-spacing: -.01em; }
.auth-hero p.lead { color: #cfe8e3; font-size: 1.05rem; max-width: 34rem; }
.auth-hero .chips { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }
.auth-hero .chip {
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px; padding: .42rem .95rem; font-size: .85rem; font-weight: 550;
    backdrop-filter: blur(4px);
}
.auth-hero .rings {
    position: absolute; right: -140px; top: -140px; width: 420px; height: 420px;
    border-radius: 50%; border: 60px solid rgba(255, 255, 255, .06);
}
.auth-hero .rings2 {
    position: absolute; left: -120px; bottom: -160px; width: 380px; height: 380px;
    border-radius: 50%; border: 48px solid rgba(255, 255, 255, .05);
}
.auth-form {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { border: none; box-shadow: var(--pw-shadow-lg); border-radius: 18px; }
.auth-footnote { color: var(--pw-ink-muted); font-size: .78rem; text-align: center; margin-top: 1.2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .pw-sidebar {
        position: fixed; z-index: 1045; height: 100vh;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .pw-sidebar.open { transform: translateX(0); box-shadow: var(--pw-shadow-lg); }
    .pw-backdrop {
        display: none; position: fixed; inset: 0; z-index: 1040;
        background: rgba(15, 36, 32, .5);
    }
    .pw-backdrop.show { display: block; }
    .pw-topbar .btn-hamburger { display: inline-flex; }
    .pw-content { padding: 1rem; }
    .auth-hero { display: none; }
}

@media (max-width: 575.98px) {
    .stat-value { font-size: 1.2rem; }
    html { font-size: 14px; }
}

/* ==========================================================================
   Host admin area
   The operator console above every tenant. Built on the same tokens as the
   pharmacy portal so the two read as one product, but deliberately a shade
   more severe: this is where a business can be suspended.
   ========================================================================== */

.pw-host-body { background: var(--pw-content-bg); color: var(--pw-ink); min-height: 100vh; }

.pw-host-bar {
    background: var(--pw-sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    box-shadow: var(--pw-shadow);
}
.pw-host-bar-inner {
    max-width: 1240px; margin: 0 auto; padding: .7rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

/* Second row of the host bar. Reuses the sidebar tokens rather than introducing new ones, so
   the host area stays visually one thing as it grows past a single screen. */
.pw-host-nav { border-top: 1px solid rgba(255, 255, 255, .06); }
.pw-host-nav-inner {
    max-width: 1240px; margin: 0 auto; padding: 0 1.25rem;
    display: flex; gap: .25rem; overflow-x: auto;
}
.pw-host-nav a {
    color: var(--pw-sidebar-ink); text-decoration: none; white-space: nowrap;
    font-size: .86rem; padding: .6rem .85rem; border-bottom: 2px solid transparent;
}
.pw-host-nav a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.pw-host-nav a.active { color: #fff; border-bottom-color: var(--pw-sidebar-active); }
.pw-host-nav a:focus-visible { outline: 2px solid var(--pw-sidebar-active); outline-offset: -2px; }
.pw-host-brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.pw-host-brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.pw-host-brand-name { color: #fff; font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; }
.pw-host-tag {
    display: inline-block; margin-left: .3rem; padding: .08rem .42rem;
    background: var(--pw-sidebar-active); color: #06231f;
    border-radius: 5px; font-size: .64rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase; vertical-align: 2px;
}
.pw-host-brand-sub { color: var(--pw-sidebar-ink); font-size: .72rem; }

.pw-host-actions { display: flex; align-items: center; gap: .6rem; }
.pw-host-icon-btn {
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1);
    color: #cfe0dc; border-radius: 9px; width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s ease;
}
.pw-host-icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.pw-host-icon-btn:focus-visible { outline: 2px solid var(--pw-sidebar-active); outline-offset: 2px; }
.pw-host-who { display: flex; align-items: center; gap: .5rem; color: #cfe0dc; font-size: .85rem; }
.pw-host-signout {
    background: transparent; border: 1px solid rgba(255, 255, 255, .22); color: #dcebe7;
}
.pw-host-signout:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }

.pw-host-main { max-width: 1240px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

/* ---- page heading ---- */
.pw-host-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem;
}
.pw-host-title {
    font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; margin: 0;
    color: var(--pw-ink);
}
.pw-host-title span { font-weight: 300; color: var(--pw-ink-muted); }
.pw-host-sub { color: var(--pw-ink-muted); font-size: .9rem; }
.pw-host-stamp {
    color: var(--pw-ink-muted); font-size: .78rem;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---- summary tiles ---- */
.pw-host-tiles {
    display: grid; gap: .85rem; margin-bottom: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.pw-tile {
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(16, 24, 40, .09);
    border-radius: var(--pw-card-radius); box-shadow: var(--pw-shadow);
    padding: .95rem 1.1rem; display: flex; align-items: center; gap: .85rem;
}
.pw-tile.is-bad { border-color: rgba(220, 53, 69, .4); }
.pw-tile-icon {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
}
.pw-tile-icon svg { width: 19px; height: 19px; }
.tint-teal  { background: var(--pw-primary-soft); color: var(--pw-primary); }
.tint-blue  { background: #e3edfa; color: #2563eb; }
.tint-green { background: #e3f5e9; color: #16794a; }
.tint-red   { background: #fbe6e8; color: #c02636; }
.tint-slate { background: #eaeef1; color: #55636e; }
.pw-tile-label {
    display: block; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
    color: var(--pw-ink-muted); font-weight: 600;
}
.pw-tile-value {
    display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.15;
    color: var(--pw-ink); font-variant-numeric: tabular-nums;
}
.pw-tile-of { font-size: .95rem; font-weight: 400; color: var(--pw-ink-muted); margin-left: .2rem; }
.pw-tile-foot { display: block; font-size: .75rem; color: var(--pw-ink-muted); margin-top: .1rem; }

/* ---- panels ---- */
.pw-panel {
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(16, 24, 40, .09);
    border-radius: var(--pw-card-radius); box-shadow: var(--pw-shadow);
    margin-bottom: 1.5rem; overflow: hidden;
}
.pw-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.05rem 1.25rem; border-bottom: 1px solid rgba(16, 24, 40, .08);
}
.pw-panel-title { font-size: 1.02rem; font-weight: 600; margin: 0; color: var(--pw-ink); }
.pw-panel-sub { color: var(--pw-ink-muted); font-size: .82rem; }
.pw-panel-form { padding: 1.1rem 1.25rem; background: rgba(16, 24, 40, .015); }
.pw-panel-form .form-label {
    font-size: .72rem; letter-spacing: .05em; text-transform: uppercase;
    color: var(--pw-ink-muted); font-weight: 600; margin-bottom: .25rem;
}
.pw-panel-note { margin-top: .7rem; font-size: .78rem; color: var(--pw-ink-muted); }

/* ---- callouts ---- */
.pw-callout {
    margin: 1rem 1.25rem 0; padding: .7rem .9rem; border-radius: 10px;
    font-size: .85rem; border-left: 3px solid transparent;
}
.pw-callout.warn { background: #fff8e6; border-left-color: #d98a00; color: #6b4a00; }
.pw-callout.info { background: var(--pw-primary-soft); border-left-color: var(--pw-primary); color: #0a5049; }

/* ---- tables ---- */
.pw-host-table thead th {
    font-size: .68rem; letter-spacing: .07em; text-transform: uppercase;
    color: var(--pw-ink-muted); font-weight: 600; white-space: nowrap;
    background: rgba(16, 24, 40, .02); border-bottom-width: 1px;
}
.pw-host-table td { padding-top: .7rem; padding-bottom: .7rem; }
.pw-host-table td.num { font-variant-numeric: tabular-nums; }
.pw-host-table tr.pw-inline-row:hover > td { background: transparent; }

.pw-tenant { display: flex; align-items: center; gap: .6rem; }
.pw-tenant-name { font-weight: 500; color: var(--pw-ink); }
.pw-code-chip {
    font-family: ui-monospace, Consolas, monospace; font-size: .74rem; font-weight: 600;
    padding: .18rem .45rem; border-radius: 6px;
    background: var(--pw-primary-soft); color: var(--pw-primary-strong);
    letter-spacing: .02em;
}
.pw-money { font-weight: 600; color: var(--pw-ink); }
.pw-sub-num { display: block; font-size: .72rem; color: var(--pw-ink-muted); }

/* ---- pills and dots ---- */
.pw-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .16rem .5rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.pw-pill.ok   { background: #e3f5e9; color: #14663f; }
.pw-pill.warn { background: #fff3d6; color: #7a5000; }
.pw-pill.bad  { background: #fbe4e6; color: #a3202e; }
.pw-pill .pw-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pw-online { display: inline-flex; align-items: center; gap: .4rem; justify-content: flex-end; }
.pw-online .pw-dot { width: 7px; height: 7px; border-radius: 50%; }
.pw-online .pw-dot.live { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .16); }
.pw-online .pw-dot.part { background: #d98a00; box-shadow: 0 0 0 3px rgba(217, 138, 0, .16); }
.pw-online .pw-dot.dead { background: #b8434f; box-shadow: 0 0 0 3px rgba(184, 67, 79, .16); }
/* Shut for the night, not broken — deliberately neutral. Colouring a closed pharmacy amber is
   what made every evening and weekend morning read as an incident. */
.pw-online .pw-dot.shut { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .16); }

/* ---- inline forms ---- */
.pw-row-actions { display: inline-flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }
.pw-field-form { display: flex; gap: .35rem; align-items: center; }
.pw-field-form .form-control { min-width: 9rem; }
.pw-inline-form {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
    padding: .85rem 1.25rem; background: rgba(16, 24, 40, .03);
    border-top: 1px solid rgba(16, 24, 40, .07);
}
.pw-inline-label { font-size: .82rem; color: var(--pw-ink-muted); margin-right: .3rem; }
.pw-avatar.sm { width: 28px; height: 28px; font-size: .78rem; }

/* ---- dark theme ---- */
html[data-bs-theme="dark"] .pw-tile,
html[data-bs-theme="dark"] .pw-panel { background: #16241f; border-color: #22352f; }
html[data-bs-theme="dark"] .pw-panel-head { border-bottom-color: #22352f; }
html[data-bs-theme="dark"] .pw-panel-form { background: #131f1b; }
html[data-bs-theme="dark"] .pw-host-table thead th { background: #131f1b; }
html[data-bs-theme="dark"] .pw-inline-form { background: #131f1b; border-top-color: #22352f; }
html[data-bs-theme="dark"] .pw-code-chip { background: #123f39; color: #6fd6c8; }
html[data-bs-theme="dark"] .tint-blue  { background: #16304d; color: #7fb0ff; }
html[data-bs-theme="dark"] .tint-green { background: #14361f; color: #6ee7a0; }
html[data-bs-theme="dark"] .tint-red   { background: #3d1a1f; color: #ff9aa5; }
html[data-bs-theme="dark"] .tint-slate { background: #22302c; color: #9fb2ac; }
html[data-bs-theme="dark"] .pw-pill.ok   { background: #14361f; color: #6ee7a0; }
html[data-bs-theme="dark"] .pw-pill.warn { background: #3a2d10; color: #f2c66a; }
html[data-bs-theme="dark"] .pw-pill.bad  { background: #3d1a1f; color: #ff9aa5; }
html[data-bs-theme="dark"] .pw-callout.warn { background: #33280d; border-left-color: #d9a13a; color: #f0d79b; }
html[data-bs-theme="dark"] .pw-callout.info { background: #123f39; border-left-color: #4fbdaf; color: #b6ece3; }
html[data-bs-theme="dark"] .pw-tile.is-bad { border-color: #6b2b33; }

@media (max-width: 600px) {
    .pw-host-head { align-items: flex-start; }
    .pw-field-form { flex-direction: column; align-items: stretch; }
    .pw-field-form .form-control { min-width: 0; }
}

/* ==========================================================================
   Top bar identity
   The pharmacy's name sits here rather than in the sidebar: it is the answer
   to "whose data am I looking at", which matters most on a platform where one
   operator can hold several businesses. The sidebar keeps the product mark.
   ========================================================================== */

.pw-brand-logo { object-fit: contain; background: #fff; padding: 3px; }

.pw-topbar-tenant { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pw-topbar-tenant-name {
    font-weight: 650; font-size: 1rem; letter-spacing: -.01em; color: var(--pw-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pw-topbar-tenant-sub { font-size: .74rem; color: var(--pw-ink-muted); }

@media (max-width: 575.98px) {
    /* On a phone the branch switcher is the control that matters; the name is on the page. */
    .pw-topbar-tenant-name { font-size: .88rem; max-width: 9rem; }
    .pw-topbar-tenant-sub { display: none; }
}

/* ==========================================================================
   Dashboard — KPI cards and charts
   Scanned, not read: the summary reads at a glance, state is carried by form
   as well as by number, and semantic colour stays separate from the accent.
   ========================================================================== */

.pw-kpi-grid {
    display: grid; gap: .85rem; margin-bottom: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
}

.pw-kpi {
    background: #fff; border: 1px solid #e9eef1;
    border-radius: var(--pw-card-radius); box-shadow: var(--pw-shadow);
    padding: .9rem 1rem; display: flex; flex-direction: column; gap: .5rem;
    position: relative; overflow: hidden;
}
/* A severity stripe, so "needs attention" reads before the number does. */
.pw-kpi.is-warn::before, .pw-kpi.is-bad::before {
    content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
}
.pw-kpi.is-warn::before { background: #d98a00; }
.pw-kpi.is-bad::before  { background: #c02636; }

.pw-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pw-kpi-label {
    font-size: .7rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
    color: var(--pw-ink-muted);
}
.pw-kpi-icon {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
    display: grid; place-items: center;
}
.pw-kpi-icon svg { width: 16px; height: 16px; }
.pw-kpi-value {
    font-size: 1.5rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em;
    color: var(--pw-ink); font-variant-numeric: tabular-nums;
}
.pw-kpi-value .unit { font-size: .82rem; font-weight: 500; color: var(--pw-ink-muted); margin-right: .15rem; }
.pw-kpi-foot { display: flex; align-items: center; gap: .4rem; font-size: .74rem; color: var(--pw-ink-muted); }

/* Change against the comparison period. Direction is shown by the arrow as well as the
   colour, so it survives both colour blindness and a greyscale print. */
.pw-delta { display: inline-flex; align-items: center; gap: .18rem; font-weight: 650; }
.pw-delta.up   { color: #16794a; }
.pw-delta.down { color: #c02636; }
.pw-delta.flat { color: var(--pw-ink-muted); }
.pw-delta svg { width: 11px; height: 11px; }

.pw-kpi-spark { margin: -.15rem -.15rem -.35rem; }
.pw-kpi-spark svg { display: block; width: 100%; height: 30px; }

/* ---- chart cards ---- */
.pw-chart-card {
    background: #fff; border: 1px solid #e9eef1;
    border-radius: var(--pw-card-radius); box-shadow: var(--pw-shadow);
    display: flex; flex-direction: column;
}
/* Equal heights are a property of a ROW of cards, so they come from .h-100 on the cards that
   sit in one. This rule used to carry height:100% itself, which stretched every STANDALONE card
   to the full height of the content area - .pw-content is a flex child with a resolved height,
   so a full-width card left a screen-sized hole beneath its own content. */
.pw-chart-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
    padding: .9rem 1.1rem .35rem;
}
.pw-chart-title { font-size: .95rem; font-weight: 650; color: var(--pw-ink); margin: 0; }
.pw-chart-sub { font-size: .73rem; color: var(--pw-ink-muted); }
.pw-chart-body { padding: .5rem 1.1rem 1.1rem; flex: 1; min-width: 0; }

/* Charts are hand-drawn SVG - no chart library, so nothing to load and nothing to break. */
.pw-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.pw-grid-line { stroke: rgba(16, 24, 40, .08); stroke-width: 1; }
.pw-axis-label { font-size: 9px; fill: var(--pw-ink-muted); font-family: inherit; }
.pw-area  { fill: url(#pwAreaFill); }
.pw-line  { fill: none; stroke: var(--pw-primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pw-line-2 { fill: none; stroke: #9aa7b4; stroke-width: 1.5; stroke-dasharray: 3 3; }
/* The last point is the one people look for, so it is drawn, not left to be inferred. */
.pw-endpoint { fill: var(--pw-primary); stroke: #fff; stroke-width: 2; }
.pw-col { fill: var(--pw-primary); opacity: .82; }
.pw-col:hover { opacity: 1; }
.pw-col-quiet { fill: #c3cdd6; }

/* ---- horizontal bar list (revenue by branch, top products) ---- */
.pw-barlist { display: flex; flex-direction: column; gap: .7rem; }
.pw-barlist-row { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; }
.pw-barlist-name {
    font-size: .82rem; color: var(--pw-ink); min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pw-barlist-value { font-size: .82rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--pw-ink); }
.pw-barlist-track {
    grid-column: 1 / -1; height: 7px; border-radius: 999px;
    background: rgba(16, 24, 40, .07); overflow: hidden;
}
.pw-barlist-fill { height: 100%; border-radius: 999px; background: var(--pw-primary); }
.pw-barlist-fill.alt { background: #4f9ecf; }

/* ---- donut ---- */
.pw-donut-wrap { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.pw-donut { position: relative; flex: 0 0 auto; }
.pw-donut svg { display: block; transform: rotate(-90deg); }
.pw-donut-centre {
    position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.15;
}
.pw-donut-centre b { font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--pw-ink); }
.pw-donut-centre span { display: block; font-size: .64rem; color: var(--pw-ink-muted); }
.pw-legend { display: flex; flex-direction: column; gap: .4rem; min-width: 0; flex: 1 1 8rem; }
.pw-legend-row { display: flex; align-items: center; gap: .45rem; font-size: .78rem; min-width: 0; }
.pw-legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.pw-legend-name { color: var(--pw-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-legend-val { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--pw-ink-muted); }

/* ---- expiry stack: the pharmacy-specific one, so severity is explicit ---- */
.pw-stack { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 1px; }
.pw-stack span { display: block; }
.sev-expired { background: #a3202e; }
.sev-30      { background: #d9534f; }
.sev-90      { background: #d98a00; }
.sev-180     { background: #b4b64a; }
.sev-ok      { background: #4a9e7f; }
.sev-none    { background: #b8c2cc; }

.pw-empty-chart {
    display: grid; place-items: center; min-height: 6rem; text-align: center;
    font-size: .8rem; color: var(--pw-ink-muted);
}

/* ---- dark theme ---- */
html[data-bs-theme="dark"] .pw-kpi,
html[data-bs-theme="dark"] .pw-chart-card { background: #16241f; border-color: #22352f; }
html[data-bs-theme="dark"] .pw-grid-line { stroke: rgba(255, 255, 255, .09); }
html[data-bs-theme="dark"] .pw-barlist-track { background: rgba(255, 255, 255, .09); }
html[data-bs-theme="dark"] .pw-endpoint { stroke: #16241f; }
html[data-bs-theme="dark"] .pw-col-quiet { fill: #3b4a45; }
html[data-bs-theme="dark"] .pw-line-2 { stroke: #6b7c85; }
html[data-bs-theme="dark"] .pw-delta.up   { color: #6ee7a0; }
html[data-bs-theme="dark"] .pw-delta.down { color: #ff9aa5; }
html[data-bs-theme="dark"] .pw-kpi-icon.tint-teal   { background: #113a34; color: #4fd1c0; }
html[data-bs-theme="dark"] .pw-kpi-icon.tint-green  { background: #12331c; color: #57c576; }
html[data-bs-theme="dark"] .pw-kpi-icon.tint-amber  { background: #3a2a10; color: #e5a94e; }
html[data-bs-theme="dark"] .pw-kpi-icon.tint-blue   { background: #14263f; color: #6ea4f5; }
html[data-bs-theme="dark"] .pw-kpi-icon.tint-red    { background: #3d1a1f; color: #ff9aa5; }
html[data-bs-theme="dark"] .pw-kpi-icon.tint-slate  { background: #22302c; color: #9fb2ac; }

.pw-kpi-icon.tint-teal   { background: #e0f2ef; color: #0e8074; }
.pw-kpi-icon.tint-green  { background: #e5f4e8; color: #1a7f37; }
.pw-kpi-icon.tint-amber  { background: #fdf1dc; color: #b45309; }
.pw-kpi-icon.tint-blue   { background: #e3edfb; color: #1d4ed8; }
.pw-kpi-icon.tint-red    { background: #fbe6e8; color: #c02636; }
.pw-kpi-icon.tint-slate  { background: #eaeef1; color: #55636e; }

/* ==========================================================================
   Printable reports
   Preview on screen, then print or save as PDF through the browser. No
   server-side PDF engine to install or keep patched, and the operator sees
   exactly what will come out before committing paper to it.
   ========================================================================== */

.pw-report {
    background: #fff; color: #1a2b27;
    border: 1px solid #e9eef1; border-radius: var(--pw-card-radius);
    box-shadow: var(--pw-shadow); padding: 1.5rem 1.75rem;
}

.pw-report-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem;
    padding-bottom: .9rem; margin-bottom: 1.1rem;
    border-bottom: 2px solid var(--pw-primary);
}
.pw-report-org { display: flex; align-items: center; gap: .75rem; }
.pw-report-logo { width: 46px; height: 46px; object-fit: contain; }
.pw-report-org-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.pw-report-org-sub { font-size: .74rem; color: var(--pw-ink-muted); }
.pw-report-meta { text-align: right; font-size: .78rem; color: var(--pw-ink-muted); line-height: 1.5; }
.pw-report-title {
    font-size: 1.05rem; font-weight: 700; color: var(--pw-ink);
    letter-spacing: .01em; margin-bottom: .15rem;
}

.pw-report-summary {
    border-collapse: collapse; margin: 0 0 1rem; min-width: 22rem;
}
.pw-report-summary th, .pw-report-summary td {
    padding: .35rem .8rem; border-bottom: 1px solid #e9eef1; font-size: .85rem; text-align: left;
}
.pw-report-summary thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pw-ink-muted); }
.pw-report-summary tfoot th { border-top: 2px solid #cfd8dc; border-bottom: none; font-weight: 700; }
.pw-report-summary .num, .pw-report-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.pw-report-note {
    font-size: .84rem; padding: .6rem .85rem; border-left: 3px solid #c02636;
    background: #fdf2f3; border-radius: 6px; margin-bottom: 1.2rem;
}

.pw-report-branch {
    font-size: .92rem; font-weight: 700; margin: 1.2rem 0 .4rem;
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    border-bottom: 1px solid #e9eef1; padding-bottom: .25rem;
}
.pw-report-branch-total { font-weight: 500; font-size: .8rem; color: var(--pw-ink-muted); }

.pw-report-table { width: 100%; border-collapse: collapse; }
.pw-report-table th, .pw-report-table td {
    padding: .3rem .5rem; border-bottom: 1px solid #eef2f4; font-size: .78rem; text-align: left;
    vertical-align: top;
}
.pw-report-table thead th {
    font-size: .66rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--pw-ink-muted); background: #f6f9f8; white-space: nowrap;
}
.pw-report-table .mono { font-family: ui-monospace, Consolas, monospace; font-size: .74rem; }
.pw-report-table tr.is-expired td { background: #fdf2f3; }

/* Severity is carried by a shape as well as a colour, so it survives a mono print. */
.pw-band-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 2px;
    margin-right: .4rem; vertical-align: 0;
}

.pw-report-foot {
    margin-top: 1.4rem; padding-top: .6rem; border-top: 1px solid #e9eef1;
    font-size: .7rem; color: var(--pw-ink-muted);
}

html[data-bs-theme="dark"] .pw-report { background: #16241f; border-color: #22352f; color: var(--pw-ink); }
html[data-bs-theme="dark"] .pw-report-table thead th { background: #131f1b; }
html[data-bs-theme="dark"] .pw-report-table th,
html[data-bs-theme="dark"] .pw-report-table td,
html[data-bs-theme="dark"] .pw-report-summary th,
html[data-bs-theme="dark"] .pw-report-summary td { border-bottom-color: #22352f; }
html[data-bs-theme="dark"] .pw-report-table tr.is-expired td { background: #33191d; }
html[data-bs-theme="dark"] .pw-report-note { background: #33191d; }

/* ---- what actually reaches the paper ---- */
@media print {
    /* Landscape: the batch table has nine columns and product names are long. */
    @page { size: A4 landscape; margin: 12mm 10mm 14mm; }

    /* The application chrome is navigation, not information. */
    .pw-sidebar, .pw-topbar, .pw-backdrop, .pw-no-print, .alert-dismissible .btn-close { display: none !important; }
    .pw-shell, .pw-main, .pw-content { display: block !important; margin: 0 !important; padding: 0 !important; }

    /* Print on white regardless of the viewer's theme, or a dark page wastes a cartridge. */
    html, body { background: #fff !important; color: #000 !important; }
    html[data-bs-theme="dark"] .pw-report,
    .pw-report { background: #fff !important; color: #000 !important;
                 border: none !important; box-shadow: none !important; padding: 0 !important; }
    html[data-bs-theme="dark"] .pw-report-table thead th,
    .pw-report-table thead th { background: #eee !important; color: #000 !important; }
    html[data-bs-theme="dark"] .pw-report-table tr.is-expired td,
    .pw-report-table tr.is-expired td { background: #f7e9ea !important; }

    /* Repeat the column headings on every page - a table that spans four sheets is unreadable
       otherwise, and this report routinely does. */
    .pw-report-table thead { display: table-header-group; }
    .pw-report-table tr { page-break-inside: avoid; }
    .pw-report-branch { page-break-after: avoid; }
    .pw-report-head { page-break-after: avoid; }
    .pw-report-summary { page-break-inside: avoid; }

    a { color: #000 !important; text-decoration: none !important; }
}

/* Grand total across grouped reports: a table of nothing but a footer, so the figure lines up
   under the same columns as the groups above it. */
.pw-report-grand { margin-top: .4rem; }
.pw-report-grand tfoot th {
    border-top: 2px solid #cfd8dc; border-bottom: none;
    font-weight: 700; font-size: .8rem; padding: .45rem .5rem;
}
html[data-bs-theme="dark"] .pw-report-grand tfoot th { border-top-color: #3a5049; }
@media print { .pw-report-grand tfoot th { border-top-color: #999 !important; } }

/* ============================================================
   Keyboard layer — the F-key legend, the F1 overlay and Ctrl+K
   PharmaCORE prints its keys along the bottom of every entry screen in blue. Staff read that
   line rather than remembering, so PharmaWorks prints one too, in the same place.
   ============================================================ */

.pw-keybar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem;
    font-size: .76rem; font-weight: 600; letter-spacing: .01em;
    color: var(--pw-primary); padding: .45rem .7rem; margin: .5rem 0 0;
    background: var(--pw-primary-soft); border-radius: 8px;
}
.pw-keybar kbd {
    background: var(--pw-content-bg); color: var(--pw-ink); border: 1px solid rgba(0,0,0,.12);
    border-radius: 4px; padding: .05rem .3rem; font-size: .72rem; font-weight: 700;
    box-shadow: 0 1px 0 rgba(0,0,0,.12); margin-right: .22rem;
}
html[data-bs-theme="dark"] .pw-keybar { color: #6fd6c8; background: #123f39; }
html[data-bs-theme="dark"] .pw-keybar kbd { background: #0d2723; color: #d6e6e2; border-color: #2a544c; }
.pw-keybar .pw-keybar-more { margin-left: auto; font-weight: 500; opacity: .85; }

/* A field the Enter ring is sitting on. Without it the caret is the only clue where you are,
   and on a dense grid that is not enough to key a delivery without looking down. */
[data-pw-keynav] input:focus, [data-pw-keynav] select:focus {
    border-color: var(--pw-primary) !important;
    box-shadow: 0 0 0 .18rem rgba(14, 128, 116, .28) !important;
}

/* ---------- overlays (F1 help, Ctrl+K jump) ---------- */
.pw-overlay {
    position: fixed; inset: 0; z-index: 1080; display: none;
    /* No backdrop-filter: on the branch machines it is a blur the GPU redraws on every keystroke,
       and it renders as a tiled mosaic in some captures. A plain scrim reads the same and costs
       nothing on a ten-year-old till. */
    background: rgba(8, 20, 17, .68);
    padding: 8vh 1rem 1rem; overflow-y: auto;
}
.pw-overlay.show { display: block; }
body.pw-overlay-open { overflow: hidden; }
.pw-overlay-panel {
    max-width: 620px; margin: 0 auto; background: var(--pw-content-bg); color: var(--pw-ink);
    border-radius: var(--pw-card-radius); box-shadow: var(--pw-shadow-lg); overflow: hidden;
}
html[data-bs-theme="dark"] .pw-overlay-panel { background: #16241f; }
html[data-bs-theme="light"] .pw-overlay-panel { background: #fff; }
.pw-overlay-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .8rem 1rem; border-bottom: 1px solid rgba(128,128,128,.22);
}
.pw-overlay-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.pw-overlay-body { padding: .9rem 1rem 1.1rem; }
.pw-overlay-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--pw-ink-muted); font-weight: 700; margin: .9rem 0 .4rem; }
.pw-overlay-section:first-child { margin-top: 0; }

.pw-keyrow { display: flex; align-items: baseline; gap: .7rem; padding: .22rem 0; font-size: .88rem; }
.pw-keyrow kbd {
    flex: 0 0 5.2rem; text-align: center;
    background: var(--pw-primary-soft); color: var(--pw-primary); border: 1px solid rgba(14,128,116,.3);
    border-radius: 5px; padding: .1rem .35rem; font-size: .78rem; font-weight: 700;
}
html[data-bs-theme="dark"] .pw-keyrow kbd { background: #123f39; color: #6fd6c8; border-color: #2a544c; }

/* ---------- Ctrl+K ---------- */
#pwJumpInput {
    width: 100%; border: 0; outline: 0; background: transparent; color: inherit;
    font-size: 1.05rem; font-weight: 600; padding: .95rem 1rem;
}
.pw-jump-list { max-height: 46vh; overflow-y: auto; border-top: 1px solid rgba(128,128,128,.22); }
.pw-jump-item {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; width: 100%;
    background: none; border: 0; text-align: left; color: inherit;
    padding: .5rem 1rem; font-size: .92rem;
}
.pw-jump-item.active, .pw-jump-item:hover { background: rgba(14, 128, 116, .16); }
.pw-jump-label { font-weight: 600; }
.pw-jump-group { font-size: .75rem; color: var(--pw-ink-muted); white-space: nowrap; }
.pw-jump-empty { padding: .9rem 1rem; color: var(--pw-ink-muted); font-size: .9rem; }
.pw-jump-foot { padding: .5rem 1rem; border-top: 1px solid rgba(128,128,128,.22);
    font-size: .76rem; color: var(--pw-ink-muted); }

@media print { .pw-overlay, .pw-keybar { display: none !important; } }

/* ---------- F4 stock inquiry ---------- */
.pw-overlay-panel.pw-overlay-wide { max-width: 940px; }
.pw-dim { color: var(--pw-ink-muted); font-weight: 500; }
.pw-inq-head { margin-bottom: .8rem; }
.pw-inq-head b { font-size: 1.05rem; }
.pw-inq-flag { background: #e05260; color: #fff; border-radius: 4px; padding: .05rem .35rem;
    font-size: .7rem; font-weight: 700; letter-spacing: .04em; }
.pw-inq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.4rem; }
.pw-inq-wide { grid-column: 1 / -1; }
.pw-inq-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--pw-ink-muted); font-weight: 700; margin-bottom: .25rem; }
.pw-inq-big { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pw-inq-table { width: 100%; font-size: .84rem; border-collapse: collapse; }
.pw-inq-table th { font-weight: 600; color: var(--pw-ink-muted); font-size: .74rem;
    padding: .1rem .35rem; border-bottom: 1px solid rgba(128,128,128,.25); }
.pw-inq-table td { padding: .16rem .35rem; border-bottom: 1px solid rgba(128,128,128,.12); }
.pw-inq-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Red for gone, amber for going. The cashier is holding the box while they read this. */
.pw-inq-table tr.pw-exp-bad td { color: #e05260; font-weight: 600; }
.pw-inq-table tr.pw-exp-warn td { color: #d08700; font-weight: 600; }
html[data-bs-theme="dark"] .pw-inq-table tr.pw-exp-warn td { color: #e5a94e; }
html[data-bs-theme="dark"] .pw-inq-table tr.pw-exp-bad td { color: #ff6b7a; }
@media (max-width: 767.98px) { .pw-inq-grid { grid-template-columns: 1fr; } }
/* The history tabs. Numbered because the till is driven from the keyboard: 1-5 jump to a tab. */
.pw-inq-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .8rem;
    border-bottom: 1px solid rgba(128,128,128,.25); }
.pw-inq-tabs button { background: none; border: 0; border-bottom: 2px solid transparent;
    padding: .35rem .7rem; font-size: .86rem; font-weight: 600; color: var(--pw-ink-muted); margin-bottom: -1px; }
.pw-inq-tabs button:hover { color: var(--pw-ink); }
.pw-inq-tabs button.active { color: var(--pw-primary); border-bottom-color: var(--pw-primary); }
.pw-inq-tabs button:focus-visible { outline: 2px solid var(--pw-primary); outline-offset: -2px; border-radius: 4px; }
.pw-inq-scroll { max-height: 55vh; overflow: auto; }
.pw-inq-scroll thead th { position: sticky; top: 0; background: var(--pw-content-bg); }
html[data-bs-theme="dark"] .pw-inq-scroll thead th { background: #16241f; }
html[data-bs-theme="light"] .pw-inq-scroll thead th { background: #fff; }
.pw-inq-table tr.pw-inq-sub td { font-weight: 600; }
.pw-inq-scroll .pw-inq-table td { white-space: nowrap; }

/* Short-dated stock, called out on the till's hint line and in its result list. */
.pos-expiry-warn { color: #d08700; font-weight: 600; }
.pos-expiry-bad { color: #e05260; font-weight: 700; }
html[data-bs-theme="dark"] .pos-expiry-warn { color: #e5a94e; }
html[data-bs-theme="dark"] .pos-expiry-bad { color: #ff6b7a; }
.pos-result .r-exp { margin-left: .4rem; font-size: .72rem; font-weight: 700;
    background: rgba(208,135,0,.18); color: #d08700; border-radius: 4px; padding: 0 .3rem; }
.pos-result .r-exp.bad { background: rgba(224,82,96,.2); color: #e05260; }
html[data-bs-theme="dark"] .pos-result .r-exp { color: #e5a94e; }
html[data-bs-theme="dark"] .pos-result .r-exp.bad { color: #ff6b7a; }

/* "no expiry" beneath the date box on a delivery line — small, because it should be the exception. */
/* A line-entry grid that reads like a spreadsheet: one straight row per line, every value in its
   own cell, the same height across. Asked for by the branches on 24 Sep 2026 - the first version
   stacked hints under the boxes, so rows were ragged and the eye had to hunt. Nothing sits under
   a box any more; anything a person needs to see gets a cell of its own. */
.pw-sheet { border-collapse: collapse; width: 100%; font-size: .85rem; }
.pw-sheet th, .pw-sheet td {
    border: 1px solid rgba(16, 24, 40, .14); padding: 0; height: 2rem; vertical-align: middle;
    white-space: nowrap;
}
.pw-sheet thead th {
    background: var(--pw-primary-soft); color: var(--pw-ink); font-weight: 600; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .02em; padding: 0 .45rem;
}
.pw-sheet td.pw-cell-ro { padding: 0 .45rem; color: var(--pw-ink); }
.pw-sheet td.pw-cell-muted { padding: 0 .45rem; color: var(--pw-ink-muted); }
.pw-sheet td input:not([type="checkbox"]) {
    display: block; width: 100%; height: 2rem; border: 0; border-radius: 0; margin: 0;
    padding: 0 .45rem; background: transparent; color: var(--pw-ink); font: inherit;
    -moz-appearance: textfield;
}
/* The up/down arrows on a number box are a mouse target inside a cell the width of five digits;
   a click meant for the box steps the value instead. Spreadsheet cells have none. */
.pw-sheet td input[type="number"]::-webkit-inner-spin-button,
.pw-sheet td input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pw-sheet td input:focus { outline: 2px solid var(--pw-primary); outline-offset: -2px; background: var(--pw-primary-soft); }
.pw-sheet td input.is-invalid { outline: 2px solid #dc3545; outline-offset: -2px; }
.pw-sheet td input[readonly] { color: var(--pw-ink-muted); }
.pw-sheet td.pw-cell-check { text-align: center; }
.pw-sheet td .btn { border-radius: 0; height: 2rem; width: 100%; border: 0; }
.pw-sheet tfoot td { padding: 0 .45rem; border-color: transparent; }
.pw-sheet tfoot tr.pw-total td { font-weight: 700; border-top: 2px solid var(--pw-ink); }
/* The entry row, PharmaCORE's: a row of input cells directly under the column labels, with the
   committed lines in the same columns below it - Cash Sale, Sales Invoice and Purchase Order all
   look like this on the desktop. */
.pw-sheet tr.pw-entry td { background: rgba(14, 128, 116, .06); border-bottom: 2px solid var(--pw-primary); }
.pw-sheet tr.pw-entry td input:not([type="checkbox"]) { font-weight: 600; }
.pw-sheet td.pw-cell-pick { position: relative; overflow: visible; }
.pw-sheet td.pw-cell-pick .pos-results { min-width: 36rem; left: 0; top: 100%; }
.pw-sheet td .btn.pw-add { font-weight: 700; font-size: .75rem; letter-spacing: .03em; }
.pw-sheet tbody tr.pw-empty td { color: var(--pw-ink-muted); text-align: center; height: 4rem; }
.pw-sheet-wrap { overflow: visible; }
/* A branch set not to show VAT (Branch.ShowVat): its VAT columns and VAT totals are hidden. The
   figures are still computed and still written into PharmaCORE - this is what people SEE. */
.pw-hide-vat .pw-col-vat { display: none !important; }
@media (max-width: 991.98px) { .pw-sheet-wrap { overflow-x: auto; } }
html[data-bs-theme="dark"] .pw-sheet th, html[data-bs-theme="dark"] .pw-sheet td { border-color: rgba(255, 255, 255, .14); }
html[data-bs-theme="dark"] .pw-sheet tfoot td { border-color: transparent; }

.pw-noexp { display: block; font-size: .7rem; color: var(--pw-ink-muted); margin-top: .15rem; cursor: pointer; }
.pw-noexp input { margin-right: .2rem; vertical-align: -1px; }

/* Twelve months of buying, one bar a month — PharmaCORE's VIEW 12 MONTH PURCHASES. Empty months
   are drawn as empty on purpose: a gap is the thing a purchaser is looking for. */
.pw-p12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: .25rem; align-items: end; }
.pw-p12-col { text-align: center; }
.pw-p12-bar { height: 46px; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(128,128,128,.10); border-radius: 3px; }
.pw-p12-bar i { display: block; width: 62%; min-height: 2px; border-radius: 2px 2px 0 0;
    background: var(--pw-primary); }
html[data-bs-theme="dark"] .pw-p12-bar i { background: #14b8a6; }
.pw-p12-lbl { font-size: .62rem; color: var(--pw-ink-muted); margin-top: .15rem; }

/* A PIN box: masked like a password, but a text field so the browser never offers to save it
   (a saved PIN on a shared counter computer fills itself in for the next person). */
.pw-pin { -webkit-text-security: disc; text-security: disc; letter-spacing: .2em; }
