:root {
  color-scheme: light;
  --page: #e7eee9;
  --surface: #f7f9f7;
  --card: #ffffff;
  --text: #17181a;
  --muted: #6d7075;
  --line: #d5d7da;
  --strong: #163d2c;
  --on-strong: #ffffff;
  --soft: #e9efeb;
  --danger: #a23333;
  --success: #2d7350;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--page); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 10px; padding: 10px 14px; border-radius: 9px; background: var(--strong); color: var(--on-strong); font-weight: 700; text-decoration: none; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--success); outline-offset: 3px; }

.site-header {
  width: min(1180px, calc(100% - 48px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-brand { display: inline-flex; align-items: center; text-decoration: none; }
.site-brand img { display: block; width: 142px; height: auto; }
.site-header nav { display: flex; align-items: center; gap: 24px; }
.site-header nav a { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.site-header nav a:hover, .site-header nav a:focus-visible { color: var(--text); }

.site-layout {
  width: min(1180px, calc(100% - 48px));
  margin: 18px auto 36px;
  display: grid;
  grid-template-columns: minmax(260px, .72fr) minmax(580px, 1.28fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.intro-panel { position: sticky; top: 32px; padding: clamp(34px, 5vw, 64px) 0 28px; }
.intro-kicker { margin: 0 0 15px; color: var(--success); font-size: 13px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.intro-panel h1, .legal-content h1 { margin: 0; font-size: clamp(42px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; font-weight: 650; }
.intro-copy { max-width: 440px; margin: 24px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.intro-button { display: inline-flex; min-height: 48px; margin-top: 26px; padding: 0 20px; align-items: center; justify-content: center; border-radius: 12px; background: var(--strong); color: var(--on-strong); font-size: 14px; font-weight: 700; text-decoration: none; }
.trust-list { display: grid; gap: 10px; margin: 28px 0 0; padding: 0; list-style: none; color: var(--text); font-size: 14px; }
.trust-list span { display: inline-grid; width: 22px; height: 22px; margin-right: 7px; place-items: center; border-radius: 50%; background: var(--soft); color: var(--success); font-weight: 800; }
.privacy-note { max-width: 390px; margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.app-shell {
  width: 100%;
  min-height: min(760px, calc(100vh - 120px));
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(20, 45, 33, .08);
}

.app-header { padding: 26px 28px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.app-title { margin: 3px 0 0; font-size: 25px; line-height: 1.2; font-weight: 600; }
h2 { margin: 0 0 18px; font-size: 18px; font-weight: 600; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.app-content { width: 100%; padding: 0 28px 30px; flex: 1; }
.screen[hidden] { display: none; }

.missing-banner { margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.missing-banner strong { font-size: 14px; }
.missing-banner p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.text-button { border: 0; background: transparent; color: var(--text); font-weight: 600; padding: 8px; }

.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 18px; }
.day-button { border: 0; background: transparent; color: var(--muted); min-height: 50px; border-radius: 10px; padding: 6px 2px; }
.day-button span, .day-button strong { display: block; }
.day-button span { font-size: 12px; }
.day-button strong { margin-top: 3px; font-size: 15px; font-weight: 600; }
.day-button.selected { background: var(--strong); color: var(--on-strong); }
.day-button.complete:not(.selected) strong::after { content: " ✓"; color: var(--success); }

.shift-card { padding: 18px; border: 1px solid var(--line); background: var(--card); border-radius: 16px; }
.shift-card-header { display: flex; justify-content: space-between; align-items: center; }
.status-label { color: var(--muted); font-size: 13px; }
.status-dot { width: 9px; height: 9px; background: var(--line); border-radius: 50%; }
.status-dot.running { background: var(--success); }
.status-dot.done { background: var(--strong); }
.shift-time { margin: 16px 0 4px; font-size: 34px; line-height: 1.2; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.shift-summary { margin: 0; color: var(--muted); font-size: 14px; }
.primary-button, .secondary-button, .danger-button { width: 100%; min-height: 50px; border-radius: 12px; font-weight: 600; padding: 12px 16px; }
.primary-button { margin-top: 18px; border: 0; background: var(--strong); color: var(--on-strong); }
.secondary-button { margin-top: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.danger-button { margin-top: 10px; border: 1px solid #e0baba; background: transparent; color: var(--danger); }
.quiet-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.quiet-actions button { min-height: 40px; border: 0; border-radius: 9px; background: var(--soft); color: var(--muted); font-size: 13px; }
.reminder-note { margin: 16px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.week-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.week-navigation { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; margin-bottom: 14px; }
.week-navigation > div { text-align: center; }
.week-navigation span, .week-navigation strong { display: block; }
.week-navigation span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.week-navigation strong { margin-top: 2px; font-size: 14px; }
.week-navigation .icon-button { font-size: 26px; line-height: 1; }
.week-summary div { padding: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.week-summary span, .week-summary strong { display: block; }
.week-summary span { color: var(--muted); font-size: 12px; }
.week-summary strong { margin-top: 5px; font-size: 20px; }
.export-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.export-panel > div:first-child strong, .export-panel > div:first-child span { display: block; }
.export-panel > div:first-child strong { font-size: 14px; }
.export-panel > div:first-child span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.export-actions { display: grid; grid-template-columns: repeat(2, minmax(72px, 1fr)); gap: 7px; }
.export-actions button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--text); font-size: 12px; font-weight: 700; }
.export-actions button:hover { border-color: var(--strong); }
.export-actions button:disabled { cursor: wait; opacity: .6; }
.export-panel p { grid-column: 1 / -1; min-height: 0; margin: 0; color: var(--success); font-size: 12px; }
.export-panel p:empty { display: none; }
.week-list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; }
.week-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.week-row:last-child { border-bottom: 0; }
.week-row-day { font-size: 14px; font-weight: 600; }
.week-row-detail { margin-top: 3px; color: var(--muted); font-size: 12px; }
.week-row-right { text-align: right; }
.week-row-value { font-variant-numeric: tabular-nums; font-size: 14px; }
.edit-entry { margin-top: 4px; border: 0; padding: 3px 0 3px 8px; background: transparent; color: var(--muted); font-size: 12px; }

.field { display: block; margin-bottom: 14px; }
.field[hidden], #bulk-fields[hidden] { display: none; }
.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field small { font-size: inherit; }
.field input, .field select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font-size: 16px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calculated-total { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 2px; }
.calculated-total strong { font-size: 20px; }
.form-error { min-height: 20px; margin: 8px 0 0; color: var(--danger); font-size: 13px; }
.entry-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 22px; padding: 4px; border-radius: 12px; background: var(--soft); }
.entry-mode button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.entry-mode button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bulk-days-fieldset { margin: 0 0 14px; padding: 0; border: 0; }
.bulk-days-fieldset legend { margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.bulk-day-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.bulk-day-picker label { position: relative; }
.bulk-day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.bulk-day-picker span { display: grid; place-items: center; min-height: 54px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); cursor: pointer; }
.bulk-day-picker b, .bulk-day-picker small { display: block; }
.bulk-day-picker b { font-size: 11px; text-transform: uppercase; }
.bulk-day-picker small { margin-top: 2px; font-size: 13px; }
.bulk-day-picker input:checked + span { border-color: var(--strong); background: var(--strong); color: var(--on-strong); }
.bulk-day-picker input:focus-visible + span { outline: 2px solid var(--success); outline-offset: 2px; }
.bulk-day-picker label.has-entry span::after { content: ""; position: absolute; top: 6px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.overwrite-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.overwrite-row input { flex: 0 0 auto; width: 19px; height: 19px; margin: 1px 0 0; }
.overwrite-row strong, .overwrite-row small { display: block; }
.overwrite-row strong { font-size: 13px; }
.overwrite-row small { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 18px; padding: 14px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { font-size: 14px; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.toggle-row input { width: 22px; height: 22px; }
.workdays-fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.workdays-fieldset legend { margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.workday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.workday-picker label { position: relative; }
.workday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.workday-picker span { display: grid; place-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.workday-picker input:checked + span { border-color: var(--strong); background: var(--strong); color: var(--on-strong); }
.workday-picker input:focus-visible + span { outline: 2px solid var(--success); outline-offset: 2px; }
.settings-feedback { min-height: 20px; text-align: center; color: var(--success); font-size: 13px; }

.bottom-nav { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
.bottom-nav button { min-height: 54px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.bottom-nav button span { font-size: 19px; line-height: 1; }
.bottom-nav button[aria-current="page"] { color: var(--text); background: var(--soft); }

.dialog-backdrop { position: fixed; inset: 0; z-index: 10; padding: 20px; background: rgba(20,20,20,.48); display: grid; place-items: end center; }
.dialog-backdrop[hidden] { display: none; }
.dialog { width: min(100%, 440px); padding: 22px; border-radius: 18px; background: var(--card); }
.dialog h2 { margin-bottom: 8px; }
.dialog p { margin: 0 0 4px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.dialog-close { width: 100%; margin-top: 6px; }

.site-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 0 0 30px; display: flex; flex-wrap: wrap; gap: 12px 24px; color: var(--muted); font-size: 12px; }
.site-footer a { margin-left: auto; font-weight: 650; }

.legal-page { background: var(--surface); }
.legal-page .site-header { border-bottom: 1px solid var(--line); }
.legal-content { width: min(760px, calc(100% - 40px)); margin: 64px auto 80px; }
.legal-content h1 { font-size: clamp(42px, 7vw, 64px); }
.legal-lead { margin: 26px 0 46px; color: var(--muted); font-size: 19px; line-height: 1.65; }
.legal-content section { margin: 0 0 34px; }
.legal-content section h2 { margin-bottom: 10px; font-size: 20px; }
.legal-content section p, .legal-content li { color: var(--muted); font-size: 15px; line-height: 1.7; }
.legal-content section p { margin: 0; }
.legal-content ul { padding-left: 22px; }
.legal-content li + li { margin-top: 8px; }
.back-link { display: inline-block; margin-bottom: 44px; color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; }
.legal-updated { margin-top: 50px; color: var(--muted); font-size: 12px; }

@media (min-width: 980px) {
  .app-content { padding-left: 34px; padding-right: 34px; }
  .app-header { padding-left: 34px; padding-right: 34px; }
  .shift-card { padding: 24px; }
  .week-summary { grid-template-columns: repeat(2, minmax(0, 220px)); }
  #manual-form, #settings-form { max-width: 620px; }
}

@media (max-width: 979px) {
  .site-layout { grid-template-columns: 1fr; width: min(760px, calc(100% - 40px)); margin-top: 0; gap: 26px; }
  .intro-panel { position: static; padding: 42px 0 4px; }
  .intro-panel h1 { font-size: clamp(42px, 9vw, 62px); }
  .intro-copy { max-width: 600px; }
  .app-shell { min-height: 720px; }
}

@media (max-width: 620px) {
  .site-header { width: 100%; min-height: 70px; padding: calc(12px + env(safe-area-inset-top)) 18px 10px; background: var(--surface); }
  .site-brand img { width: 126px; }
  .site-header nav a:first-child { display: none; }
  .site-header nav { gap: 12px; }
  .site-header nav a { font-size: 12px; }
  .site-layout { width: 100%; margin: 0; gap: 0; }
  .intro-panel { padding: 38px 20px 34px; background: var(--page); }
  .intro-panel h1 { font-size: clamp(40px, 13vw, 54px); }
  .intro-copy { margin-top: 18px; font-size: 16px; line-height: 1.55; }
  .intro-button { margin-top: 22px; }
  .trust-list { margin-top: 24px; }
  .privacy-note { margin-top: 20px; }
  .app-shell { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .app-header { padding: 22px 20px 16px; }
  .app-content { padding: 0 20px 24px; }
  .export-panel { grid-template-columns: 1fr; }
  .export-actions { width: 100%; }
  .site-footer { width: 100%; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); background: var(--surface); }
  .site-footer a { width: 100%; margin-left: 0; }
  .legal-content { margin-top: 40px; }
  .legal-page .site-footer { background: var(--page); }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --page: #111915; --surface: #1b2420; --card: #242e29; --text: #f5f7f5; --muted: #aab5af; --line: #3b4841; --strong: #a8e1c1; --on-strong: #123021; --soft: #303b35; --danger: #f0a6a6; --success: #86d2a9; }
  .bottom-nav { background: rgba(42,43,47,.96); }
  .site-brand { padding: 5px 8px; border-radius: 8px; background: #f7f9f7; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
