:root {
  color-scheme: light;
  --page: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f7;
  --wrapper: #ffffff;
  --wrapper-rgb: 255,255,255;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-3: #93c5fd;
  --accent-rgb: 37,99,235;
  --accent-2-rgb: 29,78,216;
  --accent-3-rgb: 147,197,253;
  --accent-contrast: #ffffff;
  --accent-2-contrast: #ffffff;
  --morning: #e0f2fe;
  --night: #dbeafe;
  --male: #2563eb;
  --female: #db2777;
  --morning-rgb: 224,242,254;
  --night-rgb: 219,234,254;
  --male-rgb: 37,99,235;
  --female-rgb: 219,39,119;
  --morning-contrast: #0f172a;
  --night-contrast: #0f172a;
  --male-contrast: #ffffff;
  --female-contrast: #ffffff;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 14px 32px rgba(15, 23, 42, .07);
  --shadow-soft: 0 8px 18px rgba(15, 23, 42, .055);
  --max: 1240px;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}
body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  font-family: "Google Sans Flex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; touch-action: manipulation; background: none; }
button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), .16);
  outline-offset: 2px;
}
.container { width: min(var(--max), calc(100% - 32px)); margin-inline: auto; }
.is-hidden { display: none !important; }

.flat-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-box {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--accent);
}

.hero { padding: 18px 0 14px; }
.hero-grid { display: grid; gap: 16px; }
.hero-card {
  min-height: 172px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--wrapper);
  box-shadow: var(--shadow);
  contain: layout paint;
}
.hero-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}
.hero-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--accent);
}
.hero-icon .flat-icon { width: 25px; height: 25px; stroke-width: 1.8; }
.hero-copy { min-width: 0; }
h1 {
  max-width: 920px;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: clamp(2rem, 4.7vw, 4rem);
  font-weight: 950;
  line-height: .98;
  letter-spacing: -.055em;
}
.hero-text {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.95rem, 1.35vw, 1.04rem);
  line-height: 1.58;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: .78rem;
  font-weight: 850;
}
.dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
}

main.container { padding-bottom: 36px; }
.tools { margin: 18px 0 10px; }
.search-wrap { position: relative; min-width: 0; }
.search-wrap .flat-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search {
  width: 100%;
  min-height: 50px;
  padding: 0 18px 0 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: 0;
  color: var(--ink);
  background: var(--wrapper);
  box-shadow: var(--shadow-soft);
}
.search::placeholder { color: #94a3b8; }
.search:focus { border-color: var(--line-strong); box-shadow: var(--shadow-soft); }

.filter-panel {
  margin: 0 0 16px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--wrapper);
  box-shadow: var(--shadow-soft);
  contain: layout paint;
}
.public-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.filter-btn {
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
}
.filter-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.filter-copy { display: grid; gap: 2px; min-width: 0; }
.filter-copy span,
.filter-copy b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-copy span { color: var(--muted); font-size: .72rem; font-weight: 880; }
.filter-copy b { color: var(--ink); font-size: .76rem; font-weight: 950; }
.filter-btn.is-active { border-color: var(--line-strong); background: var(--surface-soft); }
.filter-btn.is-active .icon-box { border-color: var(--line-strong); background: var(--surface); color: var(--accent); }
.filter-summary { margin: 9px 2px 0; color: var(--muted); font-size: .76rem; line-height: 1.45; overflow-wrap: anywhere; }

.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--wrapper);
  box-shadow: var(--shadow);
  contain: layout paint;
}
.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 0;
  background: var(--wrapper);
}
.table-title-wrap { min-width: 0; max-width: 100%; }
.table-head h2 { margin: 0; color: var(--ink); font-size: 1.08rem; font-weight: 950; letter-spacing: -.02em; }
.table-head p { margin: 4px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.55; }
.week-switch {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(132px, 1fr));
  gap: 7px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}
.week-tab {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  background: transparent;
}
.week-copy { display: grid; gap: 2px; min-width: 0; }
.week-tab span,
.week-tab b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-tab span { color: var(--ink); font-size: .76rem; font-weight: 950; line-height: 1.1; }
.week-tab b { color: var(--muted); font-size: .66rem; font-weight: 850; line-height: 1.15; }
.week-tab.is-active { border-color: var(--line-strong); background: var(--surface); }
.week-tab:disabled { opacity: .52; cursor: not-allowed; }

.table-scroll {
  overflow: auto;
  padding: 16px;
  background: var(--wrapper);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-scroll::-webkit-scrollbar { height: 7px; width: 7px; }
.table-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line-strong); }
#scheduleTable {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--wrapper);
}
#scheduleTable[data-visible-cells="1"] { min-width: 500px; }
#scheduleTable[data-visible-cells="2"] { min-width: 700px; }
#scheduleTable[data-visible-cells="3"] { min-width: 840px; }
#scheduleTable[data-visible-cells="4"] { min-width: 980px; }
#scheduleTable th {
  padding: 13px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  font-size: .68rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
  background: var(--surface-muted);
}
#scheduleTable th:first-child { width: 17%; border-right-color: var(--line); background: var(--surface-soft); }
#scheduleTable th:not(:first-child) { width: 20.75%; }
#scheduleTable th.col-morning { background: var(--morning); color: var(--morning-contrast); }
#scheduleTable th.col-night { background: var(--night); color: var(--night-contrast); }
.th-label { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.th-label .flat-icon { width: 15px; height: 15px; }
#scheduleTable td {
  min-height: 128px;
  padding: 13px 12px;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--wrapper);
}
#scheduleTable td:last-child, #scheduleTable th:last-child { border-right: 0; }
#scheduleTable tbody tr:last-child td { border-bottom: 0; }
.date-cell { background: var(--surface-soft); }
.date-card { display: flex; flex-direction: column; gap: 8px; min-height: 100%; }
.date-card b { color: var(--ink); font-size: .96rem; font-weight: 920; line-height: 1.45; overflow-wrap: anywhere; }
.today-tag {
  display: none;
  width: max-content;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: .66rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.is-today .today-tag { display: inline-flex; }
.shift-cell {
  --shift-color: var(--morning);
  --shift-rgb: var(--morning-rgb);
  --shift-contrast: var(--morning-contrast);
  --person-color: var(--male);
  --person-rgb: var(--male-rgb);
  --person-contrast: var(--male-contrast);
}
#scheduleTable td.cell-morning {
  --shift-color: var(--morning);
  --shift-rgb: var(--morning-rgb);
  --shift-contrast: var(--morning-contrast);
  background: rgba(var(--morning-rgb), .20);
}
#scheduleTable td.cell-night {
  --shift-color: var(--night);
  --shift-rgb: var(--night-rgb);
  --shift-contrast: var(--night-contrast);
  background: rgba(var(--night-rgb), .20);
}
.cell-male { --person-color: var(--male); --person-rgb: var(--male-rgb); --person-contrast: var(--male-contrast); }
.cell-female { --person-color: var(--female); --person-rgb: var(--female-rgb); --person-contrast: var(--female-contrast); }
.shift-title {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--ink);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 9px;
}
.shift-title-main { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.shift-title-main .flat-icon { width: 14px; height: 14px; color: var(--ink); }
.shift-title b { color: var(--muted); font: inherit; font-weight: 850; }
.people { display: grid; grid-template-columns: 1fr; gap: 7px; align-content: start; min-width: 0; }
.person {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 7px 8px 7px 6px;
  border: 1px solid rgba(var(--person-rgb), .28);
  border-radius: 13px;
  background: var(--wrapper);
  color: var(--person-color);
  font-size: .80rem;
  font-weight: 780;
  line-height: 1.25;
}
.person-index {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(var(--person-rgb), .12);
  color: var(--person-color);
}
.person-index .flat-icon { width: 14px; height: 14px; stroke-width: 2; }
.person-name { min-width: 0; max-width: 100%; color: var(--ink); overflow-wrap: anywhere; word-break: break-word; }
.person-total {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 3px 7px;
  border: 1px solid rgba(var(--person-rgb), .24);
  border-radius: 999px;
  background: rgba(var(--person-rgb), .08);
  color: var(--person-color);
  font-size: .68rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}
.empty { display: inline-block; max-width: 100%; color: var(--muted); font-size: .82rem; font-style: italic; overflow-wrap: anywhere; }

.notes-table-panel {
  margin: 0 16px 16px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--wrapper);
  box-shadow: var(--shadow-soft);
  contain: layout paint;
}
.notes-table-panel.is-hidden { display: none; }
.notes-table-head { display: flex; align-items: center; margin-bottom: 9px; }
.notes-table-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: .02em;
  line-height: 1.1;
}
.notes-table-scroll { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.notes-table { width: 100%; min-width: 0; table-layout: fixed; border: 0; border-radius: 0; background: transparent; }
.notes-table td {
  position: relative;
  padding: 10px 12px 10px 30px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: .80rem;
  font-weight: 780;
  line-height: 1.45;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.notes-table td::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 13px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}
.notes-table tbody tr:last-child td { border-bottom: 0; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  :root { --shadow: 0 10px 24px rgba(15,23,42,.065); --shadow-soft: 0 6px 16px rgba(15,23,42,.05); }
  body { font-size: 12px; letter-spacing: -.005em; }
  .container, .hero .container { width: 100%; max-width: var(--max); padding-inline: 10px; }
  .hero { padding: 10px 0 12px; }
  .hero-card { min-height: 126px; padding: 14px; border-radius: 20px; }
  .hero-head { gap: 10px; }
  .hero-icon { width: 40px; height: 40px; min-width: 40px; border-radius: 14px; }
  .hero-icon .flat-icon { width: 20px; height: 20px; }
  h1 { margin-bottom: 7px; font-size: clamp(1.25rem, 7vw, 1.82rem); line-height: 1.04; letter-spacing: -.045em; }
  .hero-text { font-size: .74rem; line-height: 1.42; }
  .hero-meta { margin-top: 10px; }
  .pill { width: 100%; padding: 6px 8px; font-size: .62rem; line-height: 1.22; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  main.container { padding-bottom: 24px; }
  .tools { margin: 10px 0 8px; }
  .search-wrap .flat-icon { left: 12px; width: 16px; height: 16px; }
  .search { min-height: 42px; padding: 0 12px 0 36px; border-radius: 14px; font-size: .74rem; }
  .filter-panel { margin-bottom: 10px; padding: 7px; border-radius: 17px; }
  .public-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .filter-btn { min-height: 47px; padding: 6px; border-radius: 12px; }
  .filter-main { gap: 6px; }
  .icon-box { width: 28px; height: 28px; min-width: 28px; border-radius: 10px; }
  .icon-box .flat-icon { width: 15px; height: 15px; }
  .filter-copy span { font-size: .53rem; line-height: 1.1; font-weight: 900; }
  .filter-copy b { font-size: .58rem; line-height: 1.12; }
  .filter-summary { margin: 6px 1px 0; padding: 0 2px; font-size: .60rem; line-height: 1.32; }

  .table-shell { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .table-head { margin-bottom: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 16px; background: var(--wrapper); flex-direction: column; gap: 8px; }
  .table-head h2 { font-size: .90rem; line-height: 1.18; }
  .table-head p { margin-top: 2px; font-size: .68rem; line-height: 1.35; overflow-wrap: anywhere; }
  .week-switch { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 5px; border-radius: 14px; }
  .week-tab { min-height: 40px; padding: 6px 7px; border-radius: 11px; gap: 6px; }
  .week-tab .icon-box { display: none; }
  .week-tab span { font-size: .61rem; }
  .week-tab b { font-size: .52rem; }
  .table-scroll { padding: 0 0 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--wrapper); box-shadow: var(--shadow-soft); }
  .table-scroll::-webkit-scrollbar { height: 5px; }
  #scheduleTable { display: table; width: max-content; max-width: none; min-width: 650px; table-layout: fixed; border: 0; border-radius: 0; overflow: visible; background: transparent; }
  #scheduleTable[data-visible-cells="1"] { min-width: 300px; }
  #scheduleTable[data-visible-cells="2"] { min-width: 420px; }
  #scheduleTable[data-visible-cells="3"] { min-width: 535px; }
  #scheduleTable[data-visible-cells="4"] { min-width: 650px; }
  #scheduleTable th, #scheduleTable td { overflow: hidden; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; }
  #scheduleTable th { height: 34px; padding: 8px 7px; font-size: .50rem; letter-spacing: .045em; }
  #scheduleTable th:first-child { width: 120px; }
  #scheduleTable th:not(:first-child) { width: 132px; }
  #scheduleTable td { min-height: 0; padding: 7px; }
  .th-label { gap: 4px; }
  .th-label .flat-icon { width: 11px; height: 11px; }
  .date-card { gap: 5px; }
  .date-card b { font-size: .66rem; line-height: 1.32; }
  .today-tag { padding: 3px 5px; font-size: .48rem; }
  .shift-title { display: flex; margin-bottom: 6px; font-size: .52rem; letter-spacing: .045em; }
  .shift-title-main .flat-icon { width: 11px; height: 11px; }
  .people { gap: 5px; }
  .person { grid-template-columns: 21px minmax(0, 1fr) auto; gap: 5px; padding: 5px; border-radius: 10px; font-size: .61rem; line-height: 1.18; }
  .person-index { width: 20px; height: 20px; border-radius: 7px; }
  .person-index .flat-icon { width: 11px; height: 11px; }
  .person-total { min-width: 24px; padding: 2px 5px; font-size: .50rem; }
  .empty { font-size: .60rem; line-height: 1.25; }
  .notes-table-panel { margin: 8px 0 0; padding: 10px; border-radius: 16px; background: var(--wrapper); box-shadow: var(--shadow-soft); }
  .notes-table-head { margin-bottom: 7px; }
  .notes-table-head h3 { font-size: .66rem; }
  .notes-table-scroll { border-radius: 12px; }
  .notes-table td { padding: 8px 8px 8px 25px; font-size: .64rem; line-height: 1.35; }
  .notes-table td::before { top: 14px; left: 10px; width: 5px; height: 5px; }
  .toast { right: 10px; left: 10px; bottom: 10px; max-width: none; border-radius: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toast { transition-duration: 0ms; }
}
