/* =====================================================================
   MediStock — "Clinic Teal" design system
   Palette : pine ink sidebar · teal primary · cool mist canvas
   Type    : Bricolage Grotesque (display, numbers) + Instrument Sans (UI)
   Layout  : mobile-first-safe. Off-canvas nav < 1024px, stacked grids,
             bottom-sheet modals and card-style tables on phones.
   NOTE    : All original class names and CSS variable names are kept, so
             every module inherits the new look automatically.
   ===================================================================== */

:root {
    /* brand */
    --accent:        #0B7A75;
    --accent-dark:   #085E5A;
    --accent-light:  #17A398;
    --accent-pale:   #E6F4F2;
    --accent-dim:    rgba(11, 122, 117, 0.09);
    --accent-glow:   rgba(11, 122, 117, 0.22);
    /* legacy aliases (modules / landing pages may still reference these) */
    --opay-orange:       var(--accent);
    --opay-orange-dark:  var(--accent-dark);
    --opay-orange-light: var(--accent-light);
    --opay-orange-pale:  var(--accent-pale);

    /* ink (sidebar) */
    --ink:        #0A2A2C;
    --ink-2:      #103A3C;
    --ink-text:   #A6C3C2;
    --ink-bright: #EAF7F5;
    --ink-line:   rgba(255,255,255,0.08);

    /* surfaces */
    --bg-base:     #F0F5F4;
    --bg-surface:  #FFFFFF;
    --bg-card:     #FFFFFF;
    --bg-hover:    #F6F9F9;
    --border:      #DCE6E4;
    --border-light:#C3D2D0;

    /* status */
    --blue:        #2563EB;  --blue-dim:    rgba(37, 99, 235, 0.10);
    --purple:      #7C3AED;  --purple-dim:  rgba(124, 58, 237, 0.10);
    --amber:       #B45309;  --amber-dim:   rgba(217, 119, 6, 0.12);
    --rose:        #D63A3A;  --rose-dim:    rgba(214, 58, 58, 0.09);
    --emerald:     #15803D;  --emerald-dim: rgba(21, 128, 61, 0.10);

    /* text */
    --text-primary:   #10262A;
    --text-secondary: #466063;
    --text-muted:     #647A7E;

    /* layout */
    --sidebar-w: 268px;
    --topbar-h:  64px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --shadow:    0 1px 2px rgba(16,38,42,0.05), 0 1px 3px rgba(16,38,42,0.04);
    --shadow-md: 0 6px 18px rgba(16,38,42,0.08);
    --shadow-lg: 0 16px 48px rgba(16,38,42,0.16);
    --trans:     all 0.18s cubic-bezier(.4,0,.2,1);

    --font-display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
    --font-body:    'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh; min-height: 100dvh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
    overflow-x: hidden;
}
img, svg, canvas, video { max-width: 100%; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, .page-title, .table-title, .modal-title { font-family: var(--font-display); }

/* ── App Shell ── */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* =====================================================================
   SIDEBAR  (the one bold element: deep pine, light-on-dark)
   ===================================================================== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--ink);
    color: var(--ink-text);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100; transition: transform .25s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 22px 20px 18px; flex-shrink: 0;
    border-bottom: 1px solid var(--ink-line);
}
.brand-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(145deg, var(--accent-light), var(--accent));
    display: grid; place-items: center;
    font-size: 17px; color: #fff; flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(23,163,152,0.35);
}
.brand-text { min-width: 0; }
.brand-name {
    font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
    color: #fff; display: block; letter-spacing: -0.02em; line-height: 1.15;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: 0.72rem; color: var(--ink-text); display: block; opacity: .85; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0 12px; overscroll-behavior: contain; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.nav-section { padding: 6px 0 2px; }
.nav-label {
    font-size: 0.74rem; font-weight: 600; letter-spacing: 0.01em;
    color: rgba(166,195,194,0.62); padding: 10px 22px 5px; display: block;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 14px; color: var(--ink-text);
    text-decoration: none; font-size: 0.9rem; font-weight: 500;
    transition: var(--trans); position: relative;
    margin: 1px 12px; border-radius: 10px; min-height: 40px;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.92rem; flex-shrink: 0; opacity: .9; }
.nav-item span { flex: 1; min-width: 0; }
.nav-item:hover { color: var(--ink-bright); background: rgba(255,255,255,0.06); }
.nav-item.active {
    color: #fff; background: rgba(23,163,152,0.20); font-weight: 600;
}
.nav-item.active i { color: #5FE0D2; opacity: 1; }
.nav-item.active::before {
    content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px;
    width: 4px; background: #3FD0C2; border-radius: 0 4px 4px 0;
}
.nav-badge {
    background: var(--rose); color: #fff; font-size: 0.66rem; font-weight: 700;
    padding: 1px 7px; border-radius: 20px; min-width: 20px; text-align: center; line-height: 1.5;
}

.sidebar-footer {
    border-top: 1px solid var(--ink-line); padding: 12px 14px 12px 16px;
    display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.16);
    flex-shrink: 0;
}
.sf-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sf-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(145deg, var(--accent-light), var(--accent));
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; font-size: 0.88rem; color: #fff; flex-shrink: 0;
}
.sf-info { flex: 1; min-width: 0; }
.sf-info span { display: block; font-size: 0.85rem; font-weight: 600; color: var(--ink-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-info small { font-size: 0.74rem; color: var(--ink-text); }
.sf-logout {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: rgba(255,255,255,0.07); color: #FFB4B4;
    display: grid; place-items: center; text-decoration: none; transition: var(--trans); font-size: 0.85rem;
}
.sf-logout:hover { background: var(--rose); color: #fff; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(8,28,30,0.55); backdrop-filter: blur(2px); z-index: 99;
}
.sidebar-overlay.open { display: block; }
.sidebar-close-btn {
    display: none; position: absolute; top: 16px; right: 14px;
    width: 34px; height: 34px; border-radius: 10px;
    background: rgba(255,255,255,0.08); border: 1px solid var(--ink-line);
    color: var(--ink-bright); cursor: pointer; align-items: center; justify-content: center; z-index: 1;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,0.16); }

/* =====================================================================
   MAIN + TOPBAR
   ===================================================================== */
.main-content {
    flex: 1; margin-left: var(--sidebar-w); min-width: 0;
    display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}
.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,0.88); backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sidebar-toggle {
    display: none; background: var(--bg-hover); border: 1px solid var(--border);
    color: var(--text-secondary); width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 10px; cursor: pointer; place-items: center; transition: var(--trans);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); min-width: 0; }
.breadcrumb .sep { color: var(--border-light); }
.breadcrumb .current-page { color: var(--text-primary); font-weight: 700; font-family: var(--font-display); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.notif-wrapper { position: relative; }
.notif-btn {
    position: relative; width: 38px; height: 38px;
    background: var(--bg-hover); border: 1px solid var(--border);
    border-radius: 10px; display: grid; place-items: center;
    color: var(--text-secondary); cursor: pointer; transition: var(--trans); font-size: 0.95rem; text-decoration: none;
}
.notif-btn:hover { color: var(--accent); border-color: var(--accent); }
.notif-btn.has-notif { color: var(--accent); border-color: rgba(11,122,117,0.35); background: var(--accent-dim); }
.notif-btn .badge {
    position: absolute; top: -6px; right: -6px; background: var(--rose); color: #fff;
    font-size: 0.62rem; font-weight: 700; min-width: 17px; height: 17px; padding: 0 3px;
    border-radius: 9px; display: grid; place-items: center; border: 2px solid #fff;
}
.notif-panel {
    position: absolute; top: calc(100% + 10px); right: 0; width: 320px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); z-index: 300; overflow: hidden; animation: slideUp .18s ease;
    max-height: 70vh; overflow-y: auto;
}

.user-menu {
    display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative;
    padding: 5px 12px 5px 6px; background: var(--bg-hover); border: 1px solid var(--border);
    border-radius: 999px; transition: var(--trans);
}
.user-menu:hover { border-color: var(--accent); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(145deg, var(--accent-light), var(--accent));
    display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 0.8rem; color: #fff;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.7rem; color: var(--accent); font-weight: 600; }
.user-dropdown {
    display: none; position: absolute; top: calc(100% + 8px); right: 0; background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius); padding: 6px;
    min-width: 180px; box-shadow: var(--shadow-lg); z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text-secondary);
    text-decoration: none; font-size: 0.86rem; border-radius: 8px; transition: var(--trans);
}
.user-dropdown a:hover { color: var(--accent); background: var(--accent-dim); }

/* =====================================================================
   PAGE
   ===================================================================== */
.page-body { padding: 26px 28px 40px; flex: 1; min-width: 0; max-width: 1680px; width: 100%; margin: 0 auto; }
.page-header { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.page-subtitle { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); min-width: 0; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px;
    display: flex; align-items: center; gap: 16px; transition: var(--trans); position: relative; overflow: hidden;
    box-shadow: var(--shadow); min-width: 0;
}
.stat-card:hover { border-color: var(--accent-light); box-shadow: var(--shadow-md); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-body { min-width: 0; }
.stat-value { font-family: var(--font-display); font-size: clamp(1.25rem, 1.05rem + .7vw, 1.6rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.stat-delta { font-size: 0.74rem; margin-top: 4px; }
.delta-up { color: var(--emerald); } .delta-down { color: var(--rose); }
.color-green  .stat-icon { background: var(--emerald-dim); color: var(--emerald); }
.color-blue   .stat-icon { background: var(--blue-dim);    color: var(--blue); }
.color-amber  .stat-icon { background: var(--amber-dim);   color: var(--amber); }
.color-rose   .stat-icon { background: var(--rose-dim);    color: var(--rose); }
.color-accent .stat-icon { background: var(--accent-dim);  color: var(--accent); }
.color-purple .stat-icon { background: var(--purple-dim);  color: var(--purple); }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; font-size: 0.875rem; font-weight: 600; font-family: var(--font-body);
    border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: var(--trans);
    white-space: nowrap; line-height: 1.1; min-height: 40px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(8,94,90,0.3); }
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 4px 14px rgba(11,122,117,0.32); }
.btn-secondary { background: #fff; color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-danger  { background: var(--rose-dim);   color: var(--rose);   border-color: rgba(214,58,58,0.22); }
.btn-danger:hover  { background: var(--rose);   color: #fff; }
.btn-warning { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(217,119,6,0.25); }
.btn-warning:hover { background: #D97706; color: #fff; }
.btn-info    { background: var(--blue-dim);   color: var(--blue);   border-color: rgba(37,99,235,0.22); }
.btn-info:hover    { background: var(--blue);   color: #fff; }
.btn-sm  { padding: 6px 12px; font-size: 0.8rem; min-height: 34px; }
.btn-lg  { padding: 13px 24px; font-size: 0.97rem; min-height: 48px; }
.btn-icon { padding: 0; width: 36px; height: 36px; min-height: 36px; }

/* =====================================================================
   TABLES
   ===================================================================== */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.table-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.table-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; padding: 11px 16px; font-size: 0.78rem; font-weight: 600;
    color: var(--text-secondary); background: #F3F8F7; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #E8EFED; transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #F3FAF9; }
tbody td { padding: 12px 16px; font-size: 0.88rem; color: var(--text-primary); vertical-align: middle; }

/* =====================================================================
   FORMS
   ===================================================================== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-control, .form-select {
    width: 100%; padding: 10px 14px; min-height: 42px; background: #fff; border: 1.5px solid var(--border);
    border-radius: 10px; color: var(--text-primary); font-family: var(--font-body); font-size: 0.9rem;
    transition: var(--trans); outline: none;
}
.form-control:hover, .form-select:hover { border-color: var(--border-light); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11,122,117,0.14); }
.form-control::placeholder { color: #90A3A6; }
textarea.form-control { resize: vertical; min-height: 84px; }
select.form-control, .form-select { appearance: none; -webkit-appearance: none; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23647A7E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form-grid.col-2 { grid-template-columns: 1fr 1fr; }
.form-grid.col-3 { grid-template-columns: 1fr 1fr 1fr; }
.span-full { grid-column: 1 / -1; }

/* Pills */
.badge-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.74rem; font-weight: 600; white-space: nowrap; }
.pill-green  { background: var(--emerald-dim); color: var(--emerald); }
.pill-red, .pill-rose { background: var(--rose-dim); color: var(--rose); }
.pill-amber  { background: var(--amber-dim);   color: var(--amber); }
.pill-blue   { background: var(--blue-dim);    color: var(--blue); }
.pill-purple { background: var(--purple-dim);  color: var(--purple); }
.pill-muted  { background: #ECF1F0;            color: var(--text-secondary); }
.pill-orange { background: var(--accent-dim);  color: var(--accent); }

.search-bar { position: relative; display: flex; align-items: center; }
.search-bar i { position: absolute; left: 13px; color: var(--text-muted); font-size: 0.85rem; pointer-events: none; }
.search-bar input { padding-left: 36px; min-width: 220px; }

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(8,28,30,0.5); backdrop-filter: blur(3px); z-index: 1000; place-items: center; padding: 16px; }
.modal-overlay.open { display: grid; }
.modal { background: #fff; border-radius: var(--radius-lg); width: min(100%, 600px); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .22s ease; -webkit-overflow-scrolling: touch; }
.modal-lg { width: min(100%, 880px); }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--accent-pale); position: sticky; top: 0; z-index: 2; }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close { width: 34px; height: 34px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; transition: var(--trans); }
.modal-close:hover { color: var(--rose); border-color: var(--rose); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; background: var(--bg-hover); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--emerald-dim); color: #166534; border-color: rgba(21,128,61,0.25); }
.alert-error   { background: var(--rose-dim);    color: #B42323; border-color: rgba(214,58,58,0.25); }
.alert-warning { background: var(--amber-dim);   color: #92400E; border-color: rgba(217,119,6,0.3); }
.alert-info    { background: var(--blue-dim);    color: #1D4ED8; border-color: rgba(37,99,235,0.25); }

/* =====================================================================
   LOGIN  (split screen; stacks on mobile)
   ===================================================================== */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.login-hero {
    position: relative; overflow: hidden; background: var(--ink); color: #fff;
    display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px;
}
.login-hero::before {
    content: ''; position: absolute; width: 620px; height: 620px; right: -220px; bottom: -240px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(23,163,152,0.55), rgba(23,163,152,0) 68%);
}
.login-hero::after {
    content: ''; position: absolute; inset: 0; opacity: .5;
    background-image: linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: linear-gradient(160deg, #000 0%, transparent 70%); -webkit-mask-image: linear-gradient(160deg, #000 0%, transparent 70%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero-top { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.login-hero-top .brand-icon { width: 42px; height: 42px; }
.login-hero h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.035em; line-height: 1.04; font-size: clamp(2.1rem, 1.2rem + 2.6vw, 3.4rem); max-width: 14ch; }
.login-hero p { color: var(--ink-text); font-size: 1rem; max-width: 40ch; margin-top: 16px; }
.login-points { display: flex; flex-wrap: wrap; gap: 10px; }
.login-points span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--ink-line); background: rgba(255,255,255,0.05); border-radius: 999px; font-size: 0.82rem; color: var(--ink-bright); }
.login-points i { color: #5FE0D2; }
.login-pane { display: grid; place-items: center; padding: 32px 24px; background: var(--bg-base); }
.login-box { width: min(420px, 100%); }
.login-brand { margin-bottom: 22px; }
.login-brand h1 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.login-brand p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.login-back { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); text-decoration: none; margin-bottom: 18px; }
.login-back:hover { color: var(--accent); }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-md); }
.login-card h2 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; }
.login-logo { display: none; }

/* =====================================================================
   DASHBOARD / POS
   ===================================================================== */
.dash-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 20px; }
.dash-grid > * { min-width: 0; }
.recent-list { display: flex; flex-direction: column; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.recent-item:last-child { border-bottom: none; }
.recent-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 0.9rem; }
.recent-body { flex: 1; min-width: 0; }
.recent-name { font-weight: 600; } .recent-sub { font-size: 0.76rem; color: var(--text-muted); margin-top: 1px; }
.recent-amount { font-family: var(--font-display); font-weight: 600; color: var(--accent); font-size: 0.92rem; white-space: nowrap; }

.pos-grid { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 20px; align-items: start; }
.pos-left, .pos-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pos-right { position: sticky; top: calc(var(--topbar-h) + 16px); }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.88rem; font-weight: 600; } .cart-item-price { font-size: 0.76rem; color: var(--text-muted); }
.cart-qty { display: flex; align-items: center; gap: 6px; }
.qty-btn { width: 30px; height: 30px; background: #fff; border: 1.5px solid var(--border); border-radius: 8px; color: var(--text-primary); cursor: pointer; display: grid; place-items: center; transition: var(--trans); }
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-val { width: 30px; text-align: center; font-weight: 700; font-size: 0.9rem; }
.cart-subtotal { font-weight: 700; color: var(--accent); font-family: var(--font-display); min-width: 80px; text-align: right; }
.cart-remove { color: var(--rose); cursor: pointer; padding: 6px; }
.checkout-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 0.88rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.checkout-row:last-child { border-bottom: none; }
.checkout-row.total { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--text-primary); }
.checkout-row.total span:last-child { color: var(--accent); }
.stock-bar { width: 80px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.stock-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.product-card { background: #fff; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; transition: var(--trans); display: flex; align-items: center; gap: 12px; }
.product-card:hover { border-color: var(--accent); background: var(--accent-dim); }
.product-card-icon { width: 40px; height: 40px; background: var(--accent-dim); border-radius: 10px; display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.product-card-info { flex: 1; min-width: 0; }
.product-card-name { font-weight: 600; font-size: 0.88rem; } .product-card-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.product-card-price { font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 0.92rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.6rem; margin-bottom: 14px; opacity: .3; display: block; color: var(--accent); }
.empty-state h3 { font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.88rem; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px; box-shadow: var(--shadow-lg); animation: toastIn .28s ease; font-size: 0.88rem; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.toast-success { border-left: 4px solid var(--emerald); } .toast.toast-error { border-left: 4px solid var(--rose); } .toast.toast-warning { border-left: 4px solid #D97706; }
.toast-success .toast-icon { color: var(--emerald); } .toast-error .toast-icon { color: var(--rose); } .toast-warning .toast-icon { color: #D97706; }

/* Roles */
.role-admin { color: var(--accent) !important; } .role-manager { color: var(--blue) !important; } .role-cashier { color: var(--purple) !important; }

/* Utilities */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); } .text-accent { color: var(--accent); } .text-rose { color: var(--rose); }
.text-amber { color: var(--amber); } .text-blue { color: var(--blue); } .font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; } .text-xs { font-size: 0.75rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 8px; }

/* Inline-style hooks for the shared topbar widgets (branch / currency / calculator) */
#cur-panel, #calc-panel { max-width: calc(100vw - 24px); }

/* =====================================================================
   PRINT
   ===================================================================== */
@media print {
    .sidebar, .sidebar-overlay, .topbar, .btn, .modal-overlay, .table-actions, .notif-wrapper, .user-menu { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { background: #fff !important; }
    .no-print { display: none !important; }
    .table-wrap, .card { box-shadow: none !important; }
}

/* =====================================================================
   RESPONSIVE
   Breakpoints:  1280 laptop · 1100 tablet-landscape · 1024 nav drawer
                 768 tablet-portrait · 640 phone · 400 small phone
   ===================================================================== */
@media (max-width: 1280px) {
    .dash-grid { grid-template-columns: minmax(0,1fr) 320px; }
    .pos-grid  { grid-template-columns: minmax(0,1fr) 340px; }
}
@media (max-width: 1100px) {
    .dash-grid, .pos-grid { grid-template-columns: minmax(0,1fr); }
    .pos-right { position: static; }
}

/* ── Navigation becomes an off-canvas drawer ── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: min(300px, 86vw); box-shadow: none; }
    .sidebar.open { transform: none; box-shadow: 8px 0 40px rgba(0,0,0,0.35); }
    .sidebar-close-btn { display: flex; }
    .sidebar-toggle { display: grid; }
    body.sidebar-locked { overflow: hidden; }
    .main-content { margin-left: 0; }
    .page-body { padding: 22px 20px 36px; }
    .topbar { padding: 0 18px; }
    .user-menu .user-info { display: none; }
    .user-menu { padding: 4px; }
    /* inline 2-pane layouts used inside modules */
    [style*="grid-template-columns"][style*="2fr 1fr"],
    [style*="grid-template-columns"][style*="1fr 340px"],
    [style*="grid-template-columns"][style*="320px 1fr"],
    [style*="grid-template-columns"][style*="200px 1fr"],
    [style*="grid-template-columns"][style*="1fr 2fr"] { grid-template-columns: minmax(0,1fr) !important; }
}

@media (max-width: 900px) {
    [style*="grid-template-columns"][style*="repeat(4,1fr)"],
    [style*="grid-template-columns"][style*="repeat(4, 1fr)"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
    [style*="grid-template-columns"][style*="repeat(6,1fr)"],
    [style*="grid-template-columns"][style*="repeat(6, 1fr)"] { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
    [style*="grid-template-columns"][style*="2fr 1fr 1fr"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
    .login-page { grid-template-columns: 1fr; }
    .login-hero { padding: 28px 24px 30px; gap: 28px; }
    .login-hero h2 { max-width: none; font-size: clamp(1.7rem, 1.2rem + 3vw, 2.4rem); }
    .login-hero::before { width: 380px; height: 380px; right: -140px; bottom: -160px; }
    .login-pane { padding: 28px 18px 40px; align-items: start; }
}

@media (max-width: 768px) {
    html { font-size: 14.5px; }
    .page-header { align-items: flex-start; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
    .stat-card { padding: 14px; gap: 12px; }
    .stat-icon { width: 42px; height: 42px; }
    .form-grid.col-3 { grid-template-columns: 1fr 1fr; }
    .form-grid.col-2 { grid-template-columns: 1fr; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { min-width: 0; max-width: none; }

    /* Topbar widgets stay reachable — compact, panels pin under the bar */
    .topbar-right { gap: 8px; }
    .topbar-branch-indicator { padding: 0 !important; width: 38px; height: 38px; justify-content: center; max-width: none !important; }
    .topbar-branch-indicator > span, .topbar-branch-indicator > i.fa-star { display: none !important; }
    .topbar-branch-indicator > i.fa-code-branch { font-size: 0.95rem !important; }
    #cur-switcher-wrap > button { height: 38px; padding: 0 9px !important; }
    #cur-switcher-wrap > button > i { display: none; }
    #cur-panel, #calc-panel, .notif-panel {
        position: fixed !important; top: calc(var(--topbar-h) + 8px) !important; right: 12px !important; left: auto !important;
    }
    .notif-panel { width: min(360px, calc(100vw - 24px)); }
    #cur-panel { width: min(240px, calc(100vw - 24px)) !important; }

    /* Tables: horizontal scroll fallback */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-wrap table, .table-scroll table { min-width: 620px; }
    .table-head, .table-actions { width: 100%; }
    .table-actions .search-bar { flex: 1 1 180px; }
    .search-bar input { min-width: 0; width: 100%; }

    /* Module tab bars (inline "width:fit-content" pill groups) scroll sideways */
    .page-body [style*="width:fit-content"] { max-width: 100%; overflow-x: auto; flex-wrap: nowrap !important; scrollbar-width: none; }
    .page-body [style*="width:fit-content"]::-webkit-scrollbar { display: none; }
    .page-body [style*="width:fit-content"] > a, .page-body [style*="width:fit-content"] > button { flex-shrink: 0; white-space: nowrap; }
}

@media (max-width: 640px) {
    .page-body { padding: 16px 14px 32px; }
    .topbar { padding: 0 12px; }
    .breadcrumb-home, .breadcrumb .sep { display: none; }
    .card { padding: 16px; border-radius: 14px; }
    .page-header .btn, .page-header form { max-width: 100%; }
    .login-card { padding: 22px 18px; border-radius: 18px; }

    /* Every inline multi-column grid → single column, except tiny stat tiles */
    [style*="grid-template-columns"]:not([style*="auto-fill"]):not([style*="auto-fit"]) { grid-template-columns: minmax(0,1fr) !important; }
    [style*="grid-template-columns"][style*="repeat(2,1fr)"], [style*="grid-template-columns"][style*="repeat(2, 1fr)"],
    [style*="grid-template-columns"][style*="repeat(3,1fr)"], [style*="grid-template-columns"][style*="repeat(3, 1fr)"],
    [style*="grid-template-columns"][style*="repeat(4,1fr)"], [style*="grid-template-columns"][style*="repeat(4, 1fr)"],
    [style*="grid-template-columns"][style*="repeat(6,1fr)"], [style*="grid-template-columns"][style*="repeat(6, 1fr)"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
    [style*="grid-column"] { grid-column: 1 / -1 !important; }
    .form-grid, .form-grid.col-2, .form-grid.col-3 { grid-template-columns: 1fr; }
    .product-grid { grid-template-columns: 1fr; max-height: 340px; }

    /* Flex rows with space-between (title + actions) wrap instead of overflowing */
    .page-body [style*="display:flex"][style*="justify-content:space-between"] { flex-wrap: wrap; gap: 8px; }
    .page-body input[style*="width:"], .page-body select[style*="width:"] { max-width: 100%; }
    .page-body [style*="min-width:2"], .page-body [style*="min-width:3"] { min-width: 0 !important; }

    /* Modals become bottom sheets */
    .modal-overlay { padding: 0; place-items: end center; }
    .modal, .modal-lg, .modal-overlay > div[style*="width"] {
        width: 100% !important; max-width: 100% !important; max-height: 92dvh;
        border-radius: 20px 20px 0 0; animation: sheetUp .26s ease;
    }
    .modal-body { padding: 18px 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .modal-footer .btn { flex: 1 1 140px; }
    @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

    /* Tables → stacked cards (JS adds .stack-mobile + data-label to eligible tables) */
    .table-wrap table.stack-mobile { min-width: 0; }
    table.stack-mobile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.stack-mobile, table.stack-mobile tbody { display: block; width: 100%; }
    table.stack-mobile tbody tr { display: block; padding: 12px 14px; border-bottom: 8px solid var(--bg-base); }
    table.stack-mobile tbody tr:last-child { border-bottom: none; }
    table.stack-mobile tbody td {
        display: flex; align-items: center; justify-content: space-between; gap: 14px;
        padding: 6px 0; text-align: right; border: none; min-width: 0; word-break: break-word;
    }
    table.stack-mobile tbody td::before {
        content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left;
        font-size: 0.76rem; font-weight: 600; color: var(--text-muted);
    }
    table.stack-mobile tbody td[data-label=""]::before { display: none; }
    table.stack-mobile tbody td[data-label=""] { justify-content: flex-end; padding-top: 10px; }
    table.stack-mobile tbody td > * { max-width: 100%; }
}

@media (max-width: 400px) {
    .stat-grid { grid-template-columns: minmax(0,1fr); }
    .topbar-right { gap: 6px; }
    .btn { padding: 9px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
