:root {
  color-scheme: light;
  --ink: #20332f;
  --muted: #53645f;
  --brand: #1d6653;
  --brand-hover: #145240;
  --canvas: #f5f8f5;
  --paper: #ffffff;
  --border: #d5e0da;
  --available: #b7e3ca;
  --available-ink: #10432f;
  --closed: #e2e5e6;
  --closed-ink: #39454a;
  --booked: #c9b3ed;
  --booked-ink: #392165;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 3px solid #186754; outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; z-index: 5; left: 16px; top: -60px; padding: 10px 14px; background: var(--paper); }
.skip:focus { top: 12px; }
.site-header { min-height: 70px; padding: 12px max(24px, calc((100vw - 1480px)/2)); display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); background: var(--paper); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 20px; white-space: nowrap; }
.brand small { margin-left: 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.brand-mark { display: inline-block; width: 30px; height: 30px; border: 8px solid var(--brand); border-radius: 10px 17px 10px 17px; transform: rotate(-15deg); }
.preview-badge { border: 1px solid #e3c594; border-radius: 100px; background: #fff6e8; color: #754b19; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.layout { max-width: 1480px; margin: auto; padding: 32px 24px 70px; }
.preflight-result { margin: -9px 0 18px; padding: 10px 14px; border: 1px solid #e3c594; border-radius: 10px; background: #fffaf0; color: #684718; font-size: 14px; }
.heading-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: var(--brand); font-size: 13px; font-weight: 700; letter-spacing: .12em; margin: 0 0 8px; }
h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 18px; line-height: 1.3; margin: 0; }
.intro { color: var(--muted); max-width: 72ch; margin: 0; }
.actions, .week-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.button { min-height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 9px 15px; color: var(--ink); background: var(--paper); font-weight: 600; transition: background .18s ease, border-color .18s ease; }
.button:not(:disabled):hover { background: #eaf2ed; border-color: #9bb9aa; }
.button-primary { background: var(--brand); color: white; border-color: var(--brand); }
.button-primary:not(:disabled):hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.button-danger { color: #9a342e; border-color: #d7a49e; background: #fff8f7; }
.button-danger:not(:disabled):hover { background: #fbece9; border-color: #bd6b63; }
.mode-button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: white; box-shadow: 0 0 0 2px #89b7a0; }
.mode-button[aria-pressed="true"]:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
#new-close[aria-pressed="true"] { background: #505c62; border-color: #505c62; color: #fff; box-shadow: 0 0 0 2px #aab4b8; }
.button-compact { padding-inline: 12px; }
.button-full { width: 100%; margin-top: 16px; }
.workspace { display: block; }
.calendar-card, .panel-card { background: var(--paper); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 8px 28px rgba(27, 57, 43, .04); }
.calendar-card { padding: 22px; overflow: hidden; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.mode-hint { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.calendar-feedback { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #e9f5ec; color: var(--available-ink); font-size: 14px; }
.selection-message { margin: 0 0 8px; color: var(--closed-ink); font-size: 13px; }
.selection-message:empty { display: none; }
.create-dialog { width: min(560px, calc(100vw - 24px)); max-height: min(90dvh, 900px); padding: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px rgba(20, 48, 35, .24); }
.create-dialog::backdrop { background: rgba(16, 36, 29, .55); }
.create-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.dialog-heading .eyebrow { margin-bottom: 4px; }
.dialog-heading h2 { font-size: 23px; }
.dialog-close { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 9px; background: #eef3ef; color: var(--ink); font-size: 26px; line-height: 1; }
.dialog-close:hover { background: #dfe9e1; }
.form-section { margin: 18px 0 0; padding: 0; border: 0; }
.form-section legend { color: var(--ink); font-size: 16px; font-weight: 700; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.empty-option { margin-top: 10px; padding: 14px; border: 1px dashed #afbeb4; border-radius: 10px; background: #f8faf8; color: var(--muted); font-size: 14px; }
.choice-row { display: flex !important; align-items: center; gap: 12px; min-height: 56px; margin-top: 8px !important; padding: 8px 12px; border: 1px solid #93bfa6; border-radius: 10px; background: #eef8f1; cursor: pointer; }
.choice-row input { width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: var(--brand); }
.choice-row strong, .choice-row small { display: block; }
.choice-row small { color: var(--muted); font-weight: 400; }
.create-dialog textarea { display: block; width: 100%; padding: 10px; border: 1px solid #b8c7be; border-radius: 9px; color: var(--ink); background: var(--paper); font: inherit; resize: vertical; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; margin-top: 18px; }
.manual-editor { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.manual-editor summary { cursor: pointer; color: var(--brand); font-size: 14px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--border); display: inline-block; }
.dot.available { background: var(--available); border-color: #579a73; }
.dot.booked { background: var(--booked); border-color: #8560bf; }
.dot.closed { background: #e9edef; border-color: #89979b; }
.dot.empty { background: var(--paper); border-color: #9ca9a2; }
.time-grid { display: grid; grid-template-columns: 54px repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; user-select: none; }
.grid-header, .time-label, .grid-cell { border-right: 1px solid var(--border); border-bottom: 1px solid #e9efeb; }
.time-label, .grid-cell { border-right-color: #edf3ef; border-bottom-color: #f2f5f3; }
.time-label[data-half-boundary="true"], .grid-cell[data-half-boundary="true"]:not([data-block]) { border-bottom: 1px dashed #dce7e0; }
.grid-header { min-height: 55px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-size: 13px; font-weight: 600; background: #f8faf8; }
.grid-header small { font-size: 12px; color: var(--muted); font-weight: 400; }
.time-label { display: flex; justify-content: center; align-items: flex-start; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 5px; }
.grid-cell { position: relative; min-height: 44px; padding: 2px 4px; background: var(--paper); }
.grid-cell[data-block] { padding-block: 0; border-bottom-color: transparent; }
.grid-cell[data-block="available"] { background: linear-gradient(to right, var(--paper) 4px, var(--available) 4px, var(--available) calc(100% - 4px), var(--paper) calc(100% - 4px)); }
.grid-cell[data-block="closed"] { background: linear-gradient(to right, var(--paper) 4px, #e9edef 4px, #e9edef calc(100% - 4px), var(--paper) calc(100% - 4px)); }
.grid-cell[data-block="booked"] { background: linear-gradient(to right, var(--paper) 4px, var(--booked) 4px, var(--booked) calc(100% - 4px), var(--paper) calc(100% - 4px)); }
.grid-cell[data-block][data-run-end="true"] { border-bottom-color: #e9efeb; }
.grid-cell[data-selectable="true"] { cursor: crosshair; }
.grid-cell[data-selected="true"] { background: #95d4ad; box-shadow: inset 0 0 0 2px #28774c; }
.grid-cell[data-selected="true"] .slot-button { background: transparent; color: #124b36; font-weight: 700; }
.grid-cell[data-selected="true"][data-selection-kind^="manage"] { background: #d7e7f2; box-shadow: inset 0 0 0 2px #38627d; }
.grid-cell[data-selected="true"][data-selection-kind^="manage"] .slot-button { background: transparent; color: #204c66; }
.slot-button { display: flex; flex-direction: column; justify-content: center; gap: 1px; width: 100%; min-height: 38px; padding: 3px 6px; border: 1px solid transparent; border-radius: 7px; text-align: left; background: transparent; color: var(--muted); font-size: 12px; line-height: 1.25; }
.slot-button:hover { background: #f0f6f1; border-color: var(--border); }
.slot-button.status-empty { color: transparent; }
.slot-button.status-empty::after { content: "＋"; position: absolute; top: 10px; left: 10px; color: #60776a; opacity: 0; transition: opacity .16s ease; }
.slot-button.status-empty:hover::after, .slot-button.status-empty:focus-visible::after { opacity: 1; }
.slot-button.status-available { background: var(--available); color: var(--available-ink); border-color: #579a73; font-weight: 700; }
.slot-button.status-closed { background: #e9edef; color: #33474d; border-color: #89979b; font-weight: 700; }
.slot-button.status-booked, .slot-button.status-booked:disabled { background: var(--booked); color: var(--booked-ink); border-color: #8662bd; font-weight: 700; opacity: 1; cursor: default; }
.slot-button.status-closed:hover { background: #dfe6e8; }
.grid-cell[data-block] .slot-button { min-height: 44px; height: 100%; border-top: 0; border-bottom: 0; border-radius: 0; padding-inline: 11px; }
.grid-cell[data-block][data-run-start="true"] .slot-button { border-top: 1px solid; border-radius: 10px 10px 0 0; }
.grid-cell[data-block][data-run-end="true"] .slot-button { border-bottom: 1px solid; border-radius: 0 0 10px 10px; }
.grid-cell[data-block][data-run-start="true"][data-run-end="true"] .slot-button { border-radius: 10px; }
.grid-cell[data-block="available"] .slot-button { border-inline-color: #579a73; }
.grid-cell[data-block="closed"] .slot-button { border-inline-color: #89979b; }
.grid-cell[data-block="booked"] .slot-button { border-inline-color: #8662bd; }
.grid-cell[data-block] .slot-button:hover { filter: brightness(.98); }
.slot-button small { font-weight: 500; font-size: 12px; }
.slot-button .block-note { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.slot-button .block-time { font-variant-numeric: tabular-nums; }
.manage-note { margin: 14px 0; padding: 10px 12px; border-radius: 9px; color: var(--closed-ink); background: #f0f3f4; overflow-wrap: anywhere; }
.login-screen { min-height: min(72vh, 720px); display: grid; place-items: center; padding: 24px; }
.login-screen[hidden], .layout[hidden] { display: none; }
.login-card { width: min(100%, 420px); padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--paper); box-shadow: 0 12px 36px #24493914; }
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.login-card .button { width: 100%; margin-top: 20px; }
.account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.side-panel { display: grid; gap: 16px; }
.panel-card { padding: 20px; }
.panel-heading { display: flex; align-items: center; gap: 10px; }
.step { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--brand); background: #e7f2eb; font-size: 12px; font-weight: 700; }
.panel-copy { margin: 8px 0 16px; }
.edit-scope { padding: 10px; border: 1px solid #b5d4c3; border-radius: 10px; background: #f0f8f2; }
.edit-scope p { margin: 0 0 8px; font-size: 13px; }
.edit-scope .button { min-height: 38px; margin: 0 5px 5px 0; padding: 7px 9px; font-size: 12px; }
form label { display: block; margin: 13px 0 5px; color: var(--ink); font-size: 14px; font-weight: 600; }
form input, form select, .mobile-day-select { display: block; width: 100%; min-height: 44px; padding: 8px 10px; color: var(--ink); background: var(--paper); border: 1px solid #b8c7be; border-radius: 9px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.repeat-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 7px; }
.repeat-row span { font-weight: 600; }
.repeat-row input, .repeat-row select { margin: 0; }
.form-error { margin: 12px 0 0; color: #ad2f25; font-size: 14px; }
.draft-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.draft-list li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 9px; background: #f8faf8; padding: 7px 7px 7px 10px; font-size: 13px; }
.draft-list li span { flex: 1; }
.remove-draft { min-height: 35px; min-width: 43px; border: 0; border-radius: 7px; background: transparent; color: #963c30; }
.remove-draft:hover { background: #f7e6df; }
.preview-summary { margin-top: 14px; padding: 12px; border-radius: 10px; background: #eef6f0; color: #224d39; font-size: 14px; }
.safe-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.mobile-day-label, .mobile-day-select { display: none; }
@media (max-width: 1120px) { .heading-row { align-items: start; flex-direction: column; } }
@media (max-width: 640px) {
  .create-dialog form { padding: 18px; }
  .dialog-actions .button { flex: 1; }
  .site-header { padding: 12px 16px; align-items: start; flex-direction: column; }
  .layout { padding: 22px 12px 50px; }
  .heading-row { gap: 18px; }
  .account-actions { width: 100%; }
  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .actions .button { padding-inline: 5px; font-size: 13px; }
  #manage-dialog .dialog-actions .button { flex: 1 1 130px; }
  #manage-dialog .dialog-actions .button-danger { flex-basis: 100%; }
  .calendar-card { padding: 14px; }
  .calendar-toolbar { align-items: start; flex-direction: column; }
  .week-controls { width: 100%; }
  .week-controls .button { flex: 1; }
  .mobile-day-label, .mobile-day-select { display: block; }
  .mobile-day-label { margin: 0 0 5px; font-size: 14px; font-weight: 600; }
  .mobile-day-select { margin-bottom: 12px; }
  .time-grid { grid-template-columns: 60px 1fr; }
  .grid-header { min-height: 45px; }
  .grid-cell { min-height: 48px; }
  .slot-button { min-height: 42px; font-size: 13px; }
  .slot-button.status-empty { color: var(--muted); }
  .slot-button.status-empty::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
