:root {
  --ink: #142033;
  --muted: #6d7787;
  --line: #172032;
  --bg: #eef2f7;
  --paper: #ffffff;
  --blue: #4b46e8;
  --green: #078967;
  --danger: #c82032;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-weight: 700; }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
.login-view { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.login-panel { width: min(420px, 100%); background: white; border: 1px solid #d8dee8; border-radius: 8px; padding: 32px; box-shadow: 0 10px 28px rgba(20, 32, 51, .12); }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: 14px; }
.version-note { margin: 6px 0 0; color: var(--green); font-size: 14px; }
h1 { margin: 0; font-size: clamp(32px, 7vw, 48px); letter-spacing: 0; }
.passcode-input { width: 100%; height: 64px; margin: 12px 0; border: 2px solid #cfd6e3; border-radius: 8px; text-align: center; font-size: 32px; letter-spacing: 10px; background: #f3f6fb; }
.primary-button { background: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(75, 70, 232, .25); }
.login-panel .primary-button { width: 100%; height: 56px; border-radius: 8px; }
.error-text { min-height: 24px; color: var(--danger); }
.app-view { width: min(1180px, 100%); margin: 0 auto; padding: 16px clamp(10px, 3vw, 28px) 48px; }
.topbar { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; }
.save-state { white-space: nowrap; padding: 8px 12px; border-radius: 8px; color: var(--green); background: #e6f8f1; border: 1px solid #bfead9; }
.board-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.board-tab { min-height: 64px; border-radius: 8px; border: 2px solid #d8dee8; background: #fff; color: var(--ink); font-size: clamp(17px, 3vw, 25px); }
.board-tab.is-active { background: var(--blue); border-color: var(--blue); color: white; }
.controls, .panel { background: white; border: 1px solid #d8dee8; border-radius: 8px; padding: 16px; box-shadow: 0 4px 18px rgba(20, 32, 51, .08); }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; color: var(--muted); font-size: 14px; }
input, select { width: 100%; height: 50px; margin-top: 6px; padding: 0 14px; border: 1px solid #cfd6e3; border-radius: 8px; background: #f3f6fb; color: var(--ink); }
.button-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.button-grid button, .erase-button { min-height: 50px; border-radius: 8px; border: 1px solid #cfd6e3; background: #f3f6fb; color: var(--ink); }
.danger-button, .erase-button { color: var(--danger) !important; background: #fff4f5 !important; border-color: #f2c5cb !important; }
.selected-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.selected-box span { color: var(--muted); }
.selected-box strong { padding: 8px 12px; border-radius: 8px; background: #eef3ff; border: 1px solid #cdd8ff; }
.erase-button { padding: 8px 12px; }
.manage { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; margin: 14px 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head span { color: var(--muted); font-size: 14px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.stamp-chip, .staff-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; border: 2px solid #cfd6e3; border-radius: 8px; padding: 0 8px; background: white; }
.stamp-chip.is-active { outline: 3px solid var(--blue); }
.stamp-chip.is-action { background: #fff7e6; border-color: #f39a08; color: #7b3c00; }
.stamp-chip.is-action.is-active { outline: 3px solid #f39a08; }
.chip-main { min-height: 36px; padding: 0 4px; color: inherit; background: transparent; }
.chip-x { color: var(--danger); background: transparent; padding: 4px; }
.add-line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 12px; }
.add-line button { min-width: 82px; color: white; background: #24364f; border-radius: 8px; }
.color-input { width: 58px; padding: 4px; }
.staff-add { grid-template-columns: 1fr auto; }
.sheet { background: white; border-radius: 8px; padding: 28px; box-shadow: 0 10px 24px rgba(20, 32, 51, .11); overflow: hidden; }
.sheet-title { width: min(680px, 86%); margin: 0 auto 26px; border: 6px double var(--line); padding: 10px; text-align: center; }
.sheet-title h2 { margin: 0; font-size: clamp(32px, 7vw, 54px); letter-spacing: 0; }
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; user-select: none; scrollbar-gutter: stable; }
.table-wrap.is-dragging, .table-wrap.is-dragging .work-cell, .table-wrap.is-dragging .name-cell { cursor: grabbing; }
.schedule-table { border-collapse: collapse; table-layout: fixed; width: max-content; min-width: 100%; cursor: grab; }
.schedule-table th, .schedule-table td { width: 58px; min-width: 58px; height: 72px; border: 4px solid var(--line); text-align: center; vertical-align: middle; padding: 2px; font-size: 20px; }
.schedule-table th { background: #f0f4fa; }
.name-cell { width: 76px !important; min-width: 76px !important; writing-mode: vertical-rl; text-orientation: upright; }
tbody .name-cell { cursor: pointer; background: #f8fbff; }
tbody .name-cell:hover { background: #e9f1ff; }
.sat { color: #1766c2; background: #eef6ff !important; }
.sun, .holiday { color: #c82032; background: #fff1f1 !important; }
.work-cell { cursor: pointer; }
.work-cell.empty:hover { background: #f7f9fc; }
.cell-stamp { display: grid; place-items: center; min-height: 100%; border-radius: 2px; line-height: 1.12; white-space: pre-line; font-size: 18px; }
@media (max-width: 760px) {
  .topbar { align-items: start; }
  .board-tabs, .control-row, .button-grid, .manage { grid-template-columns: 1fr; }
  .sheet { padding: 18px 10px; }
  .schedule-table th, .schedule-table td { width: 54px; min-width: 54px; height: 70px; font-size: 18px; }
  .name-cell { width: 60px !important; min-width: 60px !important; }
}
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: white; }
  .no-print { display: none !important; }
  .app-view { width: 100%; padding: 0; }
  .sheet { box-shadow: none; border-radius: 0; padding: 0; }
  .table-wrap { overflow: visible; }
  .schedule-table { width: 100%; table-layout: fixed; }
  .schedule-table th, .schedule-table td { width: auto; min-width: 0; height: 42px; border-width: 2px; font-size: 11px; }
  .name-cell { width: 32px !important; min-width: 32px !important; }
  .sheet-title { margin-bottom: 10px; padding: 4px; }
  .sheet-title h2 { font-size: 28px; }
}
