:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #66707a;
  --gold: #b07a22;
  --gold-2: #8a6118;
  --line: #d7d2c6;
  --rest: #6b7280;
  --work: #2b6f96;
  --mid: #c47a2c;
  --nat: #b42318;
  --duty: #c24a1f;
  --off: #6b726c;
  --leave: #b08920;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: "Noto Sans SC", sans-serif;
  letter-spacing: 0.01em;
}
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(176, 122, 34, 0.08), transparent 55%),
    radial-gradient(800px 400px at 90% 0%, rgba(43, 111, 150, 0.06), transparent 50%);
  z-index: 0;
}
body > *:not(.grain) { position: relative; z-index: 1; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.04em; line-height: 1.1; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
}
.lede { color: var(--muted); max-width: 42rem; line-height: 1.6; }
.lede.tight { margin-top: 0; }
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 36px 32px 28px;
  box-shadow: 0 16px 40px rgba(28, 36, 48, .08);
}
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--gold-2); }
input, .note {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 12px;
  font: 15px/1.4 "Noto Sans SC", sans-serif;
}
input:focus, .note:focus { outline: 2px solid var(--gold); }
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  font: 600 14px/1 "Noto Sans SC", sans-serif;
  cursor: pointer;
}
.btn.gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.ghost { background: #fff; }
.btn.ghost:hover, .chip:hover, .cell:hover, .own-cell:hover { border-color: var(--gold); }
.hint { color: var(--muted); font-size: 12px; }
.flash { padding: 10px 12px; }
.flash-bad { background: #fde8e4; color: #9b2c1f; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 22px clamp(16px, 3vw, 36px) 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.topbar-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page { padding: 20px clamp(16px, 3vw, 36px) 48px; }
.page.wide { padding-right: 12px; }
.inbox {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.inbox h2 { margin: 0 0 8px; font-size: 16px; }
.inbox .names { margin: 0; color: var(--gold-2); line-height: 1.7; }
.inbox small { color: var(--muted); margin-left: 4px; font-family: "JetBrains Mono", monospace; }
.btn.tiny { padding: 2px 6px; font-size: 12px; margin-left: 4px; }
@media (max-width: 720px) {
  .inbox { grid-template-columns: 1fr; }
}
.meter {
  min-width: 88px;
  padding: 8px 10px 6px;
  border: 1px solid var(--gold);
  background: #fff8ea;
}
.meter strong { font-family: "JetBrains Mono", monospace; font-size: 22px; }
.meter span, .meter em { color: var(--muted); font-style: normal; font-size: 12px; }
.pill, .link { font-size: 13px; color: var(--gold-2); }
.pill-lock { color: #9b2c1f; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.own-board { overflow: auto; border: 1px solid var(--line); background: #fff; }
.own-table { width: min(720px, 100%); border-collapse: collapse; background: #fff; }
.own-table th, .own-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.own-table tr.type-work td:nth-child(3) { color: #1f6f96; }
.own-table tr.type-mid_autumn td:nth-child(3) { color: #b86a18; }
.own-table tr.type-national_day td:nth-child(3) { color: #b42318; }
.own-cell {
  min-width: 112px;
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: 600 14px/1 "Noto Sans SC", sans-serif;
  padding: 6px 8px;
}
.own-cell.status-unset { color: var(--muted); }
.own-cell.status-work { background: #dceef8; border-color: var(--work); color: #16465f; }
.own-cell.status-duty { background: #fde4d6; border-color: var(--duty); color: #8a2e12; }
.own-cell.status-off { background: #ececec; border-color: var(--off); color: #3d423e; }
.own-cell.status-leave { background: #fff1c7; border-color: var(--leave); color: #6d5410; }
.day-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.day-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  border-top: 3px solid var(--rest);
}
.day-card.type-work { border-top-color: var(--work); }
.day-card.type-mid_autumn { border-top-color: var(--mid); }
.day-card.type-national_day { border-top-color: var(--nat); }
.day-card header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 10px;
  font-family: "JetBrains Mono", monospace;
}
.day-card time { font-size: 20px; }
.day-card i {
  margin-left: auto;
  font-style: normal;
  color: var(--gold-2);
}
.status-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip, .cell {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  cursor: pointer;
  font: 600 13px/1 "Noto Sans SC", sans-serif;
}
.chip.is-on, .cell.status-work { background: #dceef8; border-color: var(--work); color: #16465f; }
.chip.is-on[data-status="duty"], .cell.status-duty { background: #fde4d6; border-color: var(--duty); color: #8a2e12; }
.chip.is-on[data-status="off"], .cell.status-off { background: #ececec; border-color: var(--off); color: #3d423e; }
.chip.is-on[data-status="leave"], .cell.status-leave { background: #fff1c7; border-color: var(--leave); color: #6d5410; }
.note { margin-top: 8px; padding: 8px 10px; }
.board-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--line); background: #fff; }
.board { border-collapse: separate; border-spacing: 0; min-width: 1280px; background: #fff; }
.board th, .board td { border-bottom: 1px solid var(--line); border-right: 1px solid #ece8de; padding: 0; text-align: center; }
.board thead th { position: sticky; top: 0; z-index: 3; background: #f7f3ea; padding: 8px 4px; font-size: 11px; }
.board .sticky-col { position: sticky; background: #fbfaf6; z-index: 4; }
.board .no { left: 0; width: 36px; }
.board .name { left: 36px; width: 72px; font-weight: 700; }
.board .prog { left: 108px; width: 118px; font-family: "JetBrains Mono", monospace; font-size: 12px; }
.board thead .sticky-col { z-index: 5; }
.board .type-rest i { color: #5c6370; }
.board .type-work i { color: #1f6f96; }
.board .type-mid_autumn i { color: #b86a18; }
.board .type-national_day i { color: #b42318; }
.cell { width: 100%; min-width: 42px; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.cell.status-unset { background: #fff; color: #9aa1a8; }
.is-empty .name { color: #9b2c1f; }
.count { font-family: "JetBrains Mono", monospace; padding: 8px 0; color: #8a2e12; }
.count.muted { color: var(--muted); }
.people { width: min(820px, 100%); border-collapse: collapse; background: #fff; }
.people th, .people td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.reset-result { width: min(820px, 100%); margin: 0 0 16px; padding: 14px; border: 1px solid #b07a22; background: #fff8e8; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.reset-result[hidden] { display: none; }
.reset-result label { flex: 1 1 280px; }
.reset-result input { width: 100%; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
code { font-family: "JetBrains Mono", monospace; color: var(--gold-2); }
@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .day-list { grid-template-columns: 1fr; }
}

/* Admin weekly work-plan overview */
.admin-plans { display: grid; gap: 18px; }
.admin-plan-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
.admin-plan-switcher, .admin-plan-switcher form, .admin-plan-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-plan-switcher label { min-width: 170px; }
.admin-plan-switcher input { padding: 8px 10px; }
.admin-plan-counts { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 12px; }
.admin-plan-counts div { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid var(--line); background: #fff; }
.admin-plan-counts strong { color: var(--gold-2); font: 700 26px/1 "JetBrains Mono", monospace; }
.admin-plan-counts span { color: var(--muted); font-size: 12px; }
.admin-plan-table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); background: #fff; }
.admin-plan-table { min-width: 1380px; width: 100%; border-collapse: separate; border-spacing: 0; }
.admin-plan-table th, .admin-plan-table td { min-width: 190px; padding: 10px; border-right: 1px solid #ece8de; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-plan-table th:first-child, .admin-plan-table td:first-child { min-width: 46px; width: 46px; text-align: center; }
.admin-plan-table th:nth-child(2), .admin-plan-table td:nth-child(2) { min-width: 145px; }
.admin-plan-table th:last-child, .admin-plan-table td:last-child { min-width: 76px; width: 76px; }
.admin-plan-table thead th { position: sticky; top: 0; z-index: 2; background: #f7f3ea; font-size: 12px; }
.admin-plan-person { display: grid; gap: 6px; }
.admin-plan-person small, .admin-plan-status, .admin-plan-day time { color: var(--muted); font-size: 11px; }
.admin-plan-status { width: max-content; padding: 3px 7px; border-radius: 999px; background: #eee; }
.admin-plan-status.status-submitted { background: #e5f3ed; color: #25634e; }
.admin-plan-status.status-draft { background: #fff1cf; color: #795914; }
.admin-plan-status.status-missing { background: #f3e5e2; color: #8b3528; }
.admin-plan-day { line-height: 1.45; }
.admin-plan-day time { display: block; margin-bottom: 5px; font-family: "JetBrains Mono", monospace; }
.admin-plan-day strong { display: block; font-size: 12px; }
.admin-plan-day p { margin: 5px 0 0; color: #354151; font-size: 12px; white-space: pre-wrap; }
.admin-plan-day.is-leave { background: #f2f2f2; color: var(--muted); }
.admin-plan-day.is-half-leave { background: #fff9ef; }
.admin-plan-leave-tag { display: inline-block; margin-bottom: 4px; padding: 1px 7px; border-radius: 999px; background: #fde7c2; color: #7d4e0d; font-size: 11px; font-weight: 700; }
.admin-plan-history { padding: 18px; border: 1px solid var(--line); background: #fff; }
.admin-plan-history > header, .admin-plan-revision > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.admin-plan-history h2 { margin: 0; }
.admin-plan-history [data-plan-history-list] { display: grid; gap: 12px; margin-top: 16px; }
.admin-plan-revision { padding: 14px; border: 1px solid var(--line); background: #fbfaf6; }
.admin-plan-revision header span { color: var(--muted); font-size: 12px; }
.admin-plan-revision-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0; }
.admin-plan-revision-days p { margin: 0; padding: 8px; border: 1px solid #e8e3d9; background: #fff; font-size: 11px; white-space: pre-wrap; }
@media (max-width: 760px) {
  .admin-plan-toolbar { align-items: stretch; flex-direction: column; }
  .admin-plan-counts { grid-template-columns: 1fr 1fr; }
  .admin-plan-revision-days { grid-template-columns: 1fr; }
}

.work-app {
  --work-navy: #15253b;
  --work-ink: #1b2a3d;
  --work-muted: #657184;
  --work-teal: #2f7168;
  --work-teal-dark: #245950;
  --work-teal-soft: #eaf4f1;
  --work-coral: #e56b52;
  --work-sand: #f6f3ed;
  --work-line: #dfe4e7;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 88% 8%, rgba(47, 113, 104, .12), transparent 24rem),
    linear-gradient(180deg, #f9faf9 0, var(--work-sand) 100%);
  color: var(--work-ink);
}
.work-app button, .work-app input, .work-app textarea, .work-app select { font-family: inherit; }
.work-nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 5vw, 72px);
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid rgba(21, 37, 59, .08);
  backdrop-filter: blur(14px);
}
.work-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--work-navy);
  text-decoration: none;
}
.work-brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--work-navy);
  color: #fff;
  font: 800 13px/1 "JetBrains Mono", monospace;
  letter-spacing: .08em;
  box-shadow: 0 8px 22px rgba(21, 37, 59, .18);
}
.work-brand > span:last-child, .work-user-name { display: grid; gap: 2px; }
.work-brand strong { font-size: 16px; letter-spacing: .03em; }
.work-brand small, .work-user-name small { color: #8a93a0; font-size: 9px; letter-spacing: .14em; }
.work-user { display: flex; align-items: center; gap: 10px; }
.work-preview-badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff4e8;
  color: #9d591f;
  font-size: 12px;
  font-weight: 700;
}
.work-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--work-teal-soft);
  color: var(--work-teal-dark);
  font-weight: 800;
}
.work-user-name strong { font-size: 13px; }
.work-back { margin-left: 8px; color: var(--work-muted); font-size: 12px; text-decoration: none; }
.work-main { width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 56px; }
.work-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 28px;
}
.work-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  color: var(--work-teal);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}
.work-kicker span { width: 28px; height: 2px; background: var(--work-coral); }
.work-offset-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--work-teal-soft);
  color: var(--work-teal-dark);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.work-hero h1 { color: var(--work-navy); font-size: clamp(34px, 5vw, 58px); letter-spacing: -.055em; }
.work-week-label { margin: 14px 0 0; color: var(--work-muted); font-size: 15px; }
.work-week-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.work-pager-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #cfd8db;
  border-radius: 10px;
  background: #fff;
  color: var(--work-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(21, 37, 59, .05);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.work-pager-btn:hover:not(.is-disabled) {
  border-color: var(--work-teal);
  color: var(--work-teal-dark);
  transform: translateY(-1px);
}
.work-pager-btn.is-disabled {
  opacity: .45;
  background: #f1f4f5;
  cursor: not-allowed;
  box-shadow: none;
}
.work-pager-today {
  border-color: rgba(47, 113, 104, .35);
  background: var(--work-teal-soft);
  color: var(--work-teal-dark);
}
.work-pager-select-wrap { display: inline-flex; }
.work-pager-select {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cfd8db;
  border-radius: 10px;
  background: #fff;
  color: var(--work-ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(21, 37, 59, .05);
}
.work-pager-select:focus {
  outline: none;
  border-color: var(--work-teal);
  box-shadow: 0 0 0 3px rgba(47, 113, 104, .12);
}
.work-copy-button {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 17px;
  border: 1px solid #cfd8db;
  border-radius: 16px;
  background: #fff;
  color: var(--work-ink);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(21, 37, 59, .07);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease;
}
.work-copy-button:hover { transform: translateY(-2px); border-color: var(--work-teal); }
.work-copy-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--work-teal-soft); color: var(--work-teal); font-size: 22px; }
.work-copy-button > span:last-child { display: grid; gap: 3px; }
.work-copy-button small { color: var(--work-muted); font-size: 11px; }
.work-copy-button strong { font-size: 15px; }
.work-overview {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--work-navy);
  color: #fff;
  box-shadow: 0 16px 40px rgba(21, 37, 59, .13);
}
.work-progress-copy { display: flex; align-items: center; gap: 15px; }
.work-progress-copy > span:last-child { display: grid; gap: 3px; }
.work-progress-copy small { color: #aeb8c5; font-size: 11px; }
.work-progress-number { font-size: 18px; color: #a9b6c6; }
.work-progress-number strong { font-size: 30px; color: #fff; }
.work-progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.14); }
.work-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #7bc2b5; transition: width .25s ease; }
.work-save-state { display: flex; align-items: center; gap: 8px; color: #bec7d1; font-size: 11px; }
.work-save-state span { width: 7px; height: 7px; border-radius: 50%; background: #7bc2b5; box-shadow: 0 0 0 4px rgba(123,194,181,.12); }
.work-save-state em { font-style: normal; }
.work-uniform, .work-week {
  border: 1px solid var(--work-line);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 14px 36px rgba(21, 37, 59, .055);
}
.work-uniform { display: grid; grid-template-columns: 280px 1fr; gap: 30px; padding: 24px; margin-bottom: 18px; }
.work-section-intro { display: flex; align-items: flex-start; gap: 13px; }
.work-section-number { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--work-teal-soft); color: var(--work-teal); font: 800 11px/1 "JetBrains Mono", monospace; }
.work-section-intro h2 { margin: 0 0 5px; color: var(--work-navy); font-size: 19px; }
.work-section-intro p { margin: 0; color: var(--work-muted); font-size: 12px; line-height: 1.55; }
.work-uniform-fields { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(280px, 1.4fr) auto; align-items: end; gap: 12px; }
.work-uniform-fields label, .work-cell-field { display: grid; gap: 7px; color: #536075; font-size: 11px; font-weight: 700; }
.work-app input[type="text"], .work-app textarea {
  width: 100%;
  border: 1px solid #d8dfe3;
  border-radius: 11px;
  background: #fbfcfc;
  color: var(--work-ink);
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.work-app input[type="text"] { min-height: 46px; }
.work-app textarea { min-height: 46px; }
.work-app input[type="text"]:focus, .work-app textarea:focus { outline: none; border-color: var(--work-teal); background: #fff; box-shadow: 0 0 0 3px rgba(47,113,104,.11); }
.work-apply-button, .work-submit-button {
  min-height: 46px;
  border: 0;
  border-radius: 11px;
  background: var(--work-teal);
  color: #fff;
  padding: 0 17px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.work-apply-button:hover, .work-submit-button:hover { background: var(--work-teal-dark); }
.work-apply-button span, .work-submit-button span { margin-left: 7px; }
.work-week { overflow: hidden; }
.work-week-title { display: flex; justify-content: space-between; align-items: center; padding: 23px 24px 20px; border-bottom: 1px solid var(--work-line); }
.work-required-note { color: var(--work-muted); font-size: 11px; }
.work-required-note i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--work-coral); }
.work-grid-head, .work-day-row { display: grid; grid-template-columns: 130px 128px minmax(180px, .9fr) minmax(300px, 1.55fr) 92px; gap: 14px; align-items: center; }
.work-grid-head { padding: 11px 22px; background: #f7f9f9; color: #8a94a2; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.work-day-row { min-height: 96px; padding: 14px 22px; border-top: 1px solid #edf0f2; transition: background .18s ease; }
.work-day-row:first-child { border-top: 0; }
.work-day-row:hover { background: #fbfcfc; }
.work-day-identity { display: grid; gap: 4px; }
.work-day-identity strong { color: var(--work-navy); font-size: 17px; }
.work-day-identity time { color: var(--work-muted); font-size: 11px; }
.work-leave-cell { display: flex; }
.work-leave-select { min-height: 38px; min-width: 96px; padding: 0 10px; border: 1px solid #d7dfe2; border-radius: 10px; background: #fff; color: var(--work-navy); font: 700 12px/1 inherit; cursor: pointer; }
.work-leave-select:focus-visible { outline: 3px solid rgba(47,113,104,.25); }
.work-leave-select[data-leave-state="am"], .work-leave-select[data-leave-state="pm"] { border-color: #d9a75c; background: #fff8ea; color: #8c5a12; }
.work-leave-select[data-leave-state="full"] { border-color: #d9826f; background: #fff3f0; color: #a45a4b; }
.work-cell-field { min-width: 0; }
.work-mobile-label { display: none; }
.work-content-field textarea { min-height: 58px; }
.work-row-status { display: flex; align-items: center; gap: 6px; color: #8b95a2; font-size: 11px; font-weight: 700; white-space: nowrap; }
.work-row-status span { width: 7px; height: 7px; border-radius: 50%; background: #cbd2d7; }
.work-day-row.is-complete .work-row-status { color: var(--work-teal); }
.work-day-row.is-complete .work-row-status span { background: #62aa9e; }
.work-day-row.is-half-leave { background: #fffdf8; }
.work-day-row.is-half-leave.is-complete .work-row-status { color: #8c5a12; }
.work-day-row.is-half-leave.is-complete .work-row-status span { background: #d6942a; }
.work-day-row.is-leave { background: #f2f3f3; }
.work-day-row.is-leave .work-cell-field { opacity: .48; }
.work-day-row.is-leave input, .work-day-row.is-leave textarea { background: #e6e9ea; cursor: not-allowed; }
.work-day-row.is-leave .work-row-status { color: #a45a4b; }
.work-day-row.is-leave .work-row-status span { background: var(--work-coral); }
.work-day-row.needs-attention { animation: work-shake .35s linear 2; background: #fff3f0; }
@keyframes work-shake { 0%,100% { transform: translateX(0); } 35% { transform: translateX(-5px); } 70% { transform: translateX(5px); } }
.work-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  padding: 18px 22px;
  border: 1px solid var(--work-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(21,37,59,.05);
}
.work-actions > div:first-child { display: grid; gap: 4px; }
.work-actions > div:first-child strong { font-size: 13px; }
.work-actions > div:first-child small { color: var(--work-muted); font-size: 11px; }
.work-actions-buttons { display: flex; gap: 9px; }
.work-draft-button { min-height: 44px; padding: 0 17px; border: 1px solid #ccd5d9; border-radius: 11px; background: #fff; color: var(--work-ink); font-weight: 800; cursor: pointer; }
.work-submit-button { min-height: 44px; }
.work-toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  padding: 11px 16px;
  border-radius: 11px;
  background: var(--work-navy);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(21,37,59,.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.work-toast[data-tone="bad"] { background: #9c4432; }
.work-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .work-uniform { grid-template-columns: 1fr; }
  .work-uniform-fields { grid-template-columns: 1fr 1.3fr; }
  .work-apply-button { grid-column: 1 / -1; }
  .work-grid-head { display: none; }
  .work-day-list { display: grid; gap: 12px; padding: 14px; }
  .work-day-row { grid-template-columns: 1fr auto; gap: 14px; border: 1px solid var(--work-line); border-radius: 14px; padding: 16px; }
  .work-leave-cell { justify-content: flex-end; }
  .work-cell-field { grid-column: 1 / -1; }
  .work-mobile-label { display: block; }
  .work-row-status { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .work-nav { padding: 11px 16px; }
  .work-preview-badge, .work-user-name, .work-back { display: none; }
  .work-main { width: min(100% - 24px, 1320px); padding: 30px 0 38px; }
  .work-hero { display: grid; gap: 20px; }
  .work-copy-button { width: 100%; }
  .work-overview { grid-template-columns: 1fr; gap: 12px; }
  .work-save-state { justify-self: start; }
  .work-uniform { padding: 18px; }
  .work-uniform-fields { grid-template-columns: 1fr; }
  .work-week-title { align-items: flex-start; gap: 14px; padding: 18px; }
  .work-required-note { display: none; }
  .work-day-list { padding: 10px; }
  .work-actions { align-items: stretch; flex-direction: column; }
  .work-actions-buttons { display: grid; grid-template-columns: 1fr 1.35fr; }
}

/* Shared handover sheet */
.handover-app {
  --sheet-navy: #17263a;
  --sheet-ink: #1c2a3c;
  --sheet-muted: #687487;
  --sheet-green: #2f7168;
  --sheet-green-soft: #e9f4f1;
  --sheet-blue: #416f91;
  --sheet-line: #dce3e7;
  min-height: 100dvh;
  background:
    linear-gradient(rgba(26, 42, 60, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 42, 60, .025) 1px, transparent 1px),
    #f5f7f6;
  background-size: 28px 28px;
  color: var(--sheet-ink);
}
.handover-nav { position: sticky; top: 0; z-index: 20; }
.handover-shared-pill { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: var(--sheet-green-soft); color: var(--sheet-green); font-size: 11px; font-weight: 800; }
.handover-shared-pill i, .handover-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #55a799; box-shadow: 0 0 0 4px rgba(85,167,153,.12); }
.handover-main { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 54px; }
.handover-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.handover-hero h1 { margin: 0; color: var(--sheet-navy); font-size: clamp(34px, 5vw, 54px); letter-spacing: -.055em; }
.handover-hero > div:first-child > p:last-child { margin: 12px 0 0; color: var(--sheet-muted); font-size: 14px; }
.handover-presence { display: flex; align-items: center; gap: 12px; min-width: 245px; padding: 13px 16px; border: 1px solid var(--sheet-line); border-radius: 14px; background: rgba(255,255,255,.86); box-shadow: 0 10px 26px rgba(23,38,58,.06); }
.handover-presence > span:last-child { display: grid; gap: 3px; }
.handover-presence strong { font-size: 12px; }
.handover-presence small { color: var(--sheet-muted); font-size: 10px; }
.handover-guide { display: flex; align-items: center; gap: 7px; margin-bottom: 14px; padding: 13px 16px; border: 1px solid #bfd4cf; border-radius: 13px; background: #eff8f5; }
.handover-guide-key { min-width: 34px; display: inline-grid; place-items: center; padding: 6px 8px; border: 1px solid #abc5bf; border-bottom-width: 3px; border-radius: 7px; background: #fff; color: #315e58; font: 700 11px/1 "JetBrains Mono", monospace; }
.handover-guide-plus { color: #72908b; }
.handover-guide div { display: grid; gap: 2px; margin-left: 8px; }
.handover-guide strong { font-size: 12px; }
.handover-guide small { color: #64817c; font-size: 10px; }
.handover-guide button { margin-left: auto; border: 0; background: transparent; color: var(--sheet-green); font-size: 12px; font-weight: 800; cursor: pointer; }
.handover-guide button:hover { text-decoration: underline; }
.handover-sheet-card { overflow: hidden; border: 1px solid #d3dce0; border-radius: 16px; background: #fff; box-shadow: 0 18px 44px rgba(23,38,58,.08); }
.handover-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 70px; padding: 12px 16px; border-bottom: 1px solid var(--sheet-line); background: #fff; }
.handover-toolbar > div { display: flex; align-items: center; gap: 11px; }
.handover-sheet-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--sheet-navy); color: #fff; font-size: 13px; font-weight: 800; }
.handover-toolbar > div:first-child > span:last-child { display: grid; gap: 3px; }
.handover-toolbar strong { font-size: 14px; }
.handover-toolbar small { color: var(--sheet-muted); font-size: 10px; }
.handover-toolbar-actions button { min-height: 36px; padding: 0 12px; border-radius: 9px; font-size: 11px; font-weight: 800; cursor: pointer; }
.handover-sync-button { border: 1px solid #d1dade; background: #fff; color: var(--sheet-muted); }
.handover-sync-button:hover { border-color: var(--sheet-green); color: var(--sheet-green); }
.handover-add-button { border: 1px solid var(--sheet-green); background: var(--sheet-green); color: #fff; }
.handover-sheet-wrap { max-height: min(58vh, 620px); overflow: auto; background: #fff; }
.handover-sheet { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.handover-sheet th, .handover-sheet td { height: 48px; padding: 0; border-right: 1px solid var(--sheet-line); border-bottom: 1px solid var(--sheet-line); background: #fff; }
.handover-sheet thead th { position: sticky; top: 0; z-index: 5; width: 190px; min-width: 190px; background: #f0f4f4; }
.handover-sheet thead th:nth-child(5) { width: 260px; min-width: 260px; }
.handover-sheet thead th:last-child, .handover-sheet td:last-child { border-right: 0; }
.handover-sheet tbody tr:last-child th, .handover-sheet tbody tr:last-child td { border-bottom: 0; }
.handover-row-number { position: sticky; left: 0; z-index: 4; width: 54px !important; min-width: 54px !important; background: #f6f8f8 !important; color: #8c97a4; font: 600 10px/1 "JetBrains Mono", monospace; text-align: center; }
.handover-corner { z-index: 7 !important; }
.handover-row-number span { display: inline-block; }
.handover-remove-row { display: none; position: absolute; inset: 50% 7px auto auto; transform: translateY(-50%); width: 20px; height: 20px; padding: 0; border: 0; border-radius: 6px; background: #f4dfda; color: #a04b38; cursor: pointer; }
.handover-sheet tbody tr:hover .handover-remove-row { display: block; }
.handover-column-letter { position: absolute; top: 5px; left: 9px; color: #94a0ab; font: 700 8px/1 "JetBrains Mono", monospace; }
.handover-sheet thead input { width: 100%; height: 100%; padding: 14px 10px 4px; border: 0; background: transparent; color: #334256; font-size: 11px; font-weight: 800; text-align: center; }
.handover-sheet td { min-width: 190px; }
.handover-sheet td textarea { width: 100%; height: 100%; min-height: 47px; display: block; overflow: hidden; resize: none; padding: 14px 11px 7px; border: 0; border-radius: 0; background: transparent; color: var(--sheet-ink); font: 13px/1.35 "Noto Sans SC", sans-serif; white-space: pre-wrap; }
.handover-sheet th input:focus, .handover-sheet td textarea:focus { position: relative; z-index: 2; outline: 2px solid var(--sheet-green); outline-offset: -2px; background: #fbfffe; box-shadow: inset 0 0 0 1px var(--sheet-green); }
.handover-sheet td.handover-conflict, .handover-sheet th.handover-conflict, .handover-sheet tr.handover-conflict td { background: #fff3ef !important; }
.handover-sheet td.handover-conflict textarea, .handover-sheet th.handover-conflict input, .handover-sheet tr.handover-conflict textarea { box-shadow: inset 0 0 0 2px #d45b43; }
.handover-sheet tbody tr:hover td, .handover-sheet tbody tr:hover .handover-row-number { background: #fbfdfc !important; }
.handover-sheet-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 42px; padding: 8px 15px; border-top: 1px solid var(--sheet-line); background: #f8faf9; color: var(--sheet-muted); font-size: 10px; }
.handover-sheet-footer > span:first-child { display: flex; align-items: center; gap: 7px; }
.handover-sheet-footer i { width: 6px; height: 6px; border-radius: 50%; background: #55a799; }
.handover-sheet-footer em { font-style: normal; }
.handover-app.has-unsaved .handover-sheet-footer i { background: #e5a43f; }
.handover-app.has-conflict .handover-sheet-footer i { background: #d45b43; }
.handover-savebar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 15px; padding: 17px 19px; border: 1px solid var(--sheet-line); border-radius: 14px; background: rgba(255,255,255,.9); box-shadow: 0 10px 28px rgba(23,38,58,.05); }
.handover-savebar > div { display: grid; gap: 3px; }
.handover-savebar strong { font-size: 12px; }
.handover-savebar small { color: var(--sheet-muted); font-size: 10px; }
.handover-savebar button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--sheet-green); color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.handover-savebar button:hover { background: #245950; }
.handover-savebar button span { margin-left: 8px; }

@media (max-width: 900px) {
  .handover-nav { flex-wrap: wrap; padding-bottom: 0; }
  .handover-hero { align-items: flex-start; flex-direction: column; }
  .handover-presence { width: 100%; }
}
@media (max-width: 680px) {
  .handover-main { width: min(100% - 20px, 1500px); padding: 28px 0 40px; }
  .handover-nav .work-user { display: none; }
  .handover-guide { align-items: flex-start; flex-wrap: wrap; }
  .handover-guide div { width: calc(100% - 98px); }
  .handover-guide button { width: 100%; margin: 7px 0 0; padding: 8px; border-top: 1px solid #cfe0dc; }
  .handover-toolbar { align-items: flex-start; flex-direction: column; }
  .handover-toolbar-actions { width: 100%; display: grid !important; grid-template-columns: 1fr 1fr; }
  .handover-toolbar-actions button { width: 100%; }
  .handover-sheet-wrap { max-height: 56vh; }
  .handover-savebar { align-items: stretch; flex-direction: column; }
  .handover-savebar button { width: 100%; }
}

/* Four-module application home */
.portal-app,
.automodel-app {
  --portal-navy: #17263a;
  --portal-ink: #1e2c3c;
  --portal-muted: #6f7b88;
  --portal-line: #dce3e5;
  min-height: 100dvh;
  color: var(--portal-ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(55, 119, 109, .11), transparent 28%),
    radial-gradient(circle at 90% 86%, rgba(179, 117, 45, .1), transparent 27%),
    #f4f6f4;
}
.portal-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(24px, calc((100vw - 1260px) / 2));
  border-bottom: 1px solid rgba(214, 223, 224, .9);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(14px);
}
.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--portal-navy);
  text-decoration: none;
}
.portal-brand > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--portal-navy);
  color: #fff;
  font: 800 12px/1 "JetBrains Mono", monospace;
  letter-spacing: .08em;
}
.portal-brand > strong { display: grid; gap: 3px; font-size: 14px; }
.portal-brand small { color: #87919c; font: 700 8px/1 "JetBrains Mono", monospace; letter-spacing: .13em; }
.portal-user { display: flex; align-items: center; gap: 10px; }
.portal-user-copy { display: grid; gap: 2px; margin-right: 7px; }
.portal-user-copy strong { font-size: 12px; }
.portal-user-copy small { color: var(--portal-muted); font-size: 10px; }
.portal-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e4efec;
  color: #2f7168;
  font-size: 13px;
  font-weight: 800;
}
.portal-user form { display: block; }
.portal-user form input { display: none; }
.portal-user button,
.portal-admin-link,
.automodel-home {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #d4dcde;
  border-radius: 9px;
  background: #fff;
  color: #5e6976;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.portal-admin-link,
.automodel-home { display: inline-flex; align-items: center; }
.portal-main { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 76px 0 70px; }
.portal-intro p { display: flex; align-items: center; gap: 8px; margin: 0 0 13px; color: #35756c; font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.portal-intro p i { width: 7px; height: 7px; border-radius: 50%; background: #55a799; box-shadow: 0 0 0 5px rgba(85,167,153,.12); }
.portal-intro h1 { max-width: 780px; margin: 0; color: var(--portal-navy); font-size: clamp(36px, 5.2vw, 62px); line-height: 1.05; letter-spacing: -.055em; }
.portal-intro > span { display: block; margin-top: 17px; color: var(--portal-muted); font-size: 14px; }
.portal-readonly-note { margin: 25px 0 -7px; padding: 12px 15px; border: 1px solid #bfd4cf; border-radius: 11px; background: #edf7f4; color: #35675f; font-size: 12px; }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 42px; }
.portal-card {
  position: relative;
  min-height: 214px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 20px;
  overflow: hidden;
  padding: 26px;
  border: 1px solid var(--portal-line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  color: var(--portal-ink);
  text-decoration: none;
  box-shadow: 0 18px 42px rgba(23, 38, 58, .065);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.portal-card::before { content: ""; position: absolute; inset: auto -70px -85px auto; width: 190px; height: 190px; border-radius: 50%; background: rgba(47, 113, 104, .055); }
.portal-card:hover { transform: translateY(-4px); border-color: #b9c9c7; box-shadow: 0 25px 55px rgba(23, 38, 58, .11); }
.portal-card:focus-visible { outline: 3px solid rgba(47, 113, 104, .28); outline-offset: 3px; }
.portal-card-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #e7f1ef;
  color: #2f7168;
  font-size: 17px;
  font-weight: 900;
}
.portal-card-handover .portal-card-mark { background: #eaf0f6; color: #416f91; }
.portal-card-holiday .portal-card-mark { background: #f7eee3; color: #a56a27; }
.portal-card-automodel .portal-card-mark { background: #eeeaf6; color: #705c94; }
.portal-card-copy { min-width: 0; display: grid; }
.portal-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 29px; }
.portal-card-meta em { color: #a1aab3; font: 700 10px/1 "JetBrains Mono", monospace; font-style: normal; }
.portal-card-meta b { padding: 5px 8px; border-radius: 99px; background: #edf5f3; color: #35756c; font-size: 9px; }
.portal-card-automodel .portal-card-meta b { background: #f1edf7; color: #705c94; }
.portal-card-copy > strong { color: var(--portal-navy); font-size: 24px; letter-spacing: -.025em; }
.portal-card-copy > small { max-width: 420px; margin-top: 10px; color: var(--portal-muted); font-size: 12px; line-height: 1.65; }
.portal-card-arrow { position: relative; z-index: 1; align-self: end; color: #89939d; font-size: 23px; transition: transform .18s ease, color .18s ease; }
.portal-card:hover .portal-card-arrow { transform: translateX(5px); color: #2f7168; }

/* Automatic-model placeholder */
.automodel-main { min-height: calc(100dvh - 77px); display: grid; justify-items: center; align-content: center; padding: 48px 24px 100px; text-align: center; }
.automodel-mark { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 19px; background: #eeeaf6; color: #705c94; font-size: 23px; font-weight: 900; }
.automodel-main p { margin: 22px 0 9px; color: #705c94; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.automodel-main h1 { margin: 0; color: var(--portal-navy); font-size: clamp(40px, 6vw, 68px); letter-spacing: -.055em; }
.automodel-main > span:nth-of-type(2) { max-width: 520px; margin-top: 17px; color: var(--portal-muted); font-size: 13px; line-height: 1.7; }
.automodel-main > a { margin-top: 30px; padding: 13px 17px; border-radius: 11px; background: var(--portal-navy); color: #fff; font-size: 12px; font-weight: 800; text-decoration: none; }
.automodel-main > a i { margin-left: 8px; font-style: normal; }

/* Observer-safe handover view */
.handover-app[data-readonly="1"] .handover-sheet input,
.handover-app[data-readonly="1"] .handover-sheet textarea { color: #536171; cursor: default; }
.handover-app[data-readonly="1"] .handover-sheet input:focus,
.handover-app[data-readonly="1"] .handover-sheet textarea:focus { outline: none; background: transparent; box-shadow: none; }
.handover-readonly-bar { border-color: #bfd4cf; background: #eff8f5; }
.handover-readonly-bar a { min-height: 42px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 10px; background: var(--sheet-green); color: #fff; font-size: 11px; font-weight: 800; text-decoration: none; }

@media (max-width: 760px) {
  .portal-header { min-height: 68px; padding: 10px 16px; }
  .portal-user-copy { display: none; }
  .portal-main { width: min(100% - 24px, 1260px); padding: 48px 0 42px; }
  .portal-intro h1 { font-size: 38px; }
  .portal-grid { grid-template-columns: 1fr; margin-top: 30px; }
  .portal-card { min-height: 185px; padding: 21px; }
  .portal-card-copy > strong { font-size: 21px; }
}

@media (max-width: 430px) {
  .portal-card { grid-template-columns: auto 1fr; gap: 15px; }
  .portal-card-arrow { display: none; }
  .portal-card-meta { margin-bottom: 23px; }
  .portal-brand > strong { display: none; }
}
/* Shared workbook tabs */
.handover-sheets-bar{padding:16px 20px;border-bottom:1px solid #d7d2c6;background:#faf9f6}
.handover-sheet-tabs{display:flex;gap:8px;overflow-x:auto;padding-bottom:10px}
.handover-sheet-tab{white-space:nowrap;border:1px solid #d7d2c6;border-radius:7px;padding:9px 14px;background:#fff;color:#475569;cursor:pointer;font:inherit}
.handover-sheet-tab[aria-pressed="true"]{background:#224c41;color:#fff;border-color:#224c41}
.handover-sheet-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.handover-sheet-tools input{flex:1;min-width:180px;max-width:340px;border-radius:6px;padding:9px;font:inherit}
.handover-sheet-tools button{border:1px solid #d7d2c6;border-radius:6px;padding:9px 12px;background:white;cursor:pointer;font:inherit}
.handover-sheets-bar button:focus-visible{outline:3px solid #b07a22;outline-offset:2px}
.handover-sheets-bar button:disabled{opacity:.55;cursor:wait}
