/* ==========================================================================
   Absence Management System — interface stylesheet
   --------------------------------------------------------------------------
   Card rule: every card, panel, table and list item uses a single uniform
   1px border with rounded corners. No left accent bars, no coloured side
   strips, no priority indicator rails anywhere in this file — status is
   communicated with badges and text only.
   ========================================================================== */

/* --- Design tokens -------------------------------------------------------
   Brand palette taken from the Saudi Icon logo:
     deep teal  #223E47  — primary surfaces, sidebar, primary buttons
     signal red #E03C4A  — accents, alerts, the letterhead page marker
   ------------------------------------------------------------------------ */
:root {
    --brand-50:  #eef3f5;
    --brand-100: #d7e3e7;
    --brand-200: #aec6ce;
    --brand-500: #3a6b78;
    --brand-600: #2b5361;
    --brand-700: #223E47;
    --brand-800: #1a303a;
    --brand-900: #14252c;

    --accent-50:  #fdedef;
    --accent-100: #fad3d8;
    --accent-200: #f4a8b1;
    --accent-500: #e8697a;
    --accent-600: #E03C4A;
    --accent-700: #b92f3b;

    --ink-900: #16262c;
    --ink-800: #22343a;
    --ink-700: #34474e;
    --ink-600: #4d626a;
    --ink-500: #6b7f87;
    --ink-400: #94a5ab;
    --ink-300: #c2ced3;
    --line:    #dde5e8;
    --line-soft:#eaf0f2;
    --surface: #ffffff;
    --canvas:  #f4f7f8;

    --success-50: #ecfdf5; --success-600: #059669; --success-700: #047857;
    --warn-50:    #fffbeb; --warn-600:    #d97706; --warn-700:    #b45309;
    --danger-50:  var(--accent-50);  --danger-600: var(--accent-600); --danger-700: var(--accent-700);
    --alert-50:   var(--accent-50);  --alert-600:  var(--accent-600); --alert-700:  var(--accent-700);
    --info-50:    var(--brand-50);   --info-600:   var(--brand-600);  --info-700:   var(--brand-700);
    --violet-50:  #f2eef7; --violet-600:  #6b4c8f;

    --sidebar-bg:     #223E47;
    --sidebar-hover:  #2b5361;
    --sidebar-active: #1a303a;
    --sidebar-text:   #c7d6da;

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;

    --shadow-xs: 0 1px 2px rgba(22, 38, 44, .05);
    --shadow-sm: 0 1px 3px rgba(22, 38, 44, .08), 0 1px 2px rgba(22, 38, 44, .04);
    --shadow-md: 0 8px 24px -12px rgba(22, 38, 44, .18);
    --shadow-lg: 0 24px 48px -24px rgba(22, 38, 44, .28);

    --sidebar-w: 256px;
    --header-h:  68px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --arabic: 'Noto Naskh Arabic', 'Traditional Arabic', 'Segoe UI', Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-800);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; color: var(--ink-900); letter-spacing: -.01em; }
p { margin: 0 0 12px; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
svg.icon { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; border-radius: 4px; }

/* --- Layout shell -------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 60;
    border-right: 1px solid rgba(255, 255, 255, .10);
}

/* --- Sidebar brand -------------------------------------------------------
   The logo is dark teal artwork, so it sits on a white plate to stay legible
   against the teal sidebar. The image is sized in absolute units: a percentage
   max-height resolves against a grid area that is itself sized by the image,
   which browsers ignore — that is what let the logo spill out of its plate. */
.sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
    flex-shrink: 0;
}

.sidebar__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .16);
    overflow: hidden;
}
.sidebar__mark img {
    display: block;
    height: 30px;
    width: auto;
    max-width: 100%;
}

/* --- Sidebar navigation --------------------------------------------------- */
/* min-height:0 lets the scrollable nav actually shrink, so the footer can
   never be pushed past the bottom of the sidebar on a short window. */
.sidebar__nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 12px 16px;
}
.sidebar__nav::-webkit-scrollbar { width: 8px; }
.sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.sidebar__nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .16);
    border-radius: 8px;
    border: 2px solid var(--sidebar-bg);
}
.sidebar__nav:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .28); }

.sidebar__label {
    font-size: 10px; font-weight: 700; letter-spacing: .13em;
    text-transform: uppercase; color: #7b959d;
    padding: 18px 12px 7px;
}
.sidebar__nav > .sidebar__label:first-child { padding-top: 8px; }

.sidebar__link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13.5px; font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.sidebar__link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar__link svg { color: #8ba4ab; transition: color .15s ease; }
.sidebar__link:hover svg { color: #ffffff; }
.sidebar__link.is-active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.sidebar__link.is-active svg { color: var(--accent-600); }
.sidebar__count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: rgba(255, 255, 255, .14); color: #e6eff1;
    padding: 1px 7px; border-radius: 20px;
}
/* Draws attention to a section that needs the admin: e.g. critical absences. */
.sidebar__count--alert { background: var(--accent-600); color: #fff; }

/* --- Sidebar footer ------------------------------------------------------- */
/* flex-shrink:0 keeps it pinned; the profile row is a full-width target so it
   is hard to miss, with the sign-out button clearly separated beside it. */
.sidebar__footer {
    flex-shrink: 0;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, .10);
    background: var(--sidebar-active);
}
.sidebar__user { display: flex; align-items: stretch; gap: 8px; }

.sidebar__profile {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 11px;
    padding: 10px;
    border-radius: var(--radius-sm);
    color: inherit;
    transition: background .15s ease;
}
.sidebar__profile:hover { background: rgba(255, 255, 255, .09); color: inherit; }
.sidebar__profile:active { background: rgba(255, 255, 255, .14); }
.sidebar__profile.is-active { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.sidebar__profile > span:last-child { display: flex; flex-direction: column; min-width: 0; }

.sidebar__logout {
    flex-shrink: 0;
    display: grid; place-items: center;
    width: 42px;
    background: rgba(255, 255, 255, .06);
    border: 0; border-radius: var(--radius-sm);
    color: #a9bfc5; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.sidebar__logout:hover { background: var(--accent-600); color: #fff; }

.sidebar__avatar {
    flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--accent-600); color: #fff;
    display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
}
.sidebar__username { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.sidebar__role { font-size: 11px; color: #9fb6bd; text-transform: capitalize; }

/* --- Main column --------------------------------------------------------- */
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--header-h);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
}
.topbar__title { min-width: 0; flex-shrink: 0; }
.topbar__title h1 { font-size: 17px; line-height: 1.2; }
.topbar__title p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-500); }
.topbar__actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar__toggle { display: none; }

/* Employee search: centred in the header, on every page. */
.topbar__search {
    flex: 1 1 auto;
    max-width: 520px;
    margin: 0 auto;
    position: relative;
    display: flex; align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 5px 0 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.topbar__search:focus-within {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(34, 62, 71, .14);
}
.topbar__search > svg { color: var(--ink-400); flex-shrink: 0; }
.topbar__search-input {
    flex: 1; min-width: 0;
    border: 0; outline: none; background: transparent;
    font: inherit; font-size: 13.5px;
    color: var(--ink-900);
    padding: 9px 10px;
}
.topbar__search-input::placeholder { color: var(--ink-400); }
.topbar__search-input::-webkit-search-cancel-button { cursor: pointer; }
.topbar__search-go {
    flex-shrink: 0;
    border: 0; border-radius: 999px;
    background: var(--brand-700); color: #fff;
    font: inherit; font-size: 12.5px; font-weight: 600;
    padding: 7px 16px; cursor: pointer;
    transition: background .15s ease;
}
.topbar__search-go:hover { background: var(--accent-600); }

.page { padding: 24px 28px 48px; flex: 1; }
.page > * + * { margin-top: 18px; }

/* --- Cards --------------------------------------------------------------- */
/* Uniform 1px border on all four sides. No side accents. */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.card__head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.card__head h2 { font-size: 14.5px; }
.card__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-500); }
.card__head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.card__foot {
    padding: 12px 20px;
    border-top: 1px solid var(--line-soft);
    display: flex; align-items: center; gap: 12px;
    font-size: 12.5px; color: var(--ink-500);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: #fbfcfe;
}

/* --- Stat tiles ---------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
    display: flex; flex-direction: column; gap: 10px;
}
.stat__top { display: flex; align-items: center; gap: 10px; }
.stat__icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand-600);
}
.stat__icon--green  { background: var(--success-50); color: var(--success-600); }
.stat__icon--amber  { background: var(--warn-50);    color: var(--warn-600); }
.stat__icon--rose   { background: var(--danger-50);  color: var(--danger-600); }
.stat__icon--sky    { background: var(--info-50);    color: var(--info-600); }
.stat__icon--violet { background: var(--violet-50);  color: var(--violet-600); }
.stat__label { font-size: 12px; font-weight: 600; color: var(--ink-500); letter-spacing: .02em; text-transform: uppercase; }
.stat__value { font-size: 26px; font-weight: 680; color: var(--ink-900); line-height: 1.1; letter-spacing: -.02em; }
.stat__meta { font-size: 12px; color: var(--ink-500); display: flex; align-items: center; gap: 6px; }
.stat__delta { font-weight: 600; }
.stat__delta--up   { color: var(--alert-600); }
.stat__delta--down { color: var(--success-600); }
.stat__delta--flat { color: var(--ink-500); }

/* --- Grids --------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .grid--sidebar { grid-template-columns: 1fr; } }

/* --- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 15px;
    font: inherit; font-size: 13px; font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-700);
    cursor: pointer; white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    box-shadow: var(--shadow-xs);
}
.btn:hover { background: #f8fafc; border-color: var(--ink-300); color: var(--ink-900); }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: not-allowed; }
.btn--primary { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn--primary:hover { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.btn--dark { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn--dark:hover { background: var(--accent-700); border-color: var(--accent-700); color: #fff; }
.btn--danger { background: var(--alert-600); border-color: var(--alert-600); color: #fff; }
.btn--danger:hover { background: var(--alert-700); border-color: var(--alert-700); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn--ghost:hover { background: #f1f5f9; }
.btn--sm { padding: 6px 11px; font-size: 12.5px; }
.btn--icon { padding: 7px; }
.btn--block { width: 100%; }

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* --- Forms --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label {
    font-size: 12.5px; font-weight: 600; color: var(--ink-700);
}
.field .hint { font-size: 12px; color: var(--ink-500); }
.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    font: inherit; font-size: 13.5px;
    color: var(--ink-900);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-300); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(34, 62, 71, .18);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7f87' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group svg { position: absolute; left: 12px; color: var(--ink-400); pointer-events: none; }
.input-group .input { padding-left: 36px; }

.checkbox { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand-700); }

.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid--wide { grid-template-columns: 1fr; }
.form-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }

/* --- Filter bar ---------------------------------------------------------- */
.filters {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.filters .field { min-width: 150px; flex: 1 1 150px; }
.filters .field--wide { flex: 2 1 220px; }
.filters__actions { display: flex; gap: 8px; }

/* --- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
    text-align: left;
    font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-500);
    background: #fbfcfe;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f9fbfd; }
.table .num { font-variant-numeric: tabular-nums; }
.table .right { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table__actions { display: flex; gap: 6px; justify-content: flex-end; }
.table__primary { font-weight: 600; color: var(--ink-900); }
.table__muted { color: var(--ink-500); font-size: 12.5px; }

.mono { font-family: var(--mono); font-size: 12.5px; }

/* --- Badges -------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
    border-radius: 20px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge--absent  { background: var(--alert-50);   color: var(--alert-700);   border-color: var(--accent-200); }
.badge--present { background: var(--success-50); color: var(--success-700); border-color: #a7f3d0; }
.badge--synced  { background: var(--info-50);    color: var(--info-700);    border-color: var(--brand-200); }
.badge--failed  { background: var(--alert-50);   color: var(--alert-700);   border-color: var(--accent-200); }
.badge--pending { background: var(--warn-50);    color: var(--warn-700);    border-color: #fde68a; }
.badge--partial { background: var(--warn-50);    color: var(--warn-700);    border-color: #fde68a; }
.badge--neutral { background: #f1f5f9;           color: var(--ink-600);     border-color: var(--line); }
.badge--brand   { background: var(--brand-50);   color: var(--brand-700);   border-color: var(--brand-200); }
.badge--violet  { background: var(--violet-50);  color: var(--violet-600);  border-color: #d8cfe6; }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --- Notifications ------------------------------------------------------- */
.notices { position: fixed; top: 82px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.notice {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    animation: notice-in .22s ease-out;
}
.notice svg { margin-top: 1px; }
.notice--success svg { color: var(--success-600); }
.notice--error   svg { color: var(--alert-600); }
.notice--warning svg { color: var(--warn-600); }
.notice--info    svg { color: var(--info-600); }
.notice__close { margin-left: auto; background: none; border: 0; color: var(--ink-400); cursor: pointer; padding: 2px; }
.notice__close:hover { color: var(--ink-700); }
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 13.5px;
}
.callout--info  { background: var(--info-50);  border-color: var(--brand-200); color: var(--info-700); }
.callout--warn  { background: var(--warn-50);  border-color: #fde68a; color: var(--warn-700); }
.callout--error { background: var(--alert-50); border-color: var(--accent-200); color: var(--alert-700); }
.callout a { color: inherit; text-decoration: underline; }

/* --- Empty & loading states --------------------------------------------- */
.empty { padding: 48px 24px; text-align: center; color: var(--ink-500); }
.empty__icon {
    width: 48px; height: 48px; margin: 0 auto 14px;
    border-radius: 14px; display: grid; place-items: center;
    background: #f1f5f9; color: var(--ink-400);
}
.empty h3 { font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 420px; margin: 0 auto 16px; }

.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
    animation: spin .7s linear infinite; display: inline-block;
}
.spinner--dark { border-color: rgba(22, 38, 44, .2); border-top-color: var(--ink-700); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Charts (inline SVG) ------------------------------------------------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart__grid { stroke: var(--line-soft); stroke-width: 1; }
.chart__axis { fill: var(--ink-400); font-size: 10px; font-family: var(--font); }
.chart__bar { fill: var(--brand-600); transition: fill .15s ease; }
.chart__bar:hover { fill: var(--accent-600); }
.chart__line { fill: none; stroke: var(--brand-700); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__area { fill: rgba(34, 62, 71, .12); }
.chart__dot { fill: var(--surface); stroke: var(--accent-600); stroke-width: 2; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bars__row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.bars__label { color: var(--ink-700); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { height: 8px; background: #eef2f7; border-radius: 20px; overflow: hidden; }
.bars__fill { height: 100%; background: var(--brand-700); border-radius: 20px; }
.bars__fill--2 { background: var(--brand-500); }
.bars__fill--3 { background: var(--brand-200); }
.bars__value { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-700); min-width: 28px; text-align: right; }

/* --- Description lists --------------------------------------------------- */
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 24px; }
.details__item { min-width: 0; }
.details__label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); }
.details__value { font-size: 14px; color: var(--ink-900); font-weight: 550; margin-top: 3px; word-break: break-word; }

/* --- Profile header ------------------------------------------------------ */
.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile__avatar {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--brand-700); color: #ffffff;
    display: grid; place-items: center; font-size: 19px; font-weight: 700;
    border: 1px solid var(--brand-800);
}
.profile__name { font-size: 18px; font-weight: 650; color: var(--ink-900); }
.profile__meta { font-size: 13px; color: var(--ink-500); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.profile__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Timeline ------------------------------------------------------------ */
.timeline { display: flex; flex-direction: column; }
.timeline__item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.timeline__item:last-child { border-bottom: none; }
.timeline__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-600); margin-top: 6px; flex-shrink: 0; }
.timeline__body { min-width: 0; }
.timeline__title { font-size: 13px; font-weight: 550; color: var(--ink-800); }
.timeline__meta { font-size: 12px; color: var(--ink-500); }

/* --- Pagination ---------------------------------------------------------- */
.pagination { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pagination a, .pagination span {
    min-width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 9px;
    font-size: 12.5px; font-weight: 600;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    color: var(--ink-600); background: var(--surface);
}
.pagination a:hover { border-color: var(--ink-300); color: var(--ink-900); }
.pagination .is-current { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.pagination .is-disabled { opacity: .45; pointer-events: none; }

/* --- Tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tabs a {
    padding: 12px 14px;
    font-size: 13.5px; font-weight: 600; color: var(--ink-500);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tabs a:hover { color: var(--ink-800); }
.tabs a.is-active { color: var(--brand-700); border-bottom-color: var(--accent-600); }

/* --- Modals -------------------------------------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(22, 38, 44, .45);
    display: none; align-items: center; justify-content: center;
    padding: 24px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
    width: min(560px, 100%);
    max-height: 85vh; overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modal-in .18s ease-out;
}
.modal__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal__head h3 { font-size: 15px; }
.modal__body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; background: #fbfcfe; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* --- Utilities ----------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--sm { gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.push-right { margin-left: auto; }
.muted { color: var(--ink-500); }
.small { font-size: 12.5px; }
.strong { font-weight: 650; color: var(--ink-900); }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--line-soft); margin: 4px 0; }

/* --- Auth screens -------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--canvas);
}
.auth__aside {
    background: var(--sidebar-bg);
    color: #e2e8f0;
    padding: 56px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.auth__aside h2 { color: #fff; font-size: 26px; line-height: 1.25; max-width: 15ch; letter-spacing: -.02em; }
.auth__aside p { color: #9fb3ba; font-size: 14px; max-width: 42ch; }
.auth__points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth__points li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--sidebar-text); }
.auth__points svg { color: var(--accent-600); margin-top: 2px; }
.auth__panel { display: grid; place-items: center; padding: 40px 24px; }
.auth__box { width: min(420px, 100%); }
.auth__box h1 { font-size: 22px; margin-bottom: 6px; }
.auth__box > p { color: var(--ink-500); margin-bottom: 24px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth__aside { display: none; } }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.nav-open::after {
        content: ''; position: fixed; inset: 0; background: rgba(22, 38, 44, .4); z-index: 55;
    }
    .main { margin-left: 0; }
    .topbar__toggle { display: inline-flex; }
    .page { padding: 18px 16px 40px; }
    .topbar { padding: 0 16px; }
    .notices { right: 12px; left: 12px; max-width: none; }
}

@media (max-width: 900px) {
    /* The header search keeps its place but gives up the growing room first. */
    .topbar__search { max-width: none; margin-left: 8px; }
    .topbar__search-go { display: none; }
    .topbar__title p { display: none; }
}

@media (max-width: 640px) {
    .topbar__title h1 { font-size: 15px; }
    .hide-sm { display: none; }
    .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .filters { padding: 14px 16px; }
    .card__body { padding: 16px; }
}

/* --- Print --------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .notices, .no-print, .modal-backdrop { display: none !important; }
    .main { margin-left: 0; }
    .page { padding: 0; }
    .card { border: none; box-shadow: none; }
    body { background: #fff; }
}

/* --- Type-ahead suggestions ---------------------------------------------- */
.suggest-list { padding: 6px; }
.suggest-item {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border: 0; border-radius: var(--radius-sm);
    background: transparent;
    font: inherit; font-size: 13px; text-align: left;
    color: var(--ink-800); cursor: pointer;
}
.suggest-item:hover { background: var(--brand-50); }
.suggest-item__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Auto-save indicator -------------------------------------------------- */
.save-state {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-500);
    white-space: nowrap;
}
.save-state::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}
.save-state--pending { color: var(--warn-700);    background: var(--warn-50);    border-color: #fde68a; }
.save-state--saving  { color: var(--brand-700);   background: var(--brand-50);   border-color: var(--brand-200); }
.save-state--saved   { color: var(--success-700); background: var(--success-50); border-color: #a7f3d0; }
.save-state--error   { color: var(--alert-700);   background: var(--alert-50);   border-color: var(--accent-200); }

.doc-saved { max-width: 210mm; margin: 0 auto 12px; display: flex; justify-content: flex-end; }

/* Quiet destructive action: neutral until hovered, then unmistakable. */
.btn--danger-ghost { color: var(--ink-500); }
.btn--danger-ghost:hover {
    background: var(--accent-600);
    border-color: var(--accent-600);
    color: #fff;
}

/* --- Threshold meter ------------------------------------------------------
   A quiet progress bar showing how far an employee is toward the escalation
   threshold. Uniform rounded track, no side rails. */
.meter {
    display: block;
    height: 6px;
    background: #eef2f4;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 4px;
}
.meter__fill { display: block; height: 100%; background: var(--brand-500); border-radius: 20px; }
.meter__fill--alert { background: var(--accent-600); }
.meter__fill--warn  { background: var(--warn-600); }

/* Row-level emphasis for an employee past the threshold: a tinted row, not a
   coloured edge strip. */
.table tbody tr.is-critical { background: var(--accent-50); }
.table tbody tr.is-critical:hover { background: #fbe3e6; }
