/* ==========================================================================
   TWE Portal — stylesheet
   --------------------------------------------------------------------------
   One file, no build step, no framework. Organised as:
     1. Tokens        6. Tables
     2. Reset         7. Badges & status
     3. Layout        8. Forms
     4. Buttons       9. Feedback (alerts, empty states)
     5. Cards        10. Utilities & responsive
   ========================================================================== */

/* 1. Tokens ============================================================== */

:root {
    --brand:          #4f46e5;
    --brand-dark:     #4338ca;
    --brand-light:    #eef2ff;

    --bg:             #f6f7f9;
    --surface:        #ffffff;
    --surface-2:      #f9fafb;
    --border:         #e5e7eb;
    --border-strong:  #d1d5db;

    --text:           #111827;
    --text-muted:     #6b7280;
    --text-faint:     #9ca3af;

    --green:          #15803d;
    --green-bg:       #dcfce7;
    --red:            #b91c1c;
    --red-bg:         #fee2e2;
    --amber:          #b45309;
    --amber-bg:       #fef3c7;
    --blue:           #1d4ed8;
    --blue-bg:        #dbeafe;
    --violet:         #6d28d9;
    --violet-bg:      #ede9fe;
    --grey:           #4b5563;
    --grey-bg:        #f3f4f6;

    --radius:         10px;
    --radius-sm:      6px;
    --radius-lg:      14px;

    --shadow-sm:      0 1px 2px rgba(16, 24, 40, .05);
    --shadow:         0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg:      0 10px 24px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .05);

    --sidebar-w:      244px;
    --topbar-h:       60px;

    --font:           system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono:      ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* 2. Reset =============================================================== */

*, *::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(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* 3. Layout ============================================================== */

.app { min-height: 100vh; }

/* --- Sidebar --- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    z-index: 40;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 18px;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar__mark {
    width: 30px; height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .02em;
}

.sidebar__name { color: #fff; font-weight: 600; font-size: 14px; }
.sidebar__org  { color: #64748b; font-size: 11px; margin-top: -2px; }

.sidebar__nav { padding: 12px 10px; flex: 1 1 auto; }

.sidebar__section {
    padding: 14px 10px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #64748b;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-weight: 500;
    transition: background .12s, color .12s;
}

.sidebar__link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }

.sidebar__link.is-active { background: var(--brand); color: #fff; }

.sidebar__link svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .9; }

.sidebar__count {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    display: grid;
    place-items: center;
}

.sidebar__link.is-active .sidebar__count { background: rgba(0, 0, 0, .28); }

.sidebar__foot {
    flex: 0 0 auto;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 11px;
    color: #64748b;
}

/* --- Top bar --- */

.topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--sidebar-w);
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 22px;
    z-index: 30;
}

.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.topbar__clock {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 34px; height: 34px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
}

/* --- User chip --- */

.userchip { display: flex; align-items: center; gap: 9px; }

.avatar {
    width: 32px; height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand-dark);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .01em;
}

.avatar--sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10px; }
.avatar--lg { width: 52px; height: 52px; flex-basis: 52px; font-size: 18px; }

.userchip__name { font-weight: 600; font-size: 13px; line-height: 1.25; }
.userchip__role { font-size: 11px; color: var(--text-muted); line-height: 1.25; }

/* --- Main --- */

.main {
    margin-left: var(--sidebar-w);
    padding: calc(var(--topbar-h) + 22px) 22px 44px;
    max-width: 1500px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head__text { flex: 1 1 260px; min-width: 0; }
.page-head__sub { color: var(--text-muted); margin-top: 3px; font-size: 13px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand); }

/* 4. Buttons ============================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, opacity .12s;
}

.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }

.btn svg { width: 15px; height: 15px; flex: 0 0 15px; }

.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn--success { background: var(--green); border-color: var(--green); color: #fff; }
.btn--success:hover { background: #166534; border-color: #166534; }

.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger:hover { background: #991b1b; border-color: #991b1b; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--grey-bg); color: var(--text); }

.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--sm svg { width: 13px; height: 13px; flex-basis: 13px; }
.btn--lg { padding: 11px 20px; font-size: 14px; }
.btn--block { width: 100%; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* 5. Cards & stats ======================================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    overflow: hidden;
}

.card__head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.card__head h2, .card__head h3 { margin: 0; }
.card__head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.card__hint { font-size: 12px; color: var(--text-muted); }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    display: block;
    color: inherit;
}

a.stat:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow); }

.stat__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat__value {
    font-size: 26px;
    font-weight: 650;
    line-height: 1.15;
    margin-top: 5px;
    font-variant-numeric: tabular-nums;
}

.stat__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.stat--accent  { border-left: 3px solid var(--brand); }
.stat--green   { border-left: 3px solid var(--green); }
.stat--red     { border-left: 3px solid var(--red); }
.stat--amber   { border-left: 3px solid var(--amber); }
.stat--blue    { border-left: 3px solid var(--blue); }
.stat--violet  { border-left: 3px solid var(--violet); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; align-items: start; }

/* 6. Tables ============================================================== */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.table--fixed { table-layout: fixed; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }

.table__primary { font-weight: 600; }
.table__sub { font-size: 12px; color: var(--text-muted); }

.person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__meta { font-size: 11px; color: var(--text-muted); }

/* 7. Badges & status ===================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.badge--green  { background: var(--green-bg);  color: var(--green); }
.badge--red    { background: var(--red-bg);    color: var(--red); }
.badge--amber  { background: var(--amber-bg);  color: var(--amber); }
.badge--blue   { background: var(--blue-bg);   color: var(--blue); }
.badge--violet { background: var(--violet-bg); color: var(--violet); }
.badge--grey   { background: var(--grey-bg);   color: var(--grey); }

.badge--dot::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12px;
    color: var(--text-muted);
}

.progress {
    height: 6px;
    border-radius: 3px;
    background: var(--grey-bg);
    overflow: hidden;
}

.progress__bar { height: 100%; background: var(--brand); border-radius: 3px; }
.progress__bar--green { background: var(--green); }
.progress__bar--amber { background: var(--amber); }
.progress__bar--red { background: var(--red); }

/* 8. Forms =============================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px 16px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--full { grid-column: 1 / -1; }

.field > label, .label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.field .req { color: var(--red); }

.input, .select, .textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    transition: border-color .12s, box-shadow .12s;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}

.input:disabled, .select:disabled, .textarea:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
}

.textarea { min-height: 88px; resize: vertical; line-height: 1.55; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.field .hint { font-size: 11.5px; color: var(--text-muted); }

.field .error { font-size: 11.5px; color: var(--red); font-weight: 500; }
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea { border-color: var(--red); }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--brand); width: 15px; height: 15px; flex: 0 0 15px; }

.form-actions {
    display: flex;
    gap: 9px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.fieldset > legend {
    padding: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Filter bar above tables */
.filters {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.filters .field { flex: 0 1 170px; gap: 4px; }
.filters .field > label { font-size: 11px; color: var(--text-muted); }
.filters .input, .filters .select { padding: 6px 10px; font-size: 13px; }
.filters .select { padding-right: 28px; }
.filters__actions { display: flex; gap: 7px; margin-left: auto; }

/* 9. Feedback ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }

.alert--success { background: var(--green-bg);  border-color: #bbf7d0; color: #14532d; }
.alert--error   { background: var(--red-bg);    border-color: #fecaca; color: #7f1d1d; }
.alert--warning { background: var(--amber-bg);  border-color: #fde68a; color: #78350f; }
.alert--info    { background: var(--blue-bg);   border-color: #bfdbfe; color: #1e3a8a; }

.alert__close {
    margin-left: auto;
    background: none;
    border: 0;
    color: inherit;
    opacity: .55;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 0 2px;
}
.alert__close:hover { opacity: 1; }

.empty {
    padding: 44px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty__icon {
    width: 40px; height: 40px;
    margin: 0 auto 10px;
    color: var(--text-faint);
}

.empty__icon svg { width: 100%; height: 100%; }

.empty__title { font-weight: 600; color: var(--text); margin-bottom: 3px; }
.empty__text { font-size: 13px; max-width: 380px; margin: 0 auto; }
.empty__action { margin-top: 16px; }

/* Credential hand-off box shown after creating an employee */
.credentials {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 18px 20px;
    font-family: var(--font-mono);
}

.credentials dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.credentials dt { color: #94a3b8; font-size: 12px; }
.credentials dd { margin: 0; font-size: 15px; font-weight: 600; color: #fff; word-break: break-all; }

/* Definition list used on detail pages */
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; margin: 0; }
.detail-list > div { min-width: 0; }
.detail-list dt {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.detail-list dd { margin: 0; font-size: 13.5px; word-break: break-word; }

/* Timeline for task history */
.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    position: relative;
    padding: 0 0 16px 22px;
    border-left: 2px solid var(--border);
}

.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }

.timeline li::before {
    content: "";
    position: absolute;
    left: -6px; top: 4px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border-strong);
}

.timeline li.is-highlight::before { border-color: var(--brand); background: var(--brand); }
.timeline__meta { font-size: 11.5px; color: var(--text-muted); }
.timeline__body { font-size: 13px; margin-top: 2px; white-space: pre-wrap; }

/* Note blocks (manager comment, blocker) */
.note {
    border-left: 3px solid var(--border-strong);
    background: var(--surface-2);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    white-space: pre-wrap;
}

.note--manager { border-left-color: var(--brand); background: var(--brand-light); }
.note--blocker { border-left-color: var(--red); background: var(--red-bg); }
.note__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    opacity: .75;
    margin-bottom: 3px;
}

/* Pagination */
.pagination { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .is-disabled { color: var(--text-faint); background: var(--surface-2); }

/* Tabs */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* 10. Login ============================================================== */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1000px 500px at 50% -15%, #e0e7ff 0%, transparent 60%),
        var(--bg);
}

.login__card {
    width: 100%;
    max-width: 392px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px 30px 26px;
}

.login__brand { text-align: center; margin-bottom: 22px; }

.login__mark {
    width: 50px; height: 50px;
    margin: 0 auto 12px;
    border-radius: 13px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 17px;
    box-shadow: var(--shadow);
}

.login__mark svg { width: 24px; height: 24px; }

.login__title { font-size: 19px; }
.login__sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.login__foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-faint); }

/* 11. Utilities ========================================================== */

.muted     { color: var(--text-muted); }
.faint     { color: var(--text-faint); }
.small     { font-size: 12px; }
.strong    { font-weight: 600; }
.mono      { font-family: var(--font-mono); font-size: .95em; }
.nowrap    { white-space: nowrap; }
.pre-wrap  { white-space: pre-wrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.tabnum    { font-variant-numeric: tabular-nums; }

.row  { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--tight { gap: 6px; }
.row--between { justify-content: space-between; }
.col  { display: flex; gap: 10px; flex-direction: column; }
.spacer { flex: 1 1 auto; }

.mt-0 { margin-top: 0; }  .mt-1 { margin-top: 6px; }  .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }

.hidden { display: none !important; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Screen-reader-only text */
.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;
}

/* 12. Responsive ========================================================= */

@media (max-width: 1000px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.is-open { transform: translateX(0); }

    .topbar { left: 0; padding: 0 14px; }
    .main   { margin-left: 0; padding: calc(var(--topbar-h) + 16px) 14px 40px; }

    .menu-toggle { display: inline-flex; }

    .scrim {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 35;
    }
}

@media (max-width: 640px) {
    .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
    .stat__value { font-size: 22px; }
    .card__body, .filters { padding: 14px; }
    .card__head { padding: 12px 14px; }
    .table th, .table td { padding: 9px 11px; }
    .userchip__name, .userchip__role { display: none; }
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1 1 auto; }
    .filters .field { flex: 1 1 130px; }
    .filters__actions { margin-left: 0; width: 100%; }
}

/* 13. Print (for reports) ================================================ */

@media print {
    .sidebar, .topbar, .filters, .page-head__actions, .btn, .pagination { display: none !important; }
    .main { margin: 0; padding: 0; max-width: none; }
    .card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; }
    body { background: #fff; font-size: 11px; }
}
