:root {
  --navy: #163a5f;
  --navy-2: #1f4e79;
  --accent: #c45c26;
  --fill: #fff8e8;
  --grid: #c5d0dc;
  --head: #1f4e79;
  --weekend: #e4ebf3;
  --short: #ffe08a;
  --long: #9fd4ff;
  --holiday: #f8d0d6;
  --ok: #1b7a4e;
  --danger: #b42318;
  --bg: #eef2f6;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6b7c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body {
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; overflow-x: hidden; }
.to-top {
  position: fixed;
  right: 14px;
  bottom: 16px;
  z-index: 30;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(16, 32, 48, 0.28);
}
.to-top:active { transform: scale(0.96); }
.app[hidden] { display: none !important; }

.topbar {
  background: linear-gradient(90deg, rgba(22, 58, 95, 0.8), rgba(31, 78, 121, 0.8));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand-title { font-size: 18px; font-weight: 700; }
.ver {
  display: inline-block;
  background: #fff;
  color: var(--navy);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 2px;
}
.brand-sub { font-size: 12px; opacity: 0.85; margin-top: 3px; }
.top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.year-box { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.year-box select {
  border: 0;
  border-radius: 6px;
  padding: 6px 8px;
  font-weight: 700;
}

.mode-switch {
  display: flex;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 4px;
}
.mode-btn {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.mode-btn.is-active { background: #fff; color: var(--navy); }

.year-banner {
  background: #fff4d6;
  color: #6a4a00;
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.year-banner[hidden] { display: none !important; }

.share-blocker {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 32, 48, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.share-blocker[hidden] { display: none !important; }
.share-box {
  max-width: 520px;
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.share-box h1 { margin: 0 0 10px; font-size: 18px; color: var(--navy); }
.share-box p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; }
.share-box code {
  background: #eef3f8;
  padding: 1px 6px;
  border-radius: 4px;
}
.share-muted { color: var(--muted); font-size: 13px !important; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  background: #d9e3ee;
  border-bottom: 1px solid #b7c6d6;
}
.tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  border-radius: 8px 8px 0 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.tab.is-active {
  background: var(--card);
  color: var(--navy);
  border-color: #b7c6d6;
  font-weight: 700;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 16px;
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--grid);
}
.hint { color: var(--accent); font-weight: 700; }

.main { padding: 10px; flex: 1; }
.panel { display: none; }
.panel.is-active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.card h2 { margin: 0 0 8px; font-size: 14px; color: var(--navy); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 8px;
}
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label { font-size: 11px; color: var(--muted); }
.field.req label::after { content: " *"; color: var(--danger); }
.field input, .field select {
  border: 1px solid #9eb1c4;
  background: var(--fill);
  padding: 6px 7px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.field.readonly input, .field.readonly select { background: #eef2f6; }
.field.warn input, .field.warn select { border-color: var(--danger); background: #fff1f0; }
.auto-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chip {
  background: #e8eef5;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--navy);
}
.chip b { margin-right: 4px; }
.note { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.note.alert { color: var(--danger); font-weight: 700; }

.actions { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
button.btn {
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-primary { background: var(--navy-2); color: #fff; }
.btn-ghost { background: #e6edf4; color: var(--navy); }
.btn-danger { background: #fde8e6; color: var(--danger); }
.btn-ok { background: #e5f6ec; color: var(--ok); }
.btn-small { padding: 3px 8px; font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; align-items: end; }
.filters .field { min-width: 130px; }

.table-wrap { overflow: auto; max-height: calc(100vh - 340px); border: 1px solid var(--grid); }
.table-wrap.stats-full { max-height: none; overflow-x: auto; }
table.sheet {
  border-collapse: collapse;
  width: 100%;
  min-width: 860px;
  font-size: 12px;
}
table.sheet.stats-weeks {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
table.sheet.stats-weeks th,
table.sheet.stats-weeks td {
  min-width: 40px;
  padding: 4px 4px;
}
table.sheet.stats-weeks th:first-child,
table.sheet.stats-weeks td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 148px;
  background: #fff;
  text-align: left;
}
table.sheet.stats-weeks thead th:first-child {
  z-index: 3;
  background: var(--head);
}
table.sheet.stats-weeks tbody tr:nth-child(even) td:first-child {
  background: #f7fafc;
}
table.sheet.stats-weeks td.total:first-child {
  background: #fff3d6;
}
table.sheet th, table.sheet td {
  border: 1px solid var(--grid);
  padding: 5px 7px;
  white-space: nowrap;
}
table.sheet th {
  position: sticky;
  top: 0;
  background: var(--head);
  color: #fff;
  z-index: 1;
}
table.sheet tbody tr:nth-child(even) { background: #f7fafc; }
table.sheet td.num { text-align: right; }
table.sheet td.center { text-align: center; }
table.sheet td.total { font-weight: 700; background: #fff3d6; }
.empty { padding: 18px; text-align: center; color: var(--muted); }

.kind-short { background: var(--short); padding: 1px 6px; border-radius: 999px; font-size: 11px; }
.kind-long { background: var(--long); padding: 1px 6px; border-radius: 999px; font-size: 11px; }

.cal-wrap { max-width: none; }
.calendar-year {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.month {
  border: 1px solid #5d6d7e;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  min-width: 0;
}
.month h3 {
  margin: 0;
  padding: 4px;
  text-align: center;
  background: var(--navy-2);
  color: #fff;
  font-size: 12px;
}
.month table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.month th, .month td {
  border: 1px solid #5d6d7e;
  vertical-align: top;
  padding: 0;
  font-size: 9px;
  background: #fff;
}
.month td {
  height: 64px;
  max-height: 64px;
  overflow: hidden;
}
.month th { height: 18px; background: #e8eef5; color: var(--navy); text-align: center; }
.month th.weekend { background: #d5e0ec; color: #4a5d70; }
.month td.out { color: #b0b8c1; background: #fafbfc; }
.month td.weekend { background: var(--weekend); }
.month td.has-short { background: var(--short); }
.month td.has-long { background: var(--long); }
.month td.has-short.has-long { background: var(--short); }
.month td.holiday { background: var(--holiday); }
.month td.has-long .cell-head { background: var(--long); }
.month td.holiday .cell-head { background: var(--holiday); }
.cell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  overflow: hidden;
  box-sizing: border-box;
}
.cell-head {
  flex: 0 0 auto;
  border-bottom: 1px solid #6e7d8d;
  background: transparent;
}
.day-num {
  font-weight: 700;
  display: block;
  text-align: center;
  font-size: 11px;
  line-height: 1.15;
  padding: 1px 0 0;
}
.cell-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.band {
  flex: 1 1 0;
  min-height: 0;
  padding: 1px 3px 0;
  text-align: left;
  font-size: 9px;
  overflow: hidden;
}
.en-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.2;
  height: 1.2em;
}
.band-short { background: var(--short); color: #8a5a00; }
.band-long { background: var(--long); color: #0b4f86; font-weight: 700; }
.band-holiday {
  background: var(--holiday);
  color: #8a3040;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.legend { font-size: 12px; color: var(--muted); margin: 0 0 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { display: inline-block; width: 11px; height: 11px; border: 1px solid #bbb; margin-right: 4px; vertical-align: -1px; }
.swatch.short { background: var(--short); }
.swatch.long { background: var(--long); }
.swatch.holiday { background: var(--holiday); }
.swatch.weekend { background: var(--weekend); }

.month-jump {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
}
.month-jump-btn {
  border: 1px solid #8aa0b5;
  background: #d9e3ee;
  color: var(--navy);
  border-radius: 4px;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-width: 0;
}
.month-jump-btn:active { transform: scale(0.96); }
.month { scroll-margin-top: 8px; }

.people-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 6px;
}
.people-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 0 10px;
  padding: 8px;
  background: #f4f8fc;
  border: 1px solid var(--grid);
  border-radius: 6px;
}
.people-chip {
  font-size: 12px;
  white-space: nowrap;
  background: #fff;
  border: 1px solid #d5dee8;
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--text);
}
.people-chip b { margin-right: 4px; color: var(--navy); }

.holi-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.data-box {
  background: #f4f8fc;
  border: 1px dashed #9bb4c9;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
}
.data-box code {
  background: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(3, 1fr); }
  .calendar-year { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .calendar-year { grid-template-columns: repeat(2, 1fr); }
}

button.btn:active, .tab:active, .mode-btn:active {
  transform: scale(0.96);
  filter: brightness(1.1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.btn-ripple {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  animation: btn-ripple 0.55s ease-out forwards;
  z-index: 1;
}
.btn-ghost .btn-ripple,
.btn-danger .btn-ripple,
.tab .btn-ripple {
  background: rgba(22, 58, 95, 0.28);
}
@keyframes btn-ripple {
  from { transform: scale(0); opacity: 0.8; }
  to { transform: scale(22); opacity: 0; }
}
body.is-busy { cursor: progress; }
.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16, 32, 48, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
}
.busy-overlay[hidden] { display: none !important; }
.busy-box {
  background: #fff;
  border-radius: 12px;
  padding: 16px 22px;
  min-width: 260px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  font-weight: 700;
  font-size: 15px;
}
.busy-spin {
  width: 22px;
  height: 22px;
  border: 3px solid #d5e0ec;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes busy-spin {
  to { transform: rotate(360deg); }
}







.who-text { display: none; }

/* Attendance entrance: monitor illustration with live controls. */
#portal { --portal-ink: #293d60; position: relative; min-height: 100vh; min-height: 100dvh; background: #dedfe1; color: #1c3464; overflow: hidden; display: grid; place-items: center; padding: 96px 64px; }
#portal[hidden], #portal [hidden] { display: none !important; }
#portal .portal-frame { position: absolute; inset: 22px; width: calc(100% - 44px); height: calc(100% - 44px); color: #b9bab8; pointer-events: none; }
#portal .frame-inner { position: absolute; inset: 36px; border: 2px solid #b9bab8; pointer-events: none; }
#portal .frame-inner::before, #portal .frame-inner::after { content: ''; position: absolute; inset: -16px; pointer-events: none; background: radial-gradient(circle at top left, #dedfe1 0 38px, #b9bab8 39px 40px, transparent 41px) top left, radial-gradient(circle at top right, #dedfe1 0 38px, #b9bab8 39px 40px, transparent 41px) top right, radial-gradient(circle at bottom left, #dedfe1 0 38px, #b9bab8 39px 40px, transparent 41px) bottom left, radial-gradient(circle at bottom right, #dedfe1 0 38px, #b9bab8 39px 40px, transparent 41px) bottom right; background-size: 48px 48px; background-repeat: no-repeat; }
#portal .top-logout { position: absolute; top: 48px; right: 52px; z-index: 3; border: 1.5px solid #293d60; border-radius: 99px; padding: 9px 20px; background: #f8fafb; color: #1c3464; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
#portal .portal-stage { width: min(1100px, 100%); position: relative; }
#portal h1 { text-align: center; white-space: nowrap; font-size: clamp(32px, 5.2vw, 70px); font-weight: 900; letter-spacing: .055em; line-height: 1.3; margin: 0 0 28px; }
#portal .computer-scene { position: relative; width: 100%; padding-top: 5.5%; padding-bottom: 13%; }
#portal .scene-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#portal .monitor { position: relative; z-index: 1; width: 60%; margin: auto; padding: 2.3% 2.3% 4.5%; border: 3px solid #293d60; border-radius: 26px; background: #5486c5; }
#portal .monitor-screen { background: #fff; border: 2.5px solid #293d60; border-radius: 13px; overflow: hidden; min-height: 380px; display: flex; flex-direction: column; }
#portal .login { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 30px 12% 12px; width: 100%; margin: auto; }
#portal .fingerprint { width: 94px; height: 100px; color: #293d60; margin-bottom: 8px; }
#portal .login-field { width: 100%; position: relative; display: block; }
#portal .login-field > svg { position: absolute; width: 27px; height: 27px; left: 18px; top: 50%; transform: translateY(-50%); fill: none; stroke: #293d60; stroke-width: 2; pointer-events: none; }
#portal .login input { width: 100%; min-height: 52px; border: 2px solid #293d60; border-radius: 99px; padding: 10px 60px; font: inherit; font-size: 21px; text-align: center; background: white; color: #293d60; }
#portal .login input::placeholder { color: #666; opacity: 1; }
#portal .pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; border-radius: 99px; background: transparent; color: #385277; font-size: 12px; cursor: pointer; min-height: 40px; padding: 6px 8px; }
#portal .btn-login { position: relative; min-height: 52px; width: 58%; border: 0; border-radius: 99px; background: #1c3464; color: white; font: inherit; font-size: 24px; font-weight: 800; letter-spacing: .12em; cursor: pointer; margin-top: 5px; }
#portal .login-check { position: absolute; width: 46px; height: 46px; right: -17px; top: -9px; }
#portal .msg { font-size: 14px; text-align: center; margin: 0; min-height: 20px; line-height: 1.4; }
#portal .msg.err { color: #a22a1c; }
#portal .msg.ok { color: #1b6b45; }
#portal .monitor-stand { position: absolute; z-index: 0; width: 25%; height: auto; left: 37.5%; bottom: 7.8%; fill: #5486c5; stroke: #293d60; stroke-width: 2.5; }
#portal .entry-art-wrap { position: relative; flex: 1; min-height: 0; background: #000; }
#portal .entry-art { display: block; width: 100%; height: 310px; object-fit: contain; background: #000; }
#portal .art-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: 90%; border: 1px solid #9cb7da; border-radius: 99px; padding: 12px 22px; background: rgba(28,52,100,.94); color: #fff; font-size: 18px; font-weight: 700; text-align: center; }
#portal .art-status:empty { display: none; }
#portal .chooser { padding: 16px 22px 8px; background: white; }
#portal .chooser-btns { display: flex; gap: 16px; justify-content: center; margin-bottom: 6px; }
#portal .btn-pick { flex: 1; min-height: 48px; border: 1.5px solid #293d60; border-radius: 99px; font: inherit; font-size: 22px; font-weight: 800; color: #1c3464; background: #eff4fb; cursor: pointer; }
#portal .btn-pick.leave { background: #edf7ef; color: #2c684d; }
#portal button { transition: filter .15s, background-color .15s; }
#portal button:hover { filter: brightness(.94); }
#portal button:disabled { opacity: .6; cursor: wait; }
#portal :is(input, button):focus-visible { outline: 3px solid #68a984; outline-offset: 3px; }
/* Keep the entire desktop illustration inside the frame on shorter screens. */
@media (min-width: 761px) and (max-height: 900px) {
  #portal .portal-stage { zoom: .75; }
}
@media (max-width: 760px) {
  #portal { padding: 90px 18px 95px; }
  #portal .portal-frame { inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
  #portal .frame-inner { inset: 22px; }
  #portal .frame-inner::before, #portal .frame-inner::after { inset: -12px; }
  #portal .top-logout { top: 34px; right: 33px; padding: 8px 17px; }
  #portal h1 { font-size: clamp(26px, 7.7vw, 48px); margin-bottom: 34px; letter-spacing: .035em; }
  #portal .computer-scene { padding-top: 10px; padding-bottom: 100px; }
  #portal .monitor { width: 94%; padding: 12px 10px 26px; border-width: 2px; border-radius: 19px; }
  #portal .monitor-screen { min-height: 360px; border-width: 2px; border-radius: 10px; }
  #portal .login { padding: 25px 17px 12px; gap: 17px; }
  #portal .fingerprint { width: 80px; height: 90px; margin-bottom: 7px; }
  #portal .login input { min-height: 50px; font-size: 18px; padding-left: 48px; padding-right: 48px; }
  #portal .login-field > svg { left: 14px; width: 24px; }
  #portal .btn-login { min-height: 50px; font-size: 22px; width: 66%; }
  #portal .monitor-stand { width: 44%; left: 28%; bottom: 49px; }
  #portal .scene-art { top: auto; bottom: 22px; height: auto; }
  #portal .entry-art { height: 280px; }
  #portal .chooser { padding: 15px 14px 8px; }
}

/* 第一次登入改密碼：沿用紙感對話框 */
.share-blocker {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(30, 30, 30, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.share-blocker[hidden] { display: none !important; }
.share-box {
  position: relative;
  background: #fffdf7; border: 3px solid #2a2a2a; border-radius: 20px;
  padding: 22px 24px; max-width: 440px; width: 100%;
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}
.modal-x {
  position: absolute; top: 8px; right: 10px;
  width: 36px; height: 36px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 28px; line-height: 1; color: #1e1e1e;
}
.share-box h2 { margin: 0 0 8px; font-size: 19px; }
.share-box p { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: #444; }
.pass-form { display: grid; gap: 10px; }
.pass-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: #333; }
.pass-form label[hidden] { display: none !important; }
.pass-form .pw-wrap { position: relative; display: block; }
.pass-form .pw-wrap input { padding-right: 64px; }
.pass-form .pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: #2c567c;
  font-size: 14px; font-weight: 800; cursor: pointer; padding: 6px 8px;
}
.pass-form input {
  border: 1px solid #9c9c9c; border-radius: 8px; background: #fff;
  padding: 9px 10px; font-size: 16px; font-family: inherit; width: 100%;
}
.btn-plain {
  justify-self: start;
  border: 2px solid #2a2a2a; background: #afc0da; border-radius: 999px;
  padding: 7px 22px; cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 700;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .calendar-year { grid-template-columns: 1fr; }
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }
  .brand { min-width: 0; }
  .brand-title { font-size: 16px; }
  .brand-sub { display: none; }
  .who-text { display: none; }
  .top-tools {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .top-tools .btn-small { padding: 6px 10px; font-size: 13px; }
  .year-box { font-size: 12px; }
  .mode-switch { margin-left: auto; flex-shrink: 0; }
  .mode-btn { padding: 7px 12px; font-size: 13px; }
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 8px 8px 0;
  }
  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 10px;
    font-size: 12px;
  }
  .status-bar {
    flex-wrap: wrap;
    padding: 7px 12px;
    gap: 4px;
  }
  .month-jump { gap: 4px; }
  .month-jump-btn { font-size: 13px; padding: 8px 0; }
  .main { padding: 8px; overflow-x: hidden; }
  .card { padding: 10px; overflow: hidden; }
  .filters .field { min-width: 0; flex: 1 1 140px; }
  .table-wrap { max-height: none; }
  table.sheet { min-width: 0; width: 100%; font-size: 12px; }
  table.sheet th, table.sheet td { padding: 4px 5px; }
  table.sheet-pin,
  table.sheet.stats-weeks { width: max-content; min-width: 100%; }
  table.sheet-pin th:nth-child(1),
  table.sheet-pin td:nth-child(1) { position: sticky; left: 0; min-width: 44px; z-index: 2; }
  table.sheet-pin th:nth-child(2),
  table.sheet-pin td:nth-child(2) { position: sticky; left: 44px; min-width: 56px; z-index: 2; }
  table.sheet-pin th:nth-child(3),
  table.sheet-pin td:nth-child(3) { position: sticky; left: 100px; min-width: 64px; z-index: 2; box-shadow: 3px 0 0 #c5d0dc; }
  table.sheet-pin thead th:nth-child(-n+3) { z-index: 4; background: var(--head); }
  table.sheet-pin tbody tr:nth-child(odd) td:nth-child(-n+3) { background: #fff; }
  table.sheet-pin tbody tr:nth-child(even) td:nth-child(-n+3) { background: #f7fafc; }
}

/* Keep the decorative frame fixed to the viewport behind readable content. */
.app {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
}
.app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: #000 url("img/leave-bg.webp") center / cover no-repeat;
}
.app > .main {
  min-width: 0;
  margin: clamp(12px, 3vw, 40px);
  background: rgba(248, 250, 252, 0.92);
  border-radius: 12px;
}
.app > .tabs { background: rgba(217, 227, 238, 0.97); flex-wrap: wrap; }
.app > .status-bar { background: rgba(255, 255, 255, 0.97); flex-wrap: wrap; }
