/* ══════════════════════════════════════════
   PAAC – Zigmaray-style dark PACS theme
   ══════════════════════════════════════════ */

:root {
    --bg-body:       #15171b;
    --bg-nav:        #1b1d22;
    --bg-toolbar:    #21242a;
    --bg-card:       #24272d;
    --bg-card-head:  #2b2f36;
    --bg-input:      #1c1f24;
    --bg-tbl-head:   #30343b;
    --bg-row-alt:    rgba(255,255,255,0.012);
    --bg-row-hover:  rgba(255,255,255,0.08);
    --border:        #484c54;
    --border-light:  #3b3f46;
    --accent:        #b8b8b8;
    --accent-hover:  #dfdfdf;
    --accent-soft:   rgba(255,255,255,0.14);
    --accent-glow:   rgba(255,255,255,0.22);
    --accent2:       #10b981;
    --accent3:       #ffc857;
    --accent4:       #d74b58;
    --text:          #c9cdd3;
    --text-bright:   #f3f5f7;
    --text-heading:  #f3f5f7;
    --text-muted:    #8f949b;
    --text-header:   #b5bac1;
    --radius:        8px;
    --radius-sm:     4px;
    --shadow:        0 2px 14px rgba(0,0,0,0.55);
    --shadow-lg:     0 8px 28px rgba(0,0,0,0.65);
    --gradient-accent: linear-gradient(135deg, #6f7278 0%, #9f4c56 100%);
    --transition:    0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ─────────────────────────────────── */
html, body {
    height: 100%;
    background: var(--bg-body);
    background-image:
        radial-gradient(ellipse 1200px 600px at 15% -10%, rgba(255,255,255,0.08) 0%, transparent 62%),
        radial-gradient(ellipse 1000px 500px at 90% 110%, rgba(215,75,88,0.10) 0%, transparent 62%);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Sarabun', 'Segoe UI Variable', 'Noto Sans Thai', Tahoma, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
* { box-sizing: border-box; }
a { color: var(--accent-hover); transition: color var(--transition); }
a:hover { color: #f0b3ba; text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--text-bright); }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #2a2e42; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3f58; }

/* ── Navbar ───────────────────────────────── */
.navbar {
    background: linear-gradient(180deg, #2f3238 0%, #24272d 100%) !important;
    border: none !important;
    border-bottom: 1px solid #3a3f47 !important;
    min-height: 68px;
    margin-bottom: 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.7), inset 0 -1px 0 rgba(255,255,255,0.02);
    border-radius: 0 !important;
    backdrop-filter: blur(8px);
}
.navbar-brand {
    color: var(--text-bright) !important;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 19px 24px;
    font-size: 20px;
}
.navbar-brand:hover,
.navbar-brand:focus,
.navbar-brand:active {
    text-decoration: none;
    outline: none !important;
    box-shadow: none !important;
}
.navbar-brand .brand-sigma { color: var(--accent-hover); }
.navbar-brand .brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.14em;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    vertical-align: middle;
    text-transform: uppercase;
}
.navbar-nav > li > a {
    color: var(--text) !important;
    padding: 23px 18px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color 0.15s, background 0.15s;
}
.navbar-nav > li > a:hover,
.navbar-nav > li.active > a {
    color: var(--text-bright) !important;
    background: rgba(255,255,255,0.08) !important;
}
.navbar-nav > li.active > a {
    border-bottom: 2px solid rgba(214, 224, 244, 0.72);
}
.navbar-nav > li > a .fa { margin-right: 8px; opacity: 0.75; }
.navbar-right .username-text {
    color: var(--text) !important;
    font-size: 13px;
    padding: 15px 10px;
    display: inline-block;
}
.navbar-right .btn-logout {
    color: var(--text) !important;
    background: transparent;
    border: 1px solid var(--border) !important;
    margin-top: 10px;
    margin-right: 10px;
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 4px;
}
.navbar-right .btn-logout:hover { background: rgba(255,255,255,0.08) !important; color: var(--text-bright) !important; }
.navbar-toggle { border-color: var(--border) !important; margin-top: 16px; margin-bottom: 16px; }
.navbar-toggle .icon-bar { background: var(--text) !important; }

/* ── Tooltip typography ───────────────────── */
.tooltip-inner {
    font-family: 'Sarabun', 'Segoe UI Variable', 'Noto Sans Thai', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-role {
    display: inline-block;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-left: 4px;
    vertical-align: middle;
    text-transform: uppercase;
}
.badge-role.admin { background: #5a2e35; color: #f3d9de; }
.badge-role.staff { background: #4c5159; color: #eceff3; }
.badge-role.doctor { background: #2f5d3f; color: #d7ffe8; }

/* ── Fixed toolbar panel ───────────────────── */
.panel-toolbar {
    position: fixed;
    top: 66px;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--bg-toolbar);
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    margin: 0;
    box-shadow: 0 3px 14px rgba(0,0,0,0.5);
}
.panel-toolbar .panel-body { padding: 9px 18px; }
.panel-toolbar .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-bright);
    height: 34px;
    font-size: 13px;
    border-radius: 4px 0 0 4px;
}
.panel-toolbar .form-control::placeholder { color: var(--text-muted); }
.panel-toolbar .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.12);
    background: #0e101c;
}
.panel-toolbar select.form-control {
    border-radius: 4px;
    cursor: pointer;
}
.panel-toolbar .input-group-btn .btn {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
    border-radius: 0 4px 4px 0;
    line-height: 34px;
}
.panel-toolbar .input-group-btn .btn:hover { background: var(--accent-hover); }

.toolbar-btn {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    background: #1c1e2c;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 4px !important;
    line-height: 34px;
    display: inline-block;
    text-decoration: none;
    margin-right: 3px;
    vertical-align: top;
    transition: background 0.12s, border-color 0.12s;
}
.toolbar-btn:hover { background: #252839 !important; color: var(--text-bright) !important; border-color: #3a3f58 !important; text-decoration: none; }
.toolbar-btn.active {
    background: rgba(215,75,88,0.18) !important;
    border-color: rgba(215,75,88,0.34) !important;
    color: #f0d3d7 !important;
}
.toolbar-btn .fa { margin-right: 5px; opacity: 0.75; }
.toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: var(--border);
    vertical-align: middle;
    margin: 0 10px;
}

/* ── Main panel (below toolbar) ─────────────── */
.panel-main {
    margin-top: 112px;
    padding: 12px 18px 24px;
}

/* ── Generic panel ────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    overflow: hidden;
}
.panel-heading {
    background: linear-gradient(180deg, var(--bg-card-head) 0%, #0c0d15 100%) !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-bright) !important;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.panel-body { padding: 14px 16px; }

/* ── Worklist table ───────────────────────── */
.table-worklist {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    color: var(--text);
    table-layout: fixed;
}
.table-worklist thead tr {
    background: var(--bg-tbl-head);
    border-bottom: 2px solid var(--border);
}
.table-worklist thead th {
    color: var(--text-header);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 10px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
    border-right: 1px solid var(--border-light);
    vertical-align: middle;
}
.table-worklist thead th:last-child { border-right: none; }
.table-worklist thead th .sort-icon {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: 4px;
}
.table-worklist thead th.sorted-asc  .sort-icon,
.table-worklist thead th.sorted-desc .sort-icon { color: var(--accent-hover); }

.table-worklist tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition), box-shadow var(--transition);
}
.table-worklist tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.table-worklist tbody tr:hover {
    background: var(--bg-row-hover) !important;
    box-shadow: inset 3px 0 0 var(--accent);
}

.table-worklist td {
    padding: 9px 10px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-right: 1px solid var(--border-light);
}
.table-worklist td:last-child { border-right: none; }

.col-num  { width: 36px;  text-align: center; color: var(--text-muted); font-size: 12px; }
.col-cb   { width: 32px;  text-align: center; }
.col-view { width: 74px; }
.col-hn   { width: 96px; }
.col-fn   { width: 120px; }
.col-ln   { width: 120px; }
.col-mod  { width: 64px;  text-align: center; }
.col-dt   { width: 140px; }

.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    background: #262a31;
    border: 1px solid #4a4d54;
    color: #d7dbe0;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
}
.btn-view:hover { background: #343840; border-color: #676c74; color: #f1f3f5; text-decoration: none; }

.mod-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: #1a2438;
    color: #6ca4e0;
    border: 1px solid #253652;
}

.empty-state-row td {
    text-align: center;
    padding: 80px 20px !important;
    color: var(--text-muted);
}
.empty-state-row .fa { display: block; font-size: 42px; margin-bottom: 14px; opacity: 0.25; }

/* ── Pagination ─────────────────────────────── */
.pagination { margin: 6px 0 0 0; }
.pagination > li > a,
.pagination > li > span {
    background: #14151e;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    padding: 3px 9px;
    line-height: 1.6;
}
.pagination > li > a:hover {
    background: #1e2030;
    color: var(--text-bright);
    border-color: #3a3f58;
}
.pagination > .active > a,
.pagination > .active > span {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}
.pagination > .disabled > a,
.pagination > .disabled > span {
    background: #0e0f18;
    color: var(--text-muted);
    border-color: var(--border-light);
}

/* ── Alerts ──────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm);
    font-size: 12.8px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-left-width: 3px;
    margin-bottom: 12px;
}
.alert .fa { font-size: 14px; margin-right: 6px; }
.alert-danger  { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.30); border-left-color: #ef4444; color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.30); border-left-color: #10b981; color: #6ee7b7; }
.alert-info    { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); border-left-color: var(--accent); color: #e3e5e8; }
.alert-warning { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.30); border-left-color: #f59e0b; color: #fcd34d; }

/* ── Form controls ───────────────────────────── */
.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-bright);
    border-radius: var(--radius-sm);
    font-size: 13px;
    height: 34px;
    box-shadow: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
    background: #0e101c;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    color: var(--text-bright);
    outline: none;
}
label { color: var(--text-header); font-size: 12px; font-weight: 500; margin-bottom: 4px; letter-spacing: 0.02em; }

/* ── Buttons ─────────────────────────────────── */
.btn {
    font-size: 12.5px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-weight: 500;
    letter-spacing: 0.01em;
}
.btn:active { transform: translateY(1px); }
.btn-default {
    background: #1c1e2c;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-default:hover {
    background: #252839;
    border-color: #3a3f58;
    color: var(--text-bright);
}
.btn-primary {
    background: var(--gradient-accent);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #858991 0%, #b5646e 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.btn-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); border-color: transparent; color: #fff; }
.btn-success:hover { background: linear-gradient(135deg, #14c98c 0%, #10b981 100%); color: #fff; }
.btn-danger  { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); border-color: transparent; color: #fff; }
.btn-danger:hover { background: linear-gradient(135deg, #f55858 0%, #dc2626 100%); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); border-color: transparent; color: #1a1300; }
.btn-info { background: linear-gradient(135deg, #5b6068 0%, #3e434a 100%); border-color: transparent; color: #fff; }
.btn-info:hover { color: #fff; }

/* ── Login page ──────────────────────────────── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-body);
    background-image:
        radial-gradient(ellipse 800px 600px at 30% 30%, rgba(255,255,255,0.10) 0%, transparent 55%),
        radial-gradient(ellipse 700px 500px at 75% 75%, rgba(215,75,88,0.08) 0%, transparent 55%),
        radial-gradient(ellipse 500px 400px at 50% 100%, rgba(16,185,129,0.05) 0%, transparent 60%);
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.login-card {
    width: 100%;
    max-width: 410px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.85), 0 0 0 1px rgba(77,127,216,0.10);
    position: relative;
    z-index: 1;
}
.login-header {
    background: linear-gradient(135deg, #141928 0%, #1a2540 60%, #1d2348 100%);
    border-bottom: 1px solid var(--border);
    padding: 36px 32px 26px;
    text-align: center;
    position: relative;
}
.login-header::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.login-logo {
    width: 66px;
    height: 66px;
    background: var(--gradient-accent);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 8px 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.login-header h3 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.10em;
    background: linear-gradient(135deg, #e3e9f4 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-header p  { margin: 0; font-size: 11px; color: var(--text-header); letter-spacing: 0.18em; text-transform: uppercase; }
.login-body { background: var(--bg-card); padding: 30px 32px 28px; }
.login-hint {
    background: var(--accent-soft);
    border: 1px solid rgba(77,127,216,0.18);
    border-radius: 8px;
    color: var(--text-header);
    font-size: 12px;
    margin-top: 20px;
    padding: 11px 14px;
    text-align: center;
}

/* ── Sub-page cards (patient search, import, audit) ── */
.page-wrapper {
    margin-top: 60px;
    padding: 14px 14px 30px;
}
.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}
.page-card-head {
    background: linear-gradient(180deg, var(--bg-card-head) 0%, #0c0d15 100%);
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-card-head .page-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0;
}
.page-card-body { padding: 16px; }

/* ── Standard audit/detail tables ───────────────────── */
.table {
    color: var(--text);
    font-size: 12.5px;
    width: 100%;
    margin-bottom: 0;
}
.table > thead > tr > th {
    background: var(--bg-tbl-head);
    color: var(--text-header);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 12px;
    padding: 7px 10px;
    white-space: nowrap;
}
.table > tbody > tr > td {
    border-top: 1px solid var(--border-light);
    padding: 7px 10px;
    vertical-align: middle;
}
.table-striped > tbody > tr:nth-child(even) > td { background: var(--bg-row-alt); }
.table-hover > tbody > tr:hover > td { background: var(--bg-row-hover); }

/* ── HN badge ────────────────────────────────── */
.hn-badge {
    display: inline-block;
    background: #132040;
    border: 1px solid #1f3a6a;
    color: #6aacf0;
    border-radius: 3px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* ── Count badge ─────────────────────────────── */
.count-badge {
    display: inline-block;
    background: #23262c;
    border: 1px solid #4a4d54;
    color: #d7dbe0;
    border-radius: 10px;
    padding: 2px 12px;
    font-size: 12.5px;
    font-weight: 600;
}

/* ── Import CD page ──────────────────────────── */
.dropzone-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
    background: var(--bg-input);
}
.dropzone-area:hover,
.dropzone-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text-bright);
    transform: translateY(-1px);
}
.dropzone-area .fa { font-size: 32px; margin-bottom: 10px; display: block; color: var(--accent); }

/* ── Status dots ─────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.status-success { background: #3db860; box-shadow: 0 0 4px #3db86066; }
.status-error   { background: #d94040; box-shadow: 0 0 4px #d9404066; }
.status-pending { background: #d4921a; box-shadow: 0 0 4px #d4921a66; }

/* ── Misc ─────────────────────────────────────── */
hr { border-color: var(--border); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    .panel-toolbar { position: relative; top: auto; }
    .panel-main    { margin-top: 10px; }
    .col-fn, .col-ln, .col-desc { display: none; }
}

/* ── Navbar ───────────────────────────────── */
.navbar-inverse {
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.navbar-inverse .navbar-brand {
    color: var(--text-heading) !important;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 12px 20px;
}

.navbar-inverse .navbar-brand .fa { color: var(--accent); margin-right: 6px; }

.navbar-inverse .navbar-nav > li > a {
    color: #94a3b8 !important;
    font-size: 13px;
    padding: 18px 14px;
    transition: color 0.15s, background 0.15s;
}
.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
    background: rgba(255,255,255,0.08) !important;
    color: var(--text) !important;
}
.navbar-inverse .navbar-nav > li.active > a {
    background: rgba(255,255,255,0.12) !important;
    color: #fff !important;
    border-bottom: 2px solid var(--accent);
}

.nav-divider { border-left: 1px solid var(--border); margin: 10px 4px; }

/* ── Page wrapper ─────────────────────────── */
.page-wrapper.with-nav { margin-top: 74px; }
.page-wrapper {
    padding: 24px 20px 40px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Cards / Panels ───────────────────────── */
.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.panel-default > .panel-heading {
    background: var(--bg-card-head);
    border-bottom: 1px solid var(--border);
    color: var(--text-heading);
    font-size: 14px;
    padding: 13px 18px;
}
.panel-default > .panel-heading strong { font-weight: 600; }
.panel-default > .panel-body { background-color: var(--bg-card); padding: 20px 18px; }

/* ── Page title row ───────────────────────── */
.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.page-title h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-heading);
}
.page-title .fa {
    font-size: 22px;
    color: var(--accent);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.10);
    border-radius: 8px;
}

/* ── Buttons ──────────────────────────────── */
.btn {
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.btn-success { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-warning { background: var(--accent3); border-color: var(--accent3); color: #000; }
.btn-default {
    background: #2d3748;
    border-color: #3d4a5c;
    color: var(--text);
}
.btn-default:hover, .btn-default:focus {
    background: #374151;
    border-color: var(--accent);
    color: #fff;
}
.btn-info { background: #555a62; border-color: #555a62; color: #fff; }
.btn-info:hover { background: #666b73; border-color: #666b73; color: #fff; }

/* ── Forms ────────────────────────────────── */
.form-control {
    background-color: #1c1f24;
    border: 1px solid #4a4d54;
    border-radius: 6px;
    color: var(--text);
    height: 38px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    background-color: #1e2640;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
    color: var(--text);
}
.form-control::placeholder { color: #4a5568; }
label { color: #94a3b8; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Tables ───────────────────────────────── */
.table {
    background-color: transparent;
    color: var(--text);
    margin-bottom: 0;
}
.table > thead > tr > th {
    background: rgba(30,37,48,0.9);
    border-bottom: 1px solid var(--border);
    border-color: var(--border);
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 10px 12px;
    text-transform: uppercase;
    white-space: nowrap;
}
.table > tbody > tr > td {
    border-color: #252f3e;
    padding: 10px 12px;
    vertical-align: middle;
}
.table-striped > tbody > tr:nth-of-type(odd) { background-color: rgba(255,255,255,0.03); }
.table-hover > tbody > tr:hover { background-color: rgba(255,255,255,0.06); }
.table-bordered { border-color: var(--border) !important; }
.table-bordered > tbody > tr > td,
.table-bordered > thead > tr > th { border-color: #252f3e !important; }

/* ── Alerts ───────────────────────────────── */
.alert {
    border-radius: 8px;
    border: none;
    font-size: 13px;
    padding: 12px 16px;
}
.alert-info    { background: rgba(255,255,255,0.08); color: #e3e5e8; border-left: 3px solid var(--accent); }
.alert-success { background: rgba(16,185,129,0.12); color: #6ee7b7; border-left: 3px solid var(--accent2); }
.alert-danger  { background: rgba(239,68,68,0.12);  color: #fca5a5; border-left: 3px solid var(--accent4); }
.alert-warning { background: rgba(245,158,11,0.12); color: #fcd34d; border-left: 3px solid var(--accent3); }

/* ── Labels / Badges ─────────────────────── */
.label-success { background: var(--accent2); border-radius: 4px; font-size: 11px; padding: 3px 7px; }
.label-danger  { background: var(--accent4); border-radius: 4px; font-size: 11px; padding: 3px 7px; }
.label-warning { background: var(--accent3); color: #000; border-radius: 4px; font-size: 11px; padding: 3px 7px; }
.label-info    { background: #5a5f67; border-radius: 4px; font-size: 11px; padding: 3px 7px; }



/* ── Dashboard Cards ─────────────────────── */
.dash-grid { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.dash-card {
    flex: 1;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: block;
    overflow: hidden;
    text-decoration: none !important;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
}
.dash-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, var(--accent-soft) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.dash-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-glow);
    transform: translateY(-3px);
}
.dash-card:hover::after { opacity: 1; }
.dash-card-accent {
    height: 3px;
    width: 100%;
}
.dash-card-body {
    padding: 22px 20px 20px;
    text-align: left;
}
.dash-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    margin-bottom: 14px;
}
.dash-card-body h4 {
    color: var(--text-heading);
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
}
.dash-card-body p { color: var(--text-muted); font-size: 12px; margin: 0; line-height: 1.5; }
.dash-card-arrow {
    position: absolute;
    right: 16px;
    bottom: 16px;
    color: #3d4a5c;
    font-size: 14px;
    transition: color 0.15s, right 0.15s;
}
.dash-card:hover .dash-card-arrow { color: var(--accent); right: 12px; }

/* colors per card */
.dc-blue   .dash-card-accent { background: linear-gradient(90deg, var(--accent), #8f949b); }
.dc-blue   .dash-card-icon   { background: linear-gradient(135deg, var(--accent), #8f949b); }
.dc-green  .dash-card-accent { background: linear-gradient(90deg, var(--accent2), #7c848d); }
.dc-green  .dash-card-icon   { background: linear-gradient(135deg, var(--accent2), #7c848d); }
.dc-orange .dash-card-accent { background: linear-gradient(90deg, var(--accent3), #ef4444); }
.dc-orange .dash-card-icon   { background: linear-gradient(135deg, var(--accent3), #f97316); }

/* ── Quick search bar ─────────────────────── */
.quick-search {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
}
.quick-search label { margin: 0; min-width: 90px; font-size: 12px; }
.quick-search .form-control { flex: 1; max-width: 340px; }

/* ── Status bar ───────────────────────────── */
.orthanc-status {
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.orthanc-status .dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}
.orthanc-status.online  { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.25); }
.orthanc-status.online  .dot { background: var(--accent2); color: var(--accent2); }
.orthanc-status.offline { background: rgba(239,68,68,0.1);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.orthanc-status.offline .dot { background: var(--accent4); color: var(--accent4); }
.orthanc-status.warning { background: rgba(245,158,11,0.1); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.orthanc-status.warning .dot { background: var(--accent3); color: var(--accent3); }

/* ── Search page ──────────────────────────── */
.search-bar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.search-bar-card .input-group { max-width: 500px; }
.search-bar-card .form-control { height: 42px; font-size: 16px; }
.search-bar-card .btn { height: 42px; padding: 0 22px; }
.input-group-btn .btn { border-radius: 0 6px 6px 0; }
.input-group .form-control:first-child { border-radius: 6px 0 0 6px; }

.hn-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    color: #d9dde2;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    padding: 8px 14px;
}
.hn-badge .fa { color: var(--accent); }

/* ── Import page ──────────────────────────── */
.import-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.import-hero {
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(134,167,206,0.15) 0%, rgba(255,255,255,0.02) 50%, rgba(134,167,206,0.08) 100%);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.import-hero-title {
    font-size: 14px;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-hero-subtitle {
    margin-top: 5px;
    color: var(--text-header);
    font-size: 12px;
}

.import-pickers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.import-picker-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    color: var(--text);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.import-picker-card:hover {
    border-color: rgba(134,167,206,0.35);
    background: rgba(134,167,206,0.10);
    color: var(--text-bright);
}

.source-unified-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    padding: 12px;
    margin-bottom: 10px;
}

.source-unified-title {
    color: var(--text-bright);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.source-unified-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.source-quick-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.source-quick-actions .btn {
    min-width: 146px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
}

.source-unified-hint {
    color: var(--text-header);
    font-size: 11.5px;
}

.picker-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(134,167,206,0.16);
    color: #bfd2ea;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.picker-title {
    font-size: 13px;
    font-weight: 600;
}

.picker-desc {
    font-size: 11.5px;
    color: var(--text-header);
}

.file-drop-label {
    background: #f1f3f5;
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    color: #6c757d;
    cursor: pointer;
    display: block;
    padding: 22px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.file-drop-label:hover,
.file-drop-label.drag-over {
    border-color: #495057;
    background: #e9ecef;
    transform: translateY(-1px);
}

.file-drop-label.is-locked {
    opacity: 0.6;
    cursor: not-allowed;
    border-style: dashed;
    background: #f1f3f5;
}

.file-drop-label.is-locked:hover {
    border-color: #adb5bd;
    background: #f1f3f5;
    transform: none;
}

.file-drop-label.is-ready {
    opacity: 1;
}

.file-drop-label.is-selected {
    border-color: #343a40;
    background: #e9ecef;
}

.file-drop-label .fa {
    font-size: 28px;
    color: #868e96;
    display: block;
    margin-bottom: 6px;
}

#files-input,
#folder-input {
    display: none;
}

.import-file-summary {
    color: #8fd9bc;
    font-size: 13px;
    margin-top: 8px;
    min-height: 20px;
}

.import-file-list {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    padding-right: 4px;
}

.import-file-actions {
    margin-top: 8px;
}

.import-preview-wrap {
    margin-top: 14px;
    border-top: 1px dashed var(--border-light);
    padding-top: 12px;
}

.import-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text-bright);
}

.import-preview-note {
    color: var(--text-header);
    font-size: 11.5px;
}

.universal-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}

.preview-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    padding: 10px;
    min-height: 170px;
}

.preview-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.preview-type {
    display: inline-block;
    background: rgba(134,167,206,0.16);
    border: 1px solid rgba(134,167,206,0.30);
    color: #c7daf0;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.preview-size {
    color: var(--text-header);
    font-size: 11px;
}

.preview-name {
    color: var(--text);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
}

.preview-body {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: rgba(0,0,0,0.16);
    min-height: 116px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.preview-dicom-wrap {
    width: 100%;
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px;
    align-items: stretch;
}

.preview-dicom-viewport {
    width: 88px;
    height: 88px;
    background: #000;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.preview-dicom-viewport canvas {
    width: 100% !important;
    height: 100% !important;
}

.preview-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.preview-pdf {
    width: 100%;
    height: 100%;
    border: 0;
}

.preview-meta {
    width: 100%;
    font-size: 11px;
    color: var(--text-header);
    line-height: 1.45;
}

.preview-meta strong {
    color: var(--text-bright);
    font-weight: 600;
}

.preview-fallback {
    color: var(--text-header);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.preview-fallback .fa {
    font-size: 16px;
}

.file-chip {
    background: rgba(134,167,206,0.12);
    border: 1px solid rgba(134,167,206,0.24);
    color: #c6d9ef;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 460px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-chip.more {
    color: var(--text-bright);
    font-weight: 600;
}

@media (max-width: 767px) {
    .import-pickers {
        grid-template-columns: 1fr;
    }
}

/* ── Audit table ──────────────────────────── */
.audit-table-wrap { overflow-x: auto; }

/* ── Misc helpers ─────────────────────────── */
.top-gap  { margin-top: 16px; }
.uid-col  { font-family: Consolas, monospace; font-size: 11px; max-width: 260px; word-break: break-all; color: #64748b; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.text-accent  { color: var(--accent) !important; }
.text-success2 { color: var(--accent2) !important; }
hr { border-color: var(--border); }

/* ── Page transitions ───────────────────────── */
.panel-main, .page-wrapper, .login-card {
    animation: fadeInUp 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Pulse for live status ──────────────────── */
.status-success, .orthanc-status.online .dot {
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 4px currentColor; }
    50%      { box-shadow: 0 0 10px currentColor, 0 0 16px currentColor; }
}

/* ── Refined count/HN/mod badges ─────────────── */
.count-badge {
    background: var(--accent-soft);
    border: 1px solid rgba(77,127,216,0.30);
    color: #93b8f0;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.hn-badge {
    background: var(--accent-soft);
    border-color: rgba(77,127,216,0.30);
    color: #93b8f0;
}
.mod-badge {
    background: rgba(108,164,224,0.10);
    border-color: rgba(108,164,224,0.28);
    color: #8cc0f0;
}

/* ── Modals (bootstrap 3) ───────────────────── */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(0,0,0,0.85);
    color: var(--text);
}
.modal-header {
    background: linear-gradient(180deg, var(--bg-card-head) 0%, #0c0d15 100%);
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header .close { color: var(--text-bright); opacity: 0.6; text-shadow: none; font-size: 22px; }
.modal-header .close:hover { opacity: 1; }
.modal-title { color: var(--text-bright); font-size: 14px; font-weight: 600; }
.modal-body { padding: 18px; }
.modal-footer { background: var(--bg-card-head); border-top: 1px solid var(--border); padding: 12px 18px; }
.modal-backdrop.in { opacity: 0.7; background: #000; }

.modal.fade .modal-dialog {
    transform: translate3d(0, 20px, 0) scale(0.97);
    opacity: 0;
    transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 220ms ease;
}

.modal.in .modal-dialog {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.modal.fade .modal-header,
.modal.fade .modal-body,
.modal.fade .modal-footer {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 220ms ease, transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal.in .modal-header,
.modal.in .modal-body,
.modal.in .modal-footer {
    opacity: 1;
    transform: translateY(0);
}

.modal.in .modal-header { transition-delay: 40ms; }
.modal.in .modal-body { transition-delay: 75ms; }
.modal.in .modal-footer { transition-delay: 110ms; }

/* ── Tabs (bootstrap 3) ─────────────────────── */
.nav-tabs {
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.nav-tabs > li > a {
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin-right: 4px;
    padding: 8px 14px;
    font-size: 13px;
    transition: all var(--transition);
}
.nav-tabs > li > a:hover {
    background: var(--bg-row-hover);
    border-color: transparent;
    color: var(--text-bright);
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-color: var(--bg-card);
    color: var(--accent-hover);
    font-weight: 600;
}

/* ── Empty / loading states ─────────────────── */
.empty-hint {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-hint .fa { font-size: 38px; opacity: 0.3; display: block; margin-bottom: 12px; }
.empty-hint h4 { color: var(--text); margin: 0 0 6px; font-size: 15px; }
.empty-hint p  { margin: 0; font-size: 12.5px; }

/* ── kbd ────────────────────────────────────── */
kbd {
    background: #1c1e2c;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    color: var(--text-bright);
    border-radius: 4px;
    padding: 1px 7px;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

/* ── Reduce motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── 2026 Clinical Command Theme (final override) ── */
:root {
    --bg-body:       #1a1b1e;
    --bg-nav:        #23252a;
    --bg-toolbar:    #2a2d32;
    --bg-card:       #1a1b1d;
    --bg-card-head:  #222428;
    --bg-input:      rgba(34,34,34,0.97);
    --bg-tbl-head:   #3a3d43;
    --bg-row-alt:    rgba(255,255,255,0.024);
    --bg-row-hover:  rgba(255,255,255,0.14);
    --border:        #62666f;
    --border-light:  #4b4f58;
    --accent:        #b8b8b8;
    --accent-hover:  #ececec;
    --accent-soft:   rgba(255,255,255,0.22);
    --accent-glow:   rgba(255,255,255,0.34);
    --text:          #dde1e6;
    --text-bright:   #fafbfd;
    --text-header:   #e0e4e9;
    --text-muted:    #c0c5cc;
    --shadow:        0 20px 48px rgba(0,0,0,0.82), 0 0 0 1px rgba(200,200,200,0.06), inset 0 1px 0 rgba(255,255,255,0.015);
    --shadow-lg:     0 34px 90px rgba(0,0,0,0.92), 0 0 0 1px rgba(200,200,200,0.08), 0 0 38px rgba(60,60,60,0.07);
    --radius:        14px;
    --radius-sm:     10px;
    --gradient-accent: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 60%, #404040 100%);
    --login-header-gradient: linear-gradient(160deg, #202225 0%, #2c2f34 50%, #24272b 100%);
    --login-body-gradient: linear-gradient(180deg, #1e2023 0%, #17191c 100%);
    --login-header-glow: radial-gradient(ellipse 100% 60% at 50% -10%, rgba(140,140,140,0.16) 0%, transparent 72%);
    --login-inner-glow: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,255,255,0.18) 0%, transparent 64%);
    --login-surface-border: rgba(200,200,200,0.20);
    --login-surface-border-strong: rgba(220,220,220,0.24);
    --login-focus-border: rgba(235,235,235,0.58);
    --login-focus-shadow: 0 0 0 3px rgba(200,200,200,0.22), 0 0 26px rgba(235,235,235,0.14);
    --login-button-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 0 1px rgba(200,200,200,0.12);
    --login-button-shadow-hover: 0 8px 30px rgba(0,0,0,0.7), 0 0 0 1px rgba(200,200,200,0.22);
}

html, body {
    background:
        radial-gradient(1300px 760px at 3% -14%, rgba(255,255,255,0.07) 0%, transparent 64%),
        radial-gradient(920px 660px at 98% 118%, rgba(255,255,255,0.045) 0%, transparent 68%),
        var(--bg-body);
    color: var(--text);
    font-family: 'Segoe UI Variable', 'Noto Sans Thai', 'IBM Plex Sans Thai', 'Segoe UI', sans-serif;
}

.navbar {
    background: linear-gradient(180deg, #343840 0%, #252932 100%) !important;
    border-bottom: 1px solid rgba(235,235,235,0.22) !important;
    box-shadow: 0 14px 34px rgba(0,0,0,0.50), inset 0 -1px 0 rgba(255,255,255,0.06);
}

.navbar-nav > li > a:hover,
.navbar-nav > li.active > a {
    background: rgba(255,255,255,0.10) !important;
    color: var(--text-bright) !important;
}

.panel,
.page-card,
.search-bar-card,
.import-form-card,
.quick-search {
    border-radius: var(--radius);
    border-color: var(--login-surface-border);
    background: var(--login-inner-glow), var(--login-body-gradient);
    box-shadow: 0 20px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(210,210,210,0.13), 0 0 56px rgba(90,90,90,0.10);
}

.panel-heading,
.page-card-head,
.modal-header {
    background: var(--login-header-glow), var(--login-header-gradient) !important;
    border-bottom-color: rgba(255,255,255,0.09) !important;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.05);
}

.panel-toolbar {
    background: var(--login-header-gradient);
    border-bottom: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 10px 24px rgba(0,0,0,0.46), inset 0 1px 0 rgba(255,255,255,0.06);
}

.toolbar-btn,
.btn,
.btn-view,
.nav-tabs > li > a,
.form-control,
.file-drop-label,
.dropzone-area,
.modal-content {
    border-radius: var(--radius-sm) !important;
}

.btn-primary {
    background: var(--gradient-accent);
    color: #f3f7fd;
    border: none;
    box-shadow: 0 6px 22px rgba(0,0,0,0.42), 0 0 0 1px rgba(220,220,220,0.16), inset 0 1px 0 rgba(255,255,255,0.08);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #505050 0%, #616161 60%, #565656 100%);
    box-shadow: 0 8px 22px rgba(0,0,0,0.40), 0 0 0 1px rgba(245,245,245,0.30), inset 0 1px 0 rgba(255,255,255,0.14);
    transform: translateY(-1px);
}

.btn-default,
.toolbar-btn {
    background: linear-gradient(180deg, #2b2d32 0%, #22252a 100%);
    border-color: rgba(230,230,230,0.20) !important;
    color: var(--text-bright);
    box-shadow: 0 3px 12px rgba(0,0,0,0.30), 0 0 0 1px rgba(210,210,210,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
}

.btn-default:hover,
.toolbar-btn:hover {
    background: linear-gradient(180deg, #363940 0%, #2a2d34 100%) !important;
    color: var(--text-bright) !important;
    border-color: rgba(245,245,245,0.30) !important;
}

.form-control {
    background: linear-gradient(180deg, rgba(42,42,42,0.98) 0%, rgba(33,33,33,0.98) 100%);
    border-color: rgba(230,230,230,0.20);
    color: var(--text-bright);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 0 1px rgba(255,255,255,0.03);
}

.form-control:focus {
    border-color: var(--login-focus-border);
    background: linear-gradient(180deg, rgba(50,50,50,0.99) 0%, rgba(39,39,39,0.99) 100%);
    box-shadow: 0 0 0 3px rgba(215,215,215,0.24), 0 0 24px rgba(245,245,245,0.16);
}

.modal-content {
    background: var(--login-inner-glow), var(--login-body-gradient) !important;
    border: 1px solid rgba(180,180,180,0.10) !important;
    box-shadow: 0 30px 80px rgba(0,0,0,0.95), 0 0 0 1px rgba(180,180,180,0.10), 0 0 80px rgba(40,40,40,0.08) !important;
}

.panel,
.page-card,
.search-bar-card,
.import-form-card,
.quick-search,
.modal-content {
    position: relative;
    overflow: hidden;
}

.panel::before,
.page-card::before,
.search-bar-card::before,
.import-form-card::before,
.quick-search::before,
.modal-content::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.005) 12%, transparent 30%);
}

.table-worklist thead tr,
.table > thead > tr > th {
    background: linear-gradient(180deg, #5a5f69 0%, #474c56 100%);
}

.table-worklist thead th,
.table > thead > tr > th {
    color: #f0f3f7;
    border-color: rgba(245,245,245,0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}

.table-worklist tbody tr:hover,
.table-hover > tbody > tr:hover > td {
    background: var(--bg-row-hover) !important;
}

.table-worklist td,
.table-worklist th,
.table > tbody > tr > td,
.table > thead > tr > th {
    border-color: var(--border-light);
}

.badge-role.admin {
    background: #4a4e56;
    color: #f0f0f0;
}

.badge-role.staff {
    background: #5a5f69;
    color: #efefef;
}

.badge-role.doctor {
    background: #4e6b57;
    color: #f0fff5;
}

.count-badge,
.hn-badge,
.mod-badge {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.22) !important;
    color: #dfdfdf !important;
}

.alert {
    border-radius: 12px;
}

.login-card {
    border-radius: 20px;
}

.login-wrapper {
    background-image:
    radial-gradient(700px 460px at 22% 22%, rgba(255,255,255,0.10) 0%, transparent 62%),
    radial-gradient(580px 420px at 78% 76%, rgba(255,255,255,0.06) 0%, transparent 62%),
    linear-gradient(180deg, #151619 0%, #101114 100%);
}

/* ── Topbar categories (compact) ─────────────── */
.navbar { min-height: 50px; }
.navbar-brand { padding-top: 12px; padding-bottom: 12px; }
.navbar-nav > li > a { padding: 14px 11px; font-size: 12.5px; }

.nav-category > a {
    border-radius: 999px;
    margin: 8px 4px 0;
    padding: 8px 12px !important;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.02);
}

.nav-category > a .fa { margin-right: 6px; }

.nav-category.active > a,
.nav-category.open > a,
.nav-category > a:hover,
.nav-category > a:focus {
    background: rgba(255,255,255,0.10) !important;
    border-color: rgba(255,255,255,0.24) !important;
    color: var(--text-bright) !important;
}

.nav-category-menu {
    margin-top: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #2a2d33;
    box-shadow: 0 16px 30px rgba(0,0,0,0.35);
    min-width: 210px;
    padding: 6px;
}

.nav-category-menu > li > a {
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12.5px;
}

.nav-category-menu > li > a:hover,
.nav-category-menu > li > a.active-link {
    background: rgba(255,255,255,0.12);
    color: var(--text-bright);
}

.nav-account .dropdown > .account-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 16px !important;
    margin-top: 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
}

.nav-account .dropdown.open > .account-pill,
.nav-account .dropdown > .account-pill:hover {
    background: rgba(255,255,255,0.10) !important;
    border-color: rgba(255,255,255,0.22);
}

.account-name {
    max-width: 160px;
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu {
    margin-top: 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #162338;
    box-shadow: 0 16px 30px rgba(0,0,0,0.35);
    min-width: 190px;
    padding: 6px;
}

.account-menu > li > a {
    color: var(--text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12.5px;
}

.account-menu > li > a:hover {
    background: rgba(78,142,255,0.16);
    color: var(--text-bright);
}

.account-menu .divider {
    background: var(--border-light);
    margin: 6px 2px;
}

@media (min-width: 768px) {
    #main-nav-links {
        display: flex;
        align-items: center;
        gap: 2px;
    }
}

@media (max-width: 991px) {
    .navbar-nav > li > a {
        padding-left: 9px;
        padding-right: 9px;
    }

    .nav-category > a {
        margin-left: 2px;
        margin-right: 2px;
        padding-left: 9px !important;
        padding-right: 9px !important;
    }
}

@media (max-width: 767px) {
    .nav-category > a {
        margin: 6px 10px;
        padding: 10px 12px !important;
    }

    .nav-category-menu {
        margin: 2px 10px 8px;
        float: none !important;
        position: static;
        width: auto;
    }

    .nav-account .dropdown > .account-pill {
        margin: 6px 10px;
        justify-content: space-between;
    }

    .account-menu {
        margin: 6px 10px 10px;
        float: none !important;
        position: static;
    }
}

/* ── Top nav polish ───────────────────────── */
.navbar.navbar-fixed-top {
    min-height: 62px;
    background:
        linear-gradient(125deg, rgba(255, 255, 255, 0.06) 0%, transparent 34%),
        linear-gradient(180deg, #2f3238 0%, #24272d 100%) !important;
    border-bottom: 1px solid rgba(178, 186, 205, 0.28) !important;
    box-shadow: 0 10px 26px rgba(2, 8, 28, 0.38), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    animation: nav-slide-down 280ms ease-out;
}

.navbar.navbar-fixed-top .container-fluid {
    padding-left: 18px;
    padding-right: 14px;
}

.navbar.navbar-fixed-top .navbar-brand {
    padding: 17px 20px;
    position: relative;
    isolation: isolate;
}

.navbar.navbar-fixed-top .brand-name {
    display: inline-block;
    position: relative;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.16em;
    background: linear-gradient(135deg, #f4f6fb 0%, #cfd5df 45%, #f6f8fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 12px rgba(245, 248, 255, 0.32), 0 0 26px rgba(255, 255, 255, 0.16);
    animation: brand-glow-pulse 3.2s ease-in-out infinite;
}

.navbar.navbar-fixed-top .brand-name::after {
    content: '';
    position: absolute;
    top: -10%;
    left: -36%;
    width: 28%;
    height: 120%;
    background: linear-gradient(90deg, rgba(255,255,255,0.00) 0%, rgba(255,255,255,0.58) 50%, rgba(255,255,255,0.00) 100%);
    filter: blur(0.5px);
    transform: skewX(-18deg);
    pointer-events: none;
    animation: brand-shimmer 4.8s ease-in-out infinite;
    opacity: 0.85;
}

#main-nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
}

#main-nav-links > li > a {
    padding: 10px 13px;
    margin: 11px 0;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #e5e9f0 !important;
    transition: background-color var(--transition), border-color var(--transition), transform var(--transition), color var(--transition);
}

#main-nav-links > li > a .fa {
    margin-right: 7px;
    opacity: 0.86;
}

#main-nav-links > li > a:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.30);
    transform: translateY(-1px);
    color: #ffffff !important;
}

#main-nav-links > li.active > a {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(223, 229, 240, 0.16) 100%) !important;
    border-color: rgba(230, 235, 243, 0.52);
    border-bottom: 1px solid rgba(230, 235, 243, 0.52);
    box-shadow: 0 8px 18px rgba(26, 30, 39, 0.30), inset 0 1px 0 rgba(255,255,255,0.10);
    color: #ffffff !important;
}

.nav-utilities {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 6px 0 0 !important;
}

.nav-utilities > li {
    float: none;
    margin: 0;
}

.nav-utilities > li > .nav-utility-btn {
    margin: 10px 0 0;
}

.nav-utility-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 10px 14px !important;
    border-radius: 12px;
    border: 1px solid rgba(210, 218, 234, 0.42);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: #e9edf6 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 8px 18px rgba(7, 14, 40, 0.20);
    transition: background-color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition), color var(--transition);
}

.nav-download-link {
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.nav-utility-btn:hover,
.nav-utility-btn:focus,
.nav-utilities .dropdown.open > .nav-utility-btn {
    border-color: rgba(230, 236, 246, 0.58);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.10) 100%) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 24px rgba(8, 12, 34, 0.28);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.account-pill {
    width: 238px;
    justify-content: space-between;
    gap: 8px;
}

.account-pill .fa-user-circle-o {
    color: #d1d8e8;
}

.account-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #f0f4ff;
    max-width: 118px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-utilities .badge-role {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.account-menu {
    margin-top: 8px;
    border-radius: 12px;
    border: 1px solid rgba(198, 208, 226, 0.30);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%),
        linear-gradient(180deg, #2d323b 0%, #242932 100%);
    box-shadow: 0 14px 26px rgba(3, 8, 20, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    width: 238px;
    min-width: 238px;
    max-width: 238px;
    padding: 6px;
    backdrop-filter: blur(8px);
}

.account-menu > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e3e8f3;
    border-radius: 9px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color var(--transition), color var(--transition), transform var(--transition);
}

.account-menu > li > a .fa {
    width: 15px;
    text-align: center;
    color: #b9c4da;
}

.account-menu > li > a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateX(1px);
}

.account-menu > li > a:hover .fa {
    color: #eaf0ff;
}

.account-menu .divider {
    margin: 6px 3px;
    background: rgba(185, 198, 220, 0.2);
}

@keyframes nav-slide-down {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes brand-glow-pulse {
    0%,
    100% {
        text-shadow: 0 0 12px rgba(245, 248, 255, 0.30), 0 0 24px rgba(255, 255, 255, 0.14);
        transform: translateY(0);
    }
    50% {
        text-shadow: 0 0 18px rgba(245, 248, 255, 0.42), 0 0 38px rgba(255, 255, 255, 0.22);
        transform: translateY(-0.5px);
    }
}

@keyframes brand-shimmer {
    0%,
    20% {
        left: -36%;
        opacity: 0;
    }
    30% {
        opacity: 0.95;
    }
    58% {
        left: 110%;
        opacity: 0;
    }
    100% {
        left: 110%;
        opacity: 0;
    }
}

@media (max-width: 991px) {
    #main-nav-links {
        margin-left: 6px;
        gap: 4px;
    }

    #main-nav-links > li > a {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 767px) {
    .navbar.navbar-fixed-top .navbar-toggle {
        margin-top: 12px;
        margin-bottom: 12px;
    }

    .navbar.navbar-fixed-top .navbar-collapse {
        border-top: 1px solid rgba(126, 148, 218, 0.28);
        background: rgba(15, 21, 43, 0.96);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    #main-nav-links {
        display: block;
        margin-left: 0;
    }

    #main-nav-links > li > a,
    .nav-utilities > li > .nav-utility-btn {
        margin: 6px 10px;
    }

    #main-nav-links > li > a,
    .nav-utilities > li > .nav-utility-btn {
        padding: 10px 12px !important;
    }

    .account-pill,
    .account-menu {
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .nav-utilities {
        display: block;
        margin-right: 0 !important;
    }

    .nav-utilities > li > .nav-utility-btn {
        display: flex !important;
        justify-content: space-between;
    }
}

/* ── Cross-page UI harmony (non-dashboard) ─────────────────── */
body.page-app:not(.page-login):not(.page-viewer) {
    --bg-body: #d1d6df;
    --bg-card: #eceff5;
    --bg-card-head: #dbe3f2;
    --bg-input: #f4f7fd;
    --bg-tbl-head: #d5ddee;
    --bg-row-alt: rgba(57, 92, 164, 0.05);
    background: linear-gradient(180deg, rgba(203, 217, 244, 0.96), rgba(190, 206, 236, 0.96));
    border-color: rgba(119, 147, 201, 0.34) !important;
    color: #2a446f;
}

body.page-app:not(.page-login):not(.page-viewer) .table > tbody > tr > td,
body.page-app:not(.page-login):not(.page-viewer) .table-worklist td {
    border-color: rgba(126, 152, 206, 0.2) !important;
    color: #2f4164;
}

body.page-app:not(.page-login):not(.page-viewer) .form-control {
    background: linear-gradient(180deg, rgba(252, 253, 255, 0.98), rgba(244, 248, 255, 0.98));
    border-color: rgba(129, 156, 209, 0.42);
    color: #223a65;
}

body.page-app:not(.page-login):not(.page-viewer) .form-control:focus {
    background: #ffffff;
    border-color: rgba(84, 122, 206, 0.7);
    box-shadow: 0 0 0 3px rgba(98, 142, 232, 0.22);
    color: #1d345a;
}

body.page-app:not(.page-login):not(.page-viewer) .btn-default,
body.page-app:not(.page-login):not(.page-viewer) .toolbar-btn {
    background: linear-gradient(180deg, rgba(234, 241, 253, 0.95), rgba(222, 232, 248, 0.96));
    border-color: rgba(122, 151, 209, 0.46) !important;
    color: #264069 !important;
    box-shadow: 0 4px 12px rgba(76, 104, 156, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.page-app:not(.page-login):not(.page-viewer) .btn-default:hover,
body.page-app:not(.page-login):not(.page-viewer) .toolbar-btn:hover {
    background: linear-gradient(180deg, rgba(225, 236, 255, 0.98), rgba(208, 224, 248, 0.98)) !important;
    border-color: rgba(86, 121, 188, 0.58) !important;
    color: #1f3560 !important;
}

body.page-app:not(.page-login):not(.page-viewer) .btn-primary {
    background: linear-gradient(135deg, #5a83da 0%, #4468bb 100%);
    border-color: rgba(68, 104, 187, 0.9);
    color: #f8fbff;
}

body.page-app:not(.page-login):not(.page-viewer) .btn-primary:hover,
body.page-app:not(.page-login):not(.page-viewer) .btn-primary:focus {
    background: linear-gradient(135deg, #678de0 0%, #5074c3 100%);
    border-color: rgba(80, 116, 195, 0.94);
}

body.page-app:not(.page-login):not(.page-viewer) .alert {
    border-radius: 10px;
    border-left-width: 4px;
}

body.page-app:not(.page-login):not(.page-viewer) .import-lab-page {
    --ink-1: #f8f9fa;
    --ink-2: #dee2e6;
    --line-1: rgba(108, 117, 125, 0.2);
    --line-2: rgba(108, 117, 125, 0.15);
    --surface-1: #343a40;
    --surface-2: #495057;
}

body.page-app:not(.page-login):not(.page-viewer) {
    overflow-x: hidden;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 248px;
    border-right: 1px solid rgba(30, 50, 110, 0.35);
    background: linear-gradient(160deg, #1a2f6e 0%, #162660 55%, #111e4d 100%);
    box-shadow: 3px 0 18px rgba(10, 18, 60, 0.28), inset -1px 0 0 rgba(255, 255, 255, 0.06);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 16px 16px;
    overflow: auto;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-top {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 8px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border: 1px solid rgba(120, 160, 255, 0.4);
    background: linear-gradient(150deg, rgba(80, 130, 255, 0.85), rgba(50, 100, 220, 0.9));
    box-shadow: 0 4px 12px rgba(60, 100, 220, 0.4);
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-title {
    color: #e8efff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    text-shadow: 0 2px 8px rgba(30, 60, 160, 0.5);
    white-space: nowrap;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-sub {
    color: rgba(180, 205, 255, 0.75);
    font-size: 11px;
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: rgba(200, 220, 255, 0.82);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link:hover {
    color: #e8f0ff;
    border-color: rgba(120, 160, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link.active {
    color: #ffffff;
    font-weight: 700;
    border-color: rgba(120, 170, 255, 0.45);
    background: linear-gradient(120deg, rgba(80, 130, 255, 0.38), rgba(50, 100, 220, 0.32));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 14px rgba(40, 80, 200, 0.28);
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link .fa {
    width: 16px;
    text-align: center;
    opacity: 0.88;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-wrap {
    margin-top: 6px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(120, 160, 255, 0.22);
    color: #e8f0ff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-toggle:hover,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-toggle:focus {
    color: #ffffff;
    text-decoration: none;
    border-color: rgba(120, 170, 255, 0.42);
    background: rgba(255, 255, 255, 0.14);
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-caret {
    margin-left: auto;
    opacity: 0.75;
    transition: transform 0.16s ease;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-toggle[aria-expanded="true"] .dash-account-caret {
    transform: rotate(180deg);
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-account {
    margin-top: 6px;
    padding-top: 6px;
    gap: 6px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-account.collapse {
    display: none;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-account.collapse.in,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-account.collapsing {
    display: flex;
    flex-direction: column;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-account .dash-nav-link {
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 12.5px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-bottom {
    border-top: 1px solid rgba(120, 160, 255, 0.22);
    padding: 12px 4px 0;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(80, 130, 255, 0.5), rgba(50, 100, 220, 0.55));
    border: 1px solid rgba(120, 170, 255, 0.4);
    color: #d0e4ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-name {
    color: #e8f0ff;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
}

body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-meta {
    color: rgba(160, 195, 255, 0.7);
    font-size: 11px;
}

body.page-app:not(.page-login):not(.page-viewer) .app-content {
    margin-left: 248px;
    min-height: 100vh;
    padding: 14px 16px 24px;
}

body.page-app:not(.page-login):not(.page-viewer) .page-wrapper {
    margin-top: 0;
    max-width: none;
}

@media (max-width: 991px) {
    body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 0;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid rgba(173, 199, 250, 0.28);
        box-shadow: 0 8px 18px rgba(9, 20, 55, 0.22);
    }

    body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-sub,
    body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-meta {
        display: none;
    }

    body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.page-app:not(.page-login):not(.page-viewer) .app-content {
        margin-left: 0;
        padding-top: 10px;
    }
}

/* Apply shared sidebar layout on dashboard as well */
body.page-dashboard .dash-rail-main {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 248px;
    border-right: 1px solid rgba(30, 50, 110, 0.35);
    background: linear-gradient(160deg, #1a2f6e 0%, #162660 55%, #111e4d 100%);
    box-shadow: 3px 0 18px rgba(10, 18, 60, 0.28), inset -1px 0 0 rgba(255, 255, 255, 0.06);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 16px 16px;
    overflow: auto;
}

body.page-dashboard .dash-rail-main .dash-rail-top {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body.page-dashboard .dash-rail-main .dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    gap: 12px;
}

body.page-dashboard .dash-rail-main .dash-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border: 1px solid rgba(120, 160, 255, 0.4);
    background: linear-gradient(150deg, rgba(80, 130, 255, 0.85), rgba(50, 100, 220, 0.9));
    box-shadow: 0 4px 12px rgba(60, 100, 220, 0.4);
}

body.page-dashboard .dash-rail-main .dash-brand-title {
    color: #e8efff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    text-shadow: 0 2px 8px rgba(30, 60, 160, 0.5);
    white-space: nowrap;
}

body.page-dashboard .dash-rail-main .dash-brand-sub {
    color: rgba(180, 205, 255, 0.75);
    font-size: 11px;
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

body.page-dashboard .dash-rail-main .dash-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.page-dashboard .dash-rail-main .dash-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: rgba(200, 220, 255, 0.82);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

body.page-dashboard .dash-rail-main .dash-nav-link:hover {
    color: #e8f0ff;
    border-color: rgba(120, 160, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
}

body.page-dashboard .dash-rail-main .dash-nav-link.active {
    color: #ffffff;
    font-weight: 700;
    border-color: rgba(120, 170, 255, 0.45);
    background: linear-gradient(120deg, rgba(80, 130, 255, 0.38), rgba(50, 100, 220, 0.32));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 14px rgba(40, 80, 200, 0.28);
}

body.page-dashboard .dash-rail-main .dash-nav-link .fa {
    width: 16px;
    text-align: center;
    opacity: 0.88;
}

body.page-dashboard .dash-rail-main .dash-account-wrap {
    margin-top: 6px;
}

body.page-dashboard .dash-rail-main .dash-account-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(120, 160, 255, 0.22);
    color: #e8f0ff;
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

body.page-dashboard .dash-rail-main .dash-account-toggle:hover,
body.page-dashboard .dash-rail-main .dash-account-toggle:focus {
    color: #ffffff;
    text-decoration: none;
    border-color: rgba(120, 170, 255, 0.42);
    background: rgba(255, 255, 255, 0.14);
}

body.page-dashboard .dash-rail-main .dash-account-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

body.page-dashboard .dash-rail-main .dash-account-caret {
    margin-left: auto;
    opacity: 0.75;
    transition: transform 0.16s ease;
}

body.page-dashboard .dash-rail-main .dash-account-toggle[aria-expanded="true"] .dash-account-caret {
    transform: rotate(180deg);
}

body.page-dashboard .dash-rail-main .dash-rail-account {
    margin-top: 6px;
    padding-top: 6px;
    gap: 6px;
}

body.page-dashboard .dash-rail-main .dash-rail-account.collapse {
    display: none;
}

body.page-dashboard .dash-rail-main .dash-rail-account.collapse.in,
body.page-dashboard .dash-rail-main .dash-rail-account.collapsing {
    display: flex;
    flex-direction: column;
}

body.page-dashboard .dash-rail-main .dash-rail-account .dash-nav-link {
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 12.5px;
}

body.page-dashboard .dash-rail-main .dash-rail-bottom {
    border-top: 1px solid rgba(120, 160, 255, 0.22);
    padding: 12px 4px 0;
}

body.page-dashboard .dash-rail-main .dash-rail-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.page-dashboard .dash-rail-main .dash-rail-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(80, 130, 255, 0.5), rgba(50, 100, 220, 0.55));
    border: 1px solid rgba(120, 170, 255, 0.4);
    color: #d0e4ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.page-dashboard .dash-rail-main .dash-rail-name {
    color: #e8f0ff;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
}

body.page-dashboard .dash-rail-main .dash-rail-meta {
    color: rgba(160, 195, 255, 0.7);
    font-size: 11px;
}

body.page-dashboard .app-content {
    margin-left: 248px;
    min-height: 100vh;
    padding: 14px 16px 24px;
}

@media (max-width: 991px) {
    body.page-dashboard .dash-rail-main {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 0;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid rgba(173, 199, 250, 0.28);
        box-shadow: 0 8px 18px rgba(9, 20, 55, 0.22);
    }

    body.page-dashboard .dash-rail-main .dash-brand-sub,
    body.page-dashboard .dash-rail-main .dash-rail-meta {
        display: none;
    }

    body.page-dashboard .dash-rail-main .dash-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.page-dashboard .app-content {
        margin-left: 0;
        padding-top: 10px;
    }
}

/* ══════════════════════════════════════════════════════════
   LUXURY NAVY — v4.0
   Palette: Deep navy #0b0d1c + Indigo/violet accent
   Inspired by dark command-palette UI with ambient glow
   ══════════════════════════════════════════════════════════ */

/* ── Core palette override ───────────────────────────────── */
:root {
    --bg-body:      #0b0d1c;
    --bg-nav:       #0e1128;
    --bg-toolbar:   #10142e;
    --bg-card:      #111428;
    --bg-card-head: #14183a;
    --bg-input:     #0c0f24;
    --bg-tbl-head:  #161b3e;
    --bg-row-alt:   rgba(60, 90, 200, 0.04);
    --bg-row-hover: rgba(70, 105, 225, 0.15);
    --border:       rgba(82, 118, 230, 0.32);
    --border-light: rgba(70, 102, 215, 0.20);
    --accent:       #5b78f0;
    --accent-hover: #7a93f5;
    --accent-soft:  rgba(82, 112, 238, 0.22);
    --accent-glow:  rgba(88, 118, 248, 0.42);
    --accent2:      #10c490;
    --accent3:      #f5a623;
    --accent4:      #e85c6a;
    --text:         #c8d3ef;
    --text-bright:  #eef2ff;
    --text-heading: #eef2ff;
    --text-muted:   #6b80aa;
    --text-header:  #9aaed4;
    --radius:       14px;
    --radius-sm:    10px;
    --shadow:       0 20px 50px rgba(4,6,28,0.80), 0 0 0 1px rgba(82,118,230,0.16);
    --shadow-lg:    0 32px 80px rgba(4,6,28,0.90), 0 0 0 1px rgba(92,128,245,0.22);
    --gradient-accent: linear-gradient(135deg, #5b78f0 0%, #7c5ef4 100%);
    --transition:   0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Body — deep navy + ambient indigo/violet glow ──────── */
html, body {
    background:
        radial-gradient(ellipse 900px 650px at 12%  8%,  rgba(55,  80, 210, 0.30) 0%, transparent 58%),
        radial-gradient(ellipse 800px 600px at 88% 92%,  rgba(90,  50, 195, 0.24) 0%, transparent 56%),
        radial-gradient(ellipse 700px 500px at 50% 50%,  rgba(30,  40, 140, 0.14) 0%, transparent 60%),
        var(--bg-body) !important;
    background-attachment: fixed !important;
    color: var(--text);
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(92,122,242,0.54) 0%, rgba(72,98,218,0.30) 100%);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(115,148,255,0.68); }

/* ── Top navbar (both variants) ──────────────────────────── */
.navbar,
.navbar.navbar-fixed-top {
    background:
        linear-gradient(125deg, rgba(100,132,255,0.06) 0%, transparent 30%),
        linear-gradient(180deg, #0f1430 0%, #0b1025 100%) !important;
    border-bottom: 1px solid rgba(88,118,238,0.30) !important;
    box-shadow: 0 10px 30px rgba(4,6,28,0.48), inset 0 -1px 0 rgba(110,148,255,0.05) !important;
}

/* ── Sidebar — luxury navy indigo (shared rule) ──────────── */
body.page-dashboard .dash-rail-main,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main {
    background: linear-gradient(180deg, #102248 0%, #0d1d3f 52%, #0a1734 100%);
    border-right: 1px solid rgba(184, 143, 82, 0.62);
    border-top: 1px solid rgba(194, 154, 92, 0.86);
    box-shadow: 4px 0 28px rgba(2,5,22,0.56), inset -1px 0 0 rgba(194, 154, 92, 0.24);
}

body.page-dashboard .dash-rail-main .dash-rail-bottom,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-bottom {
    border-top: 1px solid rgba(194, 154, 92, 0.46);
}

/* Sidebar brand mark */
body.page-dashboard .dash-brand,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand {
    align-items: center;
}

body.page-dashboard .dash-brand-mark,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-mark {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 32% 22%, rgba(255,255,255,0.34), transparent 24%),
        linear-gradient(145deg, #31b7ff 0%, #1479ea 52%, #0d3f9f 100%);
    border: 1px solid rgba(133, 197, 255, 0.5);
    box-shadow:
        0 12px 26px rgba(9, 69, 176, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        inset 0 -1px 0 rgba(0, 18, 80, 0.28);
    overflow: hidden;
}

body.page-dashboard .dash-brand-mark::before,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-mark::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 7px;
    border: 1px solid rgba(230, 247, 255, 0.28);
    pointer-events: none;
}

body.page-dashboard .dash-brand-mark .fa,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-mark .fa,
body.page-dashboard .dash-brand-logo > i,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-logo > i {
    display: none;
}

body.page-dashboard .dash-brand-logo,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-logo {
    position: relative;
    width: 25px;
    height: 18px;
    display: block;
}

body.page-dashboard .dash-brand-logo::before,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-logo::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 4px;
    width: 21px;
    height: 11px;
    border: 2px solid rgba(247, 252, 255, 0.96);
    border-radius: 999px;
    transform: rotate(-14deg);
    box-shadow: 0 0 12px rgba(216, 244, 255, 0.34);
}

body.page-dashboard .dash-brand-logo::after,
body.page-app:not(.page-login):not(.page-viewer) .dash-brand-logo::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 0 0 2px rgba(8, 67, 155, 0.42),
        0 0 12px rgba(236, 250, 255, 0.58);
}

/* Sidebar nav links */
body.page-dashboard .dash-rail-main .dash-nav-link,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link {
    color: rgba(178,210,255,0.80);
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
    text-shadow: none;
}

body.page-dashboard .dash-rail-main .dash-brand-eye-word,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-eye-word {
    background: linear-gradient(180deg, #7fddff 0%, #2aa9ff 42%, #1682ed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: 'Sora', system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: 0.03em;
    margin-right: 8px;
}

body.page-dashboard .dash-rail-main .dash-brand-view-word,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-view-word {
    color: rgba(150, 178, 215, 0.85);
    background: none;
    -webkit-text-fill-color: rgba(150, 178, 215, 0.85);
    font-family: 'Sora', system-ui, sans-serif;
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* REH outlined logo mark */
body.page-dashboard .dash-rail-main .dash-brand-mark.reh-mark,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-mark.reh-mark {
    background: transparent;
    border: 0;
    box-shadow: none;
    width: 34px;
    height: 42px;
    color: #3aa3ff;
    filter: drop-shadow(0 0 6px rgba(58, 163, 255, 0.35));
}
body.page-dashboard .dash-rail-main .dash-brand-mark.reh-mark svg,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-mark.reh-mark svg {
    width: 100%;
    height: 100%;
    display: block;
}
body.page-dashboard .dash-rail-main .dash-brand-mark.reh-mark::before,
body.page-dashboard .dash-rail-main .dash-brand-mark.reh-mark::after,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-mark.reh-mark::before,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-mark.reh-mark::after {
    display: none !important;
    content: none !important;
}

body.page-dashboard .dash-rail-main .dash-brand-title,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-title {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    text-shadow: none;
}

body.page-dashboard .dash-rail-main .dash-nav-link:hover,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link:hover {
    color: #e8eeff;
    background: rgba(92,122,248,0.14);
    border-color: rgba(102,144,255,0.28);
    transform: translateX(2px);
}
body.page-dashboard .dash-rail-main .dash-nav-link.active,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-nav-link.active {
    color: #ffffff;
    font-weight: 700;
    background: linear-gradient(120deg, rgba(88,118,248,0.46), rgba(98,68,225,0.36));
    border-color: rgba(122,164,255,0.54);
    box-shadow:
        inset 3px 0 0 rgba(135,175,255,0.90),
        inset 0 1px 0 rgba(255,255,255,0.12),
        0 4px 18px rgba(58,88,225,0.32);
}

/* Sidebar account toggle */
body.page-dashboard .dash-rail-main .dash-account-toggle,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-toggle {
    background: rgba(92,122,248,0.10);
    border-color: rgba(102,144,255,0.22);
    color: #dce8ff;
}
body.page-dashboard .dash-rail-main .dash-account-toggle:hover,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-account-toggle:hover {
    background: rgba(92,122,248,0.18);
    border-color: rgba(112,158,255,0.38);
    text-decoration: none;
}

/* Sidebar avatar */
body.page-dashboard .dash-rail-main .dash-rail-avatar,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-avatar {
    background: linear-gradient(145deg, rgba(82,118,242,0.55), rgba(72,52,208,0.58));
    border: 1px solid rgba(122,168,255,0.42);
    box-shadow: 0 0 0 2px rgba(112,158,255,0.30), 0 4px 12px rgba(42,68,205,0.30);
    color: #c8dcff;
}

/* Sidebar rail name / meta */
body.page-dashboard .dash-rail-main .dash-rail-name,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-name {
    color: #dce8ff;
}
body.page-dashboard .dash-rail-main .dash-rail-meta,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-meta {
    color: rgba(152,192,255,0.65);
}

/* Sidebar bottom separator + gradient line */
body.page-dashboard .dash-rail-main .dash-rail-bottom,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-bottom {
    border-top-color: rgba(102,144,255,0.28);
    position: relative;
}
body.page-dashboard .dash-rail-main .dash-rail-bottom::before,
body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-rail-bottom::before {
    content: '';
    position: absolute;
    top: -1px; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(122,175,255,0.65) 50%, transparent);
    pointer-events: none;
}

/* ── Override light-mode page-app → luxury dark ──────────── */
body.page-app:not(.page-login):not(.page-viewer):not(.page-mwl):not(.page-import):not(.page-patient-search):not(.page-settings) {
    --bg-body:      #0b0d1c;
    --bg-card:      rgba(16,20,44,0.96);
    --bg-card-head: rgba(18,24,52,0.98);
    --bg-input:     rgba(12,15,36,0.98);
    --bg-tbl-head:  rgba(20,26,58,0.98);
    --bg-row-alt:   rgba(60,90,200,0.04);
    --bg-row-hover: rgba(72,108,228,0.14);
    --border:       rgba(82,118,230,0.28);
    --border-light: rgba(70,102,215,0.18);
    --accent:       #5b78f0;
    --accent-hover: #7a93f5;
    --accent-soft:  rgba(82,112,238,0.22);
    --accent-glow:  rgba(88,118,248,0.40);
    --text:         #c8d3ef;
    --text-bright:  #eef2ff;
    --text-header:  #9aaed4;
    --text-muted:   #6b80aa;
    --gradient-accent: linear-gradient(135deg, #5b78f0 0%, #7c5ef4 100%);
    background:
        radial-gradient(ellipse 900px 650px at 12%  8%,  rgba(55, 80,210,0.30) 0%, transparent 58%),
        radial-gradient(ellipse 800px 600px at 88% 92%,  rgba(90, 50,195,0.24) 0%, transparent 56%),
        radial-gradient(ellipse 700px 500px at 50% 50%,  rgba(30, 40,140,0.14) 0%, transparent 60%),
        #0b0d1c !important;
    background-attachment: fixed !important;
    color: var(--text);
}

body.page-app:not(.page-login):not(.page-viewer) .navbar.navbar-fixed-top {
    background:
        linear-gradient(160deg, #0e1535 0%, #0b1228 100%) !important;
    border-bottom: 1px solid rgba(92,128,248,0.32) !important;
    box-shadow: 0 10px 30px rgba(4,6,28,0.46) !important;
}

body.page-app:not(.page-login):not(.page-viewer) .page-wrapper:not(.import-lab-page):not(.mwl-page) {
    margin-top: 0;
    border: 1px solid rgba(82,118,228,0.22);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(14,18,42,0.92), rgba(10,14,34,0.96));
    box-shadow: 0 14px 40px rgba(4,6,28,0.40), inset 0 1px 0 rgba(122,162,255,0.07);
}

body.page-app:not(.page-login):not(.page-viewer) .panel {
    border: 1px solid rgba(82,118,228,0.26);
    background: linear-gradient(180deg, rgba(16,20,46,0.96), rgba(12,15,36,0.98));
    box-shadow: 0 8px 24px rgba(4,6,28,0.38), inset 0 1px 0 rgba(122,162,255,0.05);
}
body.page-app:not(.page-login):not(.page-viewer) .panel-heading {
    background: linear-gradient(180deg, rgba(20,26,60,0.98), rgba(14,18,48,0.98)) !important;
    border-bottom: 1px solid rgba(82,118,228,0.20) !important;
    color: var(--text-bright) !important;
    box-shadow: inset 0 1px 0 rgba(122,162,255,0.07) !important;
}
body.page-app:not(.page-login):not(.page-viewer) .table > thead > tr > th,
body.page-app:not(.page-login):not(.page-viewer) .table-worklist thead th {
    background: linear-gradient(180deg, rgba(20,26,60,0.98), rgba(14,20,50,0.98));
    border-color: rgba(82,118,228,0.24) !important;
    color: var(--text-header);
}
body.page-app:not(.page-login):not(.page-viewer) .table > tbody > tr > td,
body.page-app:not(.page-login):not(.page-viewer) .table-worklist td {
    border-color: rgba(70,100,215,0.16) !important;
    color: var(--text);
}
body.page-app:not(.page-login):not(.page-viewer) .form-control {
    background: linear-gradient(180deg, rgba(12,15,36,0.98), rgba(9,11,28,0.98));
    border-color: rgba(82,118,228,0.34);
    color: var(--text-bright);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
body.page-app:not(.page-login):not(.page-viewer) .form-control:focus {
    background: rgba(14,18,44,0.99);
    border-color: rgba(112,152,255,0.72);
    box-shadow: 0 0 0 3px rgba(82,118,242,0.26), 0 0 24px rgba(102,148,255,0.18);
    color: var(--text-bright);
}
body.page-app:not(.page-login):not(.page-viewer) .form-control::placeholder { color: var(--text-muted); }
body.page-app:not(.page-login):not(.page-viewer) label { color: var(--text-header); }

body.page-app:not(.page-login):not(.page-viewer) .btn-default,
body.page-app:not(.page-login):not(.page-viewer) .toolbar-btn {
    background: linear-gradient(180deg, rgba(22,28,68,0.98), rgba(16,20,52,0.98));
    border-color: rgba(88,118,238,0.30) !important;
    color: var(--text-bright) !important;
    box-shadow: 0 3px 12px rgba(4,6,28,0.28), inset 0 1px 0 rgba(145,178,255,0.06);
}
body.page-app:not(.page-login):not(.page-viewer) .btn-default:hover,
body.page-app:not(.page-login):not(.page-viewer) .toolbar-btn:hover {
    background: linear-gradient(180deg, rgba(32,40,88,0.98), rgba(24,30,72,0.98)) !important;
    border-color: rgba(112,152,255,0.48) !important;
    color: #ffffff !important;
}
body.page-app:not(.page-login):not(.page-viewer) .btn-primary {
    background: linear-gradient(135deg, #5b78f0 0%, #7c5ef4 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 22px rgba(78,108,242,0.44), 0 0 0 1px rgba(162,192,255,0.16), inset 0 1px 0 rgba(255,255,255,0.12);
}
body.page-app:not(.page-login):not(.page-viewer) .btn-primary:hover,
body.page-app:not(.page-login):not(.page-viewer) .btn-primary:focus {
    background: linear-gradient(135deg, #6e8cf4 0%, #8e72f8 100%);
    box-shadow: 0 8px 28px rgba(88,118,252,0.54), 0 0 0 1px rgba(172,202,255,0.24);
    transform: translateY(-1px);
}
body.page-app:not(.page-login):not(.page-viewer) .alert { border-radius: 12px; border-left-width: 4px; }

/* ── Panels / cards — global luxury glass ───────────────── */
.panel,
.page-card,
.search-bar-card,
.import-form-card,
.quick-search {
    background: linear-gradient(160deg, rgba(14,20,48,0.96), rgba(10,14,36,0.98));
    border-color: rgba(82,118,228,0.26);
    box-shadow: 0 20px 50px rgba(4,6,28,0.72), 0 0 0 1px rgba(88,122,232,0.14), 0 0 60px rgba(52,78,205,0.08);
}
.panel-heading,
.page-card-head,
.modal-header {
    background: linear-gradient(180deg, rgba(18,24,58,0.98) 0%, rgba(12,16,44,0.98) 100%) !important;
    border-bottom-color: rgba(82,118,228,0.20) !important;
    box-shadow: inset 0 1px 0 rgba(122,162,255,0.07) !important;
}

/* Panel toolbar */
.panel-toolbar {
    background: linear-gradient(180deg, #101428 0%, #0c1020 100%);
    border-bottom: 1px solid rgba(82,118,238,0.26);
    box-shadow: 0 10px 28px rgba(4,6,28,0.46), inset 0 1px 0 rgba(122,162,255,0.04);
}

/* ── Form controls — global ─────────────────────────────── */
.form-control {
    background: linear-gradient(180deg, rgba(12,15,36,0.98) 0%, rgba(9,11,28,0.98) 100%);
    border-color: rgba(82,118,228,0.32);
    color: var(--text-bright);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.form-control:focus {
    background: rgba(14,18,44,0.99);
    border-color: rgba(112,152,255,0.70);
    box-shadow: 0 0 0 3px rgba(82,118,242,0.26), 0 0 24px rgba(102,148,255,0.18);
    color: var(--text-bright);
}
.form-control::placeholder { color: var(--text-muted); }

/* ── Buttons — global ───────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, #5b78f0 0%, #7c5ef4 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 22px rgba(78,108,242,0.44), 0 0 0 1px rgba(162,192,255,0.14), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #6e8cf4 0%, #8e72f8 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 28px rgba(88,118,252,0.54), 0 0 0 1px rgba(172,202,255,0.24), inset 0 1px 0 rgba(255,255,255,0.14);
    transform: translateY(-1px);
}
.btn-default,
.toolbar-btn {
    background: linear-gradient(180deg, rgba(20,26,62,0.98) 0%, rgba(15,20,48,0.98) 100%);
    border-color: rgba(82,118,238,0.30) !important;
    color: var(--text-bright) !important;
    box-shadow: 0 3px 12px rgba(4,6,28,0.28), inset 0 1px 0 rgba(142,178,255,0.06);
}
.btn-default:hover,
.toolbar-btn:hover {
    background: linear-gradient(180deg, rgba(30,40,86,0.98) 0%, rgba(22,30,68,0.98) 100%) !important;
    border-color: rgba(112,152,255,0.46) !important;
    color: #ffffff !important;
}
.btn-success:hover { box-shadow: 0 4px 18px rgba(16,185,129,0.44); }
.btn-danger:hover  { box-shadow: 0 4px 18px rgba(232,92,106,0.44); }
.btn-warning:hover { box-shadow: 0 4px 18px rgba(245,166,35,0.40); }

/* ── Table worklist ─────────────────────────────────────── */
.table-worklist thead tr,
.table > thead > tr > th {
    background: linear-gradient(180deg, rgba(20,26,60,0.98) 0%, rgba(14,18,48,0.98) 100%);
}
.table-worklist thead th,
.table > thead > tr > th {
    color: var(--text-header);
    border-color: rgba(82,118,228,0.22) !important;
    box-shadow: inset 0 1px 0 rgba(142,178,255,0.08);
}
.table-worklist tbody tr:hover {
    background: var(--bg-row-hover) !important;
    box-shadow: inset 4px 0 0 rgba(128,172,255,0.90) !important;
}

/* ── Modals ──────────────────────────────────────────────── */
.modal-content {
    background: linear-gradient(160deg, rgba(14,20,48,0.98) 0%, rgba(10,14,36,0.99) 100%) !important;
    border: 1px solid rgba(82,118,228,0.26) !important;
    box-shadow: 0 32px 90px rgba(4,6,28,0.95), 0 0 0 1px rgba(92,128,242,0.20), 0 0 80px rgba(52,78,205,0.10) !important;
}
.modal-footer {
    background: rgba(14,18,48,0.98);
    border-top-color: rgba(82,118,228,0.18);
}
.modal-backdrop.in {
    backdrop-filter: blur(4px) saturate(1.12);
    -webkit-backdrop-filter: blur(4px) saturate(1.12);
    background: rgba(4,6,26,0.72);
    opacity: 1 !important;
}

/* ── Badges / pills ──────────────────────────────────────── */
.count-badge,
.hn-badge,
.mod-badge {
    background: rgba(82,118,242,0.14) !important;
    border-color: rgba(98,135,248,0.34) !important;
    color: #aac2ff !important;
}
.badge-role.admin  { background: rgba(92,68,228,0.30); color: #d4ccff; }
.badge-role.staff  { background: rgba(72,102,228,0.24); color: #c8d4ff; }
.badge-role.doctor { background: rgba(16,185,129,0.22); color: #a7f3d8; }

/* ── Status dot — ring pulse ────────────────────────────── */
@keyframes lx-online-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(16,196,144,0.80), 0 0 5px rgba(16,196,144,0.50); }
    65%  { box-shadow: 0 0 0 5px rgba(16,196,144,0),    0 0 16px rgba(16,196,144,0.62); }
    100% { box-shadow: 0 0 0 0   rgba(16,196,144,0),    0 0 5px rgba(16,196,144,0.44); }
}
.orthanc-status.online .dot { animation: lx-online-pulse 2.2s ease-out infinite !important; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination > li > a,
.pagination > li > span {
    background: rgba(14,18,44,0.98);
    border-color: rgba(82,118,228,0.26);
    color: var(--text);
}
.pagination > li > a:hover {
    background: rgba(24,32,72,0.98);
    border-color: rgba(102,144,255,0.40);
    color: var(--text-bright);
}
.pagination > .active > a,
.pagination > .active > span {
    background: var(--gradient-accent) !important;
    border-color: transparent !important;
    color: #fff !important;
}

/* ── Nav tabs ────────────────────────────────────────────── */
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    background: rgba(14,18,44,0.98);
    border-color: rgba(82,118,228,0.30);
    border-bottom-color: rgba(14,18,44,0.98);
    color: var(--accent-hover);
}

/* ── Dashboard hero cards ────────────────────────────────── */
.dc-blue   .dash-card-accent { background: linear-gradient(90deg,  #5b78f0, #7c5ef4); }
.dc-blue   .dash-card-icon   { background: linear-gradient(135deg, #5b78f0, #7c5ef4); box-shadow: 0 6px 18px rgba(82,112,242,0.44); }
.dc-green  .dash-card-accent { background: linear-gradient(90deg,  #10c490, #0ea5e9); }
.dc-green  .dash-card-icon   { background: linear-gradient(135deg, #10c490, #0ea5e9); box-shadow: 0 6px 18px rgba(16,196,144,0.42); }
.dc-orange .dash-card-accent { background: linear-gradient(90deg,  #f5a623, #e85c6a); }
.dc-orange .dash-card-icon   { background: linear-gradient(135deg, #f5a623, #f97316); box-shadow: 0 6px 18px rgba(245,166,35,0.42); }
.dash-card:hover {
    border-color: rgba(98,135,248,0.42);
    box-shadow: 0 28px 72px rgba(4,6,28,0.82), 0 0 0 1px rgba(98,135,248,0.32), 0 0 50px rgba(62,92,225,0.22) !important;
}

/* ── Panel/card hover lift ───────────────────────────────── */
.page-card,
.search-bar-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.page-card:hover,
.search-bar-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 60px rgba(4,6,28,0.80), 0 0 0 1px rgba(98,135,248,0.28) !important;
}

/* ── Login page — luxury deep navy ──────────────────────── */
.login-wrapper {
    background:
        radial-gradient(ellipse 700px 520px at 22% 20%, rgba(58, 85,218,0.34) 0%, transparent 60%),
        radial-gradient(ellipse 620px 480px at 78% 78%, rgba(95, 55,208,0.26) 0%, transparent 58%),
        radial-gradient(ellipse 500px 380px at 52% 55%, rgba(32, 44,158,0.16) 0%, transparent 62%),
        #0b0d1c !important;
}
.login-card {
    border-radius: 20px;
    border-color: rgba(82,118,228,0.28) !important;
    box-shadow: 0 32px 90px rgba(3,5,22,0.92), 0 0 0 1px rgba(98,132,242,0.22), 0 0 80px rgba(52,82,215,0.14);
}
.login-header {
    background: linear-gradient(145deg, #0e1535 0%, #121d4a 55%, #0e1840 100%);
}
.login-logo {
    background: linear-gradient(135deg, #5b78f0 0%, #7c5ef4 100%);
    box-shadow: 0 10px 32px rgba(82,112,242,0.58), inset 0 1px 0 rgba(255,255,255,0.16);
}
.login-header h3 {
    background: linear-gradient(135deg, #eef2ff 0%, #a8c0ff 60%, #c8d6ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Dropzone ────────────────────────────────────────────── */
.dropzone-area:hover,
.dropzone-area.drag-over {
    border-color: rgba(102,148,255,0.62);
    background: rgba(78,112,238,0.12);
    box-shadow: 0 0 0 3px rgba(92,132,248,0.28), 0 6px 20px rgba(58,88,215,0.18);
}
.file-drop-label {
    background: rgba(12,15,36,0.95) !important;
    border: 2px dashed rgba(82,118,228,0.38) !important;
    border-radius: 10px;
    color: var(--text-muted) !important;
}
.file-drop-label .fa { color: var(--accent) !important; }
.file-drop-label:hover,
.file-drop-label.drag-over {
    border-color: rgba(112,152,255,0.65) !important;
    background: rgba(72,108,238,0.12) !important;
    color: var(--text-bright) !important;
}

/* ── Page transitions — spring easing ───────────────────── */
.panel-main, .page-wrapper, .login-card {
    animation: lxPageIn 0.40s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes lxPageIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ── Reduce motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .dash-brand-mark,
    body.page-dashboard .dash-rail-main .dash-brand-mark,
    body.page-app:not(.page-login):not(.page-viewer) .dash-rail-main .dash-brand-mark {
        animation: none !important;
    }
    .orthanc-status.online .dot { animation: none !important; }
}

/* ── MWL — white light theme ─────────────────────────────── */
body.page-app.page-mwl:not(.page-login):not(.page-viewer) {
    background: #f5f5f7 !important;
    background-attachment: scroll !important;
    color: #1d1d1f;
}
body.page-app.page-mwl .app-content {
    background: #f5f5f7 !important;
}
body.page-app.page-mwl .page-wrapper.mwl-page {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* ── Import Center — white light theme ─────────────────────── */
body.page-app.page-import:not(.page-login):not(.page-viewer) {
    background: #f5f5f7 !important;
    background-attachment: scroll !important;
    color: #1d1d1f;
}
body.page-app.page-import .app-content {
    background: #ffffff !important;
}
body.page-app.page-import .page-wrapper.import-lab-page {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* ── Patient Search — white light theme ────────────────────── */
body.page-app.page-patient-search:not(.page-login):not(.page-viewer) {
    background: #f5f5f7 !important;
    background-attachment: scroll !important;
    color: #1d1d1f;
}
body.page-app.page-patient-search .app-content {
    background: #ffffff !important;
}
body.page-app.page-patient-search .page-wrapper.patient-search-page {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* ── Settings — white light theme ─────────────────────────── */
body.page-app.page-settings:not(.page-login):not(.page-viewer) {
    --text: #515159;
    --text-bright: #1d1d1f;
    --text-header: #515159;
    --text-muted: #86868b;
    --accent: #0a84ff;
    background: #f5f5f7 !important;
    background-attachment: scroll !important;
    color: #1d1d1f;
}
body.page-app.page-settings .app-content {
    background: #ffffff !important;
}
body.page-app.page-settings .page-wrapper.gray-page {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
body.page-app.page-settings .modal-content {
    background: #ffffff !important;
    border: 1px solid rgba(60, 60, 67, 0.12) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.16) !important;
}
body.page-app.page-settings .modal-header,
body.page-app.page-settings .modal-footer {
    background: #ffffff !important;
    border-color: rgba(60, 60, 67, 0.12) !important;
}
body.page-app.page-settings .modal-backdrop.in {
    background: rgba(0, 0, 0, 0.32) !important;
}
