:root {
  color-scheme: light;
  --ink: #261d37;
  --muted: #625973;
  --violet: #6943b1;
  --violet-dark: #4b2c87;
  --line: #e9e3f0;
  --canvas: #f8f6fb;
  --white: #fff;
  --radius: 18px;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
a { color: var(--violet-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #9264e5; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 4.2vw, 3.4rem); letter-spacing: -.055em; line-height: 1.05; font-weight: 700; }
h2 { font-size: 1.25rem; line-height: 1.28; letter-spacing: -.035em; }
.skip { position: fixed; top: .5rem; left: .5rem; padding: .75rem; background: white; z-index: 5; transform: translateY(-180%); }
.skip:focus { transform: none; }
.sidebar { width: 218px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; gap: 43px; padding: 29px 18px 24px; background: #241b36; color: #fff; }
.brand { color: #fff; display: flex; gap: 12px; align-items: center; padding: 0 7px; font-weight: 700; font-size: 1.04rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand small, .sidebar-footer small { display: block; font-weight: 500; color: #cec1e1; font-size: .8rem; margin-top: 2px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; flex: none; border-radius: 13px; background: #e8d9ff; }
.brand-mark span { width: 13px; height: 11px; position: relative; border: 2px solid #552d93; border-top: 0; border-radius: 0 0 2px 2px; transform: translateY(3px); }
.brand-mark span::before { content: ""; position: absolute; top: -7px; left: -1px; width: 11px; height: 11px; transform: rotate(45deg); border: 2px solid #552d93; border-right: 0; border-bottom: 0; border-radius: 1px; }
.brand-mark span::after { content: ""; position: absolute; width: 2px; height: 4px; background: #552d93; left: 4px; bottom: 0; }
nav { display: grid; gap: 6px; }
nav a { display: flex; align-items: center; gap: 12px; padding: 12px 13px; min-height: 46px; color: #e1d7ef; font-weight: 570; font-size: .94rem; border-radius: 10px; }
nav a:hover { background: #392949; text-decoration: none; }
nav a[aria-current="page"] { background: #48335f; color: #fff; }
.nav-icon { width: 20px; text-align: center; color: #dcc2ff; font-size: 1.2rem; line-height: 1; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #493d57; padding: 18px 4px 0; display: flex; gap: 10px; align-items: center; font-size: .88rem; }
.currency-mark { flex: none; display: grid; place-items: center; min-width: 34px; min-height: 34px; padding: 0 6px; background: #40314f; border-radius: 50%; color: #e9d9ff; font-weight: 700; }
main { margin-left: 218px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; height: 68px; padding: 0 clamp(20px, 4vw, 49px); border-bottom: 1px solid var(--line); background: #fff; font-weight: 700; }
.top-meta { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; }
.picker-trigger { display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid #ded3ed; border-radius: 8px; background: white; color: var(--ink); font-size: .86rem; font-weight: 700; }
.picker-trigger:hover { background: #f4edfc; border-color: #c9b4e7; }
#currency-trigger, #account-trigger { flex: none; }
#account-trigger { min-height: 36px; padding: 6px 10px; font-size: .86rem; }
#country-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.flag { flex: none; font-size: 1.04rem; line-height: 1; }
.picker-chevron { flex: none; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(-2px) rotate(45deg); margin: 0 1px; }
.workspace { max-width: 1460px; margin: 0 auto; padding: 30px clamp(20px, 4vw, 49px) 0; }
.hero { overflow: hidden; position: relative; min-height: 305px; display: grid; grid-template-columns: 57% 43%; border-radius: 23px; background: #e9def9; }
.hero-content { position: relative; z-index: 1; padding: clamp(27px, 4vw, 50px); align-self: center; }
.hero h1 { font-size: clamp(2.65rem, 5.7vw, 5.45rem); line-height: .96; letter-spacing: -.065em; }
.hero p { max-width: 410px; color: #4d4160; line-height: 1.52; margin: 17px 0 22px; font-size: 1rem; }
.hero-image { background-color: #c5b2e5; background-image: url("housing.jpg"); background-size: cover; background-position: center 54%; }
.button { display: inline-flex; justify-content: center; align-items: center; text-align: center; min-height: 43px; padding: 10px 16px; border: 1px solid var(--violet-dark); background: var(--violet-dark); color: white; border-radius: 9px; font-weight: 700; font-size: .91rem; line-height: 1.25; }
.button:hover { background: #3e226f; border-color: #3e226f; text-decoration: none; }
.button-light { background: var(--ink); border-color: var(--ink); }
.button-light:hover { background: #432f5d; border-color: #432f5d; }
.secondary { background: #fff; color: var(--violet-dark); border-color: #ded3ed; }
.secondary:hover { background: #f2ecfb; border-color: #d1bde8; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 8px #30204306; min-width: 0; }
.overview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 13px; }
.overview-heading h2 { font-size: 1.5rem; }
#example-status { color: var(--muted); font-size: .82rem; text-align: right; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 16px 18px; display: grid; align-content: start; gap: 7px; }
.metric-icon { height: 32px; width: 32px; display: grid; place-items: center; border-radius: 9px; font-weight: 700; font-size: 1.03rem; margin-bottom: 1px; }
.lavender { background: #f0e6ff; color: #63419c; }
.peach { background: #fff1e5; color: #9b4a29; }
.mint { background: #e2f4eb; color: #28684e; }
.metric > span:not(.metric-icon) { color: var(--muted); font-size: .9rem; }
.metric strong { font-size: clamp(1.5rem, 2.45vw, 2.25rem); line-height: 1.1; letter-spacing: -.055em; overflow-wrap: anywhere; }
.metric a, .panel-heading a { font-size: .875rem; font-weight: 700; }
.dashboard-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 15px; margin-top: 15px; }
.dashboard-panel { padding: 20px; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.shortlist-row, .expense-row, .item-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.shortlist-row strong, .expense-row strong, .item-row strong { overflow-wrap: anywhere; text-align: right; }
.shortlist-row span, .expense-row span { overflow-wrap: anywhere; }
.shortlist-row small, .expense-row small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.renewal-amount { font-size: clamp(1.45rem, 3vw, 2.15rem); font-weight: 700; line-height: 1.15; letter-spacing: -.055em; overflow-wrap: anywhere; }
.progress { width: 100%; height: 10px; display: block; border: none; border-radius: 20px; overflow: hidden; appearance: none; color: #7150b5; background: #ede7f3; margin: 13px 0; }
.progress::-webkit-progress-bar { background: #ede7f3; border-radius: 20px; }
.progress::-webkit-progress-value { background: #7150b5; border-radius: 20px; }
.progress::-moz-progress-bar { background: #7150b5; border-radius: 20px; }
.hint, .muted, .main-footer { color: var(--muted); line-height: 1.5; }
.hint { font-size: .875rem; }
.main-footer { padding: 24px 0; font-size: .8rem; }
.page-heading { margin: 12px 0 24px; }
.page-heading p { margin-top: 9px; color: var(--muted); line-height: 1.5; }
.with-action { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.with-action .button { flex: none; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 17px; }
.tool-panel { padding: clamp(17px, 2.8vw, 29px); }
.tool-panel > h2 { margin-bottom: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full { grid-column: 1 / -1; }
label { font-size: .9rem; font-weight: 700; min-width: 0; }
.field, .plain-input { margin-top: 6px; min-height: 44px; border: 1px solid #ddd3e8; background: #fcfaff; border-radius: 9px; width: 100%; color: var(--ink); font-weight: 600; }
.field { display: flex; align-items: center; }
.field > span { padding: 0 11px; color: var(--muted); }
.field input { width: 100%; min-width: 0; height: 42px; padding: 0 11px; border: 0; background: transparent; color: inherit; font-weight: inherit; }
.field > span:first-child + input { padding-left: 0; }
.field:focus-within { outline: 2px solid #986be4; outline-offset: 1px; }
.field input:focus { outline: none; }
.field:has(input:invalid) { border-color: #b54d4d; }
.plain-input { display: block; padding: 8px 11px; }
select.plain-input { appearance: none; padding-right: 31px; background: linear-gradient(45deg, transparent 50%, #624b74 50%) calc(100% - 15px) 50% / 5px 5px no-repeat, linear-gradient(135deg, #624b74 50%, transparent 50%) calc(100% - 10px) 50% / 5px 5px no-repeat, #fcfaff; }
.tool-panel > .hint { margin-top: 11px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.result-banner { display: grid; gap: 5px; border-radius: 13px; background: #eee3ff; padding: 16px; margin-bottom: 14px; }
.result-banner strong { font-size: clamp(1.85rem, 4vw, 3.2rem); font-weight: 700; letter-spacing: -.065em; line-height: 1.08; overflow-wrap: anywhere; }
.result-banner span { font-weight: 700; color: #513377; }
.item-row { font-size: .93rem; }
.item-row span { display: flex; align-items: center; gap: 8px; }
.item-row i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cost-stack { display: flex; height: 10px; overflow: hidden; border-radius: 20px; background: #ede7f3; margin: 15px 0; }
.cost-stack span { min-width: 0; }
.two-results { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.two-results strong { display: block; font-size: 1.22rem; letter-spacing: -.04em; overflow-wrap: anywhere; }
.reminder { background: #fff0df; color: #72390f; border-radius: 8px; padding: 10px 12px; margin-top: 12px; font-size: .875rem; }
.table-panel { padding: 19px; }
.table-scroll { overflow: auto; }
.compare-table { border-collapse: collapse; width: 100%; min-width: max(390px, 100%); }
.compare-table th, .compare-table td { text-align: right; padding: 12px 10px; vertical-align: middle; min-width: 125px; }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; min-width: 135px; }
.compare-table thead th { color: var(--violet-dark); overflow-wrap: anywhere; max-width: 180px; }
.compare-table tbody tr { border-top: 1px solid var(--line); }
.compare-table tbody th { font-weight: 550; color: var(--muted); }
.compare-table .total { background: #f4edfc; font-weight: 700; }
.compare-table .total th { color: var(--ink); font-weight: inherit; }
.compare-table .lowest { color: #266349; }
.compare-table .table-actions td { vertical-align: top; }
.table-actions button { background: none; color: var(--violet-dark); border: 0; display: block; padding: 4px 0; margin-left: auto; font-size: .85rem; font-weight: 700; text-align: right; }
.table-actions button:hover { text-decoration: underline; }
.table-actions button.remove { color: #8a475b; }
.chart-panel { margin-top: 15px; padding: 19px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 145px) minmax(45px, 1fr) max-content; gap: 12px; align-items: center; margin-top: 13px; }
.bar-name { overflow-wrap: anywhere; }
.chart-bar { height: 13px; border-radius: 10px; background: #efeaf6; overflow: hidden; }
.chart-bar div { height: 100%; border-radius: inherit; background: #aa8dd5; }
.bar-row.lowest .chart-bar div { background: #6744a7; }
.cart-note { margin-top: 12px; }
.expenses { margin-top: 17px; }
.expense-form { display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 15px; }
.expense-row .text-button { display: block; margin-left: auto; }
.text-button { border: 0; background: none; color: var(--violet-dark); font-size: .84rem; font-weight: 700; padding: 4px 0; }
.text-button:hover { text-decoration: underline; }
dialog { max-width: min(535px, calc(100% - 24px)); width: 100%; max-height: calc(100% - 24px); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); padding: 23px; }
dialog::backdrop { background: #2116319c; }
#account-dialog { max-width: min(480px, calc(100% - 24px)); }
#account-dialog .panel-heading { align-items: center; margin-bottom: 14px; }
.account-context { margin-top: 13px; font-weight: 700; overflow-wrap: anywhere; }
.account-status:not(:empty) { margin-top: 10px; padding: 9px 11px; border-radius: 8px; background: #f2ecfb; color: var(--violet-dark); }
.account-status[data-error="true"] { background: #fff0e6; color: #773c26; }
#account-dialog .actions { margin-top: 13px; }
#location-dialog { max-width: min(450px, calc(100% - 24px)); }
#location-dialog .panel-heading { align-items: center; margin-bottom: 14px; }
#location-hint { margin: 8px 0; }
.location-results { max-height: min(340px, 45vh); overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.location-option { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 10px; background: white; color: var(--ink); text-align: left; }
.location-option:hover, .location-option[aria-pressed="true"] { background: #f2ecfb; }
.location-option:focus-visible { outline-offset: -3px; }
.location-code { margin-left: auto; flex: none; color: var(--violet-dark); font-size: .82rem; font-weight: 700; }

dialog .panel-heading, dialog .actions { margin: 0; }
.close-button { border: none; background: #f0e8fb; border-radius: 8px; width: 34px; height: 34px; color: var(--violet-dark); font-size: 1.25rem; line-height: 1; flex: none; }
#toast:not(:empty) { position: fixed; right: 18px; bottom: 18px; z-index: 4; background: var(--ink); color: white; max-width: calc(100vw - 36px); padding: 11px 15px; border-radius: 9px; box-shadow: 0 5px 16px #392b5560; }
@media (max-width: 960px) {
  .sidebar { width: 180px; padding-inline: 12px; }
  .brand { gap: 8px; padding-inline: 0; font-size: .94rem; }
  .brand-mark { width: 35px; height: 35px; }
  main { margin-left: 180px; }
  .hero { grid-template-columns: 60% 40%; }
  .hero h1 { font-size: clamp(2.4rem, 5vw, 3.5rem); }
  .tool-grid { gap: 12px; }
  .expense-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 710px) {
  .sidebar { width: auto; position: static; gap: 11px; padding: 12px 14px 9px; }
  .sidebar nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  nav a { justify-content: center; gap: 5px; min-height: 40px; padding: 6px 3px; font-size: .84rem; }
  .nav-icon { display: none; }
  .brand { padding: 0; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand small { display: none; }
  .sidebar-footer { display: none; }
  main { margin-left: 0; min-height: 0; }
  .topbar { height: 49px; }
  .workspace { padding-top: 17px; }
  .hero h1 { font-size: clamp(2.3rem, 8vw, 4.1rem); }
  .hero { min-height: 255px; }
  .hero-content { padding: 23px 17px; }
  .hero p { margin: 11px 0 14px; }
  .tool-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .workspace { padding-inline: 13px; }
  .topbar { gap: 7px; padding-inline: 13px; }
  #section-name { display: none; }
  .top-meta { margin-left: auto; }
  .picker-trigger { gap: 5px; padding-inline: 7px; }
  .hero { display: block; }
  .hero-content { padding: 21px 17px; }
  .hero-image { height: 142px; background-position: center 51%; }
  .desktop-break { display: none; }
  .metrics, .dashboard-grid { grid-template-columns: 1fr; gap: 9px; }
  .metric { grid-template-columns: 32px 1fr; column-gap: 10px; padding: 12px 14px; }
  .metric-icon { grid-row: span 3; }
  .with-action { align-items: start; flex-direction: column; }
  .compare-table th, .compare-table td { padding-inline: 8px; }
  .bar-row { grid-template-columns: minmax(55px, 85px) minmax(20px, 1fr) max-content; gap: 6px; }
  .bar-row strong { font-size: .81rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .view { animation: appear .18s ease-out; }
  @keyframes appear { from { opacity: .65; } to { opacity: 1; } }
}
