:root {
  color-scheme: dark;
  --canvas: #091316;
  --surface: #111e22;
  --surface-raised: #18282d;
  --input: #0d181b;
  --line: #294147;
  --text: #eef6f4;
  --muted: #a5b6b9;
  --accent: #62d7b1;
  --accent-ink: #08261e;
  --warning: #f3c56c;
  --danger: #ed8d8d;
  --shadow: 0 14px 36px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --canvas: #f5f7f6;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --input: #f7faf8;
  --line: #cbd8d4;
  --text: #162326;
  --muted: #5d6e70;
  --accent: #167b60;
  --accent-ink: #ffffff;
  --warning: #9a6500;
  --danger: #b64040;
  --shadow: 0 10px 28px rgba(23, 43, 40, .10);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-width: 320px; color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100dvh; max-width: 760px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom)); }
.auth-shell { display: grid; align-content: center; min-height: 100dvh; padding-bottom: max(52px, env(safe-area-inset-bottom)); }
.auth-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); font-weight: 800; letter-spacing: .04em; }
.brand h1 { margin: 0; font-size: 1.05rem; letter-spacing: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }

.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.auth-panel { padding: 24px; }
.auth-panel h2, .section-title, .dashboard-heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: 0; }
.auth-panel .intro { color: var(--muted); line-height: 1.45; margin: 8px 0 24px; }
.field { display: grid; gap: 7px; margin: 14px 0; }
.field label, .compact-field label { color: var(--muted); font-size: .74rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 6px; background: var(--input); color: var(--text); padding: 0 13px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 215, 177, .12); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; width: 100%; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.button:hover { filter: brightness(1.04); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.button.warning { color: #2a2007; background: var(--warning); }
.text-button, .logout { border: 0; background: transparent; color: var(--muted); }
.text-button { padding: 8px 0; text-decoration: underline; }
.install-app-button { margin-top: 12px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 30px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.logout { padding: 9px 0 9px 8px; font-size: .84rem; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text); font-size: 1.2rem; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.date-label { color: var(--muted); text-align: center; font-size: .88rem; text-transform: capitalize; }
.clock { margin: 8px 0 24px; text-align: center; font-size: clamp(2.6rem, 12vw, 4.3rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.status-card { padding: 22px; margin-bottom: 16px; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--accent); font-weight: 800; }
.status-dot { width: 9px; height: 9px; border-radius: 100%; background: currentColor; }
.status-card p { margin: 12px 0 0; color: var(--muted); line-height: 1.45; }
.action-grid { display: grid; gap: 10px; margin: 16px 0 24px; }
.action-button { min-height: 72px; font-size: 1.03rem; }
.action-button small { display: block; margin-top: 3px; color: inherit; font-size: .74rem; opacity: .76; font-weight: 600; }

.notice { margin: 14px 0; padding: 12px 13px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: rgba(98, 215, 177, .07); color: var(--muted); font-size: .85rem; line-height: 1.45; }
.notice.warning { border-left-color: var(--warning); background: rgba(243, 197, 108, .07); }
.notice.error { border-left-color: var(--danger); background: rgba(237, 141, 141, .07); }
.section { margin-top: 28px; }
.section-header { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 12px; }
.section-subtitle, .dashboard-heading > div > p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .7rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }

.event-list { overflow: hidden; }
.event { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; }
.event strong { display: block; font-size: .96rem; }
.event small { display: block; margin-top: 4px; color: var(--muted); font-size: .77rem; }
.event time { font-size: 1.08rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; margin: 5px 4px 0 0; align-items: center; min-height: 21px; padding: 0 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .68rem; }
.pill.confirmed { border-color: rgba(98, 215, 177, .5); color: var(--accent); }
.pill.attention { border-color: rgba(243, 197, 108, .5); color: var(--warning); }
.empty { padding: 22px; color: var(--muted); text-align: center; }

.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.dashboard-heading.compact { margin-bottom: 0; }
.month-control { display: flex; align-items: center; gap: 6px; }
.month-label { min-height: 38px; border: 0; background: transparent; color: var(--text); font-weight: 750; text-transform: capitalize; white-space: nowrap; }
.day-filter { display: flex; align-items: center; gap: 8px; margin: -8px 0 18px; color: var(--muted); font-size: .78rem; font-weight: 750; }
.day-picker, .clear-day { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); padding: 0 10px; }
.day-picker { font-weight: 750; text-transform: capitalize; }
.clear-day { color: var(--muted); border: 0; background: transparent; text-decoration: underline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 16px; min-height: 112px; }
.metric small { display: block; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 10px; font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.compact-button { width: auto; min-height: 38px; padding: 0 12px; font-size: .8rem; white-space: nowrap; }
.selected-day { padding-top: 2px; }
.next-holiday { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 16px; border: 1px solid rgba(243, 197, 108, .55); border-left: 3px solid var(--warning); border-radius: 6px; background: rgba(243, 197, 108, .08); }
.next-holiday .eyebrow { color: var(--warning); }
.next-holiday strong { display: block; font-size: 1rem; }
.next-holiday p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.4; text-transform: capitalize; }
.holiday-scope { flex: 0 0 auto; color: var(--warning); font-size: .7rem; font-weight: 800; text-align: right; }
.recent-days, .day-card-list { display: grid; gap: 10px; }
.day-card { padding: 15px; }
.day-card-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 15px; }
.day-card-heading p { margin: 0 0 4px; color: var(--muted); font-size: .76rem; }
.day-card-heading .holiday-caption { color: var(--warning); }
.holiday-record { border-color: rgba(243, 197, 108, .38); }
.day-card-heading h3 { margin: 0; font-size: .98rem; text-transform: capitalize; }
.status-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .69rem; font-weight: 800; white-space: nowrap; }
.status-badge.completed { border-color: rgba(98, 215, 177, .5); color: var(--accent); }
.status-badge.working, .status-badge.working_after_break { border-color: rgba(113, 171, 255, .55); color: #8eb8ff; }
.status-badge.on_break { border-color: rgba(243, 197, 108, .55); color: var(--warning); }
.day-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; }
.day-details small { display: block; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.day-details strong { display: block; margin-top: 4px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.day-evidence { margin: 14px 0 0; color: var(--muted); font-size: .74rem; }
.proof-link { margin-top: 14px; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: .78rem; font-weight: 750; text-decoration: underline; }
.revert-button { margin-top: 10px; color: var(--danger); }
.calendar-section { scroll-margin-top: 14px; }
.holiday-list { display: grid; gap: 7px; margin-bottom: 12px; }
.holiday-chip { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid rgba(243, 197, 108, .45); border-radius: 6px; background: rgba(243, 197, 108, .07); color: var(--text); text-align: left; }
.holiday-chip strong { color: var(--warning); font-size: .75rem; text-transform: capitalize; }
.holiday-chip span { overflow: hidden; color: var(--muted); font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.calendar-empty { margin: 0 0 12px; color: var(--muted); font-size: .82rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-weekday { min-width: 0; padding: 4px 0; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .04em; text-align: center; text-transform: uppercase; }
.calendar-blank { min-height: 58px; }
.calendar-day { display: grid; align-content: start; min-width: 0; min-height: 58px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); text-align: left; }
.calendar-day strong { font-size: .84rem; font-variant-numeric: tabular-nums; }
.calendar-day span { display: -webkit-box; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .58rem; line-height: 1.15; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.calendar-day.is-rest { opacity: .5; }
.calendar-day.is-holiday { border-color: rgba(243, 197, 108, .68); background: rgba(243, 197, 108, .15); }
.calendar-day.is-holiday strong, .calendar-day.is-holiday span { color: var(--warning); }
.calendar-day.has-record:not(.is-holiday) { border-color: rgba(98, 215, 177, .6); background: rgba(98, 215, 177, .09); }
.calendar-day.has-record:not(.is-holiday) span { color: var(--accent); }
.calendar-day.is-today { outline: 1px solid var(--accent); outline-offset: 1px; }

.settings-layout { display: grid; gap: 16px; }
.report-metrics { margin-top: 16px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.report-actions .compact-button { flex: 1 1 170px; }
.report-history { overflow: hidden; }
.closing-list { display: grid; }
.closing-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.closing-row:last-child { border-bottom: 0; }
.closing-row strong, .closing-row small { display: block; }
.closing-row small { margin-top: 4px; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.admin-panel { padding: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.admin-panel h2 { margin: 0; font-size: 1.08rem; }
.admin-panel p { margin: 6px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.person-list { margin-top: 18px; border-top: 1px solid var(--line); }
.person-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.person-row > div:nth-child(2) { min-width: 0; flex: 1; }
.person-row strong, .person-row small { display: block; }
.person-row small { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.person-initial { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(98, 215, 177, .12); color: var(--accent); font-size: .82rem; font-weight: 800; }
.settings-disclosure { margin-top: 14px; }
.settings-disclosure summary { color: var(--accent); cursor: pointer; font-size: .88rem; font-weight: 750; }
.inline-form { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
.compact-field { display: grid; gap: 6px; }
.compact-field input { min-height: 42px; }
.compact-field > small { color: var(--muted); font-size: .72rem; }
.full-width { grid-column: 1 / -1; }
.action-field { align-self: end; }

.camera-dialog { width: min(100% - 28px, 540px); padding: 0; border: 0; background: transparent; color: var(--text); }
.camera-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.camera-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); box-shadow: var(--shadow); }
.camera-card h2 { margin: 0; font-size: 1.1rem; }
.camera-card p { margin: 6px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.camera-card video { width: 100%; min-height: 210px; border-radius: 6px; background: #05090a; object-fit: cover; }
.camera-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adjustment-dialog { width: min(100% - 28px, 540px); padding: 0; border: 0; background: transparent; color: var(--text); }
.adjustment-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.adjustment-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); box-shadow: var(--shadow); }
.install-dialog { width: min(100% - 28px, 440px); padding: 0; border: 0; background: transparent; color: var(--text); }
.install-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.install-card { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); box-shadow: var(--shadow); }
.install-card h2 { margin: 0; font-size: 1.12rem; }
.install-card p { margin: 6px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.install-card ol { display: grid; gap: 9px; margin: 0; padding-left: 21px; color: var(--text); font-size: .86rem; line-height: 1.4; }
.adjustment-card h2 { margin: 0; font-size: 1.08rem; text-transform: capitalize; }
.adjustment-card p { margin: 6px 0 0; color: var(--muted); font-size: .83rem; line-height: 1.4; }
.adjustment-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--input); color: var(--text); padding: 10px 13px; outline: none; }
textarea { min-height: 78px; resize: vertical; }
select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(98, 215, 177, .12); }
.setup-note { margin-top: 18px; color: var(--muted); font-size: .76rem; line-height: 1.4; }

@media (min-width: 620px) {
  .shell { padding-left: 26px; padding-right: 26px; }
  .metric-grid { grid-template-columns: repeat(5, 1fr); }
  .recent-days, .day-card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form.two-columns { grid-template-columns: 1fr 1fr; }
  .holiday-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-day, .calendar-blank { min-height: 76px; }
}
