:root {
  color-scheme: light;
  --blue-950: #063563;
  --blue-800: #0758a8;
  --blue-700: #0873d1;
  --blue-100: #e8f3ff;
  --orange: #f7a81b;
  --orange-100: #fff4dc;
  --green: #16845b;
  --green-100: #e4f7ef;
  --red: #c94545;
  --ink: #162235;
  --muted: #65738a;
  --line: #dce5ee;
  --surface: #ffffff;
  --background: #f2f6fa;
  --shadow: none;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); color: var(--ink); }
button, select, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100dvh; padding-bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
.topbar { height: 4.6rem; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .72rem; }
.brand-logo { width: 4.8rem; height: 2.4rem; object-fit: contain; object-position: left center; flex: 0 0 auto; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: -.01em; }
.brand small { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.icon-button { width: 2.7rem; height: 2.7rem; border: 0; border-radius: 0; display: grid; place-items: center; background: #edf4fa; color: var(--blue-950); position: relative; }
.notification-dot { width: .52rem; height: .52rem; border-radius: 0; background: var(--orange); border: 2px solid white; position: absolute; right: .42rem; top: .38rem; }

main { width: min(100%, 760px); margin: 0 auto; padding: 1rem; }
.hero-card { padding: 1.25rem; border-radius: 0; background: var(--blue-800); color: white; display: flex; justify-content: space-between; align-items: flex-start; box-shadow: none; overflow: hidden; position: relative; }
.hero-card::after { content: none; }
.eyebrow { margin: 0 0 .28rem; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 800; color: inherit; opacity: .72; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 1.45rem; margin-bottom: .36rem; letter-spacing: -.03em; }
h2 { font-size: 1.16rem; margin-bottom: 0; letter-spacing: -.02em; }
.hero-subtitle { margin: 0; font-size: .84rem; opacity: .76; }
.connection-pill { z-index: 1; display: flex; align-items: center; gap: .42rem; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.12); padding: .43rem .66rem; border-radius: 0; font-size: .76rem; font-weight: 700; }
.connection-pill span { width: .47rem; height: .47rem; border-radius: 0; background: var(--orange); box-shadow: none; }

.filter-row { margin: 1rem 0; display: grid; grid-template-columns: 1fr 1fr auto; gap: .62rem; align-items: end; }
.filter-row label { display: flex; flex-direction: column; gap: .32rem; font-size: .72rem; color: var(--muted); font-weight: 700; }
select { min-height: 2.8rem; width: 100%; padding: 0 2.25rem 0 .8rem; color: var(--ink); border: 1px solid var(--line); border-radius: 0; background-color: white; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230758a8' stroke-width='2'/%3E%3C/svg%3E"); background-position: calc(100% - 12px) center; background-size: 12px 8px; background-repeat: no-repeat; appearance: none; font-weight: 700; }
.refresh-button { width: 2.8rem; height: 2.8rem; border: 0; border-radius: 0; background: var(--blue-100); color: var(--blue-800); display: grid; place-items: center; }
.refresh-button.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.summary-card { min-height: 6.4rem; padding: 1rem; border-radius: 0; display: flex; align-items: center; gap: .8rem; border: 1px solid transparent; }
.summary-primary { background: var(--blue-100); color: var(--blue-950); border-color: #cee5fa; }
.summary-warning { background: var(--orange-100); color: #7b4b00; border-color: #f6dfae; }
.summary-icon { width: 2.3rem; height: 2.3rem; border-radius: 0; background: rgba(255,255,255,.72); display: grid; place-items: center; flex: 0 0 auto; }
.summary-card strong, .summary-card span { display: block; }
.summary-card strong { font-size: 1.7rem; line-height: 1; margin-bottom: .3rem; }
.summary-card div > span { font-size: .74rem; font-weight: 700; line-height: 1.25; opacity: .78; }

.section-heading { margin: 1.45rem 0 .75rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.section-heading .eyebrow { color: var(--blue-800); }
.text-button { border: 0; background: transparent; color: var(--blue-800); padding: .5rem 0; font-size: .78rem; font-weight: 800; }
.text-button[aria-pressed="true"] { color: var(--red); }
.attendance-list { display: grid; gap: .7rem; }
.attendance-card { background: var(--surface); border: 1px solid var(--line); border-radius: 0; padding: .95rem; box-shadow: none; }
.attendance-card.is-missing { border-color: #f2cb84; border-left: 4px solid var(--orange); box-shadow: none; }
.attendance-card.is-weekend { opacity: .72; }
.attendance-head { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; }
.attendance-date { display: flex; gap: .7rem; align-items: center; }
.date-box { width: 2.8rem; height: 2.8rem; border-radius: 0; background: #eef4f8; color: var(--blue-950); display: grid; place-items: center; font-weight: 850; font-size: 1.05rem; }
.attendance-date strong, .attendance-date span { display: block; }
.attendance-date strong { font-size: .9rem; }
.attendance-date span { margin-top: .15rem; color: var(--muted); font-size: .73rem; }
.status-badge { padding: .37rem .58rem; border-radius: 0; font-size: .7rem; line-height: 1; font-weight: 800; white-space: nowrap; }
.status-ok { background: var(--green-100); color: var(--green); }
.status-missing { background: var(--orange-100); color: #8a5603; }
.status-weekend { background: #edf1f5; color: var(--muted); }
.time-row { margin-top: .8rem; display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.time-cell { background: #f7f9fb; padding: .66rem .72rem; border-radius: 0; }
.time-cell span, .time-cell strong { display: block; }
.time-cell span { font-size: .67rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.time-cell strong { margin-top: .18rem; font-size: .92rem; }
.explanation-preview { margin: .75rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; padding-top: .68rem; border-top: 1px dashed var(--line); }
.explain-button { width: 100%; margin-top: .75rem; min-height: 2.65rem; border: 0; border-radius: 0; background: var(--orange-100); color: #7b4b00; font-weight: 800; }
.empty-state { text-align: center; padding: 2.5rem 1.2rem; background: white; border: 1px dashed var(--line); border-radius: 0; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: .35rem; }

.bottom-nav { height: calc(4.8rem + env(safe-area-inset-bottom)); padding: .42rem .75rem env(safe-area-inset-bottom); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); display: flex; justify-content: space-around; backdrop-filter: blur(16px); }
.nav-item { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 0; display: grid; place-items: center; align-content: center; gap: .26rem; font-size: .68rem; font-weight: 700; }
.nav-item svg { width: 1.38rem; }
.nav-item.active { color: var(--blue-800); background: var(--blue-100); }

.sheet { width: min(calc(100% - 1rem), 560px); max-height: 92dvh; margin: auto auto 0; padding: 0; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: white; box-shadow: none; }
.sheet::backdrop { background: rgba(5,28,50,.55); backdrop-filter: blur(2px); }
.sheet form { padding: .7rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.sheet-handle { width: 2.8rem; height: .3rem; margin: 0 auto 1rem; border-radius: 0; background: #d6dee6; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.sheet-header .eyebrow { color: var(--blue-800); }
.missing-detail, .security-card { padding: .9rem; border-radius: 0; background: var(--orange-100); color: #704600; font-size: .84rem; line-height: 1.5; margin-bottom: 1rem; }
.security-card { background: var(--blue-100); color: var(--blue-950); }
.security-card strong { display: block; margin-bottom: .3rem; }
.security-card p { margin-bottom: 0; }
.textarea-label { display: grid; gap: .42rem; font-size: .82rem; font-weight: 800; }
textarea { width: 100%; resize: vertical; padding: .85rem; border: 1px solid var(--line); border-radius: 0; color: var(--ink); line-height: 1.5; min-height: 7rem; }
textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(8,115,209,.2); outline-offset: 2px; }
.textarea-label small { justify-self: end; color: var(--muted); font-weight: 600; }
.privacy-note { color: var(--muted); font-size: .74rem; line-height: 1.5; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: .65rem; margin-top: 1rem; }
.primary-button, .secondary-button { min-height: 3rem; border-radius: 0; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary-button { border: 0; background: var(--blue-800); color: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.full-width { width: 100%; }
.form-stack { display: grid; gap: .8rem; margin-bottom: .8rem; }
.field-label { display: grid; gap: .35rem; color: var(--ink); font-size: .82rem; font-weight: 800; }
.field-label input { min-height: 3rem; width: 100%; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: white; }
.field-label input:focus { outline: 3px solid rgba(8,115,209,.2); outline-offset: 2px; border-color: var(--blue-700); }
.connect-status { min-height: 1.3rem; margin: .2rem 0 .8rem; color: var(--red); font-size: .78rem; line-height: 1.45; }
.connect-status.success { color: var(--green); }
.support-link { display: block; margin-top: .8rem; color: var(--blue-800); font-size: .78rem; font-weight: 700; text-align: center; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(5.8rem + env(safe-area-inset-bottom)); transform: translate(-50%, 1rem); width: max-content; max-width: calc(100% - 2rem); padding: .75rem 1rem; border-radius: 0; background: var(--blue-950); color: white; font-size: .82rem; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 720px) {
  body { padding: 1.2rem 0; }
  .app-shell { width: min(100% - 2rem, 780px); margin: 0 auto; border-radius: 0; background: var(--background); box-shadow: none; overflow: hidden; min-height: calc(100dvh - 2.4rem); }
  .topbar { position: relative; }
  .bottom-nav { width: min(100% - 2rem, 780px); left: 50%; transform: translateX(-50%); border-radius: 0; }
  .sheet { margin: auto; border-radius: 0; }
}

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

