:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #191d37;
  background: #f5f7fb;
  --surface: #fff;
  --muted: #5b637d;
  --line: #e4e8f2;
  --primary: #5145ce;
  --primary-dark: #4235b4;
  --shadow: 0 4px 18px #20274c06;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #6254e6; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3.5vw, 2.6rem); letter-spacing: -.045em; line-height: 1.12; }
h2 { font-size: 1.16rem; letter-spacing: -.025em; line-height: 1.35; }
svg { display: block; width: 20px; height: 20px; }
.skip { position: fixed; top: 10px; left: 10px; z-index: 5; background: white; padding: 12px; transform: translateY(-200%); }
.skip:focus { transform: none; }
.startup { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); padding: 20px; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-layout { width: min(100%, 850px); display: grid; grid-template-columns: 1fr 1fr; border-radius: 23px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: 0 14px 45px #20274c15; }
.auth-intro { display: flex; flex-direction: column; justify-content: center; gap: 16px; min-height: 410px; padding: 36px; color: white; background: radial-gradient(ellipse at 100% 0%, #ad98ff80, transparent 60%), linear-gradient(135deg, #292271, #5141c4); }
.auth-intro .brand { margin: 0 0 15px; }
.auth-intro .brand-accent { color: #d8ceff; }
.auth-intro p { color: #f3efff; line-height: 1.55; max-width: 30ch; }
.auth-panel { align-self: center; padding: 34px; }
.auth-panel h2 { font-size: 1.65rem; }
.auth-panel .form > .button { width: 100%; }
.auth-panel .form #auth-hint { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.pin-caption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; }
.pin-caption small { color: var(--muted); font-size: .85rem; font-weight: 500; }
.pin-entry { position: relative; display: block; }
.pin-entry input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; font-size: 1rem; }
.pin-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(4px, 1.5vw, 8px); pointer-events: none; }
.pin-cell { display: grid; place-items: center; height: clamp(44px, 12vw, 52px); border: 1px solid #cfd5e6; border-radius: 10px; background: #f8f8fc; }
.pin-cell::after { content: ""; display: block; width: 9px; height: 9px; border-radius: 50%; background: #c7c9da; transform: scale(.35); }
.pin-cell-extra { border-style: dashed; }
.pin-cell.is-filled { border-color: #b4a9ee; border-style: solid; background: #f0ecff; }
.pin-cell.is-filled::after { background: var(--primary-dark); transform: none; }
.pin-entry:focus-within .pin-cell.is-current { border-color: var(--primary); border-style: solid; background: #f3f0ff; box-shadow: 0 0 0 2px #c4bafa; }
.pin-entry input[aria-invalid="true"] + .pin-cells .pin-cell { border-color: #ad4358; }
.auth-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; margin-top: 12px; }
.auth-actions button { padding: 0; border: 0; background: transparent; }
.recovery-description { color: var(--muted); margin-top: 5px; }
.recovery-value { border-radius: 9px; padding: 12px; background: #f2efff; font-family: ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }

.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 35px 17px 22px;
  background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; width: fit-content; margin: 0 10px 51px; font-weight: 800; font-size: 1.43rem; letter-spacing: -.06em; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #fff; background: linear-gradient(145deg,#7369f4,#5145ce 70%); box-shadow: 0 6px 12px #5549cc31; }
.brand-accent { color: var(--primary); }
.nav { display: grid; gap: 6px; }
.nav a { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 9px 13px; border-radius: 12px; color: var(--muted); font-weight: 650; }
.nav a:hover { background: #f5f4fb; color: var(--primary-dark); }
.nav a[aria-current="page"] { background: #eeebfd; color: #4937ba; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 18px 7px 2px; font-size: .88rem; }
.sidebar-bottom small { display: block; color: var(--muted); margin-top: 3px; }
.sidebar-time-icon { color: var(--primary); background: #f1effd; border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; }
.sidebar-time-icon svg { width: 17px; height: 17px; }
.main { width: 100%; max-width: 1500px; margin: 0 auto; padding: 37px clamp(22px, 3.6vw, 57px) 20px; }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 26px; }
.eyebrow { color: var(--muted); font-size: .91rem; font-weight: 650; margin-bottom: 7px; text-transform: capitalize; }
.account { background: white; border: 1px solid var(--line); color: #46645b; padding: 8px 11px; border-radius: 10px; display: flex; gap: 7px; align-items: center; font-size: .82rem; font-weight: 650; white-space: nowrap; }
.account svg { width: 17px; height: 17px; }
.account-group { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.account-group .account { min-width: 0; max-width: 165px; }
#account-label { overflow: hidden; text-overflow: ellipsis; }
#signout { min-height: 36px; }
.connection-error { background: #fff2e7; color: #803e16; padding: 12px 16px; border: 1px solid #f2d5bd; border-radius: 14px; margin-bottom: 16px; }
.connection-error a { text-decoration: underline; font-weight: 700; }
.connection-error button { margin-left: 5px; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); gap: 18px; }
.punch-card { border-radius: 23px; color: white; background: radial-gradient(ellipse at 103% -5%, #a38afca1, transparent 58%), linear-gradient(125deg, #2a2374, #4b3cbd 66%, #6050d2); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.punch-card::before, .punch-card::after { content: ""; position: absolute; width: 330px; aspect-ratio: 1; border: 1px solid #ffffff26; border-radius: 50%; inset: -148px -101px auto auto; pointer-events: none; z-index: -1; }
.punch-card::after { width: 390px; inset: -154px -131px auto auto; border-color: #ffffff1c; }
.punch-content { padding: 24px 25px 23px; }
.punch-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.punch-icon { display: grid; place-items: center; width: 42px; height: 42px; background: #ffffff21; border: 1px solid #ffffff28; border-radius: 13px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #ffffff44; border-radius: 99px; padding: 6px 9px; font-size: .875rem; font-weight: 650; background: #271c685f; text-align: center; }
.status-pill::before { content: ""; flex: 0 0 7px; height: 7px; background: #d9d3ff; border-radius: 50%; }
.status-pill[data-state="active"]::before { background: #6bf0c3; box-shadow: 0 0 0 3px #6bf0c33a; }
.status-pill[data-state="done"]::before { background: #73e7ab; }
.clock { font-variant-numeric: tabular-nums; font-weight: 760; letter-spacing: -.075em; font-size: clamp(3.3rem, 6.5vw, 5.5rem); line-height: 1.13; margin-top: 13px; white-space: nowrap; }
.clock span { color: #cfc6ff; }
.clock small { font-size: .27em; letter-spacing: -.04em; color: #dfd9ff; margin-left: 9px; }
.shift-description { color: #eeeaff; font-size: .94rem; margin: 5px 0 19px; min-height: 22px; }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; line-height: 1.15; }
.button svg { width: 17px; height: 17px; }
.button:hover:not(:disabled) { filter: brightness(.96); }
.punch-button { background: #fff; color: #392b99; min-height: 47px; box-shadow: 0 5px 14px #20176a38; }
.primary { background: var(--primary); color: #fff; }
.secondary { background: #fff; color: #343a57; border-color: var(--line); }
.small { font-size: .88rem; padding: 8px 12px; }
.punch-events { background: #1c15544d; border-top: 1px solid #ffffff24; display: grid; grid-template-columns: 1fr 1fr; }
.punch-events > div { display: flex; align-items: center; gap: 10px; padding: 13px 22px; min-width: 0; }
.punch-events > div + div { border-left: 1px solid #ffffff24; }
.event-icon { color: #ddd5ff; display: grid; place-items: center; width: 35px; height: 35px; background: #ffffff15; border-radius: 9px; flex: 0 0 auto; }
.event-icon svg { width: 16px; height: 16px; }
.punch-events div div span { font-size: .875rem; color: #e1dcff; display: block; }
.punch-events strong { display: block; font-size: 1rem; margin-top: 3px; font-variant-numeric: tabular-nums; }

.panel, .summary-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel { padding: 21px 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel-head p { color: var(--muted); font-size: .875rem; margin-top: 4px; line-height: 1.5; }
.tile { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; display: grid; place-items: center; }
.tile svg { width: 19px; height: 19px; }
.purple { background: #efecff; color: #5441c3; }
.teal { background: #e1f7f0; color: #09735a; }
.amber { background: #fff2d9; color: #915c09; }
.blue { background: #e8f0ff; color: #2755aa; }
.week-summary { display: flex; align-items: baseline; gap: 7px; margin: 15px 0 12px; flex-wrap: wrap; }
.week-summary strong { font-size: 1.64rem; font-weight: 780; letter-spacing: -.042em; }
.week-summary span { color: var(--muted); font-size: .875rem; }
.week-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(5px, 1vw, 15px); padding-inline: 2px; }
.day-chart { text-align: center; color: var(--muted); min-width: 0; font-size: .82rem; font-weight: 650; }
.day-chart.current { color: #4834bc; }
.track { position: relative; background: #f0f1f7; border-radius: 7px; height: 89px; max-width: 37px; margin: 0 auto 6px; display: flex; align-items: stretch; justify-content: flex-start; flex-direction: column-reverse; overflow: hidden; }
.day-chart.current .track { background: #eeeaff; outline: 1px solid #c9bdf8; }
.bar-regular { background: #6956df; }
.bar-overtime { background: #22a68a; }
.bar-rest { background: #efb546; }
.chart-key { display: flex; gap: 7px 13px; flex-wrap: wrap; margin-top: 15px; color: var(--muted); font-size: .8rem; }
.chart-key span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.chart-key i { display: block; background: #6956df; border-radius: 3px; width: 9px; height: 9px; }
.chart-key span:nth-child(2) i { background: #22a68a; }
.chart-key span:nth-child(3) i { background: #efb546; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 17px 0; }
.summary-card { padding: 15px 12px; display: flex; gap: 9px; align-items: center; }
.summary-card p { color: var(--muted); font-size: .875rem; }
.summary-card strong { display: block; font-size: 1.16rem; line-height: 1.25; margin-top: 3px; letter-spacing: -.026em; font-variant-numeric: tabular-nums; }
.text-link { color: var(--primary-dark); font-size: .9rem; font-weight: 700; min-height: 32px; display: inline-flex; align-items: center; }
.text-link:hover { text-decoration: underline; }
.empty { text-align: center; display: grid; justify-items: center; gap: 7px; color: var(--muted); padding: 22px 8px 10px; }
.empty strong { color: #323852; }
.empty p { font-size: .9rem; line-height: 1.5; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar { display: flex; align-items: center; gap: 10px; margin: 17px 0 5px; color: var(--muted); font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; color: #242942; background: #fff; border: 1px solid #d9ddeb; border-radius: 9px; padding: 8px 10px; min-height: 43px; }
select { appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%235b637d' stroke-width='1.6'/%3E%3C/svg%3E") right 8px center / 16px no-repeat; }
.filter-bar input { max-width: 200px; }
.record-table { width: 100%; border-collapse: collapse; text-align: left; margin-top: 9px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.record-table th { color: var(--muted); font-weight: 650; white-space: nowrap; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.record-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.record-table td:first-child, .record-table th:first-child { padding-left: 0; }
.record-table td:last-child, .record-table th:last-child { padding-right: 0; text-align: right; }
.record-table tr:last-child td { border-bottom: none; }
.record-table strong { display: block; }
.record-table small { display: block; color: var(--muted); font-size: .79rem; margin-top: 3px; }
.edit-record { color: var(--primary-dark); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; align-items: start; }
.form { display: grid; gap: 15px; margin-top: 16px; }
.form label, legend { color: #3f4663; font-size: .9rem; font-weight: 650; }
.form label { display: grid; gap: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form fieldset { margin: 0; padding: 0; min-width: 0; border: 0; }
.day-choices { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.day-choices label { position: relative; }
.day-choices input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.day-choices span { display: grid; place-items: center; min-width: 40px; min-height: 42px; padding: 0 4px; border: 1px solid var(--line); border-radius: 8px; }
.day-choices input:checked + span { background: #ede9fd; color: var(--primary-dark); border-color: #cec5fa; }
.day-choices input:focus-visible + span { outline: 3px solid #6254e6; outline-offset: 2px; }
.form .switch-field { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.switch-field small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
.switch-field input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--primary); flex: 0 0 20px; }
.form > .button { justify-self: start; }
.overrides { margin: 16px 0 0; padding: 0; list-style: none; }
.overrides li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.overrides small { display: block; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.rules { grid-column: 1 / -1; }
.rules dl { display: flex; gap: 12px; flex-wrap: wrap; margin: 13px 0; }
.rules dl div { display: flex; align-items: center; flex: 1 1 185px; gap: 9px; background: #f5f4fb; padding: 10px; border-radius: 9px; }
.rules dt { font-weight: 800; color: var(--primary-dark); white-space: nowrap; }
.rules dd { margin: 0; }
.rules p { color: var(--muted); font-size: .9rem; }
dialog { border: 1px solid var(--line); border-radius: 19px; width: min(460px, calc(100% - 28px)); padding: 20px; max-height: calc(100dvh - 28px); overflow: auto; color: inherit; }
dialog::backdrop { background: #1c234977; }
dialog .form { margin: 0; }
.icon-button { background: #f1effa; border: 0; color: var(--primary-dark); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; flex: none; }
.field-error { color: #a3293a; font-size: .9rem; }
.toast { position: fixed; z-index: 4; bottom: 22px; right: 22px; padding: 12px 16px; max-width: calc(100% - 44px); border-radius: 12px; color: white; background: #273056; box-shadow: 0 8px 20px #20274c30; }
.toast[data-kind="error"] { background: #88293e; }
.footer { margin-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; padding-top: 13px; color: var(--muted); font-size: .82rem; }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 176px minmax(0, 1fr); }
  .main { padding-inline: 24px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; display: block; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 18px; }
  .brand { margin: 0; }
  .brand-icon { width: 34px; height: 34px; border-radius: 10px; }
  .sidebar-bottom { display: none; }
  .nav { position: fixed; inset: auto 0 0; padding: 5px max(12px, env(safe-area-inset-left)) max(5px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right)); z-index: 3; display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid var(--line); }
  .nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 5px 2px; font-size: .875rem; }
  .nav svg { width: 19px; height: 19px; }
  .main { padding: 22px 18px calc(76px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(66px + env(safe-area-inset-bottom)); }
}
@media (max-width: 620px) {
  .auth-screen { padding: 13px; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { gap: 8px; min-height: 0; padding: 20px; }
  .auth-intro .brand { margin-bottom: 5px; }
  .auth-intro h1 br { display: none; }
  .auth-intro p { max-width: none; }
  .auth-panel { padding: 21px; }
  .main { padding-inline: 13px; }
  .page-head { margin-bottom: 15px; }
  .account-group { flex-direction: column; align-items: flex-end; }
  .account-group .account { max-width: 117px; }
  .account { font-size: .77rem; padding: 7px; }
  .dashboard, .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 15px; border-radius: 17px; }
  .punch-card { border-radius: 18px; }
  .punch-content { padding: 17px; }
  .punch-button { width: 100%; }
  .punch-events > div { padding: 10px 13px; }
  .summary-grid { gap: 8px; margin: 12px 0; }
  .summary-card { padding: 10px 8px; border-radius: 14px; gap: 6px; }
  .summary-card .tile { width: 31px; height: 31px; flex-basis: 31px; }
  .summary-card .tile svg { width: 16px; height: 16px; }
  .summary-card strong { font-size: 1.05rem; }
  .history-head { flex-wrap: wrap; }
  .record-table, .record-table tbody, .record-table tr, .record-table td { display: block; }
  .record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .record-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 9px 0; border-top: 1px solid var(--line); }
  .record-table td, .record-table td:first-child, .record-table td:last-child { padding: 0; text-align: left; border: 0; }
  .record-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .8rem; margin-bottom: 2px; }
  .record-table td:first-child { grid-column: 1 / -1; }
}
