/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #1e3a5f; --navy2: #15304f;
    --blue: #2563eb; --blue-lt: #eff6ff; --blue-md: #bfdbfe;
    --green: #16a34a; --green-lt: #f0fdf4;
    --red: #dc2626; --red-lt: #fef2f2;
    --amber: #d97706; --amber-lt: #fffbeb;
    --gray: #64748b; --gray-lt: #f8fafc;
    --border: #e2e8f0; --border2: #cbd5e1;
    --text: #0f172a; --text2: #475569; --text3: #94a3b8;
    --radius: 8px; --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.12);
    --app-bg: #f0f2f5;
    --topnav-bg: #1e3a5f;
    --topnav-bg-2: #15304f;
    --brand-bg: #2563eb;
    --panel-bg: #fff;
    --panel-soft: #f8fafc;
    --table-hover: #fafcff;
}

body.skin-lotus,
.skin-lotus {
    --navy: #1e3a5f; --navy2: #15304f;
    --blue: #2563eb; --blue-lt: #eff6ff; --blue-md: #bfdbfe;
    --app-bg: #f0f2f5; --topnav-bg: #1e3a5f; --topnav-bg-2: #15304f; --brand-bg: #2563eb;
    --panel-bg: #fff; --panel-soft: #f8fafc; --table-hover: #fafcff;
}

body.skin-ocean,
.skin-ocean {
    --navy: #0f4c5c; --navy2: #0b3b47;
    --blue: #0891b2; --blue-lt: #ecfeff; --blue-md: #a5f3fc;
    --app-bg: #eef7f8; --topnav-bg: #0f4c5c; --topnav-bg-2: #0b3b47; --brand-bg: #0891b2;
    --panel-bg: #ffffff; --panel-soft: #f0fdfa; --table-hover: #ecfeff;
}

body.skin-emerald,
.skin-emerald {
    --navy: #14532d; --navy2: #0f3f23;
    --blue: #059669; --blue-lt: #ecfdf5; --blue-md: #a7f3d0;
    --app-bg: #f0f7f2; --topnav-bg: #14532d; --topnav-bg-2: #0f3f23; --brand-bg: #059669;
    --panel-bg: #ffffff; --panel-soft: #f7fee7; --table-hover: #f0fdf4;
}

body.skin-rose,
.skin-rose {
    --navy: #7f1d1d; --navy2: #641616;
    --blue: #e11d48; --blue-lt: #fff1f2; --blue-md: #fecdd3;
    --app-bg: #faf4f5; --topnav-bg: #7f1d1d; --topnav-bg-2: #641616; --brand-bg: #e11d48;
    --panel-bg: #ffffff; --panel-soft: #fff1f2; --table-hover: #fff7ed;
}

/* Skin overrides for screens that still use inline colors. */
body[class*="skin-"] .lotus-topnav,
[class*="skin-"] .lotus-topnav,
body[class*="skin-"] *[style*="background:#1e3a5f"],
body[class*="skin-"] *[style*="background: #1e3a5f"],
[class*="skin-"] *[style*="background:#1e3a5f"],
[class*="skin-"] *[style*="background: #1e3a5f"] {
    background: var(--topnav-bg) !important;
}

body[class*="skin-"] .lotus-brand-logo,
body[class*="skin-"] .lotus-user-avatar,
[class*="skin-"] .lotus-brand-logo,
[class*="skin-"] .lotus-user-avatar,
body[class*="skin-"] *[style*="background:#2563eb"],
body[class*="skin-"] *[style*="background: #2563eb"],
[class*="skin-"] *[style*="background:#2563eb"],
[class*="skin-"] *[style*="background: #2563eb"] {
    background: var(--brand-bg) !important;
}

body[class*="skin-"] .btn-primary,
body[class*="skin-"] .pag-btn.active,
[class*="skin-"] .btn-primary,
[class*="skin-"] .pag-btn.active {
    background: var(--blue) !important;
    border-color: var(--blue) !important;
}

body[class*="skin-"] main,
body[class*="skin-"] .lotus-main,
body[class*="skin-"] .layout-loading,
[class*="skin-"] main,
[class*="skin-"] .lotus-main,
[class*="skin-"] .layout-loading,
body[class*="skin-"] *[style*="background:#f0f2f5"],
body[class*="skin-"] *[style*="background: #f0f2f5"],
[class*="skin-"] *[style*="background:#f0f2f5"],
[class*="skin-"] *[style*="background: #f0f2f5"] {
    background: var(--app-bg) !important;
}

body[class*="skin-"] *[style*="background:#f8fafc"],
body[class*="skin-"] *[style*="background: #f8fafc"],
body[class*="skin-"] *[style*="background:#fafbfc"],
body[class*="skin-"] *[style*="background: #fafbfc"],
[class*="skin-"] *[style*="background:#f8fafc"],
[class*="skin-"] *[style*="background: #f8fafc"],
[class*="skin-"] *[style*="background:#fafbfc"],
[class*="skin-"] *[style*="background: #fafbfc"] {
    background: var(--panel-soft) !important;
}

body[class*="skin-"] *[style*="background:#eff6ff"],
body[class*="skin-"] *[style*="background: #eff6ff"],
[class*="skin-"] *[style*="background:#eff6ff"],
[class*="skin-"] *[style*="background: #eff6ff"] {
    background: var(--blue-lt) !important;
}

body[class*="skin-"] *[style*="color:#1d4ed8"],
body[class*="skin-"] *[style*="color: #1d4ed8"],
[class*="skin-"] *[style*="color:#1d4ed8"],
[class*="skin-"] *[style*="color: #1d4ed8"] {
    color: var(--blue) !important;
}

body[class*="skin-"] .form-ctrl:focus,
[class*="skin-"] .form-ctrl:focus {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent) !important;
}

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 13px;
    background: var(--app-bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────────── */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.app-body   { display: flex; flex: 1; overflow: hidden; height: calc(100vh - 50px); }
.main-content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ── Main Layout ───────────────────────────────────────────────── */
.layout-loading {
    display:flex;align-items:center;justify-content:center;height:100vh;
    flex-direction:column;gap:12px;background:var(--app-bg);
}
.layout-loading-logo {
    width:40px;height:40px;background:var(--topnav-bg);border-radius:10px;
    display:flex;align-items:center;justify-content:center;color:#fff;
    font-weight:700;font-size:16px;
}
.layout-loading-text { color:#64748b;font-size:13px; }
.lotus-shell { display:flex;flex-direction:column;min-height:100vh; }
.lotus-topnav {
    background:var(--topnav-bg);height:52px;display:flex;align-items:center;
    padding:0 16px;gap:2px;flex-shrink:0;box-shadow:0 2px 8px rgba(0,0,0,.2);
    position:sticky;top:0;z-index:200;overflow:visible;
}
.lotus-brand {
    display:flex;align-items:center;gap:8px;text-decoration:none;
    margin-right:10px;flex-shrink:0;
}
.lotus-brand-logo {
    width:30px;height:30px;background:var(--brand-bg);border-radius:7px;
    display:flex;align-items:center;justify-content:center;color:#fff;
    font-weight:700;font-size:12px;
}
.lotus-brand-text { color:#fff;font-weight:600;font-size:13px;white-space:nowrap; }
.lotus-nav-sep { width:1px;height:22px;background:rgba(255,255,255,.2);margin:0 6px;flex-shrink:0; }
.lotus-nav-link {
    display:inline-flex;align-items:center;gap:4px;padding:6px 10px;
    border-radius:6px;color:rgba(255,255,255,.8);font-size:12.5px;
    cursor:pointer;white-space:nowrap;text-decoration:none;user-select:none;
}
.lotus-nav-link:hover { background:rgba(255,255,255,.14);color:#fff; }
.lotus-nav-dd { position:relative;flex-shrink:0; }
.lotus-nav-menu {
    position:absolute;top:100%;left:0;background:#fff;border-radius:8px;
    min-width:210px;max-height:80vh;overflow-y:auto;box-shadow:0 8px 24px rgba(0,0,0,.15);
    border:1px solid #e2e8f0;z-index:1000;padding:6px;margin-top:4px;
}
.lotus-nav-group {
    font-size:10px;font-weight:600;color:#94a3b8;text-transform:uppercase;
    letter-spacing:.5px;padding:4px 10px 2px;
}
.lotus-nav-item {
    display:block;padding:6px 10px;border-radius:6px;color:#374151;
    font-size:12.5px;text-decoration:none;white-space:nowrap;
}
.lotus-nav-item:hover { background:#f1f5f9;color:#1d4ed8; }
.lotus-nav-divider { height:1px;background:#f1f5f9;margin:4px 0; }
.lotus-nav-spacer { flex:1;min-width:12px; }
.lotus-icon-btn {
    width:32px;height:32px;border-radius:8px;border:none;background:rgba(255,255,255,.1);
    cursor:pointer;color:rgba(255,255,255,.8);font-size:15px;display:flex;
    align-items:center;justify-content:center;flex-shrink:0;transition:background .15s;
}
.lotus-icon-btn:hover { background:rgba(255,255,255,.18); }
.lotus-skin-select option { color:#0f172a;background:#fff; }
.lotus-user-chip {
    display:flex;align-items:center;gap:7px;padding:4px 10px 4px 5px;
    background:rgba(255,255,255,.1);border-radius:20px;border:none;cursor:pointer;
    flex-shrink:0;font-family:inherit;
}
.lotus-user-chip:hover { background:rgba(255,255,255,.16); }
.lotus-user-avatar {
    width:26px;height:26px;border-radius:50%;background:#2563eb;color:#fff;
    display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;
}
.lotus-user-name { color:#fff;font-size:12px;white-space:nowrap; }
.lotus-user-logout { color:rgba(255,255,255,.5);font-size:10px; }
.lotus-main { flex:1;padding:16px 20px;background:var(--app-bg);overflow-y:auto; }

@media (max-width: 760px) {
    .lotus-topnav { height:auto;min-height:52px;padding:8px 10px; }
    .lotus-brand-text { display:none; }
    .lotus-nav-sep { display:none; }
    .lotus-user-name { display:none; }
    .lotus-main { padding:12px; }
}

/* ── TopNav ───────────────────────────────────────────────────── */
.topnav {
    height: 50px; background: var(--navy);
    display: flex; align-items: center; padding: 0 20px; gap: 12px;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.logo-box { width: 32px; height: 32px; background: var(--blue); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.logo-title { color: #fff; font-size: 14px; font-weight: 600; }
.logo-sub { color: rgba(255,255,255,.45); font-size: 10px; }
.nav-sep { width: 1px; height: 24px; background: rgba(255,255,255,.2); }
.topnav-breadcrumb { color: rgba(255,255,255,.6); font-size: 12px; flex: 1; }
.topnav-breadcrumb span { color: #fff; font-weight: 500; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-icon-btn { width: 32px; height: 32px; border-radius: 8px; border: none; background: rgba(255,255,255,.1); cursor: pointer; color: rgba(255,255,255,.7); font-size: 14px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.nav-icon-btn:hover { background: rgba(255,255,255,.18); }
.user-chip { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 5px; background: rgba(255,255,255,.1); border-radius: 20px; cursor: pointer; }
.user-av { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; }
.user-name { color: #fff; font-size: 12px; font-weight: 500; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar { width: 220px; background: var(--navy); overflow-y: auto; flex-shrink: 0; padding-bottom: 16px; }
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.tree-group { margin-top: 4px; }
.tree-group-hdr { display: flex; align-items: center; gap: 7px; padding: 7px 14px 5px; color: rgba(255,255,255,.45); font-size: 10.5px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; cursor: pointer; user-select: none; }
.tree-group-hdr:hover { color: rgba(255,255,255,.7); }
.tree-group-hdr .caret { margin-left: auto; font-size: 9px; transition: transform .2s; }
.tree-group-hdr.open .caret { transform: rotate(90deg); }
.tree-children { overflow: hidden; transition: max-height .2s ease; }

.tree-item { display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 20px; color: rgba(255,255,255,.6); cursor: pointer; font-size: 12.5px; transition: all .12s; border-left: 2px solid transparent; }
.tree-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.tree-item.active { background: rgba(37,99,235,.25); color: #93c5fd; border-left-color: #3b82f6; }
.tree-item .icon { font-size: 13px; width: 16px; text-align: center; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 13px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 12.5px; font-family: inherit; cursor: pointer; background: var(--panel-bg); color: var(--text2); transition: all .12s; font-weight: 400; white-space: nowrap; }
.btn:hover { background: var(--gray-lt); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: #1d4ed8; }
.btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover { background: var(--navy2); }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-lt); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.auto-btn-icon {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:1.05em;
    min-width:1.05em;
    height:1.05em;
    line-height:1;
    font-size:1.05em;
    font-weight:700;
    flex-shrink:0;
}
.btn-xs .auto-btn-icon,
.btn-sm .auto-btn-icon { font-size:1em; }

/* ── Form controls ────────────────────────────────────────────── */
.form-ctrl { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12.5px; font-family: inherit; background: var(--panel-bg); color: var(--text); outline: none; transition: border .15s; }
.form-ctrl:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.form-label { font-size: 11.5px; color: var(--text2); font-weight: 500; display: block; margin-bottom: 4px; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-row { margin-bottom: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.form-err { font-size: 11px; color: var(--red); margin-top: 3px; }

/* ── Card ─────────────────────────────────────────────────────── */
.card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); }
.page-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.page-sub { font-size: 12px; color: var(--gray); }
.page-head { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel-bg); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 40; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Stats ────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.stat-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.stat-val { font-size: 20px; font-weight: 700; line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--gray); margin-top: 2px; }

/* ── Table / ListView ─────────────────────────────────────────── */
.tbl-card,
.lotus-listview {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tbl-card:has(> .tbl-body-scroll),
.lotus-listview {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tbl-header,
.lotus-listview-header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-soft);
    flex-shrink: 0;
}

.tbl-footer,
.lotus-listview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    font-size: 12px;
    color: var(--gray);
    flex-shrink: 0;
}

.tbl-body-scroll,
.catalog-table-scroll,
.lotus-listview-scroll,
.employee-related-table,
.table-scroll-both,
.card:has(table.data-table),
div[style*="overflow:auto"]:has(> table),
div[style*="overflow: auto"]:has(> table),
div[style*="overflow-y:auto"]:has(> table),
div[style*="overflow-y: auto"]:has(> table) {
    overflow-x: auto;
    overflow-y: auto;
    min-height: 0;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
}

.tbl-body-scroll,
.lotus-listview-scroll,
.table-scroll-both {
    flex: 1;
    max-height: var(--listview-max-height, min(640px, calc(100vh - 220px)));
}

.tbl-body-scroll > table,
.catalog-table-scroll > table,
.lotus-listview-scroll > table,
.employee-related-table > table,
.employee-related-table table,
.table-scroll-both > table,
.card:has(table.data-table) table.data-table,
div[style*="overflow:auto"] > table,
div[style*="overflow: auto"] > table,
div[style*="overflow-y:auto"] > table,
div[style*="overflow-y: auto"] > table {
    width: max-content;
    min-width: 100%;
}

.tbl-body-scroll::-webkit-scrollbar,
.catalog-table-scroll::-webkit-scrollbar,
.lotus-listview-scroll::-webkit-scrollbar,
.employee-related-table::-webkit-scrollbar,
.table-scroll-both::-webkit-scrollbar,
.card:has(table.data-table)::-webkit-scrollbar,
div[style*="overflow:auto"]:has(> table)::-webkit-scrollbar,
div[style*="overflow: auto"]:has(> table)::-webkit-scrollbar,
div[style*="overflow-y:auto"]:has(> table)::-webkit-scrollbar,
div[style*="overflow-y: auto"]:has(> table)::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.tbl-body-scroll::-webkit-scrollbar-thumb,
.catalog-table-scroll::-webkit-scrollbar-thumb,
.lotus-listview-scroll::-webkit-scrollbar-thumb,
.employee-related-table::-webkit-scrollbar-thumb,
.table-scroll-both::-webkit-scrollbar-thumb,
.card:has(table.data-table)::-webkit-scrollbar-thumb,
div[style*="overflow:auto"]:has(> table)::-webkit-scrollbar-thumb,
div[style*="overflow: auto"]:has(> table)::-webkit-scrollbar-thumb,
div[style*="overflow-y:auto"]:has(> table)::-webkit-scrollbar-thumb,
div[style*="overflow-y: auto"]:has(> table)::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid var(--panel-bg);
}

.tbl-body-scroll::-webkit-scrollbar-track,
.catalog-table-scroll::-webkit-scrollbar-track,
.lotus-listview-scroll::-webkit-scrollbar-track,
.employee-related-table::-webkit-scrollbar-track,
.table-scroll-both::-webkit-scrollbar-track,
.card:has(table.data-table)::-webkit-scrollbar-track,
div[style*="overflow:auto"]:has(> table)::-webkit-scrollbar-track,
div[style*="overflow: auto"]:has(> table)::-webkit-scrollbar-track,
div[style*="overflow-y:auto"]:has(> table)::-webkit-scrollbar-track,
div[style*="overflow-y: auto"]:has(> table)::-webkit-scrollbar-track {
    background: #f1f5f9;
}

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { padding: 9px 12px; text-align: left; font-weight: 500; color: var(--gray); font-size: 11.5px; background: var(--panel-soft); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--table-hover); }

.tbl-body-scroll thead th,
.catalog-table-scroll thead th,
.lotus-listview-scroll thead th,
.employee-related-table thead th,
.table-scroll-both thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* ── Department Tree ──────────────────────────────────────────── */
.dept-tree-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    padding: 8px;
    background: #ffffff;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
}

.dept-tree-scroll > .dept-tree-all-row,
.dept-tree-node {
    width: max-content;
    min-width: 320px;
}

.dept-tree-all-row,
.dept-tree-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    min-width: 304px;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    margin-bottom: 2px;
    color: #334155;
    transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}

.dept-tree-all-row:hover,
.dept-tree-row:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.dept-tree-all-row.is-active,
.dept-tree-row.is-active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    box-shadow: inset 2px 0 0 #2563eb;
}

.dept-tree-toggle {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 10px;
    line-height: 1;
    flex: 0 0 auto;
}

.dept-tree-toggle:not(.is-empty):hover {
    background: #e2e8f0;
    color: #1d4ed8;
}

.dept-tree-toggle.is-empty {
    color: transparent;
}

.dept-tree-folder,
.dept-tree-all-icon {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 5px;
    flex: 0 0 auto;
}

.dept-tree-folder {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.dept-tree-folder::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 2px;
    width: 6px;
    height: 4px;
    border-radius: 3px 3px 1px 1px;
    background: #38bdf8;
}

.dept-tree-folder::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: 3px;
    height: 7px;
    border-radius: 2px;
    background: #0ea5e9;
}

.dept-tree-all-icon {
    background: #dbeafe;
    border: 1px solid #bfdbfe;
}

.dept-tree-all-icon::before,
.dept-tree-all-icon::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: #2563eb;
}

.dept-tree-all-icon::before {
    width: 6px;
    height: 6px;
    left: 5px;
    top: 3px;
}

.dept-tree-all-icon::after {
    width: 10px;
    height: 5px;
    left: 3px;
    bottom: 4px;
}

.dept-tree-name {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 17px;
}

.dept-tree-all-label {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.dept-tree-count {
    margin-left: 8px;
    background: #eef2ff;
    color: #475569;
    border: 1px solid #dbeafe;
    font-size: 10px;
    line-height: 16px;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    text-align: center;
    flex: 0 0 auto;
}

.dept-tree-all-row.is-active .dept-tree-count,
.dept-tree-row.is-active .dept-tree-count {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.dept-tree-children {
    position: relative;
    width: max-content;
    min-width: 100%;
    margin-left: 9px;
    padding-left: 20px;
    border-left: 1px solid #e2e8f0;
}

.dept-tree-children .dept-tree-row::before {
    content: "";
    position: absolute;
    left: -21px;
    top: 50%;
    width: 18px;
    height: 1px;
    background: #e2e8f0;
}

.dept-tree-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.dept-tree-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid var(--panel-bg);
}

.dept-tree-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
}

/* ── Badge ────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f1f5f9; color: #64748b; }

/* ── Avatar ───────────────────────────────────────────────────── */
.av { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.flex-cell { display: flex; align-items: center; gap: 8px; }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); background: #fafbfc; font-size: 12px; }
.pag-btns { display: flex; gap: 4px; }
.pag-btn { min-width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; padding: 0 6px; color: var(--gray); transition: all .12s; font-family: inherit; }
.pag-btn:hover { background: #f1f5f9; }
.pag-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.pag-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 560px; max-width: 95vw; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-hdr { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-hdr h3 { font-size: 14px; font-weight: 600; }
.modal-body { padding: 16px 20px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; cursor: pointer; color: var(--gray); font-size: 17px; }
.modal-close:hover { background: #f1f5f9; }

/* ── Drawer ───────────────────────────────────────────────────── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 400; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 680px; background: #fff; z-index: 401; display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.12); }
.drawer-hdr { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #fafbfc; flex-shrink: 0; }

/* ── Loading ──────────────────────────────────────────────────── */
.loading-spinner { display: flex; align-items: center; justify-content: center; padding: 40px; flex-direction: column; gap: 12px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loading { 0%,100% { transform: translateX(-100%); } 50% { transform: translateX(100%); } }

/* ── Search & Filter ──────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.search-inp { padding-left: 32px !important; }
.filter-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 14px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Catalog screens: match employee list rhythm ──────────────── */
.catalog-page {
    height: calc(100vh - 84px);
    margin: -16px -20px;
    background: var(--panel-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.catalog-head {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.catalog-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.catalog-search { width: min(260px, 32vw); }
.catalog-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text2);
    cursor: pointer;
    white-space: nowrap;
}
.catalog-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--text2);
    font-size: 12px;
    white-space: nowrap;
}
.catalog-selection {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text2);
    font-size: 12px;
    flex-shrink: 0;
}
.catalog-table {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.catalog-table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.catalog-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}
.catalog-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--gray);
    font-size: 12px;
    flex-shrink: 0;
}
.catalog-modal {
    width: 720px;
    max-width: 96vw;
}
.catalog-modal .modal-hdr {
    background: var(--navy);
    color: #fff;
}
.catalog-modal .modal-close {
    color: #fff;
}
.catalog-modal .modal-close:hover {
    background: rgba(255,255,255,.12);
}

@media (max-width: 760px) {
    .catalog-head {
        align-items: stretch;
        flex-direction: column;
    }
    .catalog-actions {
        justify-content: flex-start;
    }
    .catalog-search {
        width: 100%;
    }
}

/* ── Toast ────────────────────────────────────────────────────── */
#blazor-error-ui { background: #fee2e2; padding: 10px 16px; position: fixed; bottom: 0; width: 100%; z-index: 999; display: none; align-items: center; gap: 8px; font-size: 13px; }

/* ── Login page ───────────────────────────────────────────────── */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; justify-content: center; }
.login-logo-box { width: 44px; height: 44px; background: var(--blue); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; }
.login-title { font-size: 20px; font-weight: 600; color: var(--text); text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--gray); text-align: center; margin-bottom: 24px; }
.section-title { font-size: 12px; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--blue-md); }

/* ── Modal Large ──────────────────────────────────────────────── */
.modal-lg {
    width: 860px;
    max-width: 96vw;
}
.modal-backdrop {
    align-items: center;
    justify-content: center;
}

/* ── Top Navigation ──────────────────────────────────────────── */

    .nav-top-item {
        display:inline-flex;align-items:center;gap:5px;
        padding:6px 10px;border-radius:6px;border:none;
        background:transparent;color:rgba(255,255,255,.75);
        font-size:12.5px;font-family:inherit;cursor:pointer;
        white-space:nowrap;text-decoration:none;
        transition:all .15s;
    }
    .nav-top-item:hover, .nav-top-active {
        background:rgba(255,255,255,.15);
        color:#fff !important;
    }
    .nav-dropdown { position:relative; }
    .nav-dropdown-btn { }
    .nav-dropdown-menu {
        display:none;position:absolute;top:calc(100% + 6px);left:0;
        background:#fff;border-radius:8px;min-width:200px;
        box-shadow:0 8px 24px rgba(0,0,0,.15);
        border:1px solid #e2e8f0;z-index:300;padding:6px;
    }
    .nav-dropdown-wide { min-width:580px; }
    .nav-dropdown:hover .nav-dropdown-menu { display:block; }
    .nav-drop-item {
        display:block;padding:7px 10px;border-radius:6px;
        color:#374151;font-size:12.5px;text-decoration:none;
        transition:background .1s;
    }
    .nav-drop-item:hover { background:#f1f5f9;color:#1d4ed8; }
    .nav-drop-item.active { background:#eff6ff;color:#1d4ed8;font-weight:500; }
    .nav-drop-group {
        font-size:10.5px;font-weight:600;color:#94a3b8;
        text-transform:uppercase;letter-spacing:.5px;
        padding:6px 10px 3px;
    }
    /* Scrollbar */
    ::-webkit-scrollbar { width:5px;height:5px; }
    ::-webkit-scrollbar-thumb { background:#cbd5e1;border-radius:3px; }

/* ── Horizontal Nav ───────────────────────────────────────────── */
.nt-btn {
    display:inline-flex;align-items:center;padding:6px 10px;
    border-radius:6px;color:rgba(255,255,255,.75);font-size:12.5px;
    cursor:pointer;white-space:nowrap;user-select:none;
    transition:all .15s;
}
.nt-btn:hover { background:rgba(255,255,255,.15);color:#fff; }
.nt-dd { position:relative; }
.nt-menu {
    display:none;position:absolute;top:calc(100% + 6px);left:0;
    background:#fff;border-radius:8px;min-width:200px;
    box-shadow:0 8px 24px rgba(0,0,0,.15);
    border:1px solid #e2e8f0;z-index:500;padding:6px;
}
.nt-dd:hover .nt-menu { display:block; }
.nt-item {
    display:block;padding:7px 10px;border-radius:6px;
    color:#374151;font-size:12.5px;text-decoration:none;
    transition:background .1s;white-space:nowrap;
}
.nt-item:hover { background:#f1f5f9;color:#1d4ed8; }
.nt-grp {
    font-size:10.5px;font-weight:600;color:#94a3b8;
    text-transform:uppercase;letter-spacing:.5px;
    padding:6px 10px 3px;
}

/* ── Dark Mode ────────────────────────────────────────────────── */
body.dark {
    --text:    #e2e8f0; --text2: #cbd5e1; --text3: #94a3b8;
    --gray:    #94a3b8;
    --border:  #334155; --border2: #475569;
    --gray-lt: #1e293b;
    --shadow:  0 1px 3px rgba(0,0,0,.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,.4);
    background: #0f172a;
    color: #e2e8f0;
}

/* Layout containers */
body.dark main { background: #0f172a !important; }
body.dark .layout-loading { background:#0f172a !important; }
body.dark .lotus-main { background:#0f172a !important; }
body.dark .lotus-nav-menu { background:#1e293b !important;border-color:#334155 !important; }
body.dark .lotus-nav-item { color:#cbd5e1 !important; }
body.dark .lotus-nav-item:hover { background:#243046 !important;color:#60a5fa !important; }
body.dark .lotus-nav-divider { background:#334155 !important; }

/* White panels → dark slate */
body.dark *[style*="background:#fff"]     { background: #1e293b !important; }
body.dark *[style*="background: #fff"]    { background: #1e293b !important; }

/* Light gray headers / footers */
body.dark *[style*="background:#f8fafc"]  { background: #172032 !important; }
body.dark *[style*="background:#fafbfc"]  { background: #172032 !important; }
body.dark *[style*="background:#f0f2f5"]  { background: #0f172a !important; }
body.dark *[style*="background:#f1f5f9"]  { background: #1a2332 !important; }

/* Selected item blue tint — keep blue-ish but darker */
body.dark *[style*="background:#eff6ff"]  { background: #1e3a5f !important; }

/* Borders */
body.dark *[style*="border:1px solid #e2e8f0"]        { border-color: #334155 !important; }
body.dark *[style*="border-bottom:1px solid #e2e8f0"] { border-bottom-color: #334155 !important; }
body.dark *[style*="border-right:1px solid #e2e8f0"]  { border-right-color:  #334155 !important; }
body.dark *[style*="border-top:1px solid #e2e8f0"]    { border-top-color:    #334155 !important; }
body.dark *[style*="border-bottom:1px solid #f1f5f9"] { border-bottom-color: #263248 !important; }

/* Text colors */
body.dark *[style*="color:#374151"] { color: #cbd5e1 !important; }
body.dark *[style*="color:#0f172a"] { color: #e2e8f0 !important; }
body.dark *[style*="color:#475569"],
body.dark *[style*="color: #475569"],
body.dark *[style*="color:#64748b"],
body.dark *[style*="color: #64748b"] { color: #94a3b8 !important; }
body.dark *[style*="color:#1d4ed8"] { color: #60a5fa !important; }

/* Table */
body.dark tbody tr:hover td { background: #243046 !important; }

/* CSS-class elements */
body.dark .card            { background: #1e293b !important; border-color: #334155 !important; }
body.dark .tbl-card        { background: #1e293b !important; border-color: #334155 !important; }
body.dark .tbl-header      { background: #172032 !important; border-color: #334155 !important; }
body.dark .tbl-footer      { background: #172032 !important; border-color: #334155 !important; }
body.dark .filter-card     { background: #1e293b !important; border-color: #334155 !important; }
body.dark .catalog-page,
body.dark .catalog-head    { background: #1e293b !important; border-color: #334155 !important; }
body.dark .catalog-selection,
body.dark .catalog-footer  { background: #172032 !important; border-color: #334155 !important; }
body.dark .catalog-count   { background: #172032 !important; border-color: #334155 !important; color: #cbd5e1 !important; }
body.dark .btn             { background: #1e293b !important; border-color: #334155 !important; color: #e2e8f0 !important; }
body.dark .btn:hover       { background: #243046 !important; }
body.dark .btn-primary     { background: var(--blue) !important; color: #fff !important; border-color: var(--blue) !important; }
body.dark .form-ctrl       { background: #0f172a !important; border-color: #334155 !important; color: #e2e8f0 !important; }
body.dark .form-ctrl:focus { border-color: #60a5fa !important; }
body.dark .modal           { background: #1e293b !important; }
body.dark .modal-hdr       { border-color: #334155 !important; background: #172032 !important; }
body.dark .modal-footer    { border-color: #334155 !important; background: #172032 !important; }
body.dark .modal-body      { background: #1e293b !important; }
body.dark .pagination      { background: #172032 !important; border-color: #334155 !important; }
body.dark .pag-btn         { background: #1e293b !important; border-color: #334155 !important; color: #94a3b8 !important; }
body.dark .pag-btn.active  { background: var(--blue) !important; color: #fff !important; }
body.dark .section-title   { color: #93c5fd !important; border-bottom-color: #334155 !important; }
body.dark .page-title      { color: #e2e8f0 !important; }
body.dark thead th         { background: #172032 !important; color: #94a3b8 !important; border-bottom-color: #334155 !important; }
body.dark tbody td         { border-bottom-color: #263248 !important; }
body.dark .layout-loading-text { color: #94a3b8 !important; }
body.dark .badge-gray      { background: #334155 !important; color: #cbd5e1 !important; }

/* Department tree */
body.dark .dept-tree-scroll {
    background: #1e293b !important;
}

body.dark .dept-tree-all-row,
body.dark .dept-tree-row {
    color: #cbd5e1 !important;
}

body.dark .dept-tree-all-row:hover,
body.dark .dept-tree-row:hover {
    background: #243046 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark .dept-tree-all-row.is-active,
body.dark .dept-tree-row.is-active {
    background: #1e3a5f !important;
    border-color: #60a5fa !important;
    color: #bfdbfe !important;
    box-shadow: inset 2px 0 0 #60a5fa !important;
}

body.dark .dept-tree-toggle {
    color: #94a3b8 !important;
}

body.dark .dept-tree-toggle:not(.is-empty):hover {
    background: #334155 !important;
    color: #bfdbfe !important;
}

body.dark .dept-tree-toggle.is-empty {
    color: transparent !important;
}

body.dark .dept-tree-count {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

body.dark .dept-tree-all-row.is-active .dept-tree-count,
body.dark .dept-tree-row.is-active .dept-tree-count {
    background: #bfdbfe !important;
    border-color: #93c5fd !important;
    color: #1e3a8a !important;
}

body.dark .dept-tree-children {
    border-left-color: #475569 !important;
}

body.dark .dept-tree-children .dept-tree-row::before {
    background: #475569 !important;
}

body.dark .dept-tree-scroll::-webkit-scrollbar-thumb {
    background: #64748b !important;
    border-color: #1e293b !important;
}

body.dark .dept-tree-scroll::-webkit-scrollbar-track {
    background: #172032 !important;
}

/* Inputs, selects */
body.dark input:not([type=checkbox]):not([type=radio]),
body.dark select,
body.dark textarea {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Scrollbar */
body.dark ::-webkit-scrollbar-thumb { background: #475569 !important; }

/* ── Form Theme Guard ────────────────────────────────────────────
   Keep every data-entry surface readable when screens mix inline styles,
   skins, and dark mode. */
.modal,
.drawer,
.catalog-modal,
.employee-edit-modal,
.filter-card,
.tbl-card,
.card,
.catalog-table,
.catalog-head,
.catalog-page {
    background-color: var(--panel-bg) !important;
    color: var(--text) !important;
}

.modal-body,
.drawer-body {
    background-color: var(--panel-bg) !important;
    color: var(--text) !important;
}

.modal-footer,
.drawer-footer,
.catalog-footer,
.tbl-footer,
.pagination {
    background-color: var(--panel-soft) !important;
    color: var(--text2) !important;
}

.form-label,
.catalog-check,
.modal-body label,
.modal-body span,
.drawer-body label,
.drawer-body span {
    color: var(--text2);
}

.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4,
.drawer-body h1,
.drawer-body h2,
.drawer-body h3,
.drawer-body h4 {
    color: var(--text);
}

.form-ctrl,
input:not([type=checkbox]):not([type=radio]),
select,
textarea {
    background-color: var(--panel-bg);
    color: var(--text);
    border-color: var(--border);
}

.form-ctrl::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text3);
    opacity: 1;
}

select option {
    background-color: var(--panel-bg);
    color: var(--text);
}

.form-ctrl:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    background-color: var(--panel-soft) !important;
    color: var(--text3) !important;
    opacity: 1;
}

body.dark {
    --panel-bg: #1e293b;
    --panel-soft: #172032;
    --table-hover: #243046;
}

body.dark .modal,
body.dark .drawer,
body.dark .catalog-modal,
body.dark .employee-edit-modal,
body.dark .filter-card,
body.dark .tbl-card,
body.dark .card,
body.dark .catalog-table,
body.dark .catalog-head,
body.dark .catalog-page {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.dark .modal-body,
body.dark .drawer-body {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

body.dark .modal-footer,
body.dark .drawer-footer,
body.dark .catalog-footer,
body.dark .tbl-footer,
body.dark .pagination {
    background-color: #172032 !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

body.dark .modal-hdr,
body.dark .drawer-hdr {
    background-color: #172032 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.dark .catalog-modal .modal-hdr,
body.dark .employee-edit-modal > div:first-child {
    background-color: var(--topnav-bg) !important;
    color: #fff !important;
}

body.dark .modal-hdr h1,
body.dark .modal-hdr h2,
body.dark .modal-hdr h3,
body.dark .modal-hdr div,
body.dark .modal-hdr span,
body.dark .catalog-modal .modal-hdr *,
body.dark .employee-edit-modal > div:first-child * {
    color: inherit !important;
}

body.dark .form-label,
body.dark .catalog-check,
body.dark .modal-body label,
body.dark .modal-body span,
body.dark .drawer-body label,
body.dark .drawer-body span {
    color: #cbd5e1 !important;
}

body.dark .form-ctrl,
body.dark input:not([type=checkbox]):not([type=radio]),
body.dark select,
body.dark textarea {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

body.dark .form-ctrl::placeholder,
body.dark input::placeholder,
body.dark textarea::placeholder {
    color: #94a3b8 !important;
}

body.dark select option {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

body.dark .form-ctrl:disabled,
body.dark input:disabled,
body.dark select:disabled,
body.dark textarea:disabled {
    background-color: #172032 !important;
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8;
}

body.dark *[style*="color:#111827"],
body.dark *[style*="color: #111827"],
body.dark *[style*="color:#1f2937"],
body.dark *[style*="color: #1f2937"],
body.dark *[style*="color:#334155"],
body.dark *[style*="color: #334155"],
body.dark *[style*="color:#1e293b"],
body.dark *[style*="color: #1e293b"] {
    color: #e2e8f0 !important;
}

body.dark *[style*="color:#6b7280"],
body.dark *[style*="color: #6b7280"],
body.dark *[style*="color:#9ca3af"],
body.dark *[style*="color: #9ca3af"],
body.dark *[style*="color:#94a3b8"],
body.dark *[style*="color: #94a3b8"] {
    color: #94a3b8 !important;
}

body.dark .modal-body *[style*="background:#fff"],
body.dark .modal-body *[style*="background: #fff"],
body.dark .drawer-body *[style*="background:#fff"],
body.dark .drawer-body *[style*="background: #fff"] {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

button,
input,
select,
textarea,
.btn,
.form-ctrl,
.modal,
.drawer,
.card,
.tbl-card,
.data-table,
.catalog-page {
    font-family: 'Be Vietnam Pro', sans-serif;
}

input,
select,
textarea,
.form-ctrl {
    font-size: 12.5px;
    line-height: 1.4;
}

/* Unified listview shell: header + scroll body + footer pinned to the bottom.
   This keeps catalog pages, form listviews, and paged tables on the same rhythm. */
.tbl-card:has(> .tbl-footer),
.tbl-card:has(> .pagination),
.catalog-table,
.lotus-listview {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.tbl-card:has(> .tbl-footer),
.tbl-card:has(> .pagination) {
    height: var(--listview-height, min(720px, calc(100vh - 180px)));
    max-height: var(--listview-shell-max-height, calc(100vh - 116px));
}

.lotus-main .tbl-card:has(> .tbl-footer),
.lotus-main .tbl-card:has(> .pagination),
.lotus-main .catalog-table,
.lotus-main .lotus-listview {
    height: var(--listview-height, calc(100vh - 132px));
}

.lotus-main .filter-card ~ .tbl-card:has(> .tbl-footer),
.lotus-main .filter-card ~ .tbl-card:has(> .pagination),
.lotus-main .page-head ~ .tbl-card:has(> .tbl-footer),
.lotus-main .page-head ~ .tbl-card:has(> .pagination) {
    height: var(--listview-height, calc(100vh - 230px));
}

.catalog-page > .catalog-table,
.catalog-page > .tbl-card,
.lotus-listview-page > .tbl-card {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
}

.tbl-card:has(> .tbl-footer) > .tbl-body-scroll,
.tbl-card:has(> .tbl-footer) > .catalog-table-scroll,
.tbl-card:has(> .tbl-footer) > .lotus-listview-scroll,
.tbl-card:has(> .tbl-footer) > div[style*="overflow:auto"]:has(> table),
.tbl-card:has(> .tbl-footer) > div[style*="overflow: auto"]:has(> table),
.tbl-card:has(> .tbl-footer) > div[style*="overflow-y:auto"]:has(> table),
.tbl-card:has(> .tbl-footer) > div[style*="overflow-y: auto"]:has(> table),
.tbl-card:has(> .pagination) > .tbl-body-scroll,
.tbl-card:has(> .pagination) > .catalog-table-scroll,
.tbl-card:has(> .pagination) > .lotus-listview-scroll,
.tbl-card:has(> .pagination) > div[style*="overflow:auto"]:has(> table),
.tbl-card:has(> .pagination) > div[style*="overflow: auto"]:has(> table),
.tbl-card:has(> .pagination) > div[style*="overflow-y:auto"]:has(> table),
.tbl-card:has(> .pagination) > div[style*="overflow-y: auto"]:has(> table),
.catalog-table > .tbl-body-scroll,
.catalog-table > .catalog-table-scroll,
.lotus-listview > .lotus-listview-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable both-edges;
    overscroll-behavior: contain;
}

.tbl-card:has(> .tbl-footer) > .tbl-footer,
.tbl-card:has(> .pagination) > .pagination,
.catalog-table > .catalog-footer,
.catalog-table > .tbl-footer,
.lotus-listview > .lotus-listview-footer {
    margin-top: auto !important;
    flex-shrink: 0 !important;
}

.assignment-listview-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
}

.assignment-listview-shell > .assignment-listview,
.assignment-listview-shell > .tbl-card {
    flex: 1 1 auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
}

.tbl-footer,
.catalog-footer,
.pagination,
.lotus-listview-footer {
    justify-content: center !important;
    text-align: center !important;
    gap: 16px;
    flex-wrap: wrap;
}

.tbl-footer > *,
.catalog-footer > *,
.pagination > *,
.lotus-listview-footer > * {
    text-align: center !important;
}

.tbl-body-scroll > table,
.catalog-table-scroll > table,
.lotus-listview-scroll > table,
.tbl-card:has(> .tbl-footer) > div[style*="overflow:auto"]:has(> table) > table,
.tbl-card:has(> .tbl-footer) > div[style*="overflow: auto"]:has(> table) > table,
.tbl-card:has(> .pagination) > div[style*="overflow:auto"]:has(> table) > table,
.tbl-card:has(> .pagination) > div[style*="overflow: auto"]:has(> table) > table,
table.data-table {
    width: max-content;
    min-width: 100%;
}
