:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #fff;
  --ink: #20252d;
  --muted: #576272;
  --line: #dbe0e7;
  --accent: #23549c;
  --focus: #2271ce;
  --day: #edf4fc;
  --day-ink: #254f7c;
  --night: #f1edf8;
  --night-ink: #534171;
  --rest-ink: #525c67;
  font: 100%/1.5 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}
*,*::before,*::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); min-width: 280px; }
button,input,select { font: inherit; color: inherit; }
button,select,summary { cursor: pointer; }
button:disabled,select:disabled { cursor: not-allowed; opacity: .65; }
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible,summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 1.25rem, 68rem); margin-inline: auto; }
.visually-hidden,.skip:not(:focus) { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: .65rem; left: .65rem; z-index: 2; background: #fff; color: var(--accent); padding: .5rem; }
.topbar { border-bottom: 1px solid var(--line); background: #fff; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 3.25rem; gap: .7rem; }
.brand { font-size: 1.125rem; margin: 0; font-weight: 700; }
.brand a { text-decoration: none; color: inherit; }
nav { display: flex; align-items: center; gap: .85rem; }
nav a { color: var(--muted); text-decoration: none; font-size: .875rem; padding: .5rem 0; white-space: nowrap; }
nav a:hover { text-decoration: underline; }
.workspace { display: grid; align-items: start; gap: .85rem; padding-top: 1rem; scroll-margin-top: .6rem; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: .32rem; padding: .75rem; }
.panel h2 { margin: 0; font-size: 1.13rem; line-height: 1.25; }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: .35rem; margin-bottom: .55rem; }
.month-navigation { display: flex; align-items: center; gap: .32rem; flex-shrink: 0; }
.square-button,.today-button,select,input:not([type="hidden"]),.primary-button { border: 1px solid var(--line); background-color: #fff; border-radius: .25rem; min-height: 2.55rem; }
.square-button,.today-button { min-height: 2.3rem; }
.square-button { width: 2.3rem; display: grid; place-items: center; padding: 0; }
.today-button { padding-inline: .5rem; white-space: nowrap; font-size: .875rem; }
.square-button:hover,.today-button:hover { border-color: #8b9aad; background: #f7f9fc; }
.stats { display: flex; flex-wrap: wrap; align-items: center; gap: .23rem .85rem; color: var(--muted); margin-bottom: .55rem; font-size: .875rem; }
.stats>div { display: inline-flex; align-items: center; gap: .19rem; white-space: nowrap; }
.stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { width: .56rem; height: .56rem; display: inline-block; flex-shrink: 0; border-radius: .07rem; }
.dot-day { background: #5b86b9; }
.dot-night { background: #8671a5; }
.dot-rest { background: #85909a; }
.weekdays,#calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); text-align: center; }
.weekdays { color: var(--muted); font-size: .79rem; padding: .34rem 0; border: 1px solid var(--line); border-bottom: 0; background: #f7f8fa; }
#calendar-grid { min-height: 12rem; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.calendar-day { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .12rem; min-width: 0; min-height: 2.9rem; padding: .24rem .06rem; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; color: var(--rest-ink); }
.calendar-day[data-shift="day"],.calendar-day[data-shift="work"] { background: var(--day); color: var(--day-ink); }
.calendar-day[data-shift="night"] { background: var(--night); color: var(--night-ink); }
.calendar-day.is-other-month { background: #f7f8fa; color: #66717d; }
.calendar-day:hover { box-shadow: inset 0 0 0 1px #7b91a7; }
.calendar-day.is-selected,.calendar-day[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day:focus-visible { outline-offset: -2px; z-index: 1; }
.day-number { font-size: .91rem; line-height: 1.12; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-shift { font-size: .75rem; line-height: 1.15; white-space: nowrap; }
.calendar-day.is-today .day-number { text-decoration: underline; text-underline-offset: .16rem; }
.calendar-day.is-override::after { content:""; position: absolute; top: .22rem; right: .22rem; width: .26rem; height: .26rem; border-radius: 50%; background: var(--accent); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .2rem .62rem; padding: 0; margin: .5rem 0 .55rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .24rem; white-space: nowrap; font-size: .78rem; }
.legend-mark { color: var(--accent); font-weight: 700; }
.action-bar { display: grid; gap: .48rem; align-items: center; padding-top: .56rem; border-top: 1px solid var(--line); }
.selected-info { display: flex; flex-wrap: wrap; gap: .15rem .5rem; color: var(--muted); font-size: .875rem; }
.selected-info strong { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.actions select { flex: 1 1 7rem; width: auto; }
.primary-button { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: .25rem; padding: .35rem .55rem; white-space: nowrap; background: var(--accent); border-color: var(--accent); color: #fff; font-size: .875rem; font-weight: 650; }
.primary-button:hover { background: #163f7c; }
.export-hint,.status,.privacy-note,.field small,.hours small { color: var(--muted); font-size: .84rem; }
.export-hint { margin: .5rem 0 0; }
.status { margin: 0; }
.status:not(:empty) { margin-top: .35rem; }
.settings h2 { margin-bottom: .7rem; scroll-margin-top: .65rem; }
.fields,.field { display: grid; }
.fields { gap: .6rem; }
.field { gap: .23rem; min-width: 0; }
.field label,.field-label { font-size: .875rem; font-weight: 650; margin: 0; }
input:not([type="hidden"]),select { min-width: 0; width: 100%; padding: .38rem .47rem; font-size: .94rem; }
select { appearance: none; padding-right: 1.65rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23576272' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .45rem center; background-size: 1rem; }
#custom-input[aria-invalid="true"] { border-color: #ac3d36; }
.advanced { border-block: 1px solid var(--line); margin-top: .66rem; }
.advanced summary { padding: .58rem 0; font-size: .875rem; }
.hours { min-width: 0; display: grid; gap: .5rem; margin: 0; padding: .1rem 0 .56rem; border: 0; }
.shift-name { display: flex; align-items: center; gap: .3rem; font-size: .875rem; color: var(--muted); }
.time-range { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: .3rem; align-items: center; }
.time-range span { font-size: .8rem; }
.time-range input { min-height: 2.3rem; padding-inline: .3rem; font-size: .88rem; }
.timezone-field { display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin: .62rem 0 0; }
.timezone-value { font-size: .875rem; color: var(--muted); }
.timezone-value strong { font-weight: 400; }
.privacy-note { margin: .45rem 0 0; }
.no-script { padding: .58rem; margin-bottom: 0; border: 1px solid var(--line); background: #fff; }
.guide { padding: 1.35rem 0 1rem; scroll-margin-top: .66rem; }
.guide h2 { font-size: 1.15rem; margin: 0 0 .27rem; }
.faqs details { border-bottom: 1px solid var(--line); }
.faqs summary { padding: .46rem .12rem; font-size: .94rem; }
.faqs p { margin: .1rem .12rem .62rem; color: var(--muted); max-width: 60rem; font-size: .9rem; }
.footer { padding: .1rem 0 .9rem; font-size: .84rem; color: var(--muted); }
@media (min-width: 42rem) {
  .shell { width: min(100% - 2.5rem,68rem); }
  .panel { padding: .95rem; }
  .panel h2 { font-size: 1.22rem; }
  .calendar-day { min-height: 3.35rem; align-items: flex-start; padding: .45rem .57rem; }
  .day-number { font-size: 1rem; }
  .day-shift { font-size: .82rem; }
  .legend li { font-size: .84rem; }
}
@media (min-width: 56rem) {
  .workspace { grid-template-columns: minmax(0,1fr) minmax(15rem,18rem); gap: 1rem; }
  .action-bar { grid-template-columns: minmax(0,1fr) auto; }
}
@media (max-width: 22.5rem) {
  .shell { width: calc(100% - .8rem); }
  .panel { padding: .55rem; }
  .stats { gap: .22rem .6rem; }
}

/* Common actions remain readable and reachable on narrow phones. */
.calendar-hint { color: var(--muted); width: 100%; font-size: .81rem; }
.square-button,.today-button,.actions select,.primary-button { min-height: 2.75rem; }
.square-button { width: 2.75rem; }
.calendar-day:focus-visible { outline: 3px dashed #8b3c18; outline-offset: -3px; }
.guide-links { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin: .2rem 0 .55rem; padding: 0; list-style: none; }
.guide-links a { color: var(--accent); display: inline-block; padding: .28rem .05rem; text-underline-offset: .16em; font-size: .9rem; }
@media (max-width: 42rem) {
  input:not([type="hidden"]),select { font-size: 1rem; }
  .actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
  .actions select { width: 100%; }
  .time-range input { font-size: 1rem; }
}
@media (max-width: 22.5rem) {
  .cal-head h2 { font-size: 1.03rem; }
  .month-navigation { gap: .24rem; }
  .actions { grid-template-columns: minmax(0,1fr); }
  .actions .primary-button { width: 100%; }
}
@media (forced-colors: active) {
  .calendar-day.is-selected { border: 2px solid Highlight; }
  .calendar-day:focus-visible { outline-color: CanvasText; }
}
