/* ==========================================================================
   HRPortal — Design System
   --------------------------------------------------------------------------
   One stylesheet, no build step. Tokens first, then primitives, then
   components. Nothing here uses a utility-class framework: every component
   has a real name so a screen reads as a screen, not as a wall of classes.

   Grid          : 4px base, 8px rhythm
   Type          : SF Pro / system stack, 6 sizes, 3 weights
   Radius        : 8 / 12 / 16 / 20 / full
   Elevation     : 4 levels, all soft and low-contrast
   Motion        : 150ms out, 240ms in, cubic-bezier(.32,.72,0,1)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand */
    --blue-50:   #EFF5FF;
    --blue-100:  #DBE8FE;
    --blue-200:  #BFD7FE;
    --blue-400:  #5B93F8;
    --blue-500:  #3B82F6;
    --blue-600:  #2563EB;
    --blue-700:  #1D4ED8;

    --cyan-400:  #22D3EE;
    --cyan-500:  #06B6D4;

    /* Semantic */
    --green-50:  #ECFDF3;
    --green-500: #16A34A;
    --green-600: #15803D;
    --amber-50:  #FFFAEB;
    --amber-400: #FBBF24;
    --amber-500: #F59E0B;
    --red-50:    #FEF2F2;
    --red-500:   #EF4444;
    --red-600:   #DC2626;
    --violet-500:#8B5CF6;
    --orange-500:#F97316;

    /* Neutrals */
    --ink:       #16203C;
    --ink-2:     #1F2A48;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-400: #94A3B8;
    --slate-300: #CBD5E1;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --slate-50:  #F8FAFC;
    --white:     #FFFFFF;

    /* Surfaces */
    --page-bg:       #E8EBF1;
    --shell-bg:      #FFFFFF;
    --card-bg:       #FFFFFF;
    --sunken-bg:     #F6F8FB;
    --field-bg:      #F2F4F8;
    --border:        #E9EDF3;
    --border-strong: #DDE3EC;

    /* Text */
    --text:       var(--ink);
    --text-muted: var(--slate-500);
    --text-soft:  var(--slate-400);
    --text-invert:#FFFFFF;

    /* Type scale */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
            "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

    --t-xs:  11.5px;
    --t-sm:  12.5px;
    --t-base:13.5px;
    --t-md:  15px;
    --t-lg:  17px;
    --t-xl:  21px;
    --t-2xl: 26px;
    --t-3xl: 32px;

    /* Radius */
    --r-sm:  8px;
    --r-md:  12px;
    --r-lg:  16px;
    --r-xl:  20px;
    --r-2xl: 26px;
    --r-full:999px;

    /* Elevation — soft, never harsh */
    --sh-1: 0 1px 2px rgba(22, 32, 60, .04), 0 1px 3px rgba(22, 32, 60, .03);
    --sh-2: 0 2px 6px rgba(22, 32, 60, .05), 0 1px 2px rgba(22, 32, 60, .04);
    --sh-3: 0 8px 24px rgba(22, 32, 60, .08), 0 2px 6px rgba(22, 32, 60, .04);
    --sh-4: 0 20px 48px rgba(22, 32, 60, .14), 0 4px 12px rgba(22, 32, 60, .06);
    --ring: 0 0 0 3px rgba(37, 99, 235, .16);

    /* Motion */
    --ease:  cubic-bezier(.32, .72, 0, 1);
    --fast:  150ms var(--ease);
    --base:  240ms var(--ease);

    /* Layout */
    --rail-w:     84px;
    --topbar-h:   64px;
    --gutter:     24px;
    --max-w:      1560px;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--t-base);
    line-height: 1.5;
    color: var(--text);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "tnum" 0;
}

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); background-clip: content-box; border: 3px solid transparent; }

::selection { background: var(--blue-100); color: var(--blue-700); }

/* --------------------------------------------------------------------------
   3. Typography helpers
   -------------------------------------------------------------------------- */
.h1 { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.h2 { font-size: var(--t-xl); font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
.h3 { font-size: var(--t-lg); font-weight: 620; letter-spacing: -.01em; color: var(--ink); }
.h4 { font-size: var(--t-md); font-weight: 600; color: var(--ink); }

.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }
.t-xs  { font-size: var(--t-xs); }
.t-sm  { font-size: var(--t-sm); }
.t-md  { font-size: var(--t-md); }
.t-lg  { font-size: var(--t-lg); }
.num   { font-variant-numeric: tabular-nums; }
.mono  { font-family: var(--mono); font-size: var(--t-sm); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase-label {
    font-size: var(--t-xs); font-weight: 600; letter-spacing: .05em;
    text-transform: uppercase; color: var(--text-soft);
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.row-top { display: flex; align-items: flex-start; }
.between { justify-content: space-between; }
.center  { justify-content: center; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1 1 auto; min-width: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; }  .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }

.grid { display: grid; gap: var(--gutter); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
/* The attendance dashboard's three-up hero row. A named class rather than an
   inline style, so the breakpoints below can collapse it. */
.g-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1.15fr); }
/* Small metric tiles: always at least two across, even on a phone —
   four stacked cards is a lot of scrolling for four numbers. */
.g-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Monday-first month grid */
.g-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }

.mt-1{margin-top:4px}  .mt-2{margin-top:8px}  .mt-3{margin-top:12px}
.mt-4{margin-top:16px} .mt-5{margin-top:20px} .mt-6{margin-top:24px}
.mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:16px} .mb-6{margin-bottom:24px}

/* --------------------------------------------------------------------------
   5. App shell
   -------------------------------------------------------------------------- */
.app {
    min-height: 100vh;
    padding: 18px;
    display: flex;
}

.shell {
    flex: 1;
    display: flex;
    max-width: var(--max-w);
    margin: 0 auto;
    background: var(--shell-bg);
    border-radius: var(--r-2xl);
    box-shadow: var(--sh-3);
    overflow: hidden;
    min-height: calc(100vh - 36px);
}

/* --- Icon rail ---------------------------------------------------------- */
.rail {
    width: var(--rail-w);
    flex: 0 0 var(--rail-w);
    border-right: 1px solid var(--border);
    padding: 18px 0 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--white);
    z-index: 30;
}

.rail-logo {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--green-500), #0F9B4A);
    color: #fff; font-weight: 700; font-size: 17px;
    box-shadow: 0 4px 12px rgba(22, 163, 74, .28);
    letter-spacing: -.02em;
}
.rail-brand { font-size: var(--t-xs); font-weight: 600; color: var(--slate-600); margin-top: 6px; }

.rail-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }

.rail-item {
    width: 58px; padding: 9px 0 7px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border-radius: var(--r-md);
    color: var(--slate-500);
    transition: background var(--fast), color var(--fast), transform var(--fast);
    position: relative;
}
.rail-item svg { width: 21px; height: 21px; stroke-width: 1.7; }
.rail-item span { font-size: 10.5px; font-weight: 550; letter-spacing: -.01em; }
.rail-item:hover { background: var(--slate-50); color: var(--slate-700); }
.rail-item:active { transform: scale(.96); }
.rail-item.is-active { background: var(--blue-50); color: var(--blue-600); }
.rail-item.is-active::before {
    content: ""; position: absolute; left: -13px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--blue-600);
}
.rail-item .rail-dot {
    position: absolute; top: 7px; right: 11px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 99px; background: var(--red-500); color: #fff;
    font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
    box-shadow: 0 0 0 2px #fff;
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; align-items: center; }

/* --- Main column -------------------------------------------------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* --- Top bar ------------------------------------------------------------ */
.topbar {
    height: var(--topbar-h);
    flex: 0 0 var(--topbar-h);
    padding: 0 24px;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    position: sticky; top: 0; z-index: 25;
}

.tabs { display: flex; align-items: center; gap: 4px; }
.tab {
    padding: 8px 15px; border-radius: var(--r-sm);
    font-size: var(--t-base); font-weight: 550; color: var(--slate-600);
    transition: background var(--fast), color var(--fast);
    white-space: nowrap;
}
.tab:hover { background: var(--slate-50); color: var(--ink); }
.tab.is-active { background: var(--blue-50); color: var(--blue-600); font-weight: 620; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 38px; height: 38px; border-radius: var(--r-md);
    display: grid; place-items: center; color: var(--slate-500);
    transition: background var(--fast), color var(--fast), transform var(--fast);
    position: relative;
}
.icon-btn svg { width: 19px; height: 19px; stroke-width: 1.8; }
.icon-btn:hover { background: var(--slate-50); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot {
    position: absolute; top: 8px; right: 9px; width: 7px; height: 7px;
    border-radius: 99px; background: var(--red-500); box-shadow: 0 0 0 2px #fff;
}

/* --- Global search ------------------------------------------------------ */
.search {
    position: relative; flex: 0 1 380px; margin-left: auto;
}
.search-input {
    width: 100%; height: 40px;
    padding: 0 66px 0 40px;
    border: 1px solid transparent; border-radius: var(--r-full);
    background: var(--field-bg);
    font-size: var(--t-base);
    transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.search-input::placeholder { color: var(--text-soft); }
.search-input:focus {
    outline: none; background: #fff;
    border-color: var(--blue-200); box-shadow: var(--ring);
}
.search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 17px; height: 17px; color: var(--slate-400); pointer-events: none;
}
.search-kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    display: flex; gap: 2px; pointer-events: none;
}
kbd {
    font-family: var(--font); font-size: 10.5px; font-weight: 600;
    color: var(--slate-500); background: #fff; border: 1px solid var(--border-strong);
    border-radius: 5px; padding: 2px 5px; min-width: 19px; text-align: center;
    box-shadow: 0 1px 0 var(--border-strong);
}

.search-panel {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--sh-4);
    max-height: 460px; overflow-y: auto; z-index: 60;
    padding: 6px;
    display: none;
}
.search-panel.is-open { display: block; animation: pop var(--base); }
.search-group-label {
    padding: 9px 12px 5px; font-size: var(--t-xs); font-weight: 650;
    letter-spacing: .04em; text-transform: uppercase; color: var(--text-soft);
}
.search-result {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: var(--r-sm);
    transition: background var(--fast);
}
.search-result:hover, .search-result.is-cursor { background: var(--blue-50); }
.search-result-icon {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
    background: var(--slate-100); color: var(--slate-500);
    display: grid; place-items: center;
}
.search-result-icon svg { width: 16px; height: 16px; }
.search-result-title { font-weight: 550; font-size: var(--t-base); }
.search-result-sub { font-size: var(--t-sm); color: var(--text-muted); }
.search-empty { padding: 26px 12px; text-align: center; color: var(--text-muted); font-size: var(--t-sm); }

/* --- Avatar ------------------------------------------------------------- */
.avatar {
    width: 34px; height: 34px; border-radius: 99px;
    background: var(--blue-100); color: var(--blue-700);
    display: grid; place-items: center;
    font-size: var(--t-sm); font-weight: 650; letter-spacing: -.01em;
    overflow: hidden; flex: 0 0 auto; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 26px; height: 26px; font-size: 10px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: var(--t-base); }
.avatar.xl { width: 72px; height: 72px; font-size: var(--t-xl); border-radius: 22px; }
.avatar-ring { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue-200); }

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* --- Page body ---------------------------------------------------------- */
.page {
    flex: 1; padding: 26px var(--gutter) 40px;
    overflow-y: auto;
    background: var(--white);
}

.page-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.page-title { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -.025em; color: var(--ink); }
.page-sub { color: var(--text-muted); font-size: var(--t-base); margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a:hover { color: var(--blue-600); }
.breadcrumb svg { width: 13px; height: 13px; color: var(--slate-300); }

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 20px;
    transition: box-shadow var(--base), transform var(--base), border-color var(--base);
}
.card.is-hoverable:hover { box-shadow: var(--sh-3); border-color: var(--border-strong); }
.card.is-clickable:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.card.flush { padding: 0; overflow: hidden; }
.card.tight { padding: 16px; }
.card.sunken { background: var(--sunken-bg); border-color: transparent; }

.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: var(--t-lg); font-weight: 620; letter-spacing: -.012em; }
.card-sub { font-size: var(--t-sm); color: var(--text-muted); margin-top: 2px; }
.card-action { margin-left: auto; font-size: var(--t-base); font-weight: 550; color: var(--blue-600); }
.card-action:hover { color: var(--blue-700); text-decoration: underline; text-underline-offset: 3px; }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Stat tile — the four small cards on the reference dashboard */
.stat {
    background: #fff; border: 1px solid var(--border); border-radius: var(--r-xl);
    padding: 18px 20px 20px;
    transition: box-shadow var(--base), transform var(--base);
}
.stat:hover { box-shadow: var(--sh-2); }
.stat-icon {
    width: 36px; height: 36px; border-radius: 11px;
    display: grid; place-items: center; margin-bottom: 14px;
}
.stat-icon svg { width: 19px; height: 19px; stroke-width: 1.8; }
.stat-icon.blue   { background: var(--blue-50);   color: var(--blue-600); }
.stat-icon.green  { background: var(--green-50);  color: var(--green-500); }
.stat-icon.amber  { background: var(--amber-50);  color: var(--amber-500); }
.stat-icon.red    { background: var(--red-50);    color: var(--red-500); }
.stat-icon.violet { background: #F5F3FF;          color: var(--violet-500); }
.stat-icon.slate  { background: var(--slate-100); color: var(--slate-500); }
.stat-label { font-size: var(--t-base); color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: var(--t-xl); font-weight: 680; letter-spacing: -.025em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-value.green { color: var(--green-500); }
.stat-value.blue  { color: var(--blue-600); }
.stat-value.red   { color: var(--red-500); }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--t-sm); font-weight: 600; margin-top: 6px; }
.stat-delta.up { color: var(--green-500); }
.stat-delta.down { color: var(--red-500); }
.stat-delta svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 16px;
    border-radius: var(--r-md);
    font-size: var(--t-base); font-weight: 570; letter-spacing: -.005em;
    white-space: nowrap;
    transition: background var(--fast), color var(--fast), box-shadow var(--fast),
                transform var(--fast), border-color var(--fast), opacity var(--fast);
}
.btn svg { width: 16px; height: 16px; stroke-width: 1.9; flex: 0 0 auto; }
.btn:active { transform: scale(.975); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.24), 0 4px 12px rgba(37,99,235,.18); }
.btn-primary:hover { background: var(--blue-700); }

.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-50); color: var(--ink); }

.btn-soft { background: var(--field-bg); color: var(--slate-700); }
.btn-soft:hover { background: var(--slate-200); }

.btn-outline { background: #fff; color: var(--slate-700); border: 1px solid var(--border-strong); }
.btn-outline:hover { border-color: var(--slate-300); background: var(--slate-50); }

.btn-success { background: var(--green-500); color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,.2); }
.btn-success:hover { background: var(--green-600); }

.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover { background: var(--red-600); }

.btn-danger-soft { background: var(--red-50); color: var(--red-600); }
.btn-danger-soft:hover { background: #FEE2E2; }

.btn-block { width: 100%; }
.btn-lg { height: 44px; padding: 0 22px; font-size: var(--t-md); border-radius: var(--r-md); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

.btn-group { display: inline-flex; background: var(--field-bg); padding: 3px; border-radius: var(--r-md); gap: 2px; }
.btn-group > * {
    height: 30px; padding: 0 13px; border-radius: 9px;
    font-size: var(--t-sm); font-weight: 550; color: var(--slate-600);
    display: inline-flex; align-items: center; gap: 6px;
    transition: background var(--fast), color var(--fast);
}
.btn-group > *:hover { color: var(--ink); }
.btn-group > .is-active { background: #fff; color: var(--ink); box-shadow: var(--sh-1); font-weight: 600; }

/* --------------------------------------------------------------------------
   8. Forms — minimum typing: big targets, real selects, steppers, chips
   -------------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.label {
    display: block; font-size: var(--t-sm); font-weight: 580;
    color: var(--slate-700); margin-bottom: 6px;
}
.label .req { color: var(--red-500); margin-left: 2px; }
.hint { font-size: var(--t-sm); color: var(--text-muted); margin-top: 5px; }
.error { font-size: var(--t-sm); color: var(--red-600); margin-top: 5px; }

.input, .select, .textarea {
    width: 100%; height: 40px; padding: 0 13px;
    background: #fff; color: var(--ink);
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    font-size: var(--t-base);
    transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
    appearance: none; -webkit-appearance: none;
}
.textarea { height: auto; min-height: 92px; padding: 10px 13px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-soft); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--slate-300); }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--blue-500); box-shadow: var(--ring); background: #fff;
}
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red-500); }
.input[readonly], .input[disabled] { background: var(--slate-50); color: var(--slate-500); }

.select {
    padding-right: 36px;
    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='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    cursor: pointer;
}

.input-group { position: relative; }
.input-group .input { padding-left: 38px; }
.input-group-icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--slate-400); pointer-events: none;
}
.input-prefix {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    font-size: var(--t-base); color: var(--slate-500); pointer-events: none;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2, .form-grid-3 .span-2 { grid-column: span 2; }
.form-grid-3 .span-3 { grid-column: span 3; }

.form-section { padding: 22px 0; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { font-size: var(--t-md); font-weight: 620; margin-bottom: 3px; }
.form-section-sub { font-size: var(--t-sm); color: var(--text-muted); margin-bottom: 18px; }

/* Checkbox & radio */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
    width: 19px; height: 19px; flex: 0 0 19px; margin-top: 1px;
    border: 1.6px solid var(--slate-300); border-radius: 6px; background: #fff;
    display: grid; place-items: center;
    transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.check-box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(.6); transition: all var(--fast); }
.check input:checked + .check-box { background: var(--blue-600); border-color: var(--blue-600); }
.check input:checked + .check-box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check-box { box-shadow: var(--ring); }
.check-label { font-size: var(--t-base); line-height: 1.45; }
.check.radio .check-box { border-radius: 99px; }

/* Selectable chips — replaces free typing wherever a list will do */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border: 1px solid var(--border-strong); border-radius: var(--r-full);
    background: #fff; font-size: var(--t-base); font-weight: 520; color: var(--slate-600);
    cursor: pointer; transition: all var(--fast); user-select: none;
}
.chip:hover { border-color: var(--blue-200); background: var(--blue-50); color: var(--blue-700); }
.chip.is-selected { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 580; }
.chip svg { width: 14px; height: 14px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

/* Stepper — numeric entry without a keyboard */
.stepper {
    display: inline-flex; align-items: center; height: 40px;
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    background: #fff; overflow: hidden;
}
.stepper button {
    width: 38px; height: 100%; display: grid; place-items: center;
    color: var(--slate-500); transition: background var(--fast), color var(--fast);
}
.stepper button:hover { background: var(--slate-50); color: var(--blue-600); }
.stepper input {
    width: 58px; height: 100%; border: 0; text-align: center;
    font-size: var(--t-base); font-weight: 600; font-variant-numeric: tabular-nums;
    border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.stepper input:focus { outline: none; background: var(--blue-50); }

/* Range slider */
.range { width: 100%; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 99px; background: var(--slate-200); outline: none; }
.range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 99px;
    background: #fff; border: 2px solid var(--blue-600); cursor: grab;
    box-shadow: var(--sh-2); transition: transform var(--fast);
}
.range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 99px; background: #fff; border: 2px solid var(--blue-600); cursor: grab; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch-track {
    width: 42px; height: 24px; border-radius: 99px; background: var(--slate-300);
    padding: 2px; transition: background var(--fast);
}
.switch-thumb {
    width: 20px; height: 20px; border-radius: 99px; background: #fff;
    box-shadow: var(--sh-2); transition: transform var(--base);
}
.switch input:checked + .switch-track { background: var(--blue-600); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }

/* Dropzone */
.dropzone {
    border: 1.6px dashed var(--slate-300); border-radius: var(--r-lg);
    padding: 28px 20px; text-align: center; background: var(--sunken-bg);
    transition: border-color var(--fast), background var(--fast);
    cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--blue-500); background: var(--blue-50); }
.dropzone svg { width: 28px; height: 28px; color: var(--slate-400); margin: 0 auto 10px; }

/* --------------------------------------------------------------------------
   9. Badges, pills, meters
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    height: 23px; padding: 0 9px; border-radius: 7px;
    font-size: var(--t-xs); font-weight: 620; letter-spacing: .002em;
    white-space: nowrap;
}
.badge.pill { border-radius: 99px; padding: 0 11px; }
.badge.blue   { background: var(--blue-50);   color: var(--blue-700); }
.badge.green  { background: var(--green-50);  color: var(--green-600); }
.badge.amber  { background: var(--amber-50);  color: #B45309; }
.badge.red    { background: var(--red-50);    color: var(--red-600); }
.badge.slate  { background: var(--slate-100); color: var(--slate-600); }
.badge.violet { background: #F5F3FF;          color: #6D28D9; }
.badge.cyan   { background: #ECFEFF;          color: #0E7490; }
.badge.orange { background: #FFF7ED;          color: #C2410C; }
.badge.solid-red { background: var(--red-500); color: #fff; }
.badge.solid-green { background: var(--green-500); color: #fff; }

.dot-legend { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--text-muted); }
.dot-legend i { width: 8px; height: 8px; border-radius: 99px; flex: 0 0 8px; }

.meter { height: 6px; border-radius: 99px; background: var(--slate-100); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--blue-600); transition: width var(--base); }
.meter.green > i { background: var(--green-500); }
.meter.amber > i { background: var(--amber-400); }
.meter.red > i   { background: var(--red-500); }

/* Attendance ring in the working-history table */
.ring { width: 26px; height: 26px; flex: 0 0 26px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.4; stroke-linecap: round; }
.ring .track { stroke: var(--slate-100); }
.ring .value { transition: stroke-dashoffset var(--base); }
.ring.meeting .value { stroke: var(--green-500); }
.ring.unmet   .value { stroke: var(--amber-400); }
.ring.action  .value { stroke: var(--red-500); }
.ring.overtime .value { stroke: var(--orange-500); }

/* Donut with a value in the middle */
.donut { position: relative; display: grid; place-items: center; }
.donut canvas { position: relative; z-index: 1; }
.donut-center {
    position: absolute; inset: 0; display: grid; place-content: center;
    text-align: center; pointer-events: none;
}
.donut-value { font-size: var(--t-xl); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.donut-label { font-size: var(--t-xs); color: var(--text-muted); margin-top: 1px; }

/* --------------------------------------------------------------------------
   10. Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { font-size: var(--t-base); }
.table th {
    text-align: left; font-size: var(--t-sm); font-weight: 600; color: var(--text-muted);
    padding: 11px 14px; background: var(--sunken-bg);
    white-space: nowrap; position: relative;
}
.table thead tr:first-child th:first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.table thead tr:first-child th:last-child  { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--fast); }
.table tbody tr:hover { background: var(--slate-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num-cell { font-variant-numeric: tabular-nums; }
.table .right { text-align: right; }
.table .center-cell { text-align: center; }

.th-sort { display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.th-sort:hover { color: var(--ink); }
.th-sort svg { width: 13px; height: 13px; color: var(--slate-300); transition: color var(--fast); }
.th-sort.is-active { color: var(--blue-600); }
.th-sort.is-active svg { color: var(--blue-600); }

/* Per-column search row */
.col-filters th { background: #fff; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); }
.col-filter {
    width: 100%; height: 32px; padding: 0 9px;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--sunken-bg); font-size: var(--t-sm);
    transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}
.col-filter:focus { outline: none; background: #fff; border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.col-filter.is-set { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); font-weight: 550; }
select.col-filter { padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; appearance: none; }

.cell-primary { font-weight: 570; color: var(--ink); }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person-name { font-weight: 570; line-height: 1.3; }
.cell-person-meta { font-size: var(--t-sm); color: var(--text-muted); line-height: 1.35; }

.row-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; opacity: .35; transition: opacity var(--fast); }
tr:hover .row-actions { opacity: 1; }

/* Empty state */
.empty { padding: 56px 24px; text-align: center; }
.empty-icon {
    width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 16px;
    background: var(--slate-100); color: var(--slate-400); display: grid; place-items: center;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { font-size: var(--t-md); font-weight: 600; margin-bottom: 4px; }
.empty-text { color: var(--text-muted); font-size: var(--t-base); max-width: 380px; margin: 0 auto 18px; }

/* --------------------------------------------------------------------------
   11. Pagination
   -------------------------------------------------------------------------- */
.pagination {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 16px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pagination-info { font-size: var(--t-sm); color: var(--text-muted); }
.pagination-info b { color: var(--ink); font-weight: 620; font-variant-numeric: tabular-nums; }
.pagination-nav { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.page-link {
    min-width: 34px; height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm); font-size: var(--t-base); font-weight: 540; color: var(--slate-600);
    transition: background var(--fast), color var(--fast);
    font-variant-numeric: tabular-nums;
}
.page-link:hover { background: var(--slate-100); color: var(--ink); }
.page-link.is-active { background: var(--blue-600); color: #fff; font-weight: 620; }
.page-link.is-disabled { color: var(--slate-300); pointer-events: none; }
.page-link svg { width: 15px; height: 15px; }
.page-gap { min-width: 26px; text-align: center; color: var(--slate-400); }
.per-page { display: flex; align-items: center; gap: 7px; font-size: var(--t-sm); color: var(--text-muted); }
.per-page select { height: 30px; padding: 0 26px 0 9px; font-size: var(--t-sm); border-radius: var(--r-sm); border: 1px solid var(--border-strong); background-color: #fff; }

/* --------------------------------------------------------------------------
   12. Tabs, toolbar, filters
   -------------------------------------------------------------------------- */
.seg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.seg-tab {
    padding: 10px 15px 12px; font-size: var(--t-base); font-weight: 550;
    color: var(--text-muted); position: relative; white-space: nowrap;
    transition: color var(--fast);
}
.seg-tab:hover { color: var(--ink); }
.seg-tab.is-active { color: var(--blue-600); font-weight: 620; }
.seg-tab.is-active::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
    height: 2px; background: var(--blue-600); border-radius: 2px 2px 0 0;
}
.seg-tab .count {
    margin-left: 6px; padding: 1px 6px; border-radius: 99px;
    background: var(--slate-100); font-size: var(--t-xs); font-weight: 650; color: var(--slate-500);
}
.seg-tab.is-active .count { background: var(--blue-50); color: var(--blue-600); }

.toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.toolbar .grow { min-width: 200px; }
.toolbar-search { position: relative; flex: 0 1 300px; }
.toolbar-search .input { height: 36px; padding-left: 34px; background: var(--sunken-bg); border-color: transparent; }
.toolbar-search .input:focus { background: #fff; border-color: var(--blue-400); }
.toolbar-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--slate-400); }
.toolbar .select { height: 36px; width: auto; min-width: 140px; font-size: var(--t-sm); }

.filter-pills { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.filter-pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 6px 0 11px; border-radius: 99px;
    background: var(--blue-50); color: var(--blue-700);
    font-size: var(--t-sm); font-weight: 550;
}
.filter-pill button { width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; color: var(--blue-600); }
.filter-pill button:hover { background: var(--blue-100); }
.filter-pill svg { width: 12px; height: 12px; }

/* --------------------------------------------------------------------------
   13. Kanban pipeline
   -------------------------------------------------------------------------- */
.board {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px;
    scroll-snap-type: x proximity;
}
.board-col {
    flex: 0 0 288px; width: 288px;
    background: var(--sunken-bg); border-radius: var(--r-lg);
    display: flex; flex-direction: column; max-height: calc(100vh - 290px);
    scroll-snap-align: start;
    transition: background var(--fast), box-shadow var(--fast);
}
.board-col.is-over { background: var(--blue-50); box-shadow: inset 0 0 0 2px var(--blue-200); }
.board-col-head {
    padding: 13px 14px 11px; display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--border);
}
.board-col-dot { width: 9px; height: 9px; border-radius: 99px; flex: 0 0 9px; }
.board-col-title { font-size: var(--t-base); font-weight: 620; }
.board-col-count {
    margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px;
    border-radius: 99px; background: var(--white); border: 1px solid var(--border);
    font-size: var(--t-xs); font-weight: 650; color: var(--slate-600);
    display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.board-col-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; flex: 1; }

.pcard {
    background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 12px; cursor: grab;
    transition: box-shadow var(--fast), transform var(--fast), border-color var(--fast);
}
.pcard:hover { box-shadow: var(--sh-2); border-color: var(--border-strong); }
.pcard:active { cursor: grabbing; }
.pcard.is-dragging { opacity: .45; transform: rotate(1.5deg) scale(.98); }
.pcard.is-overdue { border-left: 3px solid var(--red-500); }
.pcard-head { display: flex; align-items: flex-start; gap: 9px; }
.pcard-name { font-weight: 590; font-size: var(--t-base); line-height: 1.3; }
.pcard-role { font-size: var(--t-sm); color: var(--text-muted); margin-top: 1px; }
.pcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pcard-foot {
    display: flex; align-items: center; gap: 8px; margin-top: 10px;
    padding-top: 9px; border-top: 1px solid var(--border);
    font-size: var(--t-xs); color: var(--text-soft);
}
.stars { display: inline-flex; gap: 1px; }
.stars svg { width: 12px; height: 12px; color: var(--slate-200); }
.stars svg.on { color: var(--amber-400); fill: var(--amber-400); }

/* --------------------------------------------------------------------------
   14. Timeline
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
    position: absolute; left: -22px; top: 3px;
    width: 16px; height: 16px; border-radius: 99px;
    background: #fff; border: 2.5px solid var(--blue-500);
    display: grid; place-items: center;
}
.tl-dot.green { border-color: var(--green-500); }
.tl-dot.red   { border-color: var(--red-500); }
.tl-dot.slate { border-color: var(--slate-300); }
.tl-title { font-size: var(--t-base); font-weight: 560; }
.tl-meta { font-size: var(--t-sm); color: var(--text-muted); margin-top: 2px; }
.tl-body { font-size: var(--t-base); color: var(--slate-600); margin-top: 6px; background: var(--sunken-bg); padding: 9px 12px; border-radius: var(--r-sm); }

/* --------------------------------------------------------------------------
   15. Modal, drawer, dropdown, toast
   -------------------------------------------------------------------------- */
.overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(15, 23, 42, .38);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; padding: 24px;
}
.overlay.is-open { display: flex; animation: fade var(--fast); }

.modal {
    width: 100%; max-width: 560px; max-height: calc(100vh - 48px);
    background: #fff; border-radius: var(--r-xl); box-shadow: var(--sh-4);
    display: flex; flex-direction: column; overflow: hidden;
    animation: rise var(--base);
}
.modal.wide { max-width: 800px; }
.modal.narrow { max-width: 420px; }
.modal-head { padding: 20px 22px 16px; display: flex; align-items: flex-start; gap: 14px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: var(--t-lg); font-weight: 640; letter-spacing: -.012em; }
.modal-sub { font-size: var(--t-sm); color: var(--text-muted); margin-top: 3px; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--sunken-bg); }

.drawer-wrap { position: fixed; inset: 0; z-index: 100; display: none; }
.drawer-wrap.is-open { display: block; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(15,23,42,.35); animation: fade var(--fast); }
.drawer {
    position: absolute; right: 0; top: 0; bottom: 0; width: 100%; max-width: 520px;
    background: #fff; box-shadow: var(--sh-4); display: flex; flex-direction: column;
    animation: slide-in var(--base);
}
.drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 14px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 7px); z-index: 60;
    min-width: 210px; padding: 6px;
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--sh-4);
    display: none;
}
.dropdown-menu.is-open { display: block; animation: pop var(--base); }
.dropdown-menu.left { right: auto; left: 0; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 11px; border-radius: var(--r-sm);
    font-size: var(--t-base); color: var(--slate-700); text-align: left;
    transition: background var(--fast), color var(--fast);
}
.dropdown-item svg { width: 16px; height: 16px; color: var(--slate-400); }
.dropdown-item:hover { background: var(--slate-50); color: var(--ink); }
.dropdown-item:hover svg { color: var(--slate-600); }
.dropdown-item.danger { color: var(--red-600); }
.dropdown-item.danger svg { color: var(--red-500); }
.dropdown-item.danger:hover { background: var(--red-50); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-label { padding: 8px 11px 4px; font-size: var(--t-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
    min-width: 290px; max-width: 400px; padding: 13px 15px;
    background: var(--ink); color: #fff; border-radius: var(--r-md);
    box-shadow: var(--sh-4); display: flex; align-items: flex-start; gap: 11px;
    font-size: var(--t-base); animation: rise var(--base);
}
.toast svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.toast.success svg { color: #4ADE80; }
.toast.error svg { color: #F87171; }
.toast.info svg { color: var(--blue-400); }
.toast-close { margin-left: auto; opacity: .6; }
.toast-close:hover { opacity: 1; }

/* Inline alert */
.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 15px; border-radius: var(--r-md);
    font-size: var(--t-base); line-height: 1.5; margin-bottom: 18px;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.alert.info    { background: var(--blue-50);  color: var(--blue-700); }
.alert.success { background: var(--green-50); color: var(--green-600); }
.alert.warning { background: var(--amber-50); color: #B45309; }
.alert.danger  { background: var(--red-50);   color: var(--red-600); }

/* --------------------------------------------------------------------------
   16. QR poster
   -------------------------------------------------------------------------- */
.qr-box {
    display: inline-grid; place-items: center; padding: 14px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
}
.qr-box canvas, .qr-box img { display: block; image-rendering: pixelated; }

.poster {
    width: 794px; min-height: 1123px;   /* A4 at 96dpi */
    background: #fff; padding: 64px 56px;
    display: flex; flex-direction: column;
    font-family: var(--font);
}
.poster-head { display: flex; align-items: center; gap: 16px; padding-bottom: 28px; border-bottom: 2px solid var(--ink); }
.poster-title { font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1.08; margin-top: 38px; }
.poster-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.poster-meta .badge { height: 30px; font-size: 14px; padding: 0 14px; }
.poster-qr { margin-top: auto; display: flex; align-items: center; gap: 32px; padding-top: 40px; border-top: 1px solid var(--border); }
.poster-qr-hint { font-size: 21px; font-weight: 600; line-height: 1.35; }
.poster-foot { margin-top: 26px; font-size: 13px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   17. Public careers pages
   -------------------------------------------------------------------------- */
.public-wrap { min-height: 100vh; background: var(--page-bg); }
.public-nav {
    height: 68px; display: flex; align-items: center; gap: 14px;
    padding: 0 24px; background: rgba(255,255,255,.9);
    backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.public-main { max-width: 940px; margin: 0 auto; padding: 30px 20px 64px; }
.public-hero { background: #fff; border-radius: var(--r-2xl); padding: 36px; box-shadow: var(--sh-2); }
.public-card { background: #fff; border-radius: var(--r-xl); padding: 26px; box-shadow: var(--sh-1); margin-top: 20px; }
.prose { font-size: var(--t-md); line-height: 1.7; color: var(--slate-700); }
.prose p { margin-bottom: 12px; }
.prose ul { list-style: none; padding: 0; }
.prose li {
    position: relative; padding-left: 22px; margin-bottom: 9px;
    list-style: none;           /* an <li> outside a <ul> still gets a UA marker */
}
.prose li::before {
    content: ""; position: absolute; left: 4px; top: 9px;
    width: 6px; height: 6px; border-radius: 99px; background: var(--blue-500);
}

.apply-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.apply-step { display: flex; align-items: center; gap: 9px; }
.apply-step-num {
    width: 28px; height: 28px; border-radius: 99px; flex: 0 0 28px;
    background: var(--slate-200); color: var(--slate-500);
    display: grid; place-items: center; font-size: var(--t-sm); font-weight: 680;
    transition: background var(--fast), color var(--fast);
}
.apply-step.is-active .apply-step-num { background: var(--blue-600); color: #fff; }
.apply-step.is-done .apply-step-num { background: var(--green-500); color: #fff; }
.apply-step-label { font-size: var(--t-base); font-weight: 540; color: var(--text-muted); }
.apply-step.is-active .apply-step-label { color: var(--ink); font-weight: 600; }
.apply-step-line { flex: 1; height: 2px; background: var(--slate-200); border-radius: 2px; min-width: 20px; }
.apply-step.is-done + .apply-step-line { background: var(--green-500); }

/* --------------------------------------------------------------------------
   18. Auth
   -------------------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
    background: linear-gradient(160deg, #1D4ED8 0%, #2563EB 45%, #0EA5E9 100%);
    color: #fff; padding: 56px 48px; display: flex; flex-direction: column;
    position: relative; overflow: hidden;
}
.auth-side::after {
    content: ""; position: absolute; right: -140px; bottom: -140px;
    width: 420px; height: 420px; border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.auth-side::before {
    content: ""; position: absolute; right: 40px; top: -80px;
    width: 240px; height: 240px; border-radius: 50%;
    background: rgba(255,255,255,.06);
}
.auth-side h2 { font-size: var(--t-3xl); font-weight: 700; letter-spacing: -.03em; line-height: 1.2; margin-top: auto; position: relative; }
.auth-side p { font-size: var(--t-md); opacity: .82; margin-top: 14px; max-width: 420px; line-height: 1.6; position: relative; }
.auth-points { margin-top: 30px; display: flex; flex-direction: column; gap: 13px; position: relative; }
.auth-point { display: flex; align-items: flex-start; gap: 11px; font-size: var(--t-base); }
.auth-point svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; opacity: .9; }

.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 384px; }
.auth-logo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
    background: linear-gradient(145deg, var(--blue-600), var(--blue-700)); color: #fff;
    font-weight: 700; font-size: 20px; box-shadow: 0 8px 20px rgba(37,99,235,.28); margin-bottom: 22px; }

/* --------------------------------------------------------------------------
   19. Misc
   -------------------------------------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.kv { display: flex; align-items: flex-start; gap: 14px; padding: 9px 0; }
.kv-key { width: 168px; flex: 0 0 168px; font-size: var(--t-base); color: var(--text-muted); }
.kv-val { font-size: var(--t-base); font-weight: 520; color: var(--ink); }
.kv-val.empty-val { color: var(--slate-300); font-weight: 400; }

.skeleton { background: linear-gradient(90deg, var(--slate-100) 25%, #EDF1F6 50%, var(--slate-100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 99px; animation: spin .6s linear infinite; }
.spinner.dark { border-color: var(--slate-200); border-top-color: var(--blue-600); }

.sticky-foot {
    position: sticky; bottom: 0; z-index: 15;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 13px 0; margin-top: 24px;
    display: flex; gap: 10px; justify-content: flex-end;
}

.scroll-x { overflow-x: auto; }
.hide { display: none !important; }

/* --------------------------------------------------------------------------
   20. Animations
   -------------------------------------------------------------------------- */
@keyframes fade    { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop     { from { opacity: 0; transform: translateY(-6px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes rise    { from { opacity: 0; transform: translateY(14px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes slide-in{ from { transform: translateX(100%) } to { transform: none } }
@keyframes spin    { to { transform: rotate(360deg) } }
@keyframes shimmer { to { background-position: -200% 0 } }

.reveal { animation: rise 380ms var(--ease) both; }
.reveal-1 { animation-delay: 40ms }  .reveal-2 { animation-delay: 80ms }
.reveal-3 { animation-delay: 120ms } .reveal-4 { animation-delay: 160ms }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------------------------------------
   21. Responsive — desktop, tablet, then a native-app feel on phones
   -------------------------------------------------------------------------- */
@media (max-width: 1340px) {
    .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat { padding: 16px 18px 18px; }
}

@media (max-width: 1180px) {
    :root { --gutter: 18px; }
    .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
    .g-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search { flex-basis: 260px; }
}

@media (max-width: 900px) {
    .g-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2, .form-grid-3 .span-2, .form-grid-3 .span-3 { grid-column: auto; }
    .kv { flex-direction: column; gap: 2px; }
    .kv-key { width: auto; flex: none; }
}

/* ---- Phone: the shell becomes a full-bleed app with a bottom tab bar ---- */
@media (max-width: 760px) {
    :root { --gutter: 16px; --topbar-h: 58px; }

    .app { padding: 0; }
    .shell { border-radius: 0; box-shadow: none; min-height: 100vh; }

    .rail { display: none; }

    .topbar { padding: 0 14px; gap: 10px; }
    .topbar .tabs { display: none; }
    .topbar-brand { display: flex !important; }
    .search { flex: 1; margin-left: 0; }
    .search-input { height: 36px; padding-right: 14px; }
    .search-kbd { display: none; }

    .page { padding: 18px 16px 96px; }
    .page-head { flex-direction: column; gap: 12px; }
    .page-actions { margin-left: 0; width: 100%; }
    .page-actions .btn { flex: 1; }
    .page-title { font-size: var(--t-xl); }

    .g-2, .g-3, .g-hero { grid-template-columns: minmax(0, 1fr); }
    .g-4, .g-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid { gap: 14px; }

    .stat { padding: 14px; }
    .stat-icon { margin-bottom: 10px; width: 32px; height: 32px; }
    .stat-icon svg { width: 17px; height: 17px; }
    .stat-value { font-size: var(--t-lg); }

    /* A month grid can't usefully become one column — let it scroll instead */
    .g-week { gap: 5px; }
    .g-week .card { padding: 7px !important; min-height: 62px !important; }

    .card, .stat { border-radius: var(--r-lg); padding: 16px; }

    /* Tables become stacked records — no horizontal scrolling on a phone */
    .table-stack thead { display: none; }
    .table-stack tbody tr {
        display: block; padding: 14px 16px;
        border-bottom: 1px solid var(--border);
    }
    .table-stack tbody tr:hover { background: transparent; }
    .table-stack td {
        display: flex; align-items: center; justify-content: space-between; gap: 14px;
        padding: 5px 0; border: 0;
    }
    .table-stack td::before {
        content: attr(data-label);
        font-size: var(--t-sm); color: var(--text-muted); font-weight: 550;
        flex: 0 0 auto;
    }
    .table-stack td.stack-primary { padding-bottom: 10px; }
    .table-stack td.stack-primary::before { display: none; }
    .table-stack td.stack-primary > * { width: 100%; }
    .table-stack .row-actions { opacity: 1; }
    .col-filters { display: none; }

    .pagination { flex-direction: column; align-items: stretch; gap: 12px; }
    .pagination-nav { margin-left: 0; justify-content: center; }
    .per-page { justify-content: center; }

    .board { gap: 10px; }
    .board-col { flex-basis: 84vw; width: 84vw; max-height: none; }

    .modal { max-width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; align-self: flex-end; max-height: 92vh; }
    .overlay { padding: 0; align-items: flex-end; }
    .modal-foot { position: sticky; bottom: 0; }
    .drawer { max-width: 100%; }

    .poster { width: 100%; min-height: auto; padding: 28px 20px; }
    .poster-title { font-size: 30px; }
    .poster-qr { flex-direction: column; align-items: flex-start; gap: 20px; }

    .toasts { left: 14px; right: 14px; bottom: 86px; }
    .toast { min-width: 0; }

    .sticky-foot { padding: 12px 16px; margin: 24px -16px 0; }
    .sticky-foot .btn { flex: 1; }
}

/* Bottom tab bar — phone only */
.tabbar { display: none; }

@media (max-width: 760px) {
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        background: rgba(255,255,255,.94);
        backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-top: 1px solid var(--border);
        padding: 7px 6px calc(7px + env(safe-area-inset-bottom, 0px));
    }
    .tabbar-item {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 5px 2px; border-radius: var(--r-md); color: var(--slate-500);
        transition: color var(--fast), background var(--fast);
    }
    .tabbar-item svg { width: 21px; height: 21px; stroke-width: 1.8; }
    .tabbar-item span { font-size: 10px; font-weight: 560; }
    .tabbar-item.is-active { color: var(--blue-600); }
    .tabbar-item:active { background: var(--slate-50); }
}

/* --------------------------------------------------------------------------
   22. Print
   -------------------------------------------------------------------------- */
@media print {
    body { background: #fff; }
    .rail, .topbar, .tabbar, .page-actions, .toolbar, .pagination, .no-print { display: none !important; }
    .app { padding: 0; }
    .shell { box-shadow: none; border-radius: 0; }
    .page { padding: 0; overflow: visible; }
    .card, .stat { break-inside: avoid; box-shadow: none; border-color: #D8DEE8; }
    .poster { padding: 0; width: 100%; }
    a[href]::after { content: ""; }
}
