:root {
  color-scheme: light;
  --ink: #222a2c;
  --muted: #7b8585;
  --muted-light: #a3acab;
  --paper: #f5f7f4;
  --surface: #fff;
  --line: #e8ece8;
  --line-dark: #dce2dd;
  --violet: #6758d6;
  --violet-dark: #5143c0;
  --violet-soft: #f0efff;
  --mint: #dff4e9;
  --green: #237454;
  --green-dark: #165b42;
  --amber: #b8782b;
  --shadow: 0 16px 42px rgba(32, 48, 42, .055);
  font-family: 'DM Sans', 'Noto Sans TC', sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
[hidden] { display: none !important; }
.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; }

.preview-banner { min-height: 35px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 7px 16px; background: #282335; color: #f6f2ff; font-size:16px; letter-spacing: .025em; }
.preview-pulse { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #b9aaff; box-shadow: 0 0 0 4px rgba(185,170,255,.13); }
.preview-banner-note { color: #bdb5c9; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.2); }
.app-frame { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 600px; display: flex; flex-direction: column; padding: 27px 17px 18px; border-right: 1px solid #e7ebe7; background: #fbfcfa; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 9px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; color: var(--violet); background: #f0efff; }
.brand-mark svg { width: 36px; height: 36px; }
.brand-copy { display: flex; flex-direction: column; gap: 3px; }
.brand-copy strong { font-size:14px; font-weight: 800; letter-spacing: .035em; }
.brand-copy small { color: #a0a8a4; font-size:13px; letter-spacing: .13em; font-weight: 700; }
.nav-label { margin: 47px 10px 12px; color: #aab2ae; font-size:14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.main-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 11px; border: 0; border-radius: 10px; background: transparent; color: #77817d; text-align: left; font-size:12px; font-weight: 600; transition: background .18s, color .18s, transform .18s; }
.nav-item:hover { background: #f1f3f0; color: var(--ink); }
.nav-item:active { transform: scale(.985); }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.is-active { color: var(--violet-dark); background: var(--violet-soft); }
.nav-chevron { margin-left: auto; color: #8b80e7; font-size:22px; line-height: 1; font-weight: 400; }
.nav-count { margin-left: auto; min-width: 21px; padding: 2px 6px; border-radius: 10px; background: #edf0ed; color: #73807a; text-align: center; font-size:15px; }
.sidebar-spacer { flex: 1; }
.sidebar-privacy { display: flex; align-items: center; gap: 9px; margin: 0 3px 14px; padding: 12px 9px; border: 1px solid #e7eee9; border-radius: 11px; background: #f9fcf9; }
.privacy-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: #318260; background: #e7f5ed; font-size:18px; }
.sidebar-privacy div { min-width: 0; display: grid; gap: 3px; }
.sidebar-privacy strong { font-size:15px; font-weight: 700; }
.sidebar-privacy small { max-width: 134px; overflow: hidden; color: #929d96; font-size:13px; text-overflow: ellipsis; white-space: nowrap; }
.privacy-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: #5db886; box-shadow: 0 0 0 3px #e4f4e9; }
.settings-nav { margin-top: 2px; }
.sidebar-footer { margin: 16px 9px 0; color: #a9b0ad; font-size:14px; }

.main-area { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px,4.5vw,72px); border-bottom: 1px solid #e8ece8; background: rgba(255,255,255,.64); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #9aa39e; font-size:16px; }
.breadcrumbs strong { color: #414c48; font-weight: 700; }
.crumb-slash { color: #c2c9c5; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.cloud-status { display: inline-flex; align-items: center; gap: 7px; color: #78847e; font-size:15px; }
.cloud-status i { width: 6px; height: 6px; border-radius: 50%; background: #56ab7b; box-shadow: 0 0 0 3px #e8f5ec; }
.account-chip { display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid #e8ece8; color: #56615d; font-size:15px; }
.avatar { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #dcd8fb; border-radius: 50%; background: #efedff; color: #6256bf; font-size:15px; font-weight: 700; }
.account-email { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chevron { color: #9ba49f; font-size:14px; }
.page-content { width: min(100%, 1430px); margin: 0 auto; padding: 43px clamp(24px,4.5vw,72px) 20px; }
.view { animation: appear .22s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: #8b86c1; font-size:14px; font-weight: 700; letter-spacing: .16em; }
.eyebrow-line { width: 17px; height: 1px; background: #aaa2ed; }
h1 { margin: 12px 0 7px; font-size: clamp(25px,2.45vw,34px); line-height: 1.25; letter-spacing: -.055em; font-weight: 700; }
h1 em { color: var(--violet); font-style: normal; }
.page-intro { margin: 0; color: #84908a; font-size:16px; line-height: 1.75; }
.heading-month { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; padding: 9px 12px; border: 1px solid #e5e9e5; border-radius: 10px; background: rgba(255,255,255,.56); color: #67736d; font-size:15px; white-space: nowrap; }
.heading-month-icon { color: #7770d8; font-size:15px; }

.overview-row { display: grid; grid-template-columns: 1fr 1fr 1.45fr; gap: 12px; margin-bottom: 18px; }
.overview-card { min-height: 91px; display: flex; align-items: center; gap: 12px; padding: 15px 16px; border: 1px solid #e8ece7; border-radius: 13px; background: rgba(255,255,255,.86); box-shadow: 0 3px 12px rgba(40,52,44,.02); }
.overview-symbol { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; }
.overview-symbol svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.symbol-violet { color: #6d62ca; background: #f0efff; }
.symbol-mint { color: #3c8d68; background: #eaf7ef; }
.overview-copy { display: grid; gap: 4px; }
.overview-copy > span { color: #8b9690; font-size:14px; }
.overview-copy strong { color: #2f3935; font-size:18px; line-height: 1; letter-spacing: -.035em; }
.overview-copy strong small { color: #929c96; font-size:14px; font-weight: 500; letter-spacing: 0; }
.overview-footnote { margin-left: auto; align-self: flex-end; color: #a1aaa5; font-size:13px; white-space: nowrap; }
.overview-tip { gap: 11px; padding: 13px 16px; background: #f5f4ff; border-color: #e9e6ff; }
.tip-stars { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: #ebe9ff; color: #7266d5; font-size:17px; }
.overview-tip > div:last-child { display: grid; gap: 4px; }
.overview-tip span { color: #8c84cf; font-size:14px; font-weight: 700; }
.overview-tip p { margin: 0; color: #72718d; font-size:14px; line-height: 1.65; }

.analysis-layout { display: grid; grid-template-columns: minmax(0,1fr) 230px; align-items: start; gap: 15px; }
.panel { border: 1px solid #e7ebe7; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.input-panel { padding: 21px 23px 18px; }
.panel-heading { display: flex; align-items: center; gap: 11px; padding-bottom: 18px; border-bottom: 1px solid #eff1ee; }
.step-badge { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #eeedff; color: #6960c4; font-size:14px; font-weight: 700; }
.panel-heading h2 { margin: 0; color: #343d39; font-size:13px; letter-spacing: -.02em; }
.panel-heading p { margin: 4px 0 0; color: #99a29d; font-size:14px; }
.panel-private { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 5px 8px; border: 1px solid #e7f1e9; border-radius: 7px; color: #55906e; background: #fbfefb; font-size:13px; }
.panel-private span { font-size:12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 18px 0 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field-label { color: #4b5651; font-size:14px; font-weight: 700; }
.field-label b { color: #cb6f6c; font-weight: 700; }
.select-wrap { position: relative; }
.select-wrap select, .field input:not([type=checkbox]), .field textarea { width: 100%; border: 1px solid #e3e8e3; border-radius: 8px; outline: none; background: #fff; color: #39443f; font-size:15px; transition: border .18s, box-shadow .18s; }
.select-wrap select { height: 37px; padding: 0 34px 0 11px; appearance: none; }
.select-wrap select:invalid, .select-wrap select option[value=""] { color: #a6aea9; }
.select-caret { position: absolute; top: 7px; right: 12px; pointer-events: none; color: #9da69f; font-size:16px; }
.select-wrap select:focus, .field input:focus, .field textarea:focus { border-color: #aaa3ed; box-shadow: 0 0 0 3px rgba(103,88,214,.09); }
.select-wrap select.needs-choice { border-color: #d67c70; box-shadow: 0 0 0 3px rgba(214,124,112,.1); }
.field-hint { color: #a0a9a4; font-size:13px; line-height: 1.5; }
.text-button, .mini-link { padding: 0; border: 0; background: transparent; color: #7568d1; font-size: inherit; font-weight: 700; }
.text-button:hover, .mini-link:hover { color: #4c40af; text-decoration: underline; }
.date-range { min-height: 37px; display: grid; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr); align-items: center; gap: 3px; }
.date-range input { height: 37px; padding: 0 8px; }
.date-dash { color: #a2aaa6; text-align: center; font-size:13px; }
.chat-field { padding-top: 1px; }
.chat-label-row { display: flex; align-items: center; justify-content: space-between; }
.char-count { color: #abb3ae; font-size:13px; }
.field textarea { min-height: 172px; resize: vertical; padding: 12px; line-height: 1.85; }
.field textarea::placeholder { color: #adb6b0; line-height: 1.8; }
.privacy-note { display: flex; align-items: center; gap: 6px; margin-top: 1px; padding: 8px 9px; border: 1px solid #e7f0e8; border-radius: 7px; background: #f9fcf9; color: #859189; font-size:13px; line-height: 1.5; }
.privacy-note-icon { color: #468863; font-size:14px; }
.privacy-note strong { color: #4b775c; font-weight: 700; }
.privacy-note .mini-link { flex: 0 0 auto; margin-left: auto; font-size:13px; }
.privacy-note .mini-link:disabled { color: #b4bcb7; text-decoration: none; }
.sample-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; color: #a1aaa5; font-size:13px; }
.sample-button { padding: 0; border: 0; background: transparent; color: #7165ca; font-size:13px; font-weight: 700; }
.sample-button span { margin-right: 4px; font-size:16px; }
.sample-button:hover { color: #483cae; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 19px; padding-top: 15px; border-top: 1px solid #eff1ee; }
.secure-foot { display: flex; align-items: center; gap: 6px; color: #9aa39e; font-size:13px; }
.tiny-lock { color: #57906d; font-size:13px; }
.button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; font-size:14px; font-weight: 700; transition: background .17s, transform .17s, box-shadow .17s; white-space: nowrap; }
.button:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.button-primary { color: #fff; background: var(--violet); box-shadow: 0 4px 12px rgba(103,88,214,.17); }
.button-primary:hover:not(:disabled) { background: var(--violet-dark); box-shadow: 0 5px 14px rgba(103,88,214,.25); }
.button-primary:disabled { box-shadow: none; }
.button-secondary { border-color: #e2e7e2; color: #64706a; background: #fff; }
.button-secondary:hover:not(:disabled) { border-color: #cbc9ee; color: var(--violet-dark); background: #faf9ff; }
.button-spark { font-size:13px; }
.button-arrow { margin-left: 2px; font-size:14px; font-weight: 400; }
.is-loading .button-spark { animation: pulse .65s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; transform: scale(.75); } }

.flow-card { position: relative; overflow: hidden; min-height: 377px; padding: 19px 18px 15px; border-radius: 14px; color: #fff; background: #302c43; box-shadow: 0 16px 35px rgba(39,34,62,.13); }
.flow-card::before { position: absolute; right: -55px; bottom: 35px; width: 180px; height: 180px; border: 1px solid rgba(191,181,255,.1); border-radius: 50%; content: ""; }
.flow-card::after { position: absolute; right: -22px; bottom: 67px; width: 116px; height: 116px; border: 1px solid rgba(191,181,255,.1); border-radius: 50%; content: ""; }
.flow-card-top { display: flex; align-items: center; justify-content: space-between; }
.flow-kicker { color: #a6a0c0; font-size:13px; font-weight: 700; letter-spacing: .15em; }
.flow-orbit { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(204,196,255,.27); border-radius: 50%; color: #c6bcff; font-size:12px; }
.flow-card h3 { margin: 12px 0 15px; font-size:21px; line-height: 1.43; letter-spacing: -.045em; }
.flow-steps { position: relative; display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.flow-steps::before { position: absolute; top: 20px; bottom: 20px; left: 12px; border-left: 1px dashed rgba(198,190,245,.28); content: ""; }
.flow-steps li { position: relative; display: grid; grid-template-columns: 25px 1fr 6px; align-items: center; gap: 10px; min-height: 53px; }
.flow-number { z-index: 1; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; background: #403b58; color: #b9b3d0; font-size:13px; }
.flow-steps li.is-current .flow-number { border-color: #b2a9fa; color: #fff; background: #6a5dcd; box-shadow: 0 0 0 4px rgba(140,126,239,.14); }
.flow-steps li > span:nth-child(2) { display: grid; gap: 3px; }
.flow-steps strong { font-size:14px; font-weight: 700; }
.flow-steps small { color: #a7a2b9; font-size:13px; }
.flow-steps li > i { width: 5px; height: 5px; border-radius: 50%; background: #8179a0; }
.flow-steps li.is-current > i { background: #b4aaff; box-shadow: 0 0 0 3px rgba(180,170,255,.11); }
.flow-footer { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 9px; border: 1px solid rgba(206,200,245,.13); border-radius: 8px; background: rgba(255,255,255,.045); color: #b4b0c7; font-size:13px; line-height: 1.65; }
.flow-footer strong { color: #e1def0; font-size:13px; }
.flow-check { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: rgba(103,201,149,.15); color: #8dd3ad; font-size:16px; }

.result-panel { margin-top: 16px; padding: 20px 23px; scroll-margin-top: 22px; }
.result-heading { padding-bottom: 15px; }
.step-badge-mint { background: #e8f6ee; color: #3a8b63; }
.review-pill { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 6px 9px; border: 1px solid #f4e5d3; border-radius: 20px; background: #fffaf3; color: #a97639; font-size:13px; }
.review-pill span { width: 5px; height: 5px; border-radius: 50%; background: #dda95f; }
.result-alert { display: flex; align-items: flex-start; gap: 8px; margin: 13px 0 2px; padding: 9px 10px; border: 1px solid #f3e5cd; border-radius: 8px; background: #fffaf2; color: #9e713d; font-size:13px; line-height: 1.65; }
.alert-icon { width: 14px; height: 14px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #d7a665; border-radius: 50%; font-size:14px; }
.table-scroll { overflow-x: auto; margin-top: 14px; }
.detail-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.detail-table th { padding: 9px 8px; border-bottom: 1px solid #edf0ed; color: #9aa39e; text-align: left; font-size:13px; font-weight: 600; white-space: nowrap; }
.detail-table td { padding: 7px 6px; border-bottom: 1px solid #f0f2ef; }
.detail-table td input { min-width: 60px; width: 100%; height: 31px; padding: 0 7px; border: 1px solid #e7ebe7; border-radius: 6px; outline: none; color: #47524d; background: #fff; font-size:14px; }
.detail-table td:first-child input { min-width: 110px; }
.detail-table td:nth-child(3) input { min-width: 70px; }
.detail-table td:nth-child(4) input, .detail-table td:nth-child(5) input { min-width: 58px; }
.detail-table td input:focus { border-color: #aaa3ed; box-shadow: 0 0 0 2px rgba(103,88,214,.08); }
.detail-table td:nth-child(4) input { text-align: center; }
.detail-table td:nth-child(5) input { text-align: right; }
.row-unpriced td:nth-child(5) input { border-color: #e2b46d; background: #fffaf2; }
.table-subtotal { display: inline-block; min-width: 70px; color: #47524d; font-size:14px; font-weight: 700; white-space: nowrap; }
.row-unpriced .table-subtotal { color: #bd853c; font-size:13px; }
.row-delete { width: 23px; height: 23px; border: 0; border-radius: 6px; background: transparent; color: #b1b8b4; font-size:16px; }
.row-delete:hover { background: #fff0ef; color: #c46b67; }
.add-row-button { margin-top: 11px; padding: 6px 0; border: 0; background: transparent; color: #7366ce; font-size:14px; font-weight: 700; }
.result-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-top: 17px; padding-top: 16px; border-top: 1px solid #eef0ed; }
.result-meta { display: flex; align-items: center; gap: 7px; color: #99a29d; font-size:13px; }
.result-meta-dot { width: 6px; height: 6px; border-radius: 50%; background: #76b78e; }
.total-block { display: grid; gap: 4px; text-align: right; }
.total-block span { color: #89948d; font-size:14px; }
.total-block strong { color: #312f4f; font-size:22px; letter-spacing: -.04em; }
.result-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.compact-heading { margin-bottom: 22px; }
.compact-heading .button { margin-bottom: 4px; }
.vendor-layout { display: grid; grid-template-columns: minmax(0,1fr) 250px; align-items: start; gap: 16px; }
.vendor-list { display: grid; gap: 12px; }
.vendor-card { overflow: hidden; padding: 15px 17px 13px; border: 1px solid #e7ebe7; border-radius: 12px; background: #fff; box-shadow: 0 8px 25px rgba(38,49,42,.035); }
.vendor-card-top { display: flex; align-items: center; gap: 10px; }
.vendor-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #675bc5; background: #f0efff; font-size:12px; font-weight: 700; }
.vendor-card-name { display: grid; gap: 4px; }
.vendor-card-name strong { color: #36413b; font-size:16px; }
.vendor-card-name span { color: #9ca6a0; font-size:13px; }
.edit-vendor { margin-left: auto; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: #7468c9; font-size:13px; font-weight: 700; }
.edit-vendor:hover { background: #f4f2ff; }
.edit-vendor span { margin-left: 4px; font-size:16px; }
.rate-chip-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid #f0f2ef; }
.rate-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #edf0ed; border-radius: 7px; background: #fbfcfb; color: #76817a; font-size:13px; }
.rate-chip strong { color: #49544e; font-size:13px; }
.rate-chip-more { align-self: center; color: #969f9a; font-size:13px; }
.vendor-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; padding-top: 10px; border-top: 1px solid #f0f2ef; color: #9aa39e; font-size:13px; }
.vendor-card-foot strong { color: #535f59; font-size:14px; }
.foot-date { margin-left: auto; }
.rate-side-note { position: sticky; top: 90px; overflow: hidden; min-height: 208px; padding: 18px; border-radius: 12px; background: #302c43; color: #fff; }
.rate-note-mark { color: #b5abff; font-size:18px; }
.rate-side-note h3 { margin: 10px 0 9px; font-size:17px; line-height: 1.45; letter-spacing: -.04em; }
.rate-side-note p { margin: 0; color: #b6b2c5; font-size:13px; line-height: 1.8; }
.rate-note-rule { height: 1px; margin: 14px 0 9px; background: rgba(255,255,255,.12); }
.rate-note-caption { color: #d0cbed; font-size:13px; }
.empty-card { min-height: 205px; display: grid; justify-items: center; align-content: center; padding: 24px; border: 1px dashed #dce2dc; border-radius: 13px; background: rgba(255,255,255,.55); text-align: center; }
.empty-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #efeeff; color: #7267d1; font-size:19px; }
.empty-card h2 { margin: 13px 0 5px; font-size:13px; }
.empty-card p { max-width: 310px; margin: 0 0 15px; color: #929c96; font-size:14px; line-height: 1.7; }

.history-list { display: grid; gap: 12px; max-width: 860px; }
.history-card { padding: 16px 18px 12px; border: 1px solid #e7ebe7; border-radius: 12px; background: #fff; box-shadow: 0 8px 25px rgba(38,49,42,.035); }
.history-card-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 13px; border-bottom: 1px solid #eef1ee; }
.history-card-head > div:first-child { display: grid; gap: 4px; }
.history-date-label { color: #9ba59f; font-size:13px; }
.history-card-head > div:first-child > strong { color: #414c46; font-size:16px; }
.history-card-head i { padding: 0 3px; color: #afb7b2; font-style: normal; }
.history-vendor { color: #766bd0; font-size:14px; }
.history-total { display: grid; align-content: center; justify-items: end; gap: 3px; }
.history-total span { color: #9ba59f; font-size:13px; }
.history-total strong { color: #34324d; font-size:19px; letter-spacing: -.04em; }
.history-lines { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 22px; padding: 9px 0; }
.history-line { display: grid; grid-template-columns: 1fr 45px 85px; align-items: center; gap: 5px; padding: 6px 0; border-bottom: 1px solid #f3f4f2; color: #727d77; font-size:13px; }
.history-line i { color: #b9c0bb; font-style: normal; }
.history-line > span:nth-child(2) { color: #98a19b; text-align: center; }
.history-line strong { color: #505b55; text-align: right; font-size:13px; }
.history-saved { color: #a1aaa5; font-size:13px; }
.history-saved span { padding: 0 4px; }

.settings-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(250px,.8fr); align-items: start; gap: 14px; }
.settings-panel { padding: 18px; }
.settings-heading { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid #eef0ed; }
.settings-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 9px; background: #efeeff; color: #7165ca; font-size:15px; }
.settings-icon-green { background: #eaf7ef; color: #488560; }
.settings-heading h2 { margin: 0; color: #38433e; font-size:16px; }
.settings-heading p { margin: 4px 0 0; color: #96a09a; font-size:13px; line-height: 1.6; }
.key-state { display: inline-flex; align-items: center; gap: 6px; margin: 13px 0; padding: 6px 9px; border: 1px solid #f0e8d9; border-radius: 20px; background: #fffcf7; color: #a87b3f; font-size:13px; }
.key-state-dot { width: 5px; height: 5px; border-radius: 50%; background: #d8a45e; }
.key-state.is-configured { border-color: #e2f1e6; background: #f9fdf9; color: #47815d; }
.key-state.is-configured .key-state-dot { background: #64ac7d; }
.key-state.is-preview { border-color: #ece9ff; background: #fbfaff; color: #766bc8; }
.key-state.is-preview .key-state-dot { background: #9387e7; }
.key-field input { height: 37px; padding: 0 10px; }
.free-tier-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; color: #7b857f; font-size:13px; line-height: 1.65; }
.free-tier-check input { width: 14px; height: 14px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--violet); }
.free-tier-check strong { color: #4a765c; }
.key-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.backup-actions { justify-content: flex-start; flex-wrap: wrap; }
.backup-actions .button { flex: 1 1 135px; min-height: 44px; }
.settings-warning { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px; border: 1px solid #f2e6d5; border-radius: 8px; background: #fffaf3; color: #a27a49; }
.settings-warning > span { width: 14px; height: 14px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #d2a365; border-radius: 50%; font-size:14px; }
.settings-warning p { margin: 0; font-size:13px; line-height: 1.7; }
.settings-warning-soft { border-color: #e8e7f7; background: #faf9ff; color: #79759d; }
.settings-warning-soft > span { border-color: #aaa4df; }
.privacy-list { display: grid; gap: 0; margin: 15px 0 0; padding: 0; list-style: none; }
.privacy-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f0f2ef; color: #89948d; font-size:13px; }
.privacy-list li strong { color: #536059; font-size:13px; font-weight: 700; text-align: right; }

.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 25px; padding: 15px 0 3px; border-top: 1px solid #e7ebe7; color: #a0aaa4; font-size:13px; }
.footer-separator { padding: 0 4px; color: #c0c7c2; }
.footer-build { color: #a5a4bc; font-size:12px; font-weight: 700; letter-spacing: .12em; }

.app-dialog { width: min(570px, calc(100vw - 30px)); max-height: min(90vh, 760px); padding: 0; overflow: auto; border: 0; border-radius: 15px; background: transparent; box-shadow: 0 25px 90px rgba(30,34,39,.28); }
.app-dialog::backdrop { background: rgba(31,35,43,.38); backdrop-filter: blur(2px); }
.dialog-card { padding: 22px; border: 1px solid rgba(255,255,255,.7); border-radius: 15px; background: #fff; }
.dialog-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.dialog-top h2 { margin: 8px 0 4px; color: #343d39; font-size:19px; letter-spacing: -.04em; }
.dialog-top p { margin: 0; color: #98a29c; font-size:14px; }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #e8ece8; border-radius: 8px; background: #fff; color: #87918b; font-size:18px; }
.dialog-name { margin-bottom: 17px; }
.dialog-name input { height: 38px; padding: 0 10px; }
.rules-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: #505b55; font-size:14px; font-weight: 700; }
.rules-editor { display: grid; gap: 7px; max-height: 260px; overflow: auto; padding: 1px 2px 2px 0; }
.rule-editor-row { display: grid; grid-template-columns: minmax(90px,1fr) minmax(90px,1fr) minmax(85px,.7fr) 24px; align-items: center; gap: 6px; }
.rule-editor-row > input, .rule-price-wrap { width: 100%; height: 34px; border: 1px solid #e6eae6; border-radius: 7px; outline: none; background: #fff; color: #46514b; font-size:13px; }
.rule-editor-row > input { padding: 0 8px; }
.rule-editor-row input:focus { border-color: #aaa3ed; box-shadow: 0 0 0 2px rgba(103,88,214,.08); }
.rule-price-wrap { display: flex; align-items: center; gap: 4px; padding: 0 6px; color: #a1aaa4; }
.rule-price-wrap input { width: 100%; min-width: 0; height: 29px; border: 0; outline: none; color: #46514b; font-size:13px; }
.remove-rule { width: 22px; height: 22px; border: 0; border-radius: 6px; background: #f8f9f7; color: #9ea7a1; font-size:15px; }
.remove-rule:hover { color: #c26965; background: #fff0ef; }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 19px; padding-top: 14px; border-top: 1px solid #eef0ed; }
.dialog-actions .button { min-height: 34px; font-size:13px; }
.dialog-spacer { flex: 1; }
.redaction-preview { max-height: 300px; overflow: auto; margin: 11px 0; padding: 12px; border: 1px solid #e8ece8; border-radius: 8px; background: #fafbfa; color: #5b665f; font-family: inherit; font-size:14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.redaction-summary { padding: 9px 10px; border: 1px solid #e5efea; border-radius: 8px; background: #f8fcf9; color: #568166; font-size:13px; line-height: 1.65; }
.toast-region { position: fixed; right: 22px; bottom: 20px; z-index: 20; display: grid; gap: 8px; width: min(340px, calc(100vw - 28px)); pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid #e6e9e6; border-radius: 10px; background: #fff; box-shadow: 0 12px 34px rgba(31,42,35,.14); color: #546059; font-size:15px; line-height: 1.6; animation: toastIn .2s ease-out; }
.toast-success { border-color: #dcefe2; color: #3e7654; }
.toast-warn { border-color: #f0e4d2; color: #966b37; }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1050px) {
  .app-frame { grid-template-columns: 205px minmax(0,1fr); }
  .sidebar { padding-inline: 12px; }
  .page-content { padding-inline: 28px; }
  .topbar { padding-inline: 28px; }
  .overview-row { grid-template-columns: 1fr 1fr; }
  .overview-tip { grid-column: 1 / -1; min-height: 67px; }
  .analysis-layout { grid-template-columns: minmax(0,1fr) 210px; }
  .input-panel { padding-inline: 18px; }
}

@media (max-width: 780px) {
  .preview-banner { justify-content: flex-start; flex-wrap: wrap; padding: 8px 14px; font-size:14px; }
  .preview-banner-note { padding-left: 7px; }
  .app-frame { display: block; padding-bottom: 61px; }
  .sidebar { position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 10; width: 100%; height: 60px; min-height: 0; display: block; padding: 0; border-top: 1px solid #e6ebe6; border-right: 0; background: rgba(255,255,255,.96); box-shadow: 0 -5px 22px rgba(38,50,42,.055); backdrop-filter: blur(12px); }
  .brand, .nav-label, .sidebar-spacer, .sidebar-privacy, .sidebar-footer { display: none; }
  .main-nav { height: 100%; display: grid; grid-template-columns: repeat(3,1fr); gap: 0; padding: 4px 10px; }
  .nav-item { min-height: 50px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 3px 5px; border-radius: 9px; font-size:13px; }
  .nav-item svg { width: 16px; height: 16px; }
  .nav-chevron, .nav-count { display: none; }
  .settings-nav { position: absolute; top: -53px; right: 13px; width: 39px; min-height: 39px; border: 1px solid #e5e9e5; border-radius: 50%; background: #fff; box-shadow: 0 3px 12px rgba(40,52,44,.08); }
  .settings-nav span { display: none; }
  .topbar { height: 55px; padding: 0 17px; }
  .topbar-right { gap: 11px; }
  .cloud-status { font-size:13px; }
  .account-chip { gap: 6px; padding-left: 9px; }
  .account-email { display: none; }
  .account-chevron { display: none; }
  .page-content { padding: 27px 16px 17px; }
  .page-heading { align-items: flex-start; margin-bottom: 17px; }
  h1 { margin-top: 9px; font-size: clamp(23px,6vw,30px); }
  .page-intro { max-width: 290px; font-size:15px; }
  .heading-month { display: none; }
  .overview-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .overview-card { min-height: 75px; gap: 8px; padding: 11px; }
  .overview-symbol { width: 29px; height: 29px; }
  .overview-symbol svg { width: 16px; height: 16px; }
  .overview-copy > span { font-size:13px; }
  .overview-copy strong { font-size:16px; }
  .overview-footnote { display: none; }
  .overview-tip { grid-column: 1 / -1; min-height: 58px; padding: 9px 12px; }
  .overview-tip p { font-size:13px; }
  .analysis-layout { grid-template-columns: minmax(0,1fr); gap: 11px; }
  .input-panel { padding: 16px 14px 13px; }
  .panel-heading { gap: 9px; padding-bottom: 13px; }
  .panel-heading h2 { font-size:12px; }
  .panel-private { padding: 4px 6px; font-size:12px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; padding: 14px 0 12px; }
  .date-range { max-width: 380px; }
  .field textarea { min-height: 155px; font-size:15px; }
  .privacy-note { align-items: flex-start; font-size:12px; }
  .privacy-note .mini-link { padding-top: 1px; font-size:12px; }
  .sample-row { align-items: flex-start; font-size:12px; }
  .sample-button { flex: 0 0 auto; font-size:12px; }
  .form-footer { margin-top: 14px; padding-top: 12px; }
  .secure-foot { max-width: 120px; font-size:12px; }
  .form-footer .button { min-height: 37px; padding-inline: 11px; font-size:13px; }
  .flow-card { display: none; }
  .result-panel { margin-top: 12px; padding: 15px 13px; }
  .result-heading { align-items: flex-start; }
  .review-pill { margin-top: 2px; padding: 5px 7px; font-size:12px; }
  .result-heading p { max-width: 190px; line-height: 1.5; }
  .table-scroll { overflow: visible; margin-top: 10px; }
  .detail-table { min-width: 0; display: block; }
  .detail-table thead { display: none; }
  .detail-table tbody { display: grid; gap: 8px; }
  .detail-table tr { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 7px; padding: 9px; border: 1px solid #edf0ed; border-radius: 9px; background: #fff; }
  .detail-table tr.row-unpriced { border-color: #f0dfc4; background: #fffdf9; }
  .detail-table td { display: grid; gap: 3px; min-width: 0; padding: 0; border: 0; }
  .detail-table td::before { color: #9ca69f; content: attr(data-label); font-size:12px; }
  .detail-table td:first-child input { min-width: 0; }
  .detail-table td:nth-child(3) input { min-width: 0; }
  .detail-table td:nth-child(4) input, .detail-table td:nth-child(5) input { min-width: 0; }
  .detail-table td:nth-child(6) { justify-content: end; align-content: center; text-align: right; }
  .detail-table td:nth-child(7) { position: absolute; right: 21px; width: 20px; margin-top: -5px; }
  .detail-table td input { height: 31px; font-size:13px; }
  .table-subtotal { min-height: 31px; display: grid; align-content: center; font-size:13px; }
  .result-bottom { align-items: flex-end; margin-top: 12px; padding-top: 12px; }
  .result-meta { max-width: 140px; align-items: flex-start; font-size:12px; line-height: 1.5; }
  .total-block span { font-size:13px; }
  .total-block strong { font-size:19px; }
  .result-actions { margin-top: 12px; }
  .result-actions .button { min-height: 35px; padding-inline: 10px; font-size:13px; }
  .vendor-layout { grid-template-columns: 1fr; }
  .rate-side-note { position: static; min-height: auto; padding: 14px; }
  .rate-side-note h3 br { display: none; }
  .rate-side-note h3 { font-size:15px; }
  .rate-side-note p { max-width: 460px; }
  .compact-heading .button { min-height: 34px; margin-top: 19px; padding-inline: 10px; font-size:13px; }
  .vendor-card { padding: 12px; }
  .rate-chip-list { gap: 5px; }
  .rate-chip { padding: 5px 6px; font-size:12px; }
  .rate-chip strong { font-size:12px; }
  .history-lines { grid-template-columns: 1fr; }
  .history-card { padding: 13px; }
  .history-card-head { gap: 10px; }
  .history-card-head > div:first-child > strong { font-size:14px; }
  .history-total strong { font-size:17px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-panel { padding: 14px; }
  .page-footer { margin-top: 18px; font-size:12px; }
  .app-dialog { width: calc(100vw - 22px); }
  .dialog-card { padding: 17px 14px; }
  .rule-editor-row { grid-template-columns: minmax(65px,1fr) minmax(65px,1fr) minmax(66px,.7fr) 22px; gap: 4px; }
  .rule-editor-row > input { padding-inline: 5px; font-size:12px; }
  .rule-price-wrap { gap: 2px; padding-inline: 4px; font-size:12px; }
  .rule-price-wrap input { font-size:12px; }
  .dialog-actions { gap: 5px; }
  .dialog-actions .button { min-height: 32px; padding-inline: 8px; font-size:12px; }
  .toast-region { right: 12px; bottom: 72px; }
}

@media (max-width: 390px) {
  .topbar { padding-inline: 12px; }
  .breadcrumbs { gap: 6px; font-size:14px; }
  .page-content { padding-inline: 12px; }
  .overview-card { padding-inline: 8px; }
  .input-panel { padding-inline: 11px; }
  .panel-private { gap: 3px; }
  .form-footer .button { gap: 6px; padding-inline: 8px; }
  .secure-foot { max-width: 98px; }
  .result-panel { padding-inline: 10px; }
  .detail-table tr { gap: 5px; padding: 7px; }
  .detail-table td input { padding-inline: 5px; }
  .result-actions .button { padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Larger, touch-friendly controls and dialog actions that remain reachable. */
.select-wrap select { height: 44px; }
.date-range input { height: 44px; }
.button { min-height: 44px; }
.icon-button { width: 44px; height: 44px; flex: 0 0 auto; }
.dialog-top { position: sticky; top: -1px; z-index: 2; padding: 8px 0 10px; background: #fff; }
.dialog-actions { position: sticky; bottom: -1px; z-index: 2; padding: 12px 0 4px; background: #fff; }
.app-dialog { overscroll-behavior: contain; }
@media (max-width: 780px) {
  .select-wrap select, .date-range input { height: 48px; }
  .field textarea { font-size: 16px; }
  .form-footer .button, .result-actions .button { min-height: 44px; font-size: 13px; }
  .app-dialog { max-height: calc(100dvh - 24px); }
}
