:root {
  color-scheme: light;
  --ink: #172943;
  --muted: #536681;
  --blue: #174dba;
  --line: #d8e0ec;
  --bg: #f4f6fb;
  --mon: #e6f7f5;
  --wed: #fff6da;
  --sat: #f2ebfa;
  --danger: #b32633;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #6687e5;
  outline-offset: 3px;
}
button svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover {
  background: #edf2fc;
}
.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.primary:hover {
  background: #113e99;
}
.quiet {
  background: transparent;
  border-color: transparent;
}
.danger {
  color: var(--danger);
}
.danger:hover {
  background: #fff0f1;
}
.icon-btn {
  padding: 10px;
  min-width: 44px;
}
.app {
  max-width: 1160px;
  margin: auto;
  padding: 26px 28px 32px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.mark {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
h1 {
  font-size: 1.5rem;
  letter-spacing: -0.035em;
  margin: 0;
  font-weight: 750;
}
.subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 2px;
}
.top-actions {
  display: flex;
  gap: 8px;
}
.week-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.week-label {
  margin: 0;
  min-width: 255px;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  text-align: center;
  font-weight: 700;
}
.week-label small {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  margin-top: 2px;
}
.week-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.save-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.save-status {
  display: flex;
  align-items: center;
  gap: 5px;
}
.save-status svg {
  width: 17px;
  height: 17px;
  color: #257351;
}
.save-status.error {
  color: var(--danger);
}
.save-status.error svg {
  color: var(--danger);
}
.save-status.pending {
  color: #975608;
}
.notice {
  border: 1px solid #e8c786;
  background: #fff6e6;
  color: #694700;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 0.9375rem;
  margin: 0 0 15px;
}
.notice button {
  font-size: 0.875rem;
  padding: 5px 8px;
  min-height: 36px;
  margin-left: 6px;
}
.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 5px 18px #23345606;
}
table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}
th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
th:last-child,
td:last-child {
  border-right: 0;
}
tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}
thead th {
  padding: 14px 10px;
  font-size: 1rem;
  text-align: left;
  font-weight: 700;
}
thead .time-head {
  width: 132px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  padding-left: 18px;
}
thead th.day-head {
  padding-left: 17px;
  border-top: 4px solid;
  vertical-align: top;
}
thead th.mon {
  border-top-color: #269991;
  background: var(--mon);
}
thead th.wed {
  border-top-color: #bf931b;
  background: var(--wed);
}
thead th.sat {
  border-top-color: #9471bf;
  background: var(--sat);
}
.day-date {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 1px;
}
.day-count {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 5px;
}
tbody th {
  padding: 14px 8px;
  font-size: 0.9375rem;
  white-space: nowrap;
  text-align: center;
  font-weight: 550;
  background: #fafbfd;
  font-variant-numeric: tabular-nums;
}
td {
  padding: 7px 10px;
  vertical-align: middle;
  height: 107px;
}
.slots {
  display: grid;
  gap: 5px;
}
.slot {
  min-height: 43px;
  width: 100%;
  justify-content: flex-start;
  border: 1px solid transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-weight: 500;
  font-size: 1rem;
  overflow: hidden;
}
.slot.empty {
  background: #f8fafd;
  color: #697a92;
  font-size: 0.875rem;
  font-weight: 400;
  border: 1px solid #e7ecf3;
}
.slot.empty:hover {
  color: var(--blue);
  border-color: #8ca8df;
  background: #eef3fd;
}
.slot.mon.filled {
  background: var(--mon);
}
.slot.wed.filled {
  background: var(--wed);
}
.slot.sat.filled {
  background: var(--sat);
}
.slot.filled:hover {
  filter: brightness(0.97);
}
.slot .person-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.slot.filled svg {
  margin-left: auto;
  width: 15px;
  height: 15px;
  opacity: 0.45;
}
.not-standing {
  font-size: 0.875rem;
  color: #718096;
  text-align: center;
  background: #f8f9fc;
}
.mobile-tabs {
  display: none;
}
.bottom {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.bottom-note {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}
.footer-tools {
  display: flex;
  gap: 7px;
}
.bottom button {
  font-size: 0.875rem;
}
.bottom #view-btn {
  margin-left: auto;
  white-space: normal;
}
.overlay {
  position: fixed;
  inset: 0;
  background: #10213c77;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
}
.overlay[hidden],
[hidden] {
  display: none !important;
}
.dialog {
  width: min(100%, 465px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 17px;
  box-shadow: 0 15px 70px #10213c44;
  padding: 23px;
}
.dialog.wide {
  width: min(100%, 730px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}
.dialog-head .icon-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 7px;
}
.field {
  display: block;
  margin: 0 0 16px;
}
.field > span {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%;
  min-height: 48px;
  background: #fff;
  border: 1px solid #c8d3e2;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 1rem;
}
.two-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-hint {
  font-size: 0.875rem;
  color: var(--muted);
  margin: -5px 0 16px;
}
.form-error {
  font-size: 0.9375rem;
  color: var(--danger);
  background: #fff1f2;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.dialog-actions.spread {
  justify-content: space-between;
}
.dialog p {
  margin: 0 0 13px;
}
.secondary-text {
  font-size: 0.9375rem;
  color: var(--muted);
}
.export-preview {
  background: #eef1f7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 14px;
}
.export-preview img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}
.help-list {
  padding-left: 21px;
  margin: 0;
}
.help-list li {
  margin-bottom: 13px;
}
.help-list b {
  display: block;
  margin-bottom: 2px;
}
.help-list p {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0;
}
.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #172943;
  color: #fff;
  box-shadow: 0 4px 22px #10213c30;
  border-radius: 11px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: calc(100% - 28px);
  z-index: 60;
  font-size: 0.9375rem;
}
.toast button {
  background: transparent;
  border: 1px solid #ffffff66;
  color: #fff;
  min-height: 35px;
  padding: 5px 9px;
  font-size: 0.875rem;
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: 245px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 30px #24375020;
  padding: 5px;
}
.menu button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  font-size: 0.9375rem;
  padding: 12px;
}
.menu-anchor {
  position: relative;
}
.range-summary {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.loading {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}
.conflict-warning {
  margin: 0 0 14px;
  background: #fff6e6;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #694700;
}
.noscript {
  margin: 20px;
  padding: 20px;
  background: #fff1f2;
  color: #9e1b29;
}
@media (min-width: 760px) {
  .day-head.current {
    box-shadow: inset 0 -3px 0 var(--blue);
  }
}
@media (max-width: 900px) {
  .app {
    padding: 22px 20px;
  }
  .week-panel {
    align-items: flex-start;
  }
  .week-label {
    min-width: 230px;
    font-size: 1.15rem;
  }
  .week-actions .current-week {
    display: none;
  }
  .topbar {
    gap: 10px;
  }
  thead .time-head {
    width: 116px;
  }
  td {
    padding: 7px;
  }
  .slot {
    padding: 8px;
    font-size: 0.9375rem;
  }
}
@media (max-width: 759px) {
  .app {
    padding: 18px 14px 24px;
  }
  .topbar {
    margin-bottom: 20px;
    align-items: flex-start;
  }
  .mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
  .identity {
    gap: 10px;
  }
  h1 {
    font-size: 1.2rem;
    letter-spacing: -0.025em;
  }
  .subtitle {
    font-size: 0.8125rem;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions .icon-btn {
    min-width: 38px;
    min-height: 40px;
    padding: 8px;
  }
  .week-panel {
    display: block;
  }
  .week-nav {
    justify-content: space-between;
    gap: 5px;
  }
  .week-label {
    min-width: 0;
    font-size: 1.13rem;
  }
  .week-nav .icon-btn {
    background: white;
  }
  .week-actions {
    margin-top: 14px;
  }
  .week-actions .primary {
    flex: 1;
    min-height: 46px;
  }
  .week-actions .current-week {
    display: flex;
    font-size: 0.875rem;
    padding: 10px;
  }
  .save-line {
    font-size: 0.8125rem;
    gap: 8px;
    margin-top: 4px;
  }
  .save-line .capacity-note {
    font-size: 0.8125rem;
  }
  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin: 15px 0 11px;
  }
  .mobile-tabs button {
    padding: 10px 4px;
    display: block;
    min-height: 63px;
    border: 1px solid transparent;
    opacity: 1;
    font-size: 0.9375rem;
    border-radius: 10px;
  }
  .mobile-tabs .mon {
    background: var(--mon);
  }
  .mobile-tabs .wed {
    background: var(--wed);
  }
  .mobile-tabs .sat {
    background: var(--sat);
  }
  .mobile-tabs button.active {
    border-color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
    color: #123c83;
  }
  .mobile-tabs .tab-date {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    margin-top: 2px;
  }
  .table-wrap {
    border-radius: 11px;
  }
  thead {
    display: none;
  }
  thead .time-head {
    width: 97px;
  }
  tbody th {
    width: 92px;
    font-size: 0.875rem;
    white-space: normal;
    line-height: 1.5;
    padding: 10px 7px;
  }
  tbody th .time-divider {
    display: none;
  }
  tbody th .time-end {
    display: block;
    color: var(--muted);
    font-weight: 400;
  }
  td {
    height: 105px;
    padding: 7px 9px;
  }
  .slot {
    min-height: 43px;
    font-size: 1rem;
    padding: 8px 11px;
  }
  .slot.empty {
    font-size: 0.9375rem;
  }
  .hide-day {
    display: none !important;
  }
  .bottom {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 12px;
  }
  .bottom-note {
    max-width: 100%;
    font-size: 0.8125rem;
  }
  .bottom #view-btn {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }
  .footer-tools {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }
  .footer-tools button {
    padding: 8px 9px;
  }
  .overlay {
    padding: 14px;
    align-items: center;
  }
  .dialog {
    padding: 19px;
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
    border-radius: 14px;
  }
  .dialog-head {
    margin-bottom: 16px;
  }
  .dialog-head h2 {
    font-size: 1.18rem;
  }
  .dialog-actions button {
    flex-grow: 1;
  }
  .dialog-actions .danger {
    flex-grow: 0;
  }
  .help-list {
    padding-left: 20px;
  }
  .toast {
    bottom: max(15px, env(safe-area-inset-bottom));
    font-size: 0.875rem;
  }
  .range-summary {
    font-size: 0.8125rem;
  }
}
@media (max-width: 350px) {
  .identity {
    gap: 7px;
  }
  .mark {
    display: none;
  }
  h1 {
    font-size: 1.1rem;
  }
  .capacity-note {
    display: none;
  }
  .week-label {
    font-size: 1rem;
  }
  .mobile-tabs button {
    font-size: 0.875rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.12s,
      border-color 0.12s;
  }
}
@media print {
  body {
    background: white;
  }
  .app {
    padding: 0;
  }
  .top-actions,
  .week-actions,
  .save-line,
  .mobile-tabs,
  .bottom,
  .notice,
  .overlay,
  .toast {
    display: none !important;
  }
  .table-wrap {
    border-radius: 0;
    box-shadow: none;
  }
  thead {
    display: table-header-group;
  }
  td.hide-day,
  th.hide-day {
    display: table-cell !important;
  }
  .slot.empty {
    border: none;
    background: none;
    color: transparent;
  }
  .slot.filled svg {
    display: none;
  }
  .slot.filled {
    background: none;
    font-size: 13px;
  }
  .slot {
    min-height: 24px;
    padding: 2px;
  }
  .slots {
    gap: 2px;
  }
  td {
    height: 56px;
  }
  tbody th {
    font-size: 12px;
  }
  .week-label {
    text-align: left;
  }
  .week-nav button {
    display: none;
  }
  .topbar {
    margin-bottom: 10px;
  }
  .mark {
    display: none;
  }
  .day-count {
    display: none;
  }
  thead .time-head {
    width: 110px;
  }
  .not-standing {
    background: white;
  }
  .week-panel {
    margin-bottom: 10px;
  }
  .week-label small {
    font-size: 12px;
  }
  @page {
    size: A4 landscape;
    margin: 12mm;
  }
}
.people-directory-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 250px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbfd;
}
.people-directory-list li {
  padding: 7px 9px 7px 13px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.directory-person-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.directory-delete {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  background: transparent;
  border-color: transparent;
}
.people-directory-list li:last-child {
  border-bottom: 0;
}
.people-directory-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 18px 0 8px !important;
}
.directory-add {
  width: 100%;
  min-height: 46px;
}
.directory-intro {
  font-size: 0.9375rem;
  color: var(--muted);
}
.directory-empty {
  padding: 20px 13px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}
.directory-saved {
  font-size: 0.9375rem;
  color: #257351;
  background: #eff8f2;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}
.directory-saved.warning {
  color: #694700;
  background: #fff6e6;
}
@media (max-width: 759px) {
  .people-directory-list {
    max-height: 220px;
  }
}

.backup-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  overscroll-behavior: contain;
}
.backup-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.backup-list li:last-child {
  border: 0;
}
.backup-copy-info {
  min-width: 0;
}
.backup-copy-info strong,
.backup-copy-info span {
  display: block;
}
.backup-copy-info strong {
  font-size: 0.9375rem;
}
.backup-copy-info span {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 4px;
}
.backup-copy-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}
.backup-copy-actions button {
  font-size: 0.8125rem;
  padding: 8px 10px;
}
.backup-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.backup-tools button {
  flex: 1;
  font-size: 0.9375rem;
}
.backup-summary {
  font-size: 0.875rem;
  color: var(--muted);
}
.backup-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.875rem;
}
@media (max-width: 599px) {
  .backup-list {
    max-height: 270px;
  }
  .backup-list li {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .backup-copy-actions button {
    flex: 1;
  }
  .backup-tools {
    flex-direction: column;
  }
  .backup-tools button {
    font-size: 0.875rem;
  }
}
.hour-btn {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 8px 0;
  border: 0;
  border-radius: 7px;
  display: block;
  background: transparent;
  font-size: inherit;
  font-weight: 550;
  line-height: inherit;
  white-space: nowrap;
}
.hour-btn:hover {
  background: #edf2fc;
}
.hour-btn:disabled {
  background: transparent;
}
@media (max-width: 759px) {
  .hour-btn {
    white-space: normal;
  }
}
