    :root {
      color-scheme: light;
      --accent: #566be9;
      --accent-soft: #e9edff;
      --text: #1d2940;
      --muted: #77839b;
      --stroke: #e4e9f2;
      --page: #f6f8fc;
      --white: #fff;
    }
    * { box-sizing: border-box; }
    body { min-width: 300px; margin: 0; background: var(--page); color: var(--text); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
    button, input { font: inherit; }
    button { cursor: pointer; }
    button:focus-visible, input:focus-visible { outline: 3px solid rgba(86,107,233,.3); outline-offset: 2px; }
    .container { max-width: 1480px; padding: 38px 26px 60px; margin: 0 auto; }
    .header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
    .eyebrow { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .17em; font-weight: 800; margin-bottom: 10px; }
    h1 { font-size: clamp(26px,3vw,39px); margin: 0 0 10px; letter-spacing: -.045em; line-height: 1.16; }
    .subtitle { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.55; max-width: 620px; }
    .toolbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
    .control { display: flex; align-items: center; min-height: 49px; gap: 9px; padding: 7px 10px; border: 1px solid var(--stroke); background: var(--white); border-radius: 13px; box-shadow: 0 3px 15px rgba(25,40,70,.025); }
    .year-button { background: #f1f4fa; color: #3e4a66; width: 33px; height: 33px; border: 0; border-radius: 9px; font-weight: 850; font-size: 20px; line-height: 1; }
    .year-button:hover:not(:disabled) { background: #e6ebf5; }
    .year-button:disabled { opacity: .35; cursor: default; }
    #year { width: 73px; border: 0; background: transparent; font-weight: 780; font-size: 18px; text-align: center; color: var(--text); appearance: textfield; -moz-appearance: textfield; }
    #year::-webkit-inner-spin-button, #year::-webkit-outer-spin-button { appearance: none; }
    .color-label { white-space: nowrap; color: #68748c; font-weight: 650; font-size: 12px; }
    #color { width: 34px; height: 34px; padding: 3px; border: 1px solid #dfe5ee; border-radius: 9px; background: white; cursor: pointer; }
    #colorHex { font-size: 12px; font-weight: 750; color: #546078; }
    .action { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 49px; padding: 0 16px; background: white; border: 1px solid var(--stroke); border-radius: 13px; font-size: 13px; font-weight: 760; color: #4d5b76; white-space: nowrap; transition: background .15s, transform .15s; }
    .action:hover { background: #eff2fa; }
    .action-primary { color: white; background: var(--accent); border-color: var(--accent); }
    .action-primary:hover { background: #4057d0; }
    .icon { display: inline-flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; }
    .count-badge { border-radius: 999px; color: var(--accent); background: var(--accent-soft); min-width: 21px; height: 21px; padding: 0 5px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 850; }
    .action-primary .count-badge { color: var(--accent); }
    .summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; background: var(--stroke); border: 1px solid var(--stroke); overflow: hidden; border-radius: 16px; margin-bottom: 19px; }
    .summary-item { background: white; min-width: 0; padding: 14px 19px; }
    .summary-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
    .summary-value { display: block; min-height: 23px; font-size: 16px; font-weight: 760; overflow-wrap: anywhere; }
    .summary-value.pending { color: #667491; font-size: 13px; font-weight: 650; padding-top: 3px; }
    .palette { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 2px 17px; }
    .palette-caption { color: var(--muted); font-weight: 650; font-size: 12px; margin-right: 2px; }
    .swatch { width: 24px; height: 24px; padding: 0; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #dfe4ee; transition: transform .15s; }
    .swatch:hover { transform: translateY(-2px); }
    .swatch.is-active { box-shadow: 0 0 0 2px #596b82; }
    .palette-note { font-size: 11px; color: #98a2b5; margin-left: 4px; }
    .calendar { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
    .month { background: white; border: 1px solid var(--stroke); border-radius: 17px; padding: 19px 15px 16px; min-width: 0; box-shadow: 0 4px 20px rgba(22,40,80,.027); }
    .month-header { font-size: 17px; line-height: 1.2; letter-spacing: -.02em; font-weight: 780; margin: 0 0 17px 4px; }
    .weekdays, .days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; }
    .weekdays { margin-bottom: 7px; }
    .weekday { height: 22px; text-align: center; font-size: 11px; font-weight: 750; color: #9aa5b8; }
    .weekday.weekend { color: #d28a94; }
    .day, .empty { aspect-ratio: 1; min-width: 0; min-height: 0; width: 100%; }
    .day { display: grid; place-items: center; position: relative; border: 0; padding: 0; border-radius: 9px; background: transparent; color: #4b5872; font-size: 13px; font-weight: 550; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
    .day.weekend { color: #c47b86; }
    .day:hover { background: #eef1f7; }
    .day.selected { color: #233049; font-weight: 720; }
    .day.selected:hover { filter: brightness(.97); }
    .day.range-edge { color: white; font-weight: 830; }
    .day.range-edge.has-overlap { color: #1d2940; }
    .day.range-edge:hover { filter: brightness(.96); }
    .day.preview { background: var(--preview-fill, #e9edff); color: #24334b; }
    .day.preview-edge { outline: 2px solid var(--preview-color, #566be9); outline-offset: -2px; font-weight: 820; }
    .day.today::after { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); bottom: 3px; left: calc(50% - 2px); }
    .day.range-edge.today:not(.has-overlap)::after { background: white; }
    .legend { margin-top: 18px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
    .legend-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: middle; }
    .legend-chip { display: inline-block; border: 1px solid #bbc8e7; border-radius: 4px; background: #e4eaff; width: 12px; height: 12px; vertical-align: middle; margin-right: 7px; }
    .tip { margin-left: auto; }
    /* Drawer */
    .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(24,34,58,.38); opacity: 0; visibility: hidden; transition: opacity .22s, visibility .22s; }
    .scrim.open { opacity: 1; visibility: visible; }
    .drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(435px, 100vw); background: white; box-shadow: -15px 0 55px rgba(25,40,75,.15); transform: translateX(105%); visibility: hidden; transition: transform .26s ease, visibility .26s; display: flex; flex-direction: column; }
    .drawer.open { transform: translateX(0); visibility: visible; }
    .drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; padding: 30px 25px 22px; border-bottom: 1px solid var(--stroke); }
    .drawer-heading { margin: 0; font-size: 23px; letter-spacing: -.035em; }
    .drawer-subtitle { margin: 7px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
    .close { width: 34px; height: 34px; flex-shrink: 0; border: 0; background: #f1f4f9; border-radius: 10px; font-size: 21px; color: #5c6880; }
    .close:hover { background: #e8edf7; }
    .drawer-scroll { flex: 1; overflow: auto; min-height: 0; padding: 19px 23px; }
    .drawer-empty { padding: 72px 16px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
    .empty-icon { font-size: 38px; display: block; margin-bottom: 12px; opacity: .6; }
    .range-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
    .range-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 13px 12px; background: #f8f9fc; border: 1px solid var(--stroke); border-radius: 14px; }
    .range-index { display: grid; flex-shrink: 0; place-items: center; border-radius: 9px; background: white; color: #8591a6; font-size: 11px; font-weight: 750; width: 25px; height: 26px; }
    .range-color { flex-shrink: 0; width: 32px; height: 32px; padding: 2px; border: 1px solid #dce3ed; border-radius: 10px; background: white; cursor: pointer; }
    .range-info { min-width: 0; flex: 1; }
    .range-dates { font-size: 13px; font-weight: 770; line-height: 1.4; }
    .range-length { font-size: 11px; color: #8a96a9; margin-top: 3px; }
    .delete { width: 31px; height: 31px; flex-shrink: 0; background: white; color: #8b96a8; border: 1px solid #e1e7ef; border-radius: 9px; display: grid; place-items: center; font-size: 16px; }
    .delete:hover { background: #ffeced; border-color: #f3c3c8; color: #ce4451; }
    .drawer-footer { padding: 16px 23px max(20px, env(safe-area-inset-bottom)); border-top: 1px solid var(--stroke); display: flex; gap: 9px; align-items: center; }
    .drawer-footer .action { flex: 1; }
    .drawer-footer .danger { color: #b54c55; }
    .drawer-footer .danger:hover { background: #fff0f1; }
    .drawer-footer .action:disabled { opacity: .4; cursor: not-allowed; background: white; }
    .toast { position: fixed; bottom: 26px; left: 50%; z-index: 100; transform: translate(-50%,20px); background: #27334e; color: white; border-radius: 12px; padding: 11px 18px; font-size: 13px; font-weight: 650; box-shadow: 0 8px 30px #19223833; visibility: hidden; opacity: 0; transition: .2s; pointer-events: none; }
    .toast.show { visibility: visible; opacity: 1; transform: translate(-50%,0); }
    @media(max-width:1200px) { .calendar { grid-template-columns: repeat(3,minmax(0,1fr)); } }
    @media(max-width:850px) { .calendar { grid-template-columns: repeat(2,minmax(0,1fr)); } }
    @media(max-width:580px) {
      .container { padding: 23px 13px 35px; }
      .calendar { grid-template-columns: 1fr; gap: 12px; }
      .month { padding: 18px; }
      .day { font-size: 15px; }
      .summary-item { padding: 12px 10px; }
      .summary-value { font-size: 13px; }
      .summary-value.pending { font-size: 11px; }
      .control { flex-grow: 1; justify-content: center; }
      .action { flex-grow: 1; }
      .tip { margin-left: 0; }
      .drawer-header { padding: 23px 19px 18px; }
      .drawer-scroll { padding: 16px; }
      .drawer-footer { padding: 14px 16px 20px; }
    }
    @media(prefers-reduced-motion:reduce) { *,*::before,*::after { transition: none !important; } }
    /* Production calendar: small badges never cover the user's range fill. */
    .holiday-toggle[aria-pressed="true"] { background: #fff4e7; border-color: #f3d9b5; color: #9d6630; }
    .holiday-toggle[aria-pressed="false"] { color: #79859a; }
    .production-bar { display:flex; align-items:center; gap:12px; min-height:30px; margin: -5px 1px 13px; color:#7d899d; font-size:12px; flex-wrap:wrap; }
    .production-status { flex:1; min-width:190px; }
    .production-status.loading { color:#a27c42; }
    .production-status.unavailable { color:#a17c63; }
    .production-source { font-size:11px; }
    .production-source a { color:#657bbf; text-decoration:none; }
    .production-source a:hover { text-decoration:underline; }
    .retry-button { padding:5px 11px; border:1px solid #e1e6ee; border-radius:8px; background:white; color:#55627c; font-size:11px; font-weight:700; }
    .retry-button:hover { background:#f2f5fb; }
    .retry-button[hidden], .production-legend[hidden] {display:none !important;}
    .production-legend { display:inline-flex; flex-wrap:wrap; align-items:center; gap:7px; }
    .holiday-dot { display:inline-block; width:9px; height:9px; vertical-align:middle; border-radius:50%; margin-left:5px; }
    .holiday-dot-red {background:#d45668;} .holiday-dot-orange {background:#e4a04a;}
    .holiday-dot-amber {background:#d2ac35;} .holiday-dot-green {background:#3ca78d;}
    .day.production-holiday:not(.selected):not(.preview) {background:#fff0f1;color:#be4e5f;font-weight:750;}
    .day.production-transferred:not(.selected):not(.preview) {background:#fff5e9;color:#b87431;font-weight:730;}
    .day.production-short:not(.selected):not(.preview) {color:#967026;font-weight:710;}
    .day.production-worked:not(.selected):not(.preview) {background:#eaf8f3;color:#32846e;font-weight:750;}
    .day.production-holiday::before,.day.production-transferred::before,.day.production-short::before,.day.production-worked::before {
      content:''; position:absolute; right:2px; top:2px; width:5px; height:5px; border-radius:50%; pointer-events:none;
    }
    .day.production-holiday::before {background:#d45668;}
    .day.production-transferred::before {background:#e4a04a;}
    .day.production-short::before {background:#d2ac35;}
    .day.production-worked::before {background:#3ca78d;}
    .day.range-edge:not(.has-overlap).production-holiday::before {background:#fff;}
    .day.range-edge:not(.has-overlap).production-transferred::before {background:#fff;}
    .day.range-edge:not(.has-overlap).production-short::before {background:#fff;}
    .day.range-edge:not(.has-overlap).production-worked::before {background:#fff;}


    /* JSON + multi-tag planning tools */
    button, input, select { font: inherit; }
    select:focus-visible { outline: 3px solid rgba(86,107,233,.3); outline-offset: 2px; }
    .new-tags-control { max-width: 270px; }
    #newTags { width: 128px; min-width: 75px; border: 0; outline: 0; color: var(--text); font-size: 12px; background: transparent; }
    #newTags::placeholder { color: #a2aab8; }
    .tag-summary, .json-section { border: 1px solid var(--stroke); border-radius: 14px; padding: 15px 14px; background: #fff; margin-bottom: 16px; }
    .subsection-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
    .subsection-head h3 { font-size: 13px; font-weight: 790; margin: 0; }
    .subsection-caption { font-size: 11px; color: #8894a9; }
    .section-description { font-size: 11px; line-height: 1.55; color: #8490a5; margin: 9px 0; }
    .section-hint { font-size: 12px; color: #a0a9ba; margin-top: 9px; }
    .section-hint[hidden] {display:none;}
    .tag-stats { margin-top: 11px; display: flex; flex-direction: column; gap: 7px; }
    .tag-stat { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 9px; background: #f5f7fc; }
    .tag-stat-name { font-size: 12px; font-weight: 800; color: #4558aa; overflow-wrap: anywhere; }
    .tag-stat-count { color: #69768c; font-size: 11px; font-weight: 690; }
    .json-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 13px 0 11px; }
    .json-actions .action { min-width: 0; padding: 0 6px; min-height: 38px; font-size: 11px; }
    .import-mode-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 650; color: #718099; }
    #importMode { max-width: 100%; flex: 1; min-width: 0; min-height: 35px; padding: 5px 7px; color: #4d5973; background: #f7f9fc; border: 1px solid var(--stroke); border-radius: 9px; font-size: 11px; }
    .range-list-header { margin: 21px 3px 12px; }
    .range-tag-input { display: block; width: 100%; min-width: 0; max-width: 100%; margin-top: 9px; padding: 7px 9px; border: 1px solid #e1e7f0; border-radius: 9px; font-size: 11px; background: #fff; color: #465571; }
    .range-tag-input::placeholder { color: #a5b0c1; }
    .range-item { align-items: flex-start; }
    .range-index, .range-color, .range-item .delete { margin-top: 3px; }
    .range-index { flex-shrink: 0; }
    @media(max-width:580px) {
      .new-tags-control { max-width: 100%; }
      #newTags { flex: 1; }
      .import-mode-label { flex-wrap: wrap; }
    }
