/* ════════════════════════════════════════════════════════════════
   PeridotXscm — site.css
   Design-system port from PeridotXsm (colors, spacing, radius,
   shadows, typography, component styling) adapted to PeridotXscm's
   TOP MENU BAR layout (PeridotXsm itself uses a sidebar — that part
   is deliberately NOT ported; every other visual/behavioral element
   below is). All existing view markup/class names are kept as-is
   (.panel, .btn, .grid, .toolbar, .formgrid, .msg-error, .modal,
   .login-box, .infobar, .menubar, .notif-bell, etc.) so this is a
   site-wide reskin with zero view-file changes required.
   ════════════════════════════════════════════════════════════════ */

:root {
    /* ---- Ported design tokens (PeridotXsm palette/system) ---- */
    --accent: #185FA5;
    --accent-light: #E6F1FB;
    --accent-dark: #0C447C;
    --accent-text: #0C447C;

    --success: #0F6E56;
    --success-bg: #E1F5EE;
    --warning: #854F0B;
    --warning-bg: #FAEEDA;
    --danger: #993C1D;
    --danger-bg: #FAECE7;
    --info: #534AB7;
    --info-bg: #EEEDFE;

    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f7;
    --bg-tertiary: #f1f0ec;
    --text-primary: #1a1a19;
    --text-secondary: #666660;
    --text-tertiary: #9a9a94;

    --border: rgba(0, 0, 0, .10);
    --border-md: rgba(0, 0, 0, .18);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .06);
    --shadow-md: 0 2px 12px rgba(0, 0, 0, .08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

    /* ---- Legacy variable names kept as aliases so any leftover
       inline style="" in a view referencing the old names still
       resolves to a sane, on-theme value. ---- */
    --bar: var(--accent-dark);
    --bar-hover: var(--accent);
    --bg: var(--bg-tertiary);
    --panel: var(--bg-primary);
    --text: var(--text-primary);
    --muted: var(--text-secondary);
    --error: #b3261e;

    --menubar-h: 46px;
    --infobar-h: 32px;
}

/* ---------- Phase C: dark mode ----------
   Single source of truth per variable — every component below already
   reads --bg-*/--text-*/--border*/--shadow* rather than hardcoded colors,
   so this one override block re-themes the whole app. --accent* is NOT
   redeclared here: it's set per-request by the inline <style> block in
   _Layout.cshtml (Infrastructure/ThemePalette.cs) based on the user's
   chosen accent color, independent of light/dark mode. Toggled via the
   data-theme attribute on <html> (see _Layout.cshtml). */
:root[data-theme="dark"] {
    --success: #35B78B;
    --success-bg: rgba(53, 183, 139, .16);
    --warning: #E0AD4F;
    --warning-bg: rgba(224, 173, 79, .16);
    --danger: #E1725A;
    --danger-bg: rgba(225, 114, 90, .16);
    --info: #9C93E8;
    --info-bg: rgba(156, 147, 232, .16);

    --bg-primary: #1e1e1c;
    --bg-secondary: #171715;
    --bg-tertiary: #101010;
    --text-primary: #eaeae6;
    --text-secondary: #a8a8a1;
    --text-tertiary: #77776f;

    --border: rgba(255, 255, 255, .10);
    --border-md: rgba(255, 255, 255, .18);

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .35);
    --shadow-md: 0 2px 14px rgba(0, 0, 0, .45);

    --error: #E1725A;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Remove native number-input spinner arrows (ported from PeridotXsm) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---------- Menu bar (top nav — kept as top bar per explicit
   requirement, restyled to PeridotXsm's visual language) ---------- */
.menubar {
    background: var(--accent-dark);
    background: linear-gradient(180deg, var(--accent-dark), #0a3b6b);
    color: #fff;
    display: flex;
    align-items: stretch;
    height: var(--menubar-h);
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    position: relative;
    z-index: 300;
}
.menubar .brand {
    padding: 0 18px;
    display: flex;
    align-items: center;
    font-weight: 600;
    letter-spacing: .3px;
    font-size: 14px;
}
.menu { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; }
.menu > li { position: relative; display: flex; align-items: stretch; }
.menu > li > span {
    display: flex;
    align-items: center;
    padding: 0 14px;
    cursor: default;
    font-size: 13px;
    color: rgba(255,255,255,.92);
    transition: background .12s, color .12s;
}
.menu > li:hover > span { background: rgba(255,255,255,.10); color: #fff; }
.menu ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: var(--bg-primary);
    color: var(--text-primary);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    border: 0.5px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 400;
}
.menu > li:hover > ul { display: block; }
.menu ul li { position: relative; }
.menu ul li a, .menu ul li > span {
    display: block;
    padding: 8px 16px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    cursor: default;
    font-size: 13px;
    transition: background .1s;
}
.menu ul li a:hover, .menu ul li.submenu:hover > span { background: var(--accent-light); color: var(--accent-text); }
.menu ul li.sep { border-top: 0.5px solid var(--border); margin: 6px 0; }
.menu li.submenu > span::after { content: "\25B8"; float: right; color: var(--text-tertiary); margin-left: 12px; }
.menu li.submenu > ul { top: -6px; left: 100%; border-radius: var(--radius-md); }
.menu li.submenu:hover > ul { display: block; }
.menuspacer { flex: 1; }

/* ---------- Notifications bell (Milestone M5), restyled ---------- */
.notif-bell { position: relative; display: flex; align-items: center; padding-right: 10px; }
.notif-bell .btn { background: transparent; border: none; color: #fff; font-size: 16px; padding: 6px 10px; position: relative; border-radius: var(--radius-md); }
.notif-bell .btn:hover { background: rgba(255,255,255,.14); }
.notif-badge { position: absolute; top: 0; right: 2px; background: var(--danger); color: #fff; font-size: 10px; line-height: 1; padding: 2px 4px; border-radius: 8px; min-width: 14px; text-align: center; box-shadow: 0 0 0 2px var(--accent-dark); }
.notif-dropdown { position: absolute; top: calc(100% + 6px); right: 0; width: 320px; max-height: 380px; overflow: auto; background: var(--bg-primary); color: var(--text-primary); border: 0.5px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 450; animation: dropIn .12s ease-out; }
.notif-dropdown-title { padding: 10px 14px; font-weight: 600; border-bottom: 0.5px solid var(--border); background: var(--bg-secondary); font-size: 13px; }
.notif-item { padding: 10px 14px; border-bottom: 0.5px solid var(--border); font-size: 12px; transition: background .1s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-secondary); }
.notif-unread { background: var(--accent-light); }
.notif-unread:hover { background: var(--accent-light); filter: brightness(.98); }
.notif-item-title { font-weight: 600; color: var(--text-primary); }
.notif-item-msg { color: var(--text-secondary); margin-top: 2px; }
.notif-item-time { color: var(--text-tertiary); font-size: 11px; margin-top: 3px; }

@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Top-right profile menu, ported from PeridotXsm (same classes) ---------- */
.profile-menu { position: relative; display: flex; align-items: center; padding-right: 6px; }
.profile-menu .btn { background: transparent; border: none; color: #fff; font-size: 16px; padding: 6px 10px; border-radius: var(--radius-md); cursor: pointer; }
.profile-menu .btn:hover { background: rgba(255,255,255,.14); }
.profile-menu-dropdown { position: absolute; top: calc(100% + 6px); right: 0; width: 220px; background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 450; overflow: hidden; padding: 6px; animation: dropIn .12s ease-out; }
.profile-menu-header { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 0.5px solid var(--border); }
.profile-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: none; background: none; font-size: 13px; color: var(--text-primary); text-decoration: none; cursor: pointer; text-align: left; font-family: inherit; }
.profile-menu-item:hover { background: var(--bg-secondary); }
.profile-menu-item i { width: 16px; color: var(--text-secondary); font-size: 13px; }
.profile-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* ---------- Phase C: theme switcher (accent dots + mode toggle), in the profile dropdown ---------- */
.profile-menu-theme-label { padding: 8px 10px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-tertiary); }
.theme-switcher { display: flex; gap: 8px; padding: 4px 10px 8px; }
.theme-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; box-shadow: 0 0 0 1px var(--border); }
.theme-dot:hover { transform: scale(1.12); }
.theme-dot.active { border-color: var(--bg-primary); box-shadow: 0 0 0 2px var(--text-primary); }
.brand-script { font-family:'Monotype Corsiva','Apple Chancery','URW Chancery L','Palatino Linotype','Book Antiqua',Georgia,serif; font-style: italic; font-weight: 400; font-size: 22px; letter-spacing: 0; }
.brand-script .brand-sub { font-size: 13px; margin-left: 2px; opacity: .85; }
.brand-script .brand-tagline { font-family: inherit; font-size: 14px; opacity: .8; margin-left: 12px; }
.brand-tagline { font-size: 10px; font-weight: 400; opacity: .75; letter-spacing: .2px; margin-left: 8px; }
@media (max-width: 900px) { .brand-tagline { display: none; } }

/* ---------- Content ---------- */
.content { flex: 1; padding: 20px; }
.panel {
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 860px;
    margin: 0 auto;
    padding: 0 0 16px 0;
    box-shadow: var(--shadow-sm);
}
.panel-title {
    background: var(--bg-secondary);
    border-bottom: 0.5px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13.5px;
}
.panel p, .panel form { padding: 0 16px; }
.form-panel { max-width: 620px; }
.desktop { text-align: center; margin-top: 60px; color: var(--text-secondary); }
.desktop h2 { color: var(--text-primary); }
.hint { font-size: 13px; }

/* ---------- Toolbar ---------- */
.toolbar { padding: 10px 16px; border-bottom: 0.5px solid var(--border); display: flex; gap: 6px; align-items: center; background: var(--bg-secondary); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.mode-badge { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-secondary); background: var(--bg-tertiary); border: 0.5px solid var(--border); padding: 3px 10px; border-radius: 99px; letter-spacing: .02em; }
.mode-badge.posted { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border: 0.5px solid var(--border-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    font-weight: 500;
    transition: background .12s, box-shadow .12s, transform .05s;
}
.btn:hover:not(:disabled) { background: var(--bg-secondary); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-help { padding: 6px 10px; font-weight: 700; }
.btn-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btnrow { padding: 14px 16px 0 16px; display: flex; gap: 8px; }

/* ---------- Form fields (modernized) ---------- */
.formgrid { display: grid; grid-template-columns: 160px 1fr; gap: 13px 10px; align-items: center; padding: 18px 16px 4px 16px; }
.formgrid label { text-align: right; color: var(--text-secondary); font-size: 12.5px; font-weight: 500; }
.formgrid input[type=text] { width: 100%; }
.idrow { display: flex; gap: 6px; }
.idrow input { max-width: 220px; }

input[type=text], input[type=password], input[type=date], input[type=number], textarea {
    padding: 8px 10px;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus,
input[type=number]:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
input[type=text]:disabled, input[type=password]:disabled, input[type=date]:disabled,
input[type=number]:disabled, select:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    box-shadow: none;
}
input[type=checkbox]:disabled { opacity: .6; }

select {
    padding: 8px 28px 8px 10px;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-family: var(--font);
    background: var(--bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9a94'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    appearance: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
select:disabled { background-color: var(--bg-tertiary); color: var(--text-secondary); cursor: not-allowed; opacity: .8; }

/* ---------- Grid (data table) ---------- */
.grid { border-collapse: collapse; width: calc(100% - 32px); margin: 12px 16px 0 16px; background: var(--bg-primary); font-size: 13px; border-radius: var(--radius-md); overflow: hidden; }
.grid th, .grid td { border-bottom: 0.5px solid var(--border); border-right: none; padding: 8px 10px; text-align: left; }
.grid th { background: var(--accent-light); color: var(--accent-text); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.grid tbody tr:hover { background: var(--bg-secondary); }
.grid tbody tr:last-child td { border-bottom: none; }

/* ---------- Login ---------- */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 8vh 16px;
    background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 55%, #378ADD 100%);
}
.login-box {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-box h1 { font-size: 19px; margin: 0 0 4px 0; color: var(--accent-dark); font-weight: 600; }
.login-box .tagline { color: var(--text-secondary); font-size: 12.5px; font-weight: 500; margin: 0 0 8px 0; }
.login-box .licensed { color: var(--text-secondary); font-size: 12px; margin-top: 0; }
.login-box label { display: block; margin: 14px 0 5px 0; color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.login-box input { width: 100%; }
.login-box .btnrow { padding: 20px 0 0 0; }
.login-box .btn { width: 100%; padding: 10px; justify-content: center; font-size: 13.5px; }

/* ---------- Messages / modal / info bar ---------- */
.msg-error {
    color: var(--danger);
    background: var(--danger-bg);
    border: none;
    border-left: 3px solid var(--danger);
    padding: 9px 13px;
    margin: 10px 16px 0 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
}
.login-box .msg-error { margin: 10px 0 0 0; }

.modal { position: fixed; inset: 0; background: rgba(15,17,20,.45); display: flex; align-items: center; justify-content: center; z-index: 500; animation: fadeIn .12s ease-out; }
.modal-box { background: var(--bg-primary); border-radius: var(--radius-lg); width: 520px; max-height: 80vh; display: flex; flex-direction: column; padding-bottom: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: popIn .14s ease-out; }
.modal-box .panel-title { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-box #helpFilter { margin: 12px 16px 0 16px; }
.help-list-wrap { overflow: auto; flex: 1; max-height: 55vh; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.infobar {
    background: var(--accent-dark);
    color: rgba(255,255,255,.85);
    display: flex;
    gap: 24px;
    padding: 6px 16px;
    font-size: 11.5px;
    height: var(--infobar-h);
    align-items: center;
}
.infobar span:last-child { margin-left: auto; }

/* ---------- Item Groups layout ---------- */
.igp-wrap { display: flex; gap: 0; }
.igp-levels { width: 220px; border-right: 0.5px solid var(--border); }
.igp-levels-title { padding: 10px 14px; font-weight: 600; font-size: 12.5px; color: var(--text-secondary); }
.igp-levels ul { list-style: none; margin: 0; padding: 0; }
.igp-levels li { padding: 8px 14px; cursor: pointer; font-size: 13px; border-left: 3px solid transparent; transition: background .1s; }
.igp-levels li:hover { background: var(--bg-secondary); }
.igp-levels li.sel { background: var(--accent-light); border-left-color: var(--accent); font-weight: 600; color: var(--accent-text); }
.igp-form { flex: 1; padding-bottom: 8px; }
.mask-hint { color: var(--text-secondary); font-size: 12px; align-self: center; }

/* ---------- Two-column form + User Rights layout ---------- */
.formgrid-2col { grid-template-columns: 130px 1fr 130px 1fr; }
.formgrid-2col .idrow { grid-column: span 3; }
.ur-wrap { display: flex; gap: 0; }
.ur-grid { flex: 1; max-height: 420px; overflow: auto; }
.ur-rights { width: 170px; border-left: 0.5px solid var(--border); padding: 0 14px 14px 14px; }
.ur-rights label { display: block; margin: 8px 0; font-size: 13px; }

/* ---------- Items tree ---------- */
.itm-tree { max-height: 520px; overflow: auto; padding: 4px 8px 12px 8px; font-size: 12.5px; }
.itm-tree ul { list-style: none; margin: 0; padding-left: 14px; }
.itm-tree > ul { padding-left: 4px; }
.itm-tree span { display: inline-block; padding: 3px 6px; cursor: pointer; border-radius: var(--radius-sm); white-space: nowrap; transition: background .1s; }
.itm-tree span:hover { background: var(--accent-light); }

/* ════════════════════════════════════════════════════════════════
   Security/Modernization milestone additions
   ════════════════════════════════════════════════════════════════ */

/* ---------- Loading spinner (for async fetch() calls) ---------- */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(0,0,0,.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}
.btn .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.btn.is-loading { pointer-events: none; opacity: .75; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton/shimmer for a loading grid row or panel */
.skeleton { background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 37%, var(--bg-tertiary) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Toast notifications (replaces alert()) ---------- */
#toastHost {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 0.5px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 11px 14px;
    font-size: 13px;
    animation: toastIn .16s ease-out;
}
.toast.leaving { animation: toastOut .14s ease-in forwards; }
.toast-success { border-left-color: var(--success); }
.toast-danger { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-danger .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-body { flex: 1; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: 14px; line-height: 1; padding: 0; }
.toast-close:hover { color: var(--text-primary); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(24px); } }

/* ---------- Confirm dialog (replaces confirm()) ---------- */
.confirm-backdrop { position: fixed; inset: 0; background: rgba(15,17,20,.45); display: flex; align-items: center; justify-content: center; z-index: 3100; animation: fadeIn .12s ease-out; }
.confirm-box { background: var(--bg-primary); border-radius: var(--radius-lg); width: 380px; max-width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: popIn .14s ease-out; overflow: hidden; }
.confirm-box-title { padding: 16px 20px 0 20px; font-weight: 600; font-size: 14.5px; }
.confirm-box-msg { padding: 10px 20px 4px 20px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.confirm-box-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 20px 20px 20px; }

/* ---------- Rate-limit / lockout banner on Login ---------- */
.login-box .msg-warning { color: var(--warning); background: var(--warning-bg); border-left: 3px solid var(--warning); padding: 9px 13px; margin: 10px 0 0 0; border-radius: var(--radius-md); font-size: 13px; }

/* ---------- Tags, alerts, page-header (ported from PeridotXsm for the
   License screen; available to any future screen built in this style) ---------- */
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 2px 9px; border-radius: 99px; font-weight: 500; white-space: nowrap; }
.tag-success { background: var(--success-bg); color: var(--success); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-accent { background: var(--accent-light); color: var(--accent-text); }
.tag-gray { background: var(--bg-tertiary); color: var(--text-secondary); }

.alert { padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 3px solid var(--warning); }

.breadcrumb { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-header-left h1 { font-size: 19px; font-weight: 600; margin: 0; }
.page-header-left p { font-size: 12.5px; color: var(--text-secondary); margin: 3px 0 0 0; }

.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 0.5px solid var(--border); background: var(--bg-secondary); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.panel-header .panel-title { padding: 0; background: none; border: none; border-radius: 0; }

.form-row { display: grid; gap: 14px; padding: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.field-value { font-size: 13px; margin-bottom: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .menu ul { min-width: 200px; }
    .notif-dropdown { width: 280px; }
}
@media (max-width: 640px) {
    .menubar { flex-wrap: wrap; height: auto; }
    .brand { padding: 8px 12px; }
    .menu { flex-wrap: wrap; }
    .content { padding: 12px; }
    .formgrid, .formgrid-2col { grid-template-columns: 1fr !important; }
    .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr !important; }
    .formgrid label { text-align: left; }
    .login-box { padding: 28px 22px; }
}
@media print {
    .menubar, .infobar, .toolbar, .btn, #toastHost { display: none !important; }
    .content { padding: 0; }
}

/* ════════════════════════════════════════════════════════════════
   Security/Admin overhaul (Phase B2/B3) — additional classes
   Views/Users/*.cshtml (ported from PeridotXsm) use a slightly
   different class vocabulary than the rest of this app's views
   (.form-group/.form-input/.form-select instead of .formgrid/bare
   input tags, .data-table instead of .grid, plus small icon-button
   and layout helpers). Rather than rewrite those views to match this
   app's existing names, these are additive aliases/classes so both
   vocabularies work side by side. Nothing above this block was
   changed. See Project Status/SECURITY_MIGRATION.md.
   ════════════════════════════════════════════════════════════════ */

/* ---------- Form fields (class-based, alongside the tag-based rules above) ---------- */
.form-group { margin-bottom: 14px; padding: 0 16px; }
.form-group:first-child { margin-top: 4px; }
.panel > .form-group,
.panel > form > .form-group { padding: 0 16px; }
.form-label { display: block; margin: 0 0 5px 0; color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.form-input, .form-select {
    width: 100%;
    padding: 8px 10px;
    border: 0.5px solid var(--border-md);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-select {
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a9a94'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.form-input:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---------- Data table (class-based alias of .grid, same visual language) ---------- */
.data-table { border-collapse: collapse; width: 100%; background: var(--bg-primary); font-size: 13px; }
.data-table th, .data-table td { border-bottom: 0.5px solid var(--border); padding: 10px 14px; text-align: left; vertical-align: middle; }
.data-table th { background: var(--accent-light); color: var(--accent-text); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.data-table tbody tr:hover { background: var(--bg-secondary); }
.data-table tbody tr:last-child td { border-bottom: none; }
.panel .data-table { border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden; }

/* ---------- Button variants used by the Users/Roles admin screens ---------- */
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-outline { background: transparent; border-color: var(--border-md); }
.btn-outline:hover:not(:disabled) { background: var(--bg-secondary); }
.btn-success { background: var(--success-bg); border-color: transparent; color: var(--success); }
.btn-success:hover:not(:disabled) { background: var(--success); color: #fff; }
.btn-icon { padding: 6px 9px; }
.row-actions { display: flex; gap: 4px; align-items: center; }

/* ---------- Misc layout helpers ---------- */
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 16px 0; margin: 0 -16px -16px; }
.panel .modal-footer { padding-left: 16px; padding-right: 16px; }

/* Frozen action column (2026-10-11): action buttons in a .grid row stay pinned to the right edge. */
.grid td.row-actions{display:table-cell;white-space:nowrap}
.grid td:last-child:has(> .btn, > form > .btn),.grid td.row-actions{position:sticky;right:0;z-index:1;background:var(--bg-primary);box-shadow:-8px 0 8px -8px rgba(0,0,0,.28)}
.grid:has(tbody td:last-child > .btn) th:last-child,.grid:has(tbody td.row-actions) th:last-child{position:sticky;right:0;z-index:2}
.grid tbody tr:hover td.row-actions,.grid tbody tr:hover td:last-child:has(> .btn){background:var(--bg-secondary)}

/* ── Grid best-fit (2026-10-11) — see wwwroot/js/grid-fit.js ─────────────────
   Columns with long text (names, descriptions, addresses...) may wrap inside a
   width band so the grid narrows to the screen instead of running wide; short
   columns (codes, dates, amounts, status) and the frozen action column never wrap. */
.data-table td.gf-wrap:not(.dt-clip),.grid td.gf-wrap{white-space:normal;min-width:170px;max-width:420px;overflow-wrap:break-word;line-height:1.35}
/* Dense grids (11+ columns, 2026-10-11): tighter padding + slightly smaller type so wide documents fit the screen. */
.data-table.gf-dense th,.data-table.gf-dense td,.grid.gf-dense th,.grid.gf-dense td{padding-left:6px;padding-right:6px;font-size:12px}
.data-table.gf-dense th,.grid.gf-dense th{white-space:normal;line-height:1.2;vertical-align:bottom}
.data-table.gf-dense td.gf-wrap:not(.dt-clip){min-width:130px;max-width:300px}

/* ── Grid tools (2026-10-11) — sort arrows, select + highlight column, selection bar ── */
th.gt-sortable{cursor:pointer;user-select:none}
th.gt-sortable:hover{opacity:.85}
th.gt-sortable::after{content:'\2195';font-size:10px;opacity:.35;margin-left:5px}
th.gt-sortable[data-gt-dir=asc]::after{content:'\25B2';opacity:.9}
th.gt-sortable[data-gt-dir=desc]::after{content:'\25BC';opacity:.9}
th.gt-col,td.gt-col{width:56px;min-width:56px;white-space:nowrap;text-align:left!important;padding-left:8px;padding-right:4px}
.gt-col input[type=checkbox]{vertical-align:middle;margin:0 6px 0 0;cursor:pointer}
.gt-dot{display:inline-block;width:16px;height:16px;border-radius:4px;border:1.5px solid var(--border);vertical-align:middle;cursor:pointer;background:var(--bg-secondary)}
.gt-dot:hover{border-color:var(--accent)}
tr[data-gt-color] > td{background:var(--gt-row)!important;color:var(--gt-fg,inherit)}
tr[data-gt-color] > td a:not(.btn){color:inherit}
.gt-bar{display:flex;align-items:center;gap:10px;background:var(--accent);color:#fff;padding:8px 14px;border-radius:8px;margin:0 0 10px;font-size:13px}
.gt-bar .gt-count{font-weight:600}
.gt-bar .btn{background:#fff;color:var(--accent);border-color:transparent}
.gt-pop{position:fixed;z-index:3000;background:var(--bg-primary);border:1px solid var(--border);border-radius:10px;padding:8px;box-shadow:0 8px 24px rgba(0,0,0,.28);display:grid;grid-template-columns:repeat(4,24px);gap:5px}
.gt-sw{width:24px;height:24px;border-radius:5px;border:1.5px solid rgba(0,0,0,.15);cursor:pointer;box-sizing:border-box}
.gt-sw:hover{border-color:var(--accent);transform:scale(1.12)}
.gt-sw-none{background:var(--bg-secondary);border:1.5px dashed var(--border)}
@media print{.gt-col,.gt-bar,.gt-pop{display:none!important}th.gt-sortable::after{content:none}}
