/* =========================================================================
   ANGEL ATTENDANCE — DESIGN SYSTEM
   =========================================================================
   One shared stylesheet for every page, loaded AFTER each template's own
   <style> block so the design system wins on equal-specificity conflicts.
   Page stylesheets keep owning layout (grid, flex, widths, positioning);
   this file owns typography, colour, spacing rhythm, radii, shadows,
   states and accessibility.

   Built from the make-it-look-good knowledge base (CONSULT.md):
     layout/spacing-system.md, layout/grid-systems.md, layout/visual-hierarchy.md,
     typography/type-scale.md, typography/readability.md, typography/font-pairing.md,
     color/color-systems.md, color/contrast-and-accessibility.md,
     components/buttons.md, components/forms.md, components/tables-and-lists.md,
     components/navigation.md, components/feedback.md, components/cards.md,
     interaction/touch-targets.md, interaction/micro-interactions.md,
     interaction/animation-timing.md, interaction/loading-states.md,
     heuristics/llm-design-gotchas.md

   Personality: Clean — subtle shadows, 6–12px radii, system sans, 150ms motion.
   Mode: light only. Brand: Angel (blue primary, red for danger).
   Design notes: docs/design-review-notes.md

   MIGRATION NOTE: legacy per-page rules remain in the templates as a
   fallback. They should be deleted incrementally; nothing here depends on
   them. Do not add new raw hex values to the templates — use these tokens.
   ========================================================================= */

/* =========================================================================
   1. TOKENS
   ========================================================================= */

:root {
    /* --- Brand (sampled from static/img/logo.jpg; asset stays untouched) --- */
    --brand-red: #ed1c24;          /* 4.38:1 on white — non-text accents only */
    --brand-blue: #0046a8;

    /* --- Surfaces --- */
    --surface: #ffffff;
    --surface-alt: #f4f7fb;        /* page background */
    --surface-sunken: #f7f9fc;     /* table head, recessed blocks */
    --surface-hover: #f2f7ff;      /* row hover */
    --overlay: rgba(16, 24, 40, 0.45);

    /* --- Text ramp (all ≥4.5:1 on --surface) --- */
    --text: #1a1a1a;               /* 17.4:1  body and headings */
    --text-secondary: #4b5563;     /*  7.6:1  labels, table meta */
    --text-muted: #5f6b7a;         /*  5.4:1  captions, placeholder, empty */
    --black: #1a1a1a;              /* was referenced but never defined */

    /* --- Borders --- */
    --border: #e4e7ec;             /* hairlines, dividers (non-text) */
    --border-strong: #8a94a6;      /*  3.0:1  control outlines */

    /* --- Primary: blue (actions, links, focus) --- */
    --blue: #0046a8;               /*  8.6:1 */
    --blue-dark: #00357f;          /* 11.6:1  unified: was 3 different values */
    --blue-light: #eaf2ff;
    --primary: var(--blue);
    --primary-hover: var(--blue-dark);
    --primary-active: #00255a;
    --primary-subtle: var(--blue-light);

    /* --- Semantic states (never colour-only; always paired with text/icon) --- */
    --green: #107638;              /*  5.7:1  was #159447 = 3.9:1 (fails) */
    --green-light: #e8f7ee;
    --green-dark: #0b5a2a;
    --danger: #b91c1c;             /*  6.5:1  brand red fails as text (4.38:1) */
    --danger-dark: #991b1b;
    --danger-light: #fef2f2;
    --warning: #92400e;            /*  7.1:1  was #f59e0b = 2.15:1 (fails) */
    --warning-light: #fffbeb;
    --purple: #6d28d9;             /*  7.1:1  overtime accent */
    --purple-light: #f1eafe;

    /* --- Legacy aliases: pages still call these; all now AA-safe --- */
    --red: var(--danger);
    --red-dark: var(--danger-dark);
    --orange: var(--warning);
    --gray: var(--text-secondary);
    --bg: var(--surface-alt);
    --white: #ffffff;
    --brown: var(--text);          /* legacy text token; #2b1b17 mapped to the text ramp */

    /* --- Typography: system stack, zero download --- */
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

    --fs-caption: 0.8125rem;       /* 13px — labels, table head, captions */
    --fs-small: 0.875rem;          /* 14px — secondary text, dense data */
    --fs-body: 1rem;               /* 16px — minimum for body and inputs */
    --fs-lead: 1.125rem;           /* 18px — lead paragraphs */
    --fs-h3: 1.25rem;              /* 20px */
    --fs-h2: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);    /* 20–24px */
    --fs-h1: clamp(1.5rem, 1.3rem + 1vw, 1.875rem);      /* 24–30px */

    /* --- Spacing: 4px base. Never use 7px/13px/18px again. --- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;

    /* --- Radius --- */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 999px;

    /* --- Elevation (Clean: subtle) --- */
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.10);
    --shadow-lg: 0 10px 24px rgba(16, 24, 40, 0.14);
    --shadow: var(--shadow-sm);    /* legacy alias: replaces the heavy platform shadow */

    /* --- Motion --- */
    --dur-fast: 100ms;
    --dur: 150ms;
    --dur-slow: 250ms;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

/* =========================================================================
   2. RESET & BASE
   ========================================================================= */

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

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

body {
    margin: 0;
    /* 16px minimum: also stops iOS Safari zooming when a field is tapped */
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: 1.5;
    color: var(--text);
    background: var(--surface-alt);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 600; }
h4 { font-size: var(--fs-lead); font-weight: 600; }

p { margin: 0 0 0.75em; }

img { max-width: 100%; height: auto; }

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

/* Visible focus everywhere. Never remove without a replacement ring. */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Times, durations and counts must align vertically. */
.time,
.time-value,
.summary-value,
.daily-summary,
.rekap-waktu,
.detail-date,
.dashboard-last-time,
td.num,
.tabular-nums {
    font-variant-numeric: tabular-nums lining-nums;
}

.text-center { text-align: center; }

/* =========================================================================
   3. PAGE, HEADER, NAVIGATION, FOOTER
   ========================================================================= */

.page {
    padding: var(--space-4);
    margin-inline: auto;
}

.header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--brand-blue);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.logo-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

/* Scales with the company name so the two stay optically balanced, and
   stays on one row with it at every width. Measured: the wordmark image is
   wide (600x337), so its rendered WIDTH is ~1.78x its height. Capped at 52px
   so it does not outgrow the name, which is capped at 19px. */
.logo {
    height: clamp(34px, 26px + 2.4vw, 52px);
    width: auto;
    max-width: 190px;
    object-fit: contain;
    display: block;
}

.company {
    min-width: 0;                 /* lets the name shrink instead of overflowing */
}

/* One line only.
   IMPORTANT: the cap is 19px, not 24px, and that is a measured decision.
   The employee page puts the header inside a column capped at 560px, so once
   the viewport is wider than that the container stops growing while a vw-based
   font size keeps growing — at 24px the name overflowed its box by 60px at
   1280px and truncated, in Chromium as well as Firefox. Capping at 19px keeps
   ~10% slack in the worst case, and the lower floor gives ~7% slack at 360px
   instead of the 3px it had, which Firefox's wider metrics were enough to
   break. Container queries would size this against the header itself, but
   keeping the fallback simple matters more than the last few pixels. */
.company-name {
    font-size: clamp(0.78125rem, 0.55rem + 1.2vw, 1.1875rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-address {
    margin: var(--space-1) 0 0;
    font-size: var(--fs-small);
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 65ch;
}

.navigation {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1);
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-button:hover {
    background: var(--surface-hover);
    color: var(--blue);
    text-decoration: none;
}

.nav-button[aria-current="page"],
.nav-button.is-active {
    color: var(--blue);
    background: var(--blue-light);
    font-weight: 600;
}

.nav-button.logout {
    margin-left: auto;
    color: var(--danger);
}

.nav-button.logout:hover {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.footer {
    margin-top: var(--space-8);
    padding: var(--space-6) var(--space-4);
    border-top: 1px solid var(--border);
    font-size: var(--fs-caption);
    line-height: 1.6;
    color: var(--text-muted);
    text-align: center;
}

/* =========================================================================
   4. CARDS & SECTIONS
   ========================================================================= */

.card,
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.table-card {
    padding: 0;                    /* table supplies its own cell padding */
    overflow: hidden;
}

.title-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.title-card h1 {
    font-size: var(--fs-h1);
    font-weight: 700;
    margin: 0;
}

.title-card p {
    margin: var(--space-1) 0 0;
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

.section-title,
.card-title {
    font-size: var(--fs-h3);
    font-weight: 600;
    color: var(--text);
    margin: 0 0 var(--space-4);
}

.section-header,
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.table-header .section-title,
.section-header .section-title {
    margin: 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.container {
    width: 100%;
}

.actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* --- Summary / stat cards --- */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: none;              /* border only: never border + shadow */
}

.summary-label {
    display: block;
    font-size: var(--fs-caption);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.summary-value {
    display: block;
    margin-top: var(--space-1);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.summary-card.hadir,
.summary-card.working      { border-top-color: var(--blue); }
.summary-card.hadir .summary-value,
.summary-card.working .summary-value { color: var(--blue); }

.summary-card.overtime     { border-top-color: var(--purple); }
.summary-card.overtime .summary-value { color: var(--purple); }

.summary-card.finished,
.summary-card.finished-ot  { border-top-color: var(--green); }
.summary-card.finished .summary-value,
.summary-card.finished-ot .summary-value { color: var(--green); }

/* =========================================================================
   5. BUTTONS
   ========================================================================= */

.primary-button,
.action-button,
.filter-button,
.export-button,
.attendance-button,
.check-button,
.admin-button,
.edit-button,
.delete-button,
.activate-button,
.deactivate-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 40px;
    min-width: 80px;
    padding: var(--space-2) var(--space-4);
    font-size: var(--fs-small);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition:
        background-color var(--dur) var(--ease),
        border-color var(--dur) var(--ease),
        color var(--dur) var(--ease),
        box-shadow var(--dur) var(--ease);
}

/* --- Primary: filled blue. One per screen/section. --- */
.primary-button,
.export-button,
.attendance-button,
.check-button,
.admin-button {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.primary-button:hover,
.export-button:hover,
.attendance-button:hover,
.check-button:hover,
.admin-button:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    text-decoration: none;
}

.primary-button:active,
.export-button:active,
.attendance-button:active,
.check-button:active,
.admin-button:active {
    background: var(--primary-active);
    border-color: var(--primary-active);
    transform: translateY(1px);
}

/* --- Secondary: outlined blue (cancel, reset, filters, row actions) --- */
.action-button,
.filter-button,
.edit-button {
    background: var(--surface);
    border-color: var(--blue);
    color: var(--blue);
}

.action-button:hover,
.filter-button:hover,
.edit-button:hover {
    background: var(--primary-subtle);
    color: var(--primary-hover);
    text-decoration: none;
}

.action-button:active,
.filter-button:active,
.edit-button:active {
    background: var(--blue-light);
    transform: translateY(1px);
}

/* --- Reversible destructive: outlined red --- */
.deactivate-button {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}

.deactivate-button:hover {
    background: var(--danger-light);
    color: var(--danger-dark);
    text-decoration: none;
}

/* --- Irreversible destructive: filled red --- */
.delete-button {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.delete-button:hover {
    background: var(--danger-dark);
    border-color: var(--danger-dark);
    color: #fff;
    text-decoration: none;
}

.delete-button:active {
    transform: translateY(1px);
}

/* --- Positive (re-activate) --- */
.activate-button {
    background: var(--surface);
    border-color: var(--green);
    color: var(--green);
}

.activate-button:hover {
    background: var(--green-light);
    color: var(--green-dark);
    text-decoration: none;
}

/* --- Compact row actions inside dense tables, 44px hit area --- */
.action-button,
.edit-button,
.delete-button,
.activate-button,
.deactivate-button {
    position: relative;
    min-width: 64px;
    min-height: 34px;
    padding: var(--space-2) var(--space-3);
}

.action-button::after,
.edit-button::after,
.delete-button::after,
.activate-button::after,
.deactivate-button::after {
    content: "";
    position: absolute;
    inset: -5px;                   /* grows the touch target to 44px */
}

/* --- Shared states --- */
/* Disabled: a flat grey treatment rather than opacity over a brand colour.
   White-on-brand at 45% opacity drops to roughly 1.7:1, which is unreadable
   even though WCAG exempts inactive controls. */
.primary-button:disabled,
.action-button:disabled,
.filter-button:disabled,
.export-button:disabled,
.attendance-button:disabled,
.check-button:disabled,
.admin-button:disabled,
.edit-button:disabled,
.delete-button:disabled,
.activate-button:disabled,
.deactivate-button:disabled,
button:disabled {
    opacity: 1;
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
    pointer-events: none;
}

/* The employee page's two action buttons carry ids (#work-button, #ot-button).
   An id selector outranks any class-based rule above, so #ot-button's red
   gradient kept winning and, combined with the page's `opacity: 0.55`, left
   white text on faded red at roughly 1.7:1. Restated at id specificity.
   `background` shorthand also clears the gradient's background-image. */
#work-button:disabled,
#ot-button:disabled,
#work-button[disabled],
#ot-button[disabled] {
    opacity: 1;
    background: var(--surface-alt);
    background-image: none;
    border-color: var(--border);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

/* --- Employee page: the single primary action, thumb-reachable --- */
.attendance-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.attendance-button,
.check-button {
    min-height: 48px;
    width: 100%;
    font-size: var(--fs-body);
    border-radius: var(--radius-md);
}

/* =========================================================================
   6. FORMS
   ========================================================================= */

.input-row,
.form-group,
.field {
    margin-bottom: var(--space-4);
}

label,
.field label,
.form-group label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--fs-caption);
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="password"],
select,
textarea,
.employee-code {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    /* 16px prevents iOS Safari from zooming the page on focus */
    font-size: var(--fs-body);
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

input::placeholder,
textarea::placeholder {
    /* was #98a2b3 = 2.58:1 (fails); now 5.4:1 */
    color: var(--text-muted);
    opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 70, 168, 0.18);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
}

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

.form-grid,
.filter-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr;    /* single column by default */
}

/* =========================================================================
   7. TABLES
   ========================================================================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th,
th {
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-caption);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    color: var(--text-secondary);
    background: var(--surface-sunken);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td,
td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-small);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface-hover);
}

/* Employee/schedule codes and times read as data, not prose. */
.code,
.employee-code,
.time,
.detail-day {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.employee-name,
.name {
    font-weight: 600;
    color: var(--text);
}

.empty {
    padding: var(--space-8) var(--space-4);
    font-size: var(--fs-small);
    color: var(--text-muted);
    text-align: center;
}

/* =========================================================================
   8. BADGES & STATUS
   ========================================================================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px var(--space-3);
    font-size: var(--fs-caption);
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--surface-alt);
    color: var(--text-secondary);
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: var(--fs-small);
    font-weight: 600;
    border-radius: var(--radius-full);
}

/* These two need to outrank the page rules in employees.html, which set a
   7px/11px padding rhythm and a 2.58:1 grey dot that fails even the 3:1
   threshold for non-text UI. */
.status.active .status-dot {
    background: var(--green);
}

.status.inactive .status-dot {
    background: var(--text-muted);
}

/* State colours — always paired with a text label, never colour alone. */
.status-badge.hadir,
.status-badge.active,
.status-badge.normal,
.status.active {
    background: var(--green-light);
    color: var(--green-dark);
}

.status-badge.working,
.status.working {
    background: var(--primary-subtle);
    color: var(--primary-hover);
}

.status-badge.overtime,
.status-badge.ot,
.status.overtime {
    background: var(--purple-light);
    color: var(--purple);
}

.status-badge.finished,
.status-badge.finished-ot,
.status.finished {
    background: var(--surface-alt);
    color: var(--text-secondary);
}

.status-badge.inactive,
.status.inactive {
    background: var(--surface-alt);
    color: var(--text-muted);
}

.status-badge.empty-badge {
    background: var(--surface-alt);
    color: var(--text-muted);
}

/* =========================================================================
   9. FEEDBACK: messages, alerts, empty and loading states
   ========================================================================= */

.message,
#message {
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: var(--fs-small);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius-md);
    background: var(--primary-subtle);
    color: var(--text);
}

.message:empty,
#message:empty {
    display: none;
}

.message.success,
#message.success {
    border-left-color: var(--green);
    background: var(--green-light);
}

.message.error,
#message.error,
.error {
    border-left-color: var(--danger);
    background: var(--danger-light);
    color: var(--text);
}

.message.warning,
#message.warning {
    border-left-color: var(--warning);
    background: var(--warning-light);
}

.error {
    color: var(--danger);
    font-size: var(--fs-small);
    font-weight: 600;
}

/* =========================================================================
   10. EMPLOYEE PAGE EXTRAS
   ========================================================================= */

.employee-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.employee-card .employee-name {
    font-size: var(--fs-lead);
    font-weight: 700;
}

.time-grid,
.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.time-box,
.evidence-box,
.evidence-item {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.time-label,
.evidence-label,
.date-label {
    display: block;
    font-size: var(--fs-caption);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.time-value,
.evidence-value {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--fs-lead);
    font-weight: 700;
    color: var(--text);
}

.evidence-title {
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--text);
}

.camera-note,
.server-time {
    font-size: var(--fs-caption);
    color: var(--text-muted);
}

/* =========================================================================
   11. HISTORY / DASHBOARD EXTRAS
   ========================================================================= */

.daily-summary,
.rekap-waktu {
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

.event-row {
    font-size: var(--fs-small);
    color: var(--text);
}

.event-type {
    font-weight: 600;
    color: var(--text);
}

.event-time {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.event-evidence,
.dashboard-last-event {
    font-size: var(--fs-caption);
    color: var(--text-muted);
}

.dashboard-last-time {
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--blue);
}

.detail-date {
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--text);
}

.employee-count,
.schedule-count {
    font-size: var(--fs-caption);
    font-weight: 600;
    color: var(--text-secondary);
}

.login-container {
    max-width: 400px;
    margin-inline: auto;
    padding: var(--space-8) var(--space-4);
}

.login-container .logo {
    height: 64px;
    margin-inline: auto;
}

/* =========================================================================
   11b. LOOSE ENDS FROM THE PAGE STYLESHEETS
   ========================================================================= */

/* The login page's submit button carries no class of its own. */
button:not([class]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-body);
    font-weight: 600;
    color: #fff;
    background: var(--blue);
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

button:not([class]):hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

button:not([class]):active {
    background: var(--primary-active);
    transform: translateY(1px);
}

/* Login card: comfortable padding instead of a 16px horizontal gutter. */
.login-container {
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 44px;
    margin-top: var(--space-4);
    font-size: var(--fs-small);
    font-weight: 500;
    color: var(--text-secondary);
}

.back:hover {
    color: var(--blue);
    text-decoration: none;
}

/* Normal vs overtime boxes on the employee page. */
.time-box.normal {
    border-color: var(--border);
}

.time-box.ot {
    border-color: var(--purple);
    background: var(--purple-light);
}

.time-box.ot .time-value {
    color: var(--purple);
}

/* <summary> acts as a disclosure control, so it needs a touch target. */
summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-2) 0;
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
}

/* =========================================================================
   12. RESPONSIVE (mobile-first adjustments)
   ========================================================================= */

@media (min-width: 640px) {
    .page { padding: var(--space-6); }

    .form-grid,
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actions { gap: var(--space-3); }
}

@media (min-width: 1024px) {
    .page { padding: var(--space-8); }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Admin nav scrolls sideways on small screens — no JS, no hamburger. */
@media (max-width: 768px) {
    .navigation {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .navigation::-webkit-scrollbar { display: none; }

    .nav-button {
        flex: 0 0 auto;
    }

    .nav-button.logout {
        margin-left: var(--space-2);
    }

    /* The header stays a single row on phones: logo + company name on one
       line, which is why the name uses a clamp instead of wrapping. */
    .header {
        gap: var(--space-3);
        padding: var(--space-3);
    }
}

/* Very narrow phones (320-340px): one line with the logo is not reachable at a
   readable size, so shrink both rather than let the name truncate. */
@media (max-width: 340px) {
    .logo {
        height: 28px;
    }

    .company-name {
        font-size: 0.75rem;
    }
}

/* Touch devices: guarantee 44px targets even on compact controls. */
@media (pointer: coarse) {
    .action-button,
    .edit-button,
    .delete-button,
    .activate-button,
    .deactivate-button,
    .nav-button,
    .filter-button {
        min-height: 44px;
    }
}

/* =========================================================================
   13. MOTION SAFETY
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .primary-button:active,
    .export-button:active,
    .attendance-button:active,
    .check-button:active,
    .admin-button:active,
    .action-button:active,
    .filter-button:active,
    .edit-button:active,
    .delete-button:active {
        transform: none;
    }
}
