/* ==========================================================================
   Mazira Workforce — design system
   --------------------------------------------------------------------------
   Hand-written rather than Tailwind, deliberately: no npm build step on a
   small instance, no CDN dependency, and one stylesheet a customer on poor
   bandwidth downloads once. Everything below is tokens first, components
   second — change a token and the whole product follows.
   ========================================================================== */

:root {
    /* Surfaces */
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --surface-muted: #f8fafc;
    --sidebar:       #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active:#1d4ed8;

    /* Text */
    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-faint:    #94a3b8;
    --text-invert:   #f8fafc;
    --text-sidebar:  #cbd5e1;
    --text-sidebar-muted: #64748b;

    /* Lines */
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    /* Accents — each has a tint for icon chips */
    --blue:   #2563eb;  --blue-tint:   #eff6ff;
    --green:  #16a34a;  --green-tint:  #f0fdf4;
    --amber:  #d97706;  --amber-tint:  #fffbeb;
    --violet: #7c3aed;  --violet-tint: #f5f3ff;
    --rose:   #e11d48;  --rose-tint:   #fff1f2;
    --teal:   #0d9488;  --teal-tint:   #f0fdfa;

    /* Shape */
    --radius:    10px;
    --radius-lg: 14px;
    --shadow:    0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 2px 4px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .08);

    --sidebar-w: 260px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ==========================================================================
   Layout
   ========================================================================== */

.layout {
    display: flex;
    min-height: 100vh;
    /* The sidebar is sticky and one viewport tall, so on a long page the
       column below it would otherwise show the page background. Painting the
       split behind the whole layout keeps the dark column continuous however
       far the content runs. */
    background: linear-gradient(
        to right,
        var(--sidebar) 0 var(--sidebar-w),
        var(--bg) var(--sidebar-w)
    );
}

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.main {
    flex: 1 1 auto;
    min-width: 0;           /* lets wide tables scroll instead of pushing layout */
    display: flex;
    flex-direction: column;
}

.content {
    padding: 28px 32px 48px;
    max-width: 1280px;
    width: 100%;
}

/* ==========================================================================
   Brand
   ========================================================================== */

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.brand__mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
    background: var(--sidebar-active);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -.02em;
}

.brand__name {
    font-weight: 650;
    font-size: 15px;
    color: #fff;
    letter-spacing: -.01em;
    line-height: 1.2;
}

.brand__tag {
    font-size: 11.5px;
    color: var(--text-sidebar-muted);
    line-height: 1.3;
}

/* ==========================================================================
   Sidebar navigation
   ========================================================================== */

.nav { padding: 14px 10px 24px; flex: 1 1 auto; }

.nav__group + .nav__group { margin-top: 18px; }

.nav__heading {
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-sidebar-muted);
    padding: 0 10px 7px;
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-sidebar);
    font-size: 14px;
    margin-bottom: 1px;
    transition: background .12s ease, color .12s ease;
}

.nav__item:hover { background: var(--sidebar-hover); color: #fff; }

.nav__item--active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 550;
}
.nav__item--active:hover { background: var(--sidebar-active); }

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

/* Modules that don't exist yet. Showing them greyed with a marker is honest —
   a link that 404s teaches the user the product is broken. */
.nav__item--soon {
    color: var(--text-sidebar-muted);
    cursor: default;
}
.nav__item--soon:hover { background: transparent; color: var(--text-sidebar-muted); }
.nav__item--soon svg { opacity: .45; }

.nav__soon {
    margin-left: auto;
    font-size: 9.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-sidebar-muted);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar__tenant {
    margin-right: auto;
    font-size: 13px;
    color: var(--text-muted);
}
.topbar__tenant strong { color: var(--text); font-weight: 600; }

.iconbtn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
}
.iconbtn:hover { background: var(--surface-muted); color: var(--text); }
.iconbtn svg { width: 18px; height: 18px; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: .02em;
}

/* ==========================================================================
   Page header
   ========================================================================== */

.page-head { margin-bottom: 24px; }

.page-head h1 {
    margin: 0 0 4px;
    font-size: 23px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.page-head p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(198px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat {
    padding: 18px 20px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat__icon { margin-bottom: 12px; }
.stat__icon svg { width: 20px; height: 20px; }

.stat__value {
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;   /* numbers stay aligned as they change */
}

/* A stat whose value is a name or a phrase rather than a number. At 28px a
   rule name wraps to three lines and shouts louder than the figures beside
   it, which inverts the hierarchy the tile row exists to create. */
.stat__value--text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.35;
}

.stat__label { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ==========================================================================
   Callout
   ========================================================================== */

.callout {
    display: flex;
    gap: 13px;
    padding: 16px 18px;
    background: var(--amber-tint);
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    margin-bottom: 26px;
}

.callout svg { width: 19px; height: 19px; flex: 0 0 19px; color: var(--amber); margin-top: 1px; }
.callout__title { font-weight: 620; font-size: 14.5px; margin-bottom: 2px; color: #78350f; }
.callout__body { font-size: 13.5px; color: #92400e; }

/* ==========================================================================
   Quick actions
   ========================================================================== */

.section-title {
    font-size: 15.5px;
    font-weight: 620;
    letter-spacing: -.01em;
    margin: 0 0 13px;
}

/* A section heading that follows content needs air above it, or the page reads
   as one undifferentiated block. The first-child rule keeps the top of a page
   tight. */
.section-title + * { margin-top: 0; }
* + .section-title { margin-top: 26px; }

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
    gap: 15px;
}

.action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow .14s ease, border-color .14s ease, transform .14s ease;
}

.action:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.action--soon { opacity: .58; cursor: default; }
.action--soon:hover { box-shadow: var(--shadow); border-color: var(--border); transform: none; }

.action__icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
}
.action__icon svg { width: 19px; height: 19px; }

.action__title { font-weight: 600; font-size: 14.5px; }
.action__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

/* Icon chips — tint background, solid foreground */
.chip-blue   { background: var(--blue-tint);   color: var(--blue); }
.chip-green  { background: var(--green-tint);  color: var(--green); }
.chip-amber  { background: var(--amber-tint);  color: var(--amber); }
.chip-violet { background: var(--violet-tint); color: var(--violet); }
.chip-rose   { background: var(--rose-tint);   color: var(--rose); }
.chip-teal   { background: var(--teal-tint);   color: var(--teal); }

.text-blue { color: var(--blue); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-violet { color: var(--violet); }

/* ==========================================================================
   Responsive
   --------------------------------------------------------------------------
   Supervisors approve timesheets on phones. The sidebar collapses to a
   horizontal scroller rather than hiding behind a hamburger nobody finds.
   ========================================================================== */

@media (max-width: 900px) {
    .layout {
        flex-direction: column;
        /* The desktop layout paints the dark sidebar column as a background
           gradient, so that a short page does not show the page background
           below a full-height sidebar. Stacked, that gradient becomes a dark
           stripe down the left of every screen — which is what it did, right
           up until somebody opened the clocking page on a phone. */
        background: var(--bg);
    }

    .sidebar {
        width: 100%;
        flex: none;
        height: auto;
        position: static;
    }

    .nav {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 10px 12px;
        -webkit-overflow-scrolling: touch;
    }

    .nav__group { display: flex; gap: 6px; }
    .nav__group + .nav__group { margin-top: 0; }
    .nav__heading { display: none; }
    .nav__item { white-space: nowrap; margin-bottom: 0; }
    .nav__item--soon, .nav__soon { display: none; }

    .topbar { padding: 0 18px; }
    .content { padding: 20px 18px 40px; }

    /* The header and the scrolling nav were taking a third of a phone screen
       before the clock button appeared — measured on a 390x844 viewport, which
       is an ordinary iPhone. On the one screen most of a customer's headcount
       will ever open, that is the whole screen spent on chrome. */
    .brand { padding: 11px 16px 12px; }
    .brand__mark { width: 28px; height: 28px; flex-basis: 28px; font-size: 14px; }
    .brand__tag { display: none; }

    .nav { padding: 8px 12px 10px; }
    .nav__item { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
    .nav__item svg { width: 15px; height: 15px; flex-basis: 15px; }
}

/* Installed and running without browser chrome.
 *
 * The operating system already shows the app's name in the switcher and on the
 * home screen, so the brand row is a second title bar for the same
 * information. Reclaiming it is roughly one more line of the clocking screen
 * visible without scrolling. */
@media (display-mode: standalone) {
    .brand { display: none; }
    .sidebar { border-bottom: 1px solid rgba(255, 255, 255, .08); }
    /* Standalone on iOS draws under the status bar. */
    .layout { padding-top: env(safe-area-inset-top); }
    .content { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   Tables
   --------------------------------------------------------------------------
   Wide tables scroll inside their own container. The page body must never
   scroll sideways — supervisors read these on phones.
   ========================================================================== */

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

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

.table thead th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

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

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

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--text-muted);
}

.empty {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 18px !important;
    font-size: 13.5px;
}
.empty:hover { background: transparent; }

/* Status pills */
.pill {
    display: inline-block;
    white-space: nowrap;      /* "Access granted" must not stack into two lines */
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.pill--active     { background: var(--green-tint);  color: var(--green);  border-color: #bbf7d0; }
.pill--probation  { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--on_leave   { background: var(--amber-tint);  color: var(--amber);  border-color: #fde68a; }
.pill--suspended  { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--terminated { background: var(--surface-muted); color: var(--text-faint); }

/* Approval and timesheet states. Named for the status value so a template can
   write pill--{{ obj.status }} and never fall out of step with the model. */
.pill--draft      { background: var(--surface-muted); color: var(--text-muted); }
.pill--submitted  { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--pending    { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--current    { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--waiting    { background: var(--surface-muted); color: var(--text-faint); }
.pill--approved   { background: var(--green-tint);  color: var(--green);  border-color: #bbf7d0; }
.pill--rejected   { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--returned   { background: var(--amber-tint);  color: var(--amber);  border-color: #fde68a; }
.pill--blocked    { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--withdrawn  { background: var(--surface-muted); color: var(--text-faint); }
.pill--skipped    { background: var(--surface-muted); color: var(--text-faint); }

/* Audit actions. Creation and updates are routine and stay quiet; anything
   that removes data or changes who can see it is coloured, because those are
   the rows someone scans a long log looking for. */
.pill--created        { background: var(--green-tint);  color: var(--green);  border-color: #bbf7d0; }
.pill--updated        { background: var(--surface-muted); color: var(--text-muted); }
.pill--deleted        { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--viewed         { background: var(--surface-muted); color: var(--text-faint); }
.pill--reopened       { background: var(--amber-tint);  color: var(--amber);  border-color: #fde68a; }
.pill--access_granted { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--access_revoked { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--login_failed   { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--denied         { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }

/* Terminal health. "Never connected" and "silent since Tuesday" call for
   different actions, so they share a colour but not a label — the detail line
   beside the pill carries the difference. */
.pill--health-ok      { background: var(--green-tint); color: var(--green); border-color: #bbf7d0; }
.pill--health-pending { background: var(--amber-tint); color: var(--amber); border-color: #fde68a; }
.pill--health-blocked { background: var(--rose-tint);  color: var(--rose);  border-color: #fecdd3; }
.pill--health-retired { background: var(--surface-muted); color: var(--text-faint); }

/* Command queue. Queued and sent are both "not done yet" from the operator's
   side, so neither is coloured as success. */
.pill--cmd-queued       { background: var(--surface-muted); color: var(--text-muted); }
.pill--cmd-sent         { background: var(--blue-tint);  color: var(--blue);  border-color: #bfdbfe; }
.pill--cmd-acknowledged { background: var(--green-tint); color: var(--green); border-color: #bbf7d0; }
.pill--cmd-failed       { background: var(--rose-tint);  color: var(--rose);  border-color: #fecdd3; }
.pill--cmd-expired      { background: var(--amber-tint); color: var(--amber); border-color: #fde68a; }

/* Team standing. Green is the default state and should look unremarkable —
   a screen where everyone is decorated is a screen nobody reads. */
.pill--rating-ok      { background: var(--green-tint); color: var(--green); border-color: #bbf7d0; }
.pill--rating-watch   { background: var(--amber-tint); color: var(--amber); border-color: #fde68a; }
.pill--rating-concern { background: var(--rose-tint);  color: var(--rose);  border-color: #fecdd3; }

/* Staff concerns. Acknowledged is blue, not green: HR has seen it but the
   matter is not finished, and colouring it as done is how things get lost. */
.pill--flag-open         { background: var(--rose-tint);  color: var(--rose);  border-color: #fecdd3; }
.pill--flag-acknowledged { background: var(--blue-tint);  color: var(--blue);  border-color: #bfdbfe; }
.pill--flag-resolved     { background: var(--green-tint); color: var(--green); border-color: #bbf7d0; }
.pill--flag-dismissed    { background: var(--surface-muted); color: var(--text-faint); }

/* Leave request states. Cancelled is grey rather than red — it is a normal
   thing to do, not a failure. */
.pill--leave-draft     { background: var(--surface-muted); color: var(--text-muted); }
.pill--leave-submitted { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--leave-approved  { background: var(--green-tint);  color: var(--green);  border-color: #bbf7d0; }
.pill--leave-rejected  { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--leave-returned  { background: var(--amber-tint);  color: var(--amber);  border-color: #fde68a; }
.pill--leave-cancelled { background: var(--surface-muted); color: var(--text-faint); }

/* Attendance day types gained a leave state. */
.pill--daytype-leave   { background: var(--violet-tint); color: var(--violet); border-color: #ddd6fe; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: #1d4ed8; }

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-muted); }

.btn--danger {
    background: #fff;
    color: var(--rose);
    border: 1px solid #fecdd3;
}
.btn--danger:hover { background: var(--rose-tint); }

.btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; }

.btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.backlink {
    display: inline-block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.backlink:hover { color: var(--blue); }

.page-head--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* More than one button beside a heading. Wraps rather than shrinking the
   buttons, because a payslip is most often opened on a phone and a download
   control squeezed to half its width is one people miss. */
.page-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-action { text-align: right; }
.row-action a { color: var(--blue); font-weight: 550; font-size: 13.5px; }
.row-action a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); }

/* ==========================================================================
   Forms
   --------------------------------------------------------------------------
   Single column at a readable measure. Multi-column HR forms look denser and
   scan worse: the eye loses its place between label and field, and on a phone
   they collapse into the same single column anyway.
   ========================================================================== */

.form { padding: 24px 26px 26px; max-width: 620px; }

.field { margin-bottom: 18px; }

.field__label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field__req {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color .12s ease, box-shadow .12s ease;
}

textarea.input { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.5; }

.input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}

.input--select {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 15px;
}

.checkbox { width: 17px; height: 17px; accent-color: var(--blue); }

.field__help { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }

.field__error {
    font-size: 12.5px;
    color: var(--rose);
    margin-top: 5px;
    font-weight: 500;
}

.field--invalid .input { border-color: var(--rose); }
.field--invalid .input:focus { box-shadow: 0 0 0 3px rgba(225, 29, 72, .12); }

.form__errors {
    background: var(--rose-tint);
    border: 1px solid #fecdd3;
    color: #9f1239;
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 13.5px;
    margin-bottom: 18px;
}

.form__actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.searchbar {
    display: flex;
    gap: 9px;
    margin-bottom: 16px;
    max-width: 520px;
}
.searchbar .input { flex: 1 1 auto; }

/* ==========================================================================
   Flash messages
   ========================================================================== */

.messages { margin-bottom: 20px; display: grid; gap: 9px; }

.message {
    padding: 11px 15px;
    border-radius: var(--radius);
    font-size: 13.8px;
    font-weight: 500;
    border: 1px solid;
}

.message--success { background: var(--green-tint); border-color: #bbf7d0; color: #14532d; }
.message--error   { background: var(--rose-tint);  border-color: #fecdd3; color: #9f1239; }
.message--warning { background: var(--amber-tint); border-color: #fde68a; color: #92400e; }
.message--info    { background: var(--blue-tint);  border-color: #bfdbfe; color: #1e3a8a; }

/* The setup callout is a link now — it should feel like one. */
a.callout { transition: border-color .14s ease, box-shadow .14s ease; }
a.callout:hover { border-color: var(--amber); box-shadow: var(--shadow-md); }

.callout__cta {
    margin-left: auto;
    align-self: center;
    font-size: 13px;
    font-weight: 620;
    color: var(--amber);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .form { padding: 18px; }
    .page-head--row { flex-direction: column; }
    .searchbar { max-width: none; }
    .callout__cta { display: none; }
}

/* ==========================================================================
   Import screens
   ========================================================================== */

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.panel { padding: 22px 24px 24px; }

.ticklist {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    font-size: 13.8px;
}

.ticklist li {
    padding: 6px 0 6px 20px;
    position: relative;
    border-bottom: 1px solid var(--border);
}
.ticklist li:last-child { border-bottom: none; }

.ticklist li::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
}

.note {
    font-size: 12.8px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 12px 0 0;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .92em;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

.callout--error {
    background: var(--rose-tint);
    border-color: #fecdd3;
    margin-bottom: 24px;
}
.callout--error svg { color: var(--rose); }
.callout--error .callout__title { color: #9f1239; }
.callout--error .callout__body { color: #be123c; }

.text-rose { color: var(--rose); }
.stat__sub { font-size: 14px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }

/* The commit bar sticks to the bottom: on a long error-free preview the
   button would otherwise be somewhere below the fold, and people conclude
   the import has no way to finish. */
.commit-bar {
    position: sticky;
    bottom: 16px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px 20px;
    font-size: 13.8px;
    color: var(--text-muted);
}
.commit-bar strong { color: var(--text); }

input[type="file"].input {
    padding: 8px 10px;
    height: auto;
    font-size: 13.5px;
}

@media (max-width: 900px) {
    .split { grid-template-columns: 1fr; }
    .commit-bar { position: static; }
}

/* ==========================================================================
   Filter bars
   ========================================================================== */

.filters {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.filters__field { display: flex; flex-direction: column; gap: 5px; }
.filters__field .field__label { margin-bottom: 0; }
.filters__field .input { min-width: 165px; }

.filters__field--check { justify-content: flex-end; }
.filters__field--check .field__label {
    flex-direction: row;
    align-items: center;
    gap: 7px;
    height: 40px;
    font-weight: 500;
}

@media (max-width: 900px) {
    .filters { flex-direction: column; align-items: stretch; }
    .filters__field .input { min-width: 0; }
}


/* ==========================================================================
   Card headers and table alignment
   ========================================================================== */

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
/* The actions on the right of a card header — buttons that must not squash.
   `:not(:only-child)` matters: a header holding just a title and its
   description has one child, which is also its last, and without this it got
   laid out as an unshrinkable row. Inside a `.table-wrap` (overflow-x: auto)
   that clipped the description mid-sentence rather than wrapping it, so the
   longer the explanation the less of it anybody could read. */
.card__head > div:last-child:not(:only-child) { display: flex; gap: 8px; flex-shrink: 0; }
.card__head > div:only-child { min-width: 0; }

.card__title {
    font-size: 15px;
    font-weight: 650;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card__sub {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--text-muted);
}

.table td.right, .table th.right { text-align: right; }

/* A timesheet row that is locked should read as settled, not as disabled. */
.row--locked td { background: var(--surface-muted); }


/* ==========================================================================
   Permission checklist
   ========================================================================== */

.perm-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2px;
    padding: 8px;
}

.perm {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .12s ease;
}
.perm:hover { background: var(--surface-muted); }
.perm input { margin-top: 2px; flex-shrink: 0; }

.perm__label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 550;
}
.perm__help {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.45;
}

/* A sensitive permission gets a left edge rather than a loud background: it
   has to be noticeable while scanning without making the safe majority of the
   list look like warnings. */
.perm--sensitive { box-shadow: inset 3px 0 0 var(--amber); }

.nowrap { white-space: nowrap; }

.text-rose { color: var(--rose); }


/* ==========================================================================
   Reports and exports
   ========================================================================== */

/* A banner is not a flash message. A flash reports what just happened and is
   gone on the next page; a banner states a condition of the thing on screen
   and stays until the condition does. An export withholding unapproved hours
   is a condition, so it must not scroll away with the messages. */
.banner {
    padding: 13px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 13.5px;
    line-height: 1.55;
    margin-bottom: 18px;
}
.banner strong { display: block; margin-bottom: 2px; }
.banner a { font-weight: 600; }

.banner--warn   { background: var(--amber-tint); border-color: #fde68a; color: #92400e; }
.banner--warn a { color: #92400e; }
/* Reserved for the one setting that lets unapproved hours out of the door. */
.banner--danger { background: var(--rose-tint); border-color: #fecdd3; color: #9f1239; }
.banner--danger a { color: #9f1239; }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.tab {
    padding: 9px 14px;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab--active { color: var(--blue); border-bottom-color: var(--blue); }

/* An export preview is a picture of a file, so it is set in the same face the
   file will be read in. Proportional digits here would hide a column that is
   one character too wide. */
.table--mono td, .table--mono th {
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 12.5px;
    white-space: nowrap;
}

.code-block {
    margin: 0;
    padding: 14px 18px;
    font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 12.5px;
    line-height: 1.7;
    overflow-x: auto;
    background: var(--surface-muted);
    color: var(--text);
}

.table__total td {
    font-weight: 650;
    border-top: 2px solid var(--border);
    background: var(--surface-muted);
}

.card__head--row { align-items: center; }

.empty-state { padding: 40px 24px; text-align: center; }
.empty-state h2 { margin: 0 0 6px; font-size: 16px; }
.empty-state p { margin: 0 auto 16px; max-width: 460px; color: var(--text-muted); }

.field-group__heading {
    margin: 0;
    padding: 14px 18px 6px;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.strong { font-weight: 650; }
.table td.shrink { width: 1%; white-space: nowrap; }

/* A report can carry ten columns, and the widest one — a person's name — is
   the one you least want wrapped onto two lines. Tightening the cells is what
   keeps the totals row on screen instead of behind a horizontal scroll. */
.table--compact td, .table--compact th {
    padding: 9px 10px;
    font-size: 12.5px;
}
.table--compact td.right, .table--compact th.right { white-space: nowrap; }

/* The heading input sits beside a field description, so it needs a floor as
   well as a ceiling — a column called "Employee number" should not leave a
   header box narrower than the word it holds. */
.table td.cell--input { width: 220px; }
.table td.cell--input .input { width: 100%; min-width: 140px; }

/* Two cards side by side on a wide screen, stacked on a narrow one. Used by
   the employee dashboard, where attendance and leave are peers rather than one
   being subordinate to the other. */
.split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    align-items: start;
}

.banner--info { background: var(--blue-tint); border-color: #bfdbfe; color: #1e3a8a; }
.banner--info a { color: #1e3a8a; }
.banner--ok   { background: var(--green-tint); border-color: #bbf7d0; color: #14532d; }

/* ==========================================================================
   Reminders
   ========================================================================== */

/* The bell carries a count, so it needs to be a positioning context. */
.iconbtn--badged { position: relative; text-decoration: none; }

.badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--rose);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* How close a date is, said in colour as well as in words — the words carry
   the meaning, the colour only makes the list scannable. */
.urgency--overdue { color: var(--rose); }
.urgency--today   { color: var(--amber); }
.urgency--soon    { color: var(--text); }
.urgency--done    { color: var(--text-muted); font-weight: 550; }

/* The note field and its button sit on one line inside a table cell. */
.inline-form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin-left: 6px;
}
.input--sm {
    padding: 6px 9px;
    font-size: 12.5px;
    min-width: 200px;
}

/* An action row with several buttons wraps rather than overflowing on a
   narrow screen. */
.form__actions--wrap { flex-wrap: wrap; }

.card__body { padding: 16px 18px; }
.card__body p { margin: 0 0 10px; }

/* Stage and status pills used by recruitment. Colour is a scanning aid only —
   every one of them also says what it is in words. */
.pill--draft, .pill--received      { background: var(--surface-muted); color: var(--text-muted); }
.pill--open, .pill--shortlisted    { background: var(--blue-tint);   color: #1e3a8a; }
.pill--interviewed                 { background: var(--violet-tint); color: #5b21b6; }
.pill--offer_pending               { background: var(--amber-tint);  color: #92400e; }
.pill--offered, .pill--accepted    { background: var(--teal-tint);   color: #115e59; }
.pill--hired, .pill--filled        { background: var(--green-tint);  color: #14532d; }
.pill--rejected, .pill--withdrawn,
.pill--cancelled                   { background: var(--rose-tint);   color: #9f1239; }
.pill--closed                      { background: var(--surface-muted); color: var(--text-muted); }

/* ==========================================================================
   Browser clocking
   --------------------------------------------------------------------------
   Sized for a phone held at arm's length in daylight, not for a desk. The
   button is deliberately enormous: the person pressing it may be wearing
   gloves, and a mis-tap costs them hours.
   ========================================================================== */

.clock { max-width: 460px; margin: 0 auto; padding: 20px; text-align: center; }

.clock__stage {
    background: #0f172a;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
}
.clock__video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.clock__canvas { display: none; }
.clock__hint {
    color: var(--text-sidebar);
    font-size: 13px;
    padding: 20px;
    margin: 0;
    grid-area: 1 / 1;
}

.clock__button {
    width: 100%;
    min-height: 96px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--blue);
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: background .12s ease, transform .06s ease;
}
.clock__button:hover:not(:disabled) { background: #1d4ed8; }
.clock__button:active:not(:disabled) { transform: scale(.99); }
.clock__button:disabled { background: var(--border-strong); cursor: default; }

.clock__time { font-size: 15px; font-weight: 500; opacity: .85; }

.clock__status {
    margin: 14px 0 6px;
    font-size: 14px;
    min-height: 20px;
    color: var(--text);
}
.clock__alt { margin: 0; font-size: 13px; }
.clock__alt a { color: var(--text-muted); text-decoration: underline; }

.clock__thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

/* ---------------------------------------------------------------------------
   The installed app: sign-in, offline, and the queue notice
   --------------------------------------------------------------------------- */

/* The signed-out shell. Centred and narrow rather than the sidebar layout,
   because these screens are reached from a phone far more often than from a
   desk — the login page is the first thing every employee in the company
   sees, and most of them will only ever see it on a handset. */
body.plain {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
    /* Keeps the panel clear of the iPhone notch and the home indicator when
       the app is installed and runs without browser chrome. */
    padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

.plain__panel {
    width: 100%;
    max-width: 400px;
    background: var(--surface, #fff);
    border-radius: 16px;
    padding: 28px 26px 24px;
    box-shadow: 0 24px 60px rgba(2, 6, 23, .45);
}

.plain__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand__mark--lg { width: 40px; height: 40px; font-size: 18px; border-radius: 11px; }
.plain__name { font-weight: 650; font-size: 15px; }
.plain__tag { font-size: 12px; color: var(--text-muted); }

.plain__title { margin: 0 0 18px; font-size: 20px; }
.plain__form { margin: 0 0 16px; }

/* `.field` is a <label> here rather than the <div> it is everywhere else, and
   a label is inline by default — so its bottom margin does nothing and the
   password box ends up welded to the Sign in button. */
.plain__form .field { display: block; }
.plain__form .input { width: 100%; box-sizing: border-box; }
.plain__form .btn--block { margin-top: 4px; }
.plain__help { font-size: 12.5px; color: var(--text-muted); margin: 14px 0 0; }
.plain__ios { font-size: 12.5px; margin: 12px 0 0; }

.btn--block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

.plain__install {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.plain__install p { margin: 0 0 10px; font-size: 12.5px; color: var(--text-muted); }

/* The offline card has no camera stage above it, so it needs its own spacing
   rather than inheriting a gap meant for a video element. */
.clock--offline { padding-top: 26px; }

.clock__queue {
    margin: 10px 0 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #92400e;
}

/* Sign-out sits in the topbar beside the avatar. A form, not a link — see the
   comment in base.html. */
.topbar__signout { margin: 0; display: flex; }

@media (max-width: 900px) {
    .plain__panel { padding: 22px 18px 20px; border-radius: 14px; }
}

/* ==========================================================================
   Documents and expiries

   Three generic pill tones and a danger card. Added here rather than reusing
   .pill--blocked and friends: those modifiers are named after workflow states
   ("rejected", "returned"), and a driver's licence is not a rejected anything.
   Naming a colour by the state it happened to mean first is how a stylesheet
   becomes unreadable.
   ========================================================================== */

.pill--danger { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--warn   { background: var(--amber-tint);  color: var(--amber);  border-color: #fde68a; }
.pill--muted  { background: var(--surface-muted); color: var(--text-faint); }

/* The one block on the compliance screen that has to be seen from across a
   room. Everything else there is ordinary. */
.card--danger { border-color: #fecdd3; box-shadow: 0 0 0 1px #fecdd3; }
.card--danger .card__title { color: var(--rose); }

.stat--danger .stat__value { color: var(--rose); }

.urgency--blocked { color: var(--rose); font-weight: 650; }
.urgency--ok      { color: var(--text-muted); }

/* A checkbox and its explanation on one line. The explanations here are long
   on purpose — "the person cannot lawfully do the job" is the actual meaning
   of the flag, and abbreviating it to "Blocks work" would leave somebody
   guessing. */
.check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 10px;
    cursor: pointer;
}
.check input { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--blue); flex: 0 0 17px; }

/* Superseded and withdrawn rows. Present, legible, clearly not current. */
.muted-row td { color: var(--text-muted); }
.muted-row td strong { font-weight: 550; }

/* The employer block at the top of a payslip. */
.payslip-issuer {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.5;
}
.payslip-issuer__logo { max-height: 46px; max-width: 160px; flex: 0 0 auto; }

/* An employee's own words, shown beside the reviewer's assessment. Visually
   quoted rather than styled as an input, so nobody edits it by accident —
   the whole value of a self-assessment is that it is not overwritten. */
.selfnote {
    background: var(--surface-muted);
    border-left: 3px solid var(--border-strong);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 9px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.selfnote strong { color: var(--text); font-weight: 600; }

/* Review stages, reusing the pill vocabulary. */
.pill--self_assessment { background: var(--amber-tint);  color: var(--amber);  border-color: #fde68a; }
.pill--with_reviewer   { background: var(--blue-tint);   color: var(--blue);   border-color: #bfdbfe; }
.pill--completed       { background: var(--green-tint);  color: var(--green);  border-color: #bbf7d0; }
.pill--declined        { background: var(--rose-tint);   color: var(--rose);   border-color: #fecdd3; }
.pill--cancelled       { background: var(--surface-muted); color: var(--text-faint); }

/* A filter button showing which view is current. */
.btn--on { background: var(--surface-muted); color: var(--text); font-weight: 600; }

/* A finished review, read as a record rather than a form. */
.record { margin-bottom: 18px; }
.record__label {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 5px;
}
.record p { margin: 4px 0 0; }
