:root {
      --paper: #f4efe5;
      --paper-deep: #e9e0cf;
      --ink: #172033;
      --muted: #60708a;
      --line: #d7d1c4;
      --blue: #1f57ff;
      --blue-dark: #1743c7;
      --green: #16794c;
      --red: #b13b3b;
      --amber: #9a6412;
      --card: rgba(255, 255, 255, 0.72);
      --card-solid: #fffdf8;
      --shadow: 0 18px 45px rgba(49, 45, 35, 0.08);
      --radius: 1.2rem;
      color-scheme: light;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }

    body {
      margin: 0;
      color: var(--ink);
      background:
        radial-gradient(circle at 88% 5%, rgba(31, 87, 255, 0.08), transparent 24rem),
        linear-gradient(180deg, #f8f4ec 0%, var(--paper) 42%, #f6f1e8 100%);
      line-height: 1.65;
    }

    button, input, select { font: inherit; }
    button { color: inherit; }
    a { color: inherit; }

    .site-header {
      max-width: 1180px;
      margin: 0 auto;
      padding: 1.2rem 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      border-bottom: 1px solid rgba(215, 209, 196, 0.78);
    }

    .site-brand {
      display: inline-flex;
      align-items: center;
      gap: 0.75rem;
      text-decoration: none;
    }

    .site-mark {
      width: 2.7rem;
      height: 2.7rem;
      display: grid;
      place-items: center;
      border-radius: 0.8rem;
      color: white;
      background: var(--ink);
      font-weight: 900;
      font-size: 1.25rem;
      box-shadow: var(--shadow);
    }

    .site-brand strong, .site-brand small { display: block; }
    .site-brand small { margin-top: -0.15rem; color: var(--muted); }

    .site-nav {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 0.35rem;
    }

    .site-nav a {
      padding: 0.45rem 0.7rem;
      border-radius: 999px;
      color: var(--muted);
      text-decoration: none;
      font-size: 0.92rem;
    }

    .site-nav a[aria-current="page"] { color: #fff; background: var(--ink); }

    .breadcrumb {
      max-width: 1050px;
      margin: 0 auto;
      padding: 1rem 1rem 0;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .breadcrumb a { text-decoration: none; }
    .breadcrumb span { padding: 0 0.45rem; opacity: 0.55; }

    main { max-width: 1050px; margin: auto; padding: 1rem; }

    .tool-hero {
      min-height: 320px;
      display: grid;
      align-items: center;
      padding: 3.5rem 0 2.4rem;
    }

    .eyebrow, .section-kicker, .mini-kicker {
      margin: 0 0 1rem;
      color: var(--blue);
      font-size: 0.88rem;
      font-weight: 850;
      letter-spacing: 0.14em;
      text-transform: uppercase;
    }

    .mini-kicker { margin-bottom: 0.35rem; font-size: 0.73rem; }
    h1, h2, h3, p { overflow-wrap: anywhere; }

    h1 {
      max-width: 920px;
      margin: 0;
      font-size: clamp(2.65rem, 7vw, 5.7rem);
      line-height: 0.99;
      letter-spacing: -0.065em;
    }

    h1 em { color: var(--blue); font-style: normal; font-weight: 500; }

    .hero-note {
      max-width: 790px;
      margin: 1.6rem 0 0;
      color: var(--muted);
      font-size: 1.05rem;
    }

    .workspace {
      padding: 1.5rem;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: rgba(255, 253, 248, 0.56);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
    }

    .comparison-toolbar {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 1rem;
      margin-bottom: 1rem;
    }

    .comparison-toolbar h2, .comparison-toolbar h3 { margin: 0; font-size: 1.35rem; }
    .comparison-toolbar p:last-child { max-width: 680px; margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; }
    .toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }

    .add-plan-button, .secondary-button, .icon-button {
      border: 1px solid var(--ink);
      border-radius: 0.8rem;
      cursor: pointer;
      font-weight: 800;
      transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
    }

    .add-plan-button {
      flex: 0 0 auto;
      padding: 0.75rem 1rem;
      color: white;
      background: var(--ink);
      box-shadow: 0 8px 18px rgba(23, 32, 51, 0.12);
    }

    .add-plan-button:hover, .secondary-button:hover, .icon-button:hover { transform: translateY(-1px); }
    .add-plan-button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

    .secondary-button, .icon-button {
      padding: 0.5rem 0.7rem;
      color: var(--ink);
      background: rgba(255, 255, 255, 0.74);
      border-color: #c7c0b3;
      font-size: 0.82rem;
    }

    .danger-button { color: var(--red); }
    .expense-items { display: grid; gap: 1rem; }

    .expense-item {
      padding: 1.1rem;
      border: 1px solid var(--line);
      border-radius: 1rem;
      background: rgba(255, 255, 255, 0.69);
    }

    .item-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      margin-bottom: 1rem;
    }

    .item-title-wrap { min-width: 0; }
    .item-title { margin: 0; font-size: 1.05rem; }
    .item-subtitle { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.78rem; }
    .item-actions { display: flex; gap: 0.4rem; }
    .remove-item { color: var(--red); }

    .expense-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0.85rem;
    }

    .expense-grid label, .sort-control, .month-settings label {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
      color: #33415a;
      font-size: 0.88rem;
      font-weight: 720;
    }

    .expense-grid input, .expense-grid select, .sort-control select, .month-settings select {
      width: 100%;
      min-height: 2.9rem;
      padding: 0.68rem 0.75rem;
      border: 1px solid #c8c1b3;
      border-radius: 0.72rem;
      color: var(--ink);
      background: rgba(255, 255, 255, 0.86);
      outline: none;
      transition: border-color 150ms ease, box-shadow 150ms ease;
    }

    .expense-grid input:focus, .expense-grid select:focus, .sort-control select:focus, .month-settings select:focus {
      border-color: var(--blue);
      box-shadow: 0 0 0 4px rgba(31, 87, 255, 0.12);
    }

    .field-wide { grid-column: span 2; }
    .input-hint { min-height: 1.1rem; color: var(--muted); font-size: 0.74rem; font-weight: 500; }
    .field-hidden { display: none !important; }

    .item-results {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 0.6rem;
      margin-top: 0.9rem;
      padding-top: 0.9rem;
      border-top: 1px dashed var(--line);
    }

    .item-results div {
      padding: 0.75rem;
      border-radius: 0.7rem;
      background: rgba(23, 32, 51, 0.045);
    }

    .item-results small { display: block; color: var(--muted); font-weight: 700; }
    .item-results strong { display: block; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }

    .results {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1rem;
      margin-top: 1.2rem;
    }

    .results article {
      min-height: 130px;
      padding: 1.2rem;
      border: 1px solid rgba(215, 209, 196, 0.78);
      border-radius: 1rem;
      background: var(--card);
    }

    .results article:last-child { color: white; border-color: var(--ink); background: var(--ink); }
    .results small { display: block; color: inherit; opacity: 0.72; font-weight: 750; }
    .results strong { display: block; margin-top: 0.5rem; font-size: clamp(1.45rem, 3.4vw, 2.05rem); line-height: 1.2; font-variant-numeric: tabular-nums; }
    .result-sub { display: block; margin-top: 0.4rem; font-size: 0.78rem; opacity: 0.66; }

    .summary-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr);
      gap: 1rem;
      margin-top: 1rem;
    }

    .summary-card {
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 1rem;
      background: var(--card-solid);
    }

    .summary-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
      padding: 1rem;
      border-bottom: 1px solid #e7e1d6;
    }

    .summary-head h3 { margin: 0; font-size: 1rem; }
    .summary-head small { color: var(--muted); }

    .category-bars { display: grid; gap: 0.9rem; padding: 1rem; }
    .category-row { display: grid; gap: 0.35rem; }
    .category-meta { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
    .category-meta strong { font-size: 0.88rem; }
    .category-meta span { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
    .category-track { height: 0.55rem; overflow: hidden; border-radius: 999px; background: rgba(23, 32, 51, 0.08); }
    .category-fill { height: 100%; border-radius: inherit; background: var(--blue); }
    .empty-state { padding: 1.4rem; color: var(--muted); text-align: center; }

    .comparison-summary {
      margin-top: 1rem;
      overflow: hidden;
      border: 1px solid var(--line);
      border-radius: 1rem;
      background: var(--card-solid);
    }

    .comparison-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
      padding: 1rem;
    }

    .comparison-head h3 { margin: 0; font-size: 1rem; }
    .comparison-tools { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; justify-content: flex-end; }
    .comparison-tools > span { color: var(--muted); font-size: 0.82rem; }
    .sort-control { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
    .sort-control select { min-height: 2.35rem; width: auto; padding: 0.4rem 2rem 0.4rem 0.6rem; }

    .table-scroll { overflow-x: auto; }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.86rem;
      font-variant-numeric: tabular-nums;
    }

    th, td {
      padding: 0.72rem 0.75rem;
      border-top: 1px solid #e7e1d6;
      text-align: right;
      white-space: nowrap;
    }

    th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
    th { color: var(--muted); background: #faf7f0; }
    tr.is-largest td { background: rgba(31, 87, 255, 0.055); }
    .rank-badge { display: inline-grid; min-width: 1.65rem; height: 1.65rem; place-items: center; border-radius: 50%; background: rgba(23, 32, 51, 0.08); font-weight: 850; }
    tr.is-largest .rank-badge { color: white; background: var(--blue); }
    .item-cell strong, .item-cell small { display: block; text-align: left; }
    .item-cell small { color: var(--muted); }

    .calendar-table th, .calendar-table td { min-width: 86px; text-align: center; }
    .calendar-table th:first-child, .calendar-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 95px; text-align: left; background: #faf7f0; }
    .calendar-table td.is-peak { color: var(--blue-dark); background: rgba(31, 87, 255, 0.08); font-weight: 850; }
    .calendar-table tfoot td { font-weight: 850; background: #faf7f0; }

    .notice {
      margin: 1rem 0 0;
      padding: 0.9rem 1rem;
      border-left: 4px solid var(--blue);
      color: var(--muted);
      background: rgba(31, 87, 255, 0.055);
      font-size: 0.9rem;
    }

    .formula-line { margin: 1rem 0 0; color: var(--muted); font-size: 0.84rem; }
    .content-section { padding: 4.2rem 0 0; }
    .content-section > h2, .eeat-block h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.15; letter-spacing: -0.035em; }

    .guide-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1rem;
      margin-top: 1.5rem;
    }

    .guide-card { padding: 1.25rem; border-top: 1px solid var(--line); }
    .guide-card strong { display: inline-grid; width: 2rem; height: 2rem; place-items: center; margin-bottom: 1rem; border-radius: 50%; color: white; background: var(--blue); }
    .guide-card h3 { margin: 0 0 0.55rem; }
    .guide-card p { margin: 0; color: var(--muted); }

    .faq-list { margin-top: 1.4rem; border-top: 1px solid var(--line); }
    details { border-bottom: 1px solid var(--line); }
    summary { padding: 1.15rem 0; cursor: pointer; font-weight: 780; list-style: none; }
    summary::-webkit-details-marker { display: none; }
    summary::after { content: "+"; float: right; color: var(--blue); font-size: 1.25rem; }
    details[open] summary::after { content: "−"; }
    details p { max-width: 850px; margin: 0 0 1.25rem; color: var(--muted); }

    .section-lead { max-width: 820px; margin: 1.1rem 0 0; color: var(--muted); font-size: 1rem; }
    .eeat-block { padding: 2.2rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .eeat-lead { max-width: 820px; margin: 1.5rem 0 0; color: var(--muted); font-size: 1.02rem; line-height: 1.9; }
    .eeat-list { margin: 1.6rem 0 0; padding-left: 1.3rem; }
    .eeat-list li + li { margin-top: 0.75rem; }

    .site-footer {
      max-width: 1050px;
      margin: 5rem auto 0;
      padding: 2.2rem 1rem 2.8rem;
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 1.5rem;
      border-top: 1px solid var(--line);
      color: var(--muted);
    }

    .footer-brand { color: var(--ink); font-weight: 850; text-decoration: none; }
    .site-footer p { margin: 0.35rem 0 0; }
    .site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }
    .site-footer small { grid-column: 1 / -1; }

    .toast {
      position: fixed;
      right: 1rem;
      bottom: 1rem;
      z-index: 10;
      max-width: min(360px, calc(100vw - 2rem));
      padding: 0.8rem 1rem;
      border-radius: 0.8rem;
      color: white;
      background: var(--ink);
      box-shadow: var(--shadow);
      opacity: 0;
      transform: translateY(0.6rem);
      pointer-events: none;
      transition: opacity 180ms ease, transform 180ms ease;
    }
    .toast.is-visible { opacity: 1; transform: translateY(0); }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    @media (max-width: 900px) {
      .expense-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .summary-grid { grid-template-columns: 1fr; }
    }

    @media (max-width: 760px) {
      .site-header { align-items: flex-start; }
      .site-nav { display: none; }
      .tool-hero { min-height: auto; padding: 3rem 0 2rem; }
      h1 { font-size: clamp(2.7rem, 15vw, 4.6rem); }
      .workspace { padding: 1rem; }
      .comparison-toolbar { align-items: stretch; flex-direction: column; }
      .toolbar-actions { justify-content: stretch; }
      .toolbar-actions button { flex: 1 1 auto; }
      .add-plan-button { width: 100%; }
      .expense-grid, .results, .guide-grid { grid-template-columns: 1fr; }
      .field-wide { grid-column: auto; }
      .item-results { grid-template-columns: 1fr; }
      .results article { min-height: auto; }
      .comparison-head { align-items: flex-start; flex-direction: column; }
      .comparison-tools { justify-content: flex-start; }
      .content-section { padding-top: 3.2rem; }
      .site-footer { grid-template-columns: 1fr; }
      .site-footer small { grid-column: 1; }
    }

    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after { transition: none !important; }
    }

/* Tool-center integration */
.tool-related{width:min(1180px,calc(100% - 2rem));margin:clamp(2.5rem,6vw,5rem) auto 0}
.tool-related h2{margin-block-end:1rem}
.section-title{margin:0 0 1rem;font-size:clamp(1.2rem,2vw,1.5rem);line-height:1.25}
.site-footer p{margin:.35rem 0}
@media(max-width:600px){.tool-related{width:min(100% - 1.5rem,1180px)}}
