:root {
  color-scheme: light;
  --ink: #102139;
  --muted: #52637a;
  --line: #dce5ee;
  --panel: #fff;
  --page: #f4f7fb;
  --accent: #1559a6;
  --accent-dark: #0c3b73;
  --accent-soft: #e9f2fc;
  --red: #c7353f;
  --red-dark: #96242d;
  --red-soft: #fff0f1;
  --late: #9b2430;
  --late-bg: #ffecef;
  --error: #941f28;
  --error-bg: #fff0f1;
  font: 16px/1.5 system-ui, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--page); }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled { opacity: 0.58; cursor: not-allowed; }
:focus-visible { outline: 3px solid #25898f; outline-offset: 3px; }

.container { width: min(1160px, calc(100% - 3rem)); margin-inline: auto; }
.site-header { background: var(--panel); border-top: 4px solid var(--red); border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgb(16 33 57 / 5%); }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.4rem; }
.header-actions { display: flex; align-items: center; gap: 0.45rem; }
.organization { color: var(--red-dark); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.055em; text-transform: uppercase; }
h1 { font-size: clamp(1.35rem, 2.5vw, 1.8rem); letter-spacing: -0.035em; }
.timezone { border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 0.76rem; font-weight: 700; padding: 0.3rem 0.6rem; }
.main-content { padding-block: 1.4rem 3.5rem; }

.view-nav { display: flex; flex-wrap: wrap; gap: 0.3rem; width: fit-content; margin-bottom: 1.65rem; padding: 0.28rem; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.view-button { min-height: 2.55rem; padding: 0.4rem 0.85rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 0.88rem; font-weight: 700; white-space: nowrap; }
.view-button:hover { background: var(--page); color: var(--ink); }
.view-button[aria-pressed="true"] { color: var(--accent-dark); background: var(--accent-soft); }
.view-heading, .surface-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.9rem 1.4rem; flex-wrap: wrap; }
.view-heading { margin-bottom: 1.1rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.95rem); letter-spacing: -0.035em; }
h3 { font-size: 1rem; font-weight: 750; }
.muted { color: var(--muted); font-size: 0.88rem; }
.surface-heading .muted { margin-top: 0.3rem; }
.report-actions, .settings-form { display: flex; align-items: flex-end; gap: 0.55rem; flex-wrap: wrap; }
.field { display: grid; gap: 0.24rem; min-width: 0; }
.field label { font-size: 0.77rem; font-weight: 700; color: var(--muted); }
input, .button { min-height: 2.65rem; border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.7rem; font-size: 0.87rem; }
input { min-width: 0; width: 100%; color: var(--ink); background: #fff; }
input::placeholder { color: var(--muted); opacity: 1; }
.search-field { width: min(100%, 250px); }
.button { display: inline-flex; align-items: center; justify-content: center; color: inherit; font-weight: 700; text-decoration: none; white-space: nowrap; }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--accent-dark); }
.secondary { background: var(--panel); color: var(--accent-dark); }
.secondary:hover:not(:disabled) { background: var(--accent-soft); }
.logout { min-height: 2rem; padding-block: 0.25rem; }

.login-screen { min-height: 100svh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(100%, 27rem); padding: clamp(1.25rem, 4vw, 2rem); border: 1px solid #cfdae8; border-top: 5px solid var(--red); border-radius: 14px; background: var(--panel); box-shadow: 0 18px 55px rgb(21 89 166 / 12%); }
.login-card > p { color: var(--red-dark); font-size: 0.85rem; font-weight: 800; }
.login-card h1 { margin-block: 0.25rem 1.35rem; }
.login-card form, .login-card label { display: grid; gap: 0.45rem; }
.login-card form { gap: 0.95rem; }
.login-card label { color: var(--muted); font-size: 0.87rem; font-weight: 700; }
.login-card [role="alert"] { background: var(--error-bg); color: var(--error); padding: 0.65rem; border-radius: 8px; }

.statistics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.stat { padding: 0.85rem 1rem; border: 1px solid #d7e3f1; border-top: 3px solid var(--accent); border-radius: 12px; background: var(--panel); }
.stat-value { display: block; font-size: 1.65rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.82rem; }
.surface { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.surface-heading { align-items: center; padding: 0.95rem 1rem; }
.settings { margin-top: 1rem; }
.settings .surface-heading { align-items: flex-end; }
.profile-intro { padding: 0.95rem 1rem; }

.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: -3px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 0.875rem; }
.report-table { min-width: 760px; }
th, td { padding: 0.66rem 0.85rem; vertical-align: middle; border-top: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 1rem; }
th:last-child, td:last-child { padding-right: 1rem; }
thead th { color: var(--accent-dark); background: #eef5fd; font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.sortable-header { cursor: pointer; user-select: none; }
.sortable-header:hover, .sortable-header:focus-visible { background: #dceafa; color: var(--accent); }
tbody tr:hover { background: #f9fbfd; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.name { color: var(--ink); font-weight: 700; }
.machine-id { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.77rem; font-variant-numeric: tabular-nums; }
.missing { color: var(--muted); font-weight: 500; }
.late-pill { display: inline-block; border-radius: 6px; padding: 0.1rem 0.35rem; background: var(--late-bg); color: var(--late); font-size: 0.78rem; font-weight: 750; }

.status-message { margin: 0.3rem 1rem 1rem; padding: 0.7rem 0.8rem; border-radius: 8px; background: var(--page); color: var(--muted); font-size: 0.87rem; }
.status-message[data-kind="error"] { background: var(--error-bg); color: var(--error); }
.status-message[data-kind="success"] { background: var(--accent-soft); color: var(--accent-dark); }
.compact { padding-block: 0.45rem; }
.profile-table th:first-child { width: 24%; }
.profile-form { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; }
.profile-form input { flex: 1 1 165px; max-width: 450px; }
.profile-save-status { color: var(--accent-dark); font-size: 0.78rem; }
.profile-save-status[data-kind="error"] { color: var(--error); }
.schedule-list { margin-top: 1rem; }
.surface + .surface { margin-top: 1rem; }
.official-table { min-width: 980px; }
select { min-height: 2.5rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0.45rem 2rem 0.45rem 0.65rem; color: var(--ink); }
.schedule-table { min-width: 920px; }
.schedule-table input[type="text"] { min-width: 13rem; }
.note-field input { min-width: 15rem; }
.schedule-table input[type="time"] { min-height: 2.2rem; width: 7.2rem; padding-block: 0.25rem; }
.row-actions { display: flex; gap: 0.35rem; }
.row-actions .button { min-height: 2.2rem; padding-block: 0.25rem; }
.rule-custom { color: var(--red-dark); font-weight: 800; }

@media (max-width: 600px) {
  .container { width: calc(100% - 1.75rem); }
  .header-content { padding-block: 1rem; }
  .main-content { padding-top: 1rem; }
  .view-nav { margin-bottom: 1.2rem; }
  .view-button { padding-inline: 0.6rem; }
  .view-heading { align-items: flex-start; }
  .report-actions > .field { flex: 1 1 8.5rem; }
  .report-actions { width: 100%; }
  .statistics { gap: 0.45rem; }
  .stat { padding: 0.65rem 0.5rem; }
  .stat-value { font-size: 1.35rem; }
  .stat-label { font-size: 0.72rem; line-height: 1.35; }
  .profile-form input { flex-basis: 125px; }
  .search-field { width: 100%; }
}

/* Modern, glass-inspired palette based on the supplied dashboard reference. */
:root {
  --ink: #101946;
  --muted: #59658d;
  --line: rgb(123 142 219 / 22%);
  --panel: rgb(255 255 255 / 78%);
  --page: #f3f4ff;
  --accent: #6758ed;
  --accent-dark: #4438b9;
  --accent-soft: #ebeaff;
  --red: #d54259;
  --red-dark: #a82942;
  --red-soft: #fff0f3;
}
body { background: radial-gradient(ellipse at 92% 0%, #d8d8ff 0, transparent 34%), radial-gradient(ellipse at 0 24%, #d9f9ff 0, transparent 32%), linear-gradient(145deg, #f7f7ff, #edf2ff 55%, #f8f1ff); }
.site-header { border-top: 0; border-bottom: 1px solid rgb(255 255 255 / 20%); color: #fff; background: linear-gradient(112deg, #10183d, #202c70 66%, #394da7); box-shadow: 0 12px 32px rgb(31 39 109 / 18%); }
.organization { color: #71f0ed; }
.timezone { color: #dfe8ff; border-color: rgb(255 255 255 / 28%); background: rgb(255 255 255 / 9%); }
.site-header .secondary { color: #fff; border-color: rgb(255 255 255 / 25%); background: rgb(255 255 255 / 10%); }
.view-nav { width: 100%; padding: 0.45rem; border-color: rgb(255 255 255 / 58%); background: rgb(255 255 255 / 62%); box-shadow: 0 10px 30px rgb(60 70 150 / 8%); backdrop-filter: blur(18px); }
.view-button { border-radius: 9px; }
.view-button[aria-pressed="true"] { color: #fff; background: linear-gradient(120deg, #5149d7, #7664f2); box-shadow: 0 7px 18px rgb(103 88 237 / 24%); }
.surface, .stat { border-color: rgb(255 255 255 / 82%); background: rgb(255 255 255 / 74%); box-shadow: 0 12px 35px rgb(54 63 137 / 8%); backdrop-filter: blur(16px); }
.stat { border-top: 3px solid #6b58ee; }
.stat:nth-child(2) { border-top-color: #23bed3; }
.stat:nth-child(3) { border-top-color: #d34ee6; }
thead th { color: #fff; background: linear-gradient(105deg, #354a9e, #6354da); }
.sortable-header:hover, .sortable-header:focus-visible { background: #796af0; color: #fff; }
tbody tr:hover { background: #f0f0ff; }
.primary { border-color: #5b50d7; background: linear-gradient(115deg, #5149d7, #7160ed); }
.primary:hover:not(:disabled) { border-color: #4339bc; background: linear-gradient(115deg, #4339bc, #6250d7); }
.secondary { border-color: #cfd3f3; color: #433caa; background: rgb(255 255 255 / 82%); }
.login-card { border-top-color: #d54259; background: rgb(255 255 255 / 86%); backdrop-filter: blur(18px); }
.login-card > p { color: #ba344c; }
.report-table { min-width: 980px; }
.profile-table { min-width: 1460px; }
.profile-history { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.early-history { color: #087f86; font-weight: 700; }
.late-history { color: #a82942; font-weight: 700; }
.balance-history { color: #4438b9; font-weight: 800; }
.early-arrival { color: #087f49; font-weight: 800; }
.balance-history.positive { color: #087f49; }
.balance-history.negative { color: #b42336; }
.profile-table { min-width: 1010px; table-layout: auto; }
.profile-table th:first-child { width: auto; min-width: 75px; }
.profile-table th:nth-child(2) { min-width: 180px; max-width: 245px; }
.profile-table th:nth-child(3) { min-width: 320px; max-width: 420px; }
.profile-table th:nth-child(n + 4) { min-width: 100px; max-width: 135px; }
.profile-table thead th { white-space: normal; overflow-wrap: normal; word-break: normal; line-height: 1.25; }
