:root {
      --bg: #f4f8fb;
      --surface: #ffffff;
      --surface-soft: #f7fafc;
      --text: #181b20;
      --muted: #6f7580;
      --faint: #9aa0aa;
      --border: #e3edf3;
      --border-strong: #d3e3ec;
      --accent: #2f8fd6;
      --accent-strong: #2378bb;
      --accent-soft: #eaf5fc;
      --green: #147a55;
      --green-soft: #eaf7f1;
      --amber: #9b6615;
      --amber-soft: #fff5df;
      --blue: #2866b1;
      --blue-soft: #edf5ff;
      --holiday: #f2f3f5;
      --danger: #b63b45;
      --shadow-sm: 0 1px 2px rgba(20, 24, 31, .03), 0 5px 18px rgba(20, 24, 31, .04);
      --shadow-lg: 0 24px 80px rgba(20, 24, 31, .14);
      --radius: 18px;
      --transition: 170ms cubic-bezier(.2,.8,.2,1);
    }

    * { box-sizing: border-box; }

    html { scroll-behavior: smooth; }

    body {
      margin: 0;
      min-width: 320px;
      min-height: 100vh;
      color: var(--text);
      background:
        radial-gradient(circle at 14% -10%, rgba(47, 143, 214, .08), transparent 26rem),
        var(--bg);
      font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", sans-serif;
      -webkit-font-smoothing: antialiased;
    }

    button, input { font: inherit; }

    button {
      border: 0;
      cursor: pointer;
    }

    button:focus-visible, input:focus-visible {
      outline: 3px solid rgba(47, 143, 214, .22);
      outline-offset: 2px;
    }

    .icon {
      width: 18px;
      height: 18px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.9;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex: none;
    }

    .app {
      width: min(1240px, calc(100% - 32px));
      margin: 0 auto;
      padding: 24px 0 64px;
    }

    .topbar {
      position: sticky;
      top: 8px;
      z-index: 20;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      margin-bottom: 8px;
      padding: 9px 10px 9px 12px;
      border: 1px solid rgba(232, 234, 238, .9);
      border-radius: 18px;
      background: rgba(255, 255, 255, .88);
      backdrop-filter: blur(20px) saturate(1.3);
      box-shadow: var(--shadow-sm);
    }

    .brand {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .brand-mark {
      width: 34px;
      height: 34px;
      display: grid;
      place-items: center;
      flex: none;
      border-radius: 12px;
      color: #fff;
      font-size: 17px;
      font-weight: 850;
      background: linear-gradient(145deg, #4aa8e8, #2f86cb);
      box-shadow: 0 8px 20px rgba(47, 143, 214, .22);
    }

    .brand-title {
      font-size: 15px;
      font-weight: 780;
      letter-spacing: -.015em;
    }

    .brand-subtitle {
      margin-top: 2px;
      color: var(--faint);
      font-size: 11px;
      font-weight: 560;
    }

    .top-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .btn {
      height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 13px;
      border-radius: 11px;
      color: #4a4f59;
      font-size: 12px;
      font-weight: 720;
      background: var(--surface);
      border: 1px solid var(--border);
      transition: transform var(--transition), border-color var(--transition), background var(--transition);
    }

    .btn:hover {
      transform: translateY(-1px);
      border-color: var(--border-strong);
      background: #fcfcfd;
    }

    .btn.primary {
      color: #fff;
      border-color: transparent;
      background: linear-gradient(145deg, #4aa8e8, #2f86cb);
      box-shadow: 0 7px 20px rgba(47, 143, 214, .18);
    }

    .btn.ghost {
      background: transparent;
      box-shadow: none;
    }

    .hero {
      display: grid;
      grid-template-columns: minmax(300px, .85fr) minmax(520px, 1.15fr);
      gap: 18px;
      align-items: center;
      padding: 16px 4px 14px;
    }

    .eyebrow {
      margin-bottom: 6px;
      color: var(--accent);
      font-size: 10px;
      font-weight: 820;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    h1 {
      margin: 0;
      font-size: clamp(27px, 3.2vw, 40px);
      line-height: 1.02;
      letter-spacing: -.04em;
      font-weight: 790;
    }

    .hero p {
      max-width: 620px;
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.45;
    }

    .month-picker {
      min-width: 0;
      padding: 10px 11px;
      border-radius: 15px;
      background: #f7fbfe;
      box-shadow: none;
    }

    .month-picker-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 8px;
      padding: 0 2px;
    }

    .month-current {
      min-width: 0;
      text-align: left;
    }

    .month-current-title {
      font-size: 13px;
      font-weight: 790;
      letter-spacing: -.015em;
    }

    .month-current-note {
      margin-top: 1px;
      color: var(--faint);
      font-size: 9px;
      font-weight: 650;
    }

    .month-navs {
      display: flex;
      align-items: center;
      gap: 5px;
      flex: none;
    }

    .month-nav-btn {
      width: 31px;
      height: 31px;
      display: grid;
      place-items: center;
      border-radius: 9px;
      color: #527087;
      background: #eef6fb;
      transition: color var(--transition), background var(--transition), transform var(--transition);
    }

    .month-nav-btn:hover:not(:disabled) {
      color: var(--accent-strong);
      background: #dff0fb;
      transform: translateY(-1px);
    }

    .month-nav-btn:disabled {
      opacity: .3;
      cursor: not-allowed;
    }

    .month-grid {
      display: grid;
      grid-template-columns: repeat(9, minmax(48px, 1fr));
      gap: 5px;
    }

    .month-chip {
      min-width: 0;
      height: 38px;
      display: grid;
      place-items: center;
      padding: 0 6px;
      position: relative;
      border-radius: 10px;
      color: #60717f;
      font-size: 10px;
      font-weight: 760;
      line-height: 1;
      background: #edf4f8;
      transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
    }

    .month-chip:hover {
      color: #2f536c;
      background: #e3f0f7;
      transform: translateY(-1px);
    }

    .month-chip.active {
      color: #fff;
      background: linear-gradient(145deg, #49a8e8, #3189cd);
      box-shadow: 0 5px 14px rgba(47, 143, 214, .20);
    }

    .month-chip.has-current:not(.active)::after {
      content: "";
      width: 5px;
      height: 5px;
      position: absolute;
      top: 5px;
      right: 5px;
      border-radius: 999px;
      background: var(--accent);
    }

    .month-chip.year-start {
      margin-left: 6px;
    }

    .summary {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-bottom: 14px;
      padding: 6px;
      border-radius: 13px;
      background: #edf6fb;
    }

    .metric {
      min-width: 0;
      min-height: 0;
      flex: 1;
      padding: 7px 10px;
      display: flex;
      align-items: baseline;
      gap: 7px;
      border: 0;
      border-radius: 9px;
      background: transparent;
      box-shadow: none;
    }

    .metric-label {
      color: #70808d;
      font-size: 10px;
      font-weight: 650;
      white-space: nowrap;
    }

    .metric-value {
      order: -1;
      margin: 0;
      color: #204f70;
      font-size: 17px;
      line-height: 1;
      letter-spacing: -.03em;
      font-weight: 800;
    }

    .metric-note {
      display: none;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 280px;
      gap: 18px;
      align-items: start;
    }

    .calendar {
      min-width: 0;
    }

    .month {
      margin-bottom: 24px;
      scroll-margin-top: 92px;
    }

    .month-head {
      display: flex;
      align-items: center;
      gap: 12px;
      margin: 0 2px 10px;
    }

    .month-title {
      font-size: 17px;
      font-weight: 790;
      letter-spacing: -.025em;
    }

    .month-line {
      display: none;
    }

    .month-count {
      margin-left: auto;
      padding: 4px 8px;
      border-radius: 999px;
      color: #648197;
      font-size: 9px;
      font-weight: 720;
      background: #edf5fa;
    }

    .week-card {
      display: grid;
      grid-template-columns: 112px minmax(0, 1fr) auto;
      gap: 16px;
      align-items: center;
      min-height: 108px;
      margin-bottom: 8px;
      padding: 15px 15px 15px 17px;
      position: relative;
      overflow: hidden;
      border: 1px solid transparent;
      border-radius: var(--radius);
      background: var(--surface);
      box-shadow: 0 4px 16px rgba(32, 79, 112, .045);
      scroll-margin-top: 92px;
      transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    }

    .week-card:hover {
      transform: translateY(-1px);
      border-color: #dceaf2;
      box-shadow: 0 8px 22px rgba(32, 79, 112, .07);
    }

    .week-card.current {
      border-color: rgba(47, 143, 214, .30);
      box-shadow: 0 8px 26px rgba(47, 143, 214, .08);
    }

    .week-card.current::before {
      content: "";
      position: absolute;
      inset: 0 auto 0 0;
      width: 4px;
      background: var(--accent);
    }

    .week-card.past {
      background: #fcfcfd;
    }

    .week-date {
      min-width: 0;
      padding-right: 10px;
    }

    .week-number {
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--faint);
      font-size: 10px;
      font-weight: 760;
      letter-spacing: .05em;
      text-transform: uppercase;
    }

    .date-main {
      margin-top: 7px;
      font-size: 18px;
      line-height: 1.05;
      font-weight: 790;
      letter-spacing: -.025em;
    }

    .date-sub {
      margin-top: 4px;
      color: var(--muted);
      font-size: 10px;
      font-weight: 650;
    }

    .week-main { min-width: 0; }

    .week-meta {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-bottom: 7px;
      flex-wrap: wrap;
    }

    .tag {
      min-height: 22px;
      display: inline-flex;
      align-items: center;
      padding: 3px 7px;
      border-radius: 7px;
      color: #5d626c;
      font-size: 9px;
      font-weight: 760;
      background: #f3f4f6;
    }

    .status {
      min-height: 22px;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 7px;
      border-radius: 7px;
      font-size: 9px;
      font-weight: 760;
    }

    .status.current { color: #2378bb; background: var(--accent-soft); }
    .status.past { color: var(--green); background: var(--green-soft); }
    .status.future { color: var(--blue); background: var(--blue-soft); }

    .status.manual { color: var(--green); background: var(--green-soft); }
    .used-toggle.active { color: var(--green); background: var(--green-soft); }
    .used-toggle.active:hover { color: #0f6b49; background: #dff2e9; }

    .question {
      max-width: 760px;
      font-size: 14px;
      line-height: 1.47;
      font-weight: 650;
      letter-spacing: -.008em;
    }

    .week-actions {
      display: flex;
      gap: 7px;
      align-items: center;
    }

    .icon-btn {
      width: 38px;
      height: 38px;
      display: inline-grid;
      place-items: center;
      border-radius: 11px;
      color: #565b65;
      background: var(--surface-soft);
      border: 1px solid var(--border);
      transition: transform var(--transition), background var(--transition), color var(--transition);
    }

    .icon-btn:hover {
      transform: translateY(-1px);
      color: var(--accent);
      background: var(--accent-soft);
    }

    .icon-btn:disabled {
      opacity: .34;
      cursor: not-allowed;
      transform: none;
      color: #777;
      background: #f5f5f6;
    }

    .holiday-card {
      min-height: 86px;
      margin-bottom: 8px;
      padding: 16px 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      overflow: hidden;
      position: relative;
      border: 1px dashed #d7d9de;
      border-radius: var(--radius);
      color: #6e737d;
      background:
        repeating-linear-gradient(-45deg, #f6f7f8 0, #f6f7f8 12px, #f2f3f5 12px, #f2f3f5 24px);
    }

    .holiday-copy {
      display: flex;
      align-items: center;
      gap: 13px;
    }

    .holiday-icon {
      width: 38px;
      height: 38px;
      display: grid;
      place-items: center;
      flex: none;
      border-radius: 11px;
      color: #7f8490;
      background: rgba(255,255,255,.7);
      border: 1px solid rgba(0,0,0,.05);
    }

    .holiday-title {
      color: #545963;
      font-size: 13px;
      font-weight: 760;
    }

    .holiday-note {
      margin-top: 3px;
      font-size: 10px;
      font-weight: 610;
    }

    .side {
      position: sticky;
      top: 82px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .side-card {
      padding: 17px;
      border-radius: 17px;
      border: 0;
      background: var(--surface);
      box-shadow: 0 4px 16px rgba(32, 79, 112, .045);
    }

    .side-title {
      font-size: 13px;
      font-weight: 770;
    }

    .side-text {
      margin-top: 6px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.5;
    }

    .side-stat {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 0;
      color: var(--muted);
      font-size: 11px;
    }

    .side-stat:last-of-type { border-bottom: 0; }

    .side-stat strong {
      color: var(--text);
      font-size: 12px;
    }

    .side .btn {
      width: 100%;
      margin-top: 10px;
    }

    .legend {
      margin-top: 12px;
      display: grid;
      gap: 8px;
    }

    .legend-row {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      font-size: 10px;
    }

    .dot {
      width: 8px;
      height: 8px;
      flex: none;
      border-radius: 999px;
      background: #cfd2d8;
    }

    .dot.current { background: var(--accent); }
    .dot.used { background: #32a275; }
    .dot.future { background: #5c8fd0; }

    .overlay {
      position: fixed;
      inset: 0;
      z-index: 40;
      opacity: 0;
      pointer-events: none;
      background: rgba(21, 24, 31, .27);
      backdrop-filter: blur(3px);
      transition: opacity var(--transition);
    }

    .overlay.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .drawer {
      width: min(470px, calc(100vw - 16px));
      height: calc(100vh - 16px);
      position: fixed;
      top: 8px;
      right: 8px;
      z-index: 50;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.8);
      border-radius: 24px;
      background: rgba(251, 251, 252, .98);
      box-shadow: var(--shadow-lg);
      transform: translateX(calc(100% + 24px));
      transition: transform 230ms cubic-bezier(.2,.8,.2,1);
    }

    .drawer.open { transform: translateX(0); }

    .drawer-head {
      padding: 20px;
    }

    .drawer-title-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 15px;
    }

    .drawer-title {
      font-size: 20px;
      font-weight: 790;
      letter-spacing: -.025em;
    }

    .drawer-description {
      margin-top: 5px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }

    .close-btn {
      width: 36px;
      height: 36px;
      display: grid;
      place-items: center;
      flex: none;
      border-radius: 10px;
      color: #626771;
      background: #f2f3f5;
    }

    .search-wrap {
      margin-top: 15px;
      position: relative;
    }

    .search-wrap .icon {
      position: absolute;
      left: 12px;
      top: 50%;
      width: 16px;
      height: 16px;
      color: var(--faint);
      transform: translateY(-50%);
    }

    .search {
      width: 100%;
      height: 41px;
      padding: 0 13px 0 38px;
      border: 1px solid var(--border);
      border-radius: 11px;
      color: var(--text);
      background: #fff;
    }

    .tabs {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      margin-top: 10px;
      padding: 5px;
      border-radius: 11px;
      background: #f0f1f3;
    }

    .tab {
      height: 32px;
      border-radius: 8px;
      color: var(--muted);
      font-size: 10px;
      font-weight: 760;
      background: transparent;
    }

    .tab.active {
      color: var(--text);
      background: #fff;
      box-shadow: 0 2px 7px rgba(20,24,31,.06);
    }

    .bank-list {
      flex: 1;
      min-height: 0;
      padding: 10px 12px 16px;
      overflow-y: auto;
    }

    .bank-item {
      padding: 13px;
      margin-bottom: 7px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: #fff;
    }

    .bank-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 7px;
    }

    .bank-category {
      color: var(--faint);
      font-size: 9px;
      font-weight: 760;
      text-transform: uppercase;
      letter-spacing: .055em;
    }

    .bank-state {
      color: var(--muted);
      font-size: 9px;
      font-weight: 700;
    }

    .bank-question {
      font-size: 12px;
      line-height: 1.45;
      font-weight: 620;
    }

    .bank-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
    .bank-use-btn {
      min-height: 30px; padding: 0 10px; border-radius: 8px; color: #4f6879;
      font-size: 9px; font-weight: 760; background: #eef5f9;
      transition: background var(--transition), color var(--transition);
    }
    .bank-use-btn:hover { color: var(--accent-strong); background: #e1f0f8; }
    .bank-use-btn.restore { color: var(--green); background: var(--green-soft); }
    .bank-use-btn.restore:hover { background: #dff2e9; }
    .bank-use-btn:disabled { opacity: .48; cursor: not-allowed; }

    .bank-empty {
      padding: 54px 20px;
      color: var(--faint);
      text-align: center;
      font-size: 11px;
      line-height: 1.5;
    }

    .drawer-foot {
      padding: 12px 18px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .drawer-foot-note {
      color: var(--faint);
      font-size: 9px;
      line-height: 1.4;
    }

    .text-btn {
      padding: 7px 9px;
      border-radius: 8px;
      color: var(--danger);
      font-size: 10px;
      font-weight: 720;
      background: transparent;
    }

    .text-btn:hover { background: #fff0f1; }

    .toast {
      max-width: calc(100vw - 28px);
      padding: 10px 14px;
      position: fixed;
      left: 50%;
      bottom: 22px;
      z-index: 80;
      color: #fff;
      font-size: 11px;
      font-weight: 680;
      border-radius: 10px;
      background: rgba(28, 31, 37, .92);
      box-shadow: 0 10px 28px rgba(0,0,0,.18);
      opacity: 0;
      pointer-events: none;
      transform: translate(-50%, 8px);
      transition: opacity 160ms ease, transform 160ms ease;
    }

    .toast.visible {
      opacity: 1;
      transform: translate(-50%, 0);
    }

    @media (max-width: 980px) {
      .hero { grid-template-columns: 1fr; gap: 12px; }
      .layout { grid-template-columns: 1fr; }
      .side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
      .week-card { grid-template-columns: 104px minmax(0,1fr) auto; }
    }

    @media (max-width: 720px) {
      .app { width: min(100% - 18px, 1240px); padding-top: 9px; }
      .topbar { top: 6px; padding: 10px; }
      .brand-subtitle, .top-actions .label { display: none; }
      .hero { grid-template-columns: 1fr; gap: 12px; padding: 14px 2px 12px; }
      .month-picker { padding: 9px; }
      .month-grid {
        display: flex;
        gap: 5px;
        overflow-x: auto;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
      }
      .month-grid::-webkit-scrollbar { display: none; }
      .month-chip {
        min-width: 60px;
        flex: 0 0 60px;
        scroll-snap-align: center;
      }
      .month-chip.year-start { margin-left: 5px; }
      .summary {
        gap: 2px;
        overflow-x: auto;
        padding: 5px;
        scrollbar-width: none;
      }
      .summary::-webkit-scrollbar { display: none; }
      .metric {
        min-width: max-content;
        flex: 0 0 auto;
        padding: 6px 9px;
      }
      .metric { min-height: 78px; padding: 14px; }
      .metric-value { font-size: 22px; }
      .week-card {
        grid-template-columns: 1fr auto;
        gap: 11px;
        min-height: 0;
        padding: 14px;
      }
      .week-date {
        grid-column: 1 / -1;
        padding: 0 0 10px;
        border-right: 0;
        }
      .date-main { font-size: 15px; }
      .date-sub { display: inline; margin-left: 4px; }
      .question { font-size: 13px; }
      .week-actions { align-self: end; }
      .side { grid-template-columns: 1fr; }
    }

    @media (max-width: 440px) {
      .summary { gap: 2px; }
      .metric-label { font-size: 9px; }
      .metric-value { font-size: 15px; }
      .month-title { font-size: 15px; }
      .holiday-card { align-items: flex-start; }
      .holiday-card > .date-main { font-size: 12px; text-align: right; }
    }
