@font-face {
  font-family: "Inter";
  src: local("Inter"), local("Arial");
  font-display: swap;
}

:root {
  --navy: #0A3A52;
  --green: #167A6D;
  --teal: #2CA8A0;
  --mint: #65C3B5;
  --gold: #D9A441;
  --ink: #082c3d;
  --paper: #f4fbf9;
  --line: rgba(10, 58, 82, .11);
  --muted: #63808b;
  --shadow: 0 22px 60px rgba(2, 35, 47, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 2%, rgba(101,195,181,.22), transparent 24rem),
    linear-gradient(145deg, #f9fdfc 0%, #eaf6f3 100%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.auth-open { overflow: hidden; }
.auth-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, rgba(4,39,54,.97), rgba(22,122,109,.95)); }
.auth-gate.hidden { display: none; }
.auth-card { width: min(430px, 100%); padding: 40px 34px; border: 1px solid rgba(255,255,255,.22); border-radius: 30px; color: white; background: rgba(7,45,59,.72); box-shadow: 0 28px 80px rgba(0,20,30,.28); backdrop-filter: blur(18px); text-align: center; }
.auth-card .eyebrow { color: var(--mint); }
.auth-card h2 { margin: 12px 0 14px; color: white; }
.auth-card p:not(.eyebrow) { margin-bottom: 24px; color: rgba(255,255,255,.72); font-size: 14px; }
.auth-card small { display: block; margin-top: 18px; color: rgba(255,255,255,.55); font-size: 11px; }
.auth-icon { width: 94px; height: 94px; margin-bottom: 24px; border-radius: 25px; box-shadow: 0 18px 38px rgba(0,0,0,.22); }
.device-access { display: grid; gap: 10px; text-align: left; }
.device-access label { color: rgba(255,255,255,.72); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.device-access input { width: 100%; padding: 14px 16px; border: 1px solid rgba(255,255,255,.25); border-radius: 14px; outline: none; color: white; background: rgba(255,255,255,.1); font: 700 20px/1.2 Inter, sans-serif; letter-spacing: .16em; text-align: center; }
.device-access input::placeholder { color: rgba(255,255,255,.38); letter-spacing: .04em; }
.device-access input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(101,195,181,.15); }
.device-unlock { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 14px 18px; border: 0; border-radius: 14px; color: var(--navy); background: white; box-shadow: 0 10px 28px rgba(0,0,0,.16); cursor: pointer; font-weight: 800; }
.device-unlock b { font: inherit; }
.device-unlock:disabled { cursor: wait; opacity: .7; }
.app-locked { visibility: hidden; }

button, a { font: inherit; }
.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(1px); pointer-events: none; }
.ambient-one { width: 28rem; height: 28rem; right: -13rem; top: 20rem; background: rgba(44,168,160,.1); }
.ambient-two { width: 20rem; height: 20rem; left: -8rem; bottom: 3rem; background: rgba(217,164,65,.08); }
.shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 118px; }
.panel { background: rgba(255,255,255,.86); border: 1px solid rgba(255,255,255,.9); border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.tab-panel[hidden] { display: none; }
.tab-panel.active { animation: tab-reveal .22s ease-out; }
@keyframes tab-reveal { from { opacity: .25; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tab-intro { max-width: 700px; margin: -3px 0 0; color: var(--muted); font-size: 13px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark { display: block; width: 50px; height: 50px; border-radius: 15px; object-fit: cover; box-shadow: 0 10px 28px rgba(10,58,82,.22); }
.eyebrow { margin: 0 0 3px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(26px, 3vw, 38px); font-weight: 500; letter-spacing: -.03em; }
h2 { margin-bottom: 12px; font-family: Georgia, serif; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.1; font-weight: 500; letter-spacing: -.025em; }
h3 { margin: 3px 0 7px; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.access-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; color: var(--green); background: rgba(44,168,160,.09); font-size: 11px; font-weight: 800; white-space: nowrap; }
.access-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(44,168,160,.12); }
.sync { padding: 7px 9px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; }
.sync:hover { background: rgba(44,168,160,.08); }
.sync.loading { cursor: wait; opacity: .7; }
.sync i { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px rgba(44,168,160,.12); }
.sync.error i { background: var(--gold); box-shadow: 0 0 0 5px rgba(217,164,65,.14); }
.manage-data { padding: 11px 16px; border: 1px solid rgba(44,168,160,.22); border-radius: 12px; color: var(--navy); background: rgba(255,255,255,.82); cursor: pointer; font-size: 13px; font-weight: 800; transition: transform .2s, border-color .2s, background .2s; }
.manage-data:hover { transform: translateY(-2px); border-color: var(--teal); background: white; }
.sheet-link { padding: 11px 16px; border-radius: 12px; color: white; background: var(--navy); text-decoration: none; font-size: 13px; font-weight: 750; transition: transform .2s, background .2s; }
.sheet-link:hover { transform: translateY(-2px); background: var(--green); }

.finance-editor { width: min(760px, calc(100% - 28px)); max-height: min(88vh, 880px); padding: 0; overflow: hidden; border: 0; border-radius: 28px; color: var(--ink); background: transparent; box-shadow: 0 30px 100px rgba(0,25,36,.34); }
.finance-editor::backdrop { background: rgba(4,39,54,.62); backdrop-filter: blur(8px); }
.finance-editor-card { max-height: min(88vh, 880px); padding: 28px; overflow-y: auto; border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: #f7fcfb; }
.finance-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.finance-editor-head h2 { margin-bottom: 0; }
.editor-close { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: white; cursor: pointer; font-size: 25px; line-height: 1; }
.editor-action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.editor-action-grid[hidden], .finance-editor-form[hidden] { display: none; }
.editor-action-grid button { display: flex; min-height: 170px; padding: 20px; flex-direction: column; align-items: flex-start; border: 1px solid rgba(44,168,160,.15); border-radius: 19px; color: var(--ink); background: white; cursor: pointer; text-align: left; transition: transform .2s, border-color .2s, box-shadow .2s; }
.editor-action-grid button:hover { transform: translateY(-3px); border-color: rgba(44,168,160,.45); box-shadow: 0 15px 35px rgba(4,39,54,.08); }
.editor-action-grid button > span { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 28px; border-radius: 12px; color: var(--green); background: rgba(44,168,160,.11); font-size: 20px; font-weight: 800; }
.editor-action-grid b { margin-bottom: 5px; font-size: 14px; }
.editor-action-grid small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.finance-editor-form { margin-top: 22px; }
.editor-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.editor-field { display: grid; align-content: start; gap: 7px; }
.editor-field[hidden] { display: none; }
.editor-field-wide { grid-column: 1 / -1; }
.editor-field > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.editor-field input, .editor-field select { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid rgba(10,58,82,.15); border-radius: 12px; outline: none; color: var(--ink); background: white; font: 700 14px/1.2 Inter, sans-serif; }
.editor-field input:focus, .editor-field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(44,168,160,.12); }
.editor-field small { color: var(--muted); font-size: 9px; }
.editor-check { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid rgba(44,168,160,.14); border-radius: 12px; background: rgba(255,255,255,.62); color: var(--ink); font-size: 11px; font-weight: 750; }
.editor-check input { width: 18px; height: 18px; accent-color: var(--green); }
.editor-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; color: #715d34; background: #fff6df; font-size: 10px; }
.editor-message { position: sticky; z-index: 4; bottom: 74px; min-height: 20px; margin: 12px 0 0; padding: 8px 10px; border-radius: 10px; color: var(--green); background: #f7fcfb; font-size: 11px; font-weight: 750; }
.editor-message:empty { min-height: 0; margin: 0; padding: 0; }
.editor-actions { position: sticky; z-index: 3; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding: 18px 0; border-top: 1px solid var(--line); background: #f7fcfb; box-shadow: 0 -12px 20px rgba(247,252,251,.96); }
.editor-actions button { min-height: 44px; padding: 11px 17px; border-radius: 12px; cursor: pointer; font-weight: 800; }
.editor-secondary { border: 1px solid var(--line); color: var(--muted); background: white; }
.editor-primary { border: 0; color: white; background: linear-gradient(135deg, var(--navy), var(--green)); box-shadow: 0 10px 25px rgba(10,58,82,.17); }
.editor-primary:disabled { cursor: wait; opacity: .65; }
.save-toast { position: fixed; z-index: 80; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); padding: 14px 18px; border-radius: 14px; color: white; background: var(--green); box-shadow: 0 18px 45px rgba(4,39,54,.24); opacity: 0; pointer-events: none; transform: translateY(16px); transition: opacity .2s, transform .2s; font-size: 12px; font-weight: 750; }
.save-toast.visible { opacity: 1; transform: none; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 20px; }
.decision-card { position: relative; overflow: hidden; padding: 34px; color: white; background: linear-gradient(120deg, rgba(10,58,82,.98), rgba(22,122,109,.95)); }
.decision-card::after { content: ""; position: absolute; width: 20rem; height: 20rem; right: -10rem; bottom: -14rem; border: 1px solid rgba(101,195,181,.25); border-radius: 50%; box-shadow: 0 0 0 45px rgba(101,195,181,.05), 0 0 0 90px rgba(101,195,181,.035); }
.decision-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; color: var(--mint); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.decision-heading p { margin: 0; }
.section-number { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid rgba(101,195,181,.55); border-radius: 50%; font-size: 10px; }
.decision-card h2 { max-width: 650px; font-size: clamp(34px, 4.3vw, 62px); }
.decision-copy { max-width: 720px; margin-bottom: 31px; color: rgba(255,255,255,.74); font-size: 15px; }
.gap-line { position: relative; z-index: 1; display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.15); }
.gap-line span { display: block; margin-bottom: 6px; color: rgba(255,255,255,.64); font-size: 12px; }
.gap-line strong { color: #f5c96c; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.04em; }
.gap-line .priority { padding: 7px 10px; border-radius: 999px; color: #ffe9b5; background: rgba(217,164,65,.18); border: 1px solid rgba(217,164,65,.35); white-space: nowrap; }

.coverage-card { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 30px; }
.ring { display: grid; place-items: center; flex: 0 0 auto; width: 146px; height: 146px; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--coverage) * 1%), #deefeb 0); }
.ring-inner { display: grid; place-content: center; width: 112px; height: 112px; border-radius: 50%; background: white; text-align: center; box-shadow: inset 0 0 0 1px var(--line); }
.ring strong { font-family: Georgia, serif; font-size: 31px; font-weight: 500; }
.ring span { color: var(--muted); font-size: 11px; }
.muted { color: var(--muted); font-size: 13px; }

.horizon-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 28px 0 14px; }
.horizon-bar p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); }
.horizon, .filter { border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; }
.horizon { padding: 9px 15px; border-radius: 10px; }
.horizon.active { color: white; background: var(--navy); box-shadow: 0 6px 15px rgba(10,58,82,.16); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { position: relative; overflow: hidden; padding: 23px; }
.kpi::after { content: ""; position: absolute; right: -20px; bottom: -28px; width: 90px; height: 90px; border: 1px solid currentColor; border-radius: 50%; opacity: .07; }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 28px; border-radius: 10px; background: rgba(44,168,160,.1); color: var(--green); font-size: 15px; font-weight: 800; }
.kpi p { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin-bottom: 5px; color: var(--navy); font-size: clamp(20px, 2.3vw, 29px); letter-spacing: -.04em; }
.kpi small { color: #8ba0a8; font-size: 10px; }
.kpi.deficit .kpi-icon, .kpi.red-contour .kpi-icon { color: #9b6711; background: rgba(217,164,65,.16); }
.kpi.deficit strong, .kpi.red-contour strong { color: #a66f11; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .6fr); gap: 20px; margin-top: 20px; }
.layers-card, .unknown-card, .payments-card { padding: 30px; }
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.period-label { padding: 7px 11px; border: 1px solid rgba(44,168,160,.25); border-radius: 999px; color: var(--green); background: rgba(44,168,160,.08); font-size: 11px; font-weight: 800; }
.layer-list { display: grid; gap: 19px; margin-top: 25px; }
.layer-meta { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 7px; font-size: 13px; }
.layer-meta span { color: var(--muted); }
.layer-meta strong { color: var(--navy); }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 9px; border-radius: 50%; }
.dot.oxygen { background: var(--teal); }
.dot.dated { background: var(--mint); }
.dot.green { background: var(--green); }
.dot.red { background: var(--gold); }
.bar { height: 8px; overflow: hidden; border-radius: 999px; background: #eaf3f1; }
.bar i { display: block; width: var(--width); height: 100%; min-width: 0; border-radius: inherit; transition: width .45s ease; }
.oxygen-bar { background: var(--teal); }
.dated-bar { background: var(--mint); }
.green-bar { background: var(--green); }
.red-bar { background: linear-gradient(90deg, #b47b1a, var(--gold)); }
.red-layer { padding-top: 17px; border-top: 1px solid var(--line); }
.legend-note { margin-top: 25px; padding: 12px 14px; border-radius: 12px; color: #786139; background: #fff8e9; font-size: 11px; }
.legend-note span { margin-right: 6px; font-weight: 850; text-transform: uppercase; }

.unknown-card { color: white; background: linear-gradient(150deg, #125d62, var(--green)); }
.unknown-card .eyebrow, .unknown-card .muted { color: rgba(255,255,255,.67); }
.unknown-icon { display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 50px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: #f7ce77; font-family: Georgia, serif; font-size: 20px; }
.unknown-card ul { padding: 0; margin: 24px 0; list-style: none; }
.unknown-card li { display: flex; justify-content: space-between; gap: 13px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.14); font-size: 12px; }
.unknown-card li b { color: #f6cf7b; font-weight: 750; text-align: right; }

.payments-card { margin-top: 20px; }
.tab-content-card, .fact-feed-card { margin-top: 0; }
.payments-head { align-items: center; }
.plan-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.plan-total { position: relative; overflow: hidden; min-height: 278px; padding: 23px; border: 1px solid rgba(44,168,160,.16); border-radius: 20px; background: linear-gradient(145deg, rgba(234,247,244,.92), rgba(255,255,255,.98)); }
.plan-total::after { content: ""; position: absolute; right: -38px; bottom: -46px; width: 122px; height: 122px; border: 1px solid rgba(44,168,160,.16); border-radius: 50%; box-shadow: 0 0 0 25px rgba(44,168,160,.04); }
.plan-total-urgent { color: white; border-color: rgba(101,195,181,.25); background: linear-gradient(130deg, var(--navy), var(--green)); }
.plan-total-heading { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--green); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.plan-total-urgent .plan-total-heading { color: var(--mint); }
.plan-total-heading i { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid currentColor; border-radius: 50%; font-style: normal; font-size: 10px; }
.plan-total > strong { position: relative; z-index: 1; display: block; margin: 14px 0 5px; color: var(--navy); font-family: Georgia, serif; font-size: clamp(27px, 3.5vw, 40px); line-height: 1; font-weight: 500; letter-spacing: -.04em; }
.plan-total-urgent > strong { color: white; }
.plan-total > small { position: relative; z-index: 1; color: var(--muted); font-size: 10px; }
.plan-total-urgent > small { color: rgba(255,255,255,.65); }
.plan-total > p { position: relative; z-index: 1; margin: 10px 0 0; color: #8b651d; font-size: 10px; font-weight: 750; }
.plan-total-urgent > p { color: #f5cf7d; }
.plan-breakdown { position: relative; z-index: 1; display: grid; gap: 7px; margin: 19px 0 0; padding-top: 14px; border-top: 1px solid rgba(10,58,82,.1); }
.plan-total-urgent .plan-breakdown { border-top-color: rgba(255,255,255,.16); }
.plan-breakdown div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.plan-breakdown dt, .plan-breakdown dd { margin: 0; font-size: 10px; }
.plan-breakdown dt { color: var(--muted); }
.plan-breakdown dd { color: var(--navy); font-weight: 800; white-space: nowrap; }
.plan-total-urgent .plan-breakdown dt { color: rgba(255,255,255,.64); }
.plan-total-urgent .plan-breakdown dd { color: white; }
.plan-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
.plan-filter-row > span { color: var(--muted); font-size: 11px; font-weight: 750; }
.filters { display: flex; gap: 6px; }
.filter { padding: 8px 12px; border-radius: 10px; }
.filter.active { color: var(--navy); background: rgba(44,168,160,.12); }
.payment-table { margin-top: 15px; }
.payment-row { display: grid; grid-template-columns: 90px minmax(220px, 1.7fr) 110px minmax(130px, .75fr) 105px 150px; align-items: center; gap: 16px; min-height: 70px; padding: 11px 5px; border-top: 1px solid var(--line); transition: opacity .2s, transform .2s; }
#actualPaymentsTable .payment-row { grid-template-columns: 90px minmax(220px, 1.7fr) 110px minmax(130px, .75fr) 105px 88px; }
.fact-edit-button { min-height: 34px; padding: 8px 11px; border: 1px solid rgba(44,168,160,.25); border-radius: 10px; color: var(--green); background: rgba(44,168,160,.08); cursor: pointer; font: 800 10px/1 Inter, sans-serif; }
.fact-edit-button:hover { border-color: var(--teal); background: rgba(44,168,160,.14); }
.payment-row.hidden { display: none; }
.payment-header { min-height: 38px; border: 0; color: #8ba0a8; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.payment-row time { color: var(--navy); font-size: 12px; font-weight: 750; }
.payment-row b { display: block; color: var(--ink); font-size: 13px; }
.payment-row small { display: block; margin-top: 3px; color: #8ba0a8; font-size: 10px; }
.payment-row strong { color: var(--navy); font-size: 13px; }
.tag, .status { justify-self: start; padding: 6px 9px; border-radius: 999px; font-size: 9px; font-weight: 850; letter-spacing: .03em; text-transform: uppercase; }
.debt-tag { color: var(--navy); background: rgba(10,58,82,.08); }
.protected-tag { color: var(--green); background: rgba(44,168,160,.1); }
.red-tag, .status.critical { color: #8b5e12; background: rgba(217,164,65,.18); }
.status.paid { color: var(--green); background: rgba(101,195,181,.16); }
.status.upcoming { color: var(--navy); background: rgba(10,58,82,.07); }
.status.unknown { color: #806326; background: #fff5d9; }
.critical-row { background: linear-gradient(90deg, rgba(217,164,65,.06), transparent 70%); }
.payment-actions { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 5px; }
.payment-actions button { padding: 6px 8px; border: 1px solid rgba(10,58,82,.12); border-radius: 9px; color: var(--muted); background: white; cursor: pointer; font-size: 9px; font-weight: 800; }
.payment-actions .payment-action-primary { border-color: rgba(44,168,160,.18); color: var(--green); background: rgba(44,168,160,.09); }
.payment-actions button:hover { border-color: var(--teal); color: var(--navy); }

.fact-hero { display: grid; grid-template-columns: minmax(360px, .85fr) minmax(0, 1.15fr); gap: 20px; }
.fact-summary-card, .category-card { padding: 30px; }
.fact-summary-card { display: flex; align-items: center; justify-content: space-between; gap: 30px; min-height: 420px; color: white; background: linear-gradient(130deg, rgba(10,58,82,.98), rgba(22,122,109,.96)); }
.fact-summary-card .eyebrow { color: var(--mint); }
.fact-summary-card .tab-intro { color: rgba(255,255,255,.67); }
.spend-donut { display: grid; place-items: center; flex: 0 0 auto; width: 205px; height: 205px; border-radius: 50%; background: #deefeb; box-shadow: 0 18px 40px rgba(0,25,36,.22); transition: background .35s ease; }
.spend-donut-inner { display: grid; place-content: center; width: 136px; height: 136px; border-radius: 50%; color: var(--navy); background: white; box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.spend-donut-inner small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.spend-donut-inner strong { display: block; max-width: 120px; margin-top: 5px; font-family: Georgia, serif; font-size: 19px; line-height: 1.1; font-weight: 500; }
.category-list { display: grid; gap: 0; margin-top: 16px; }
.category-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 12px; min-height: 51px; border-top: 1px solid var(--line); }
.category-row > i { width: 10px; height: 10px; border-radius: 50%; background: var(--category-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--category-color) 15%, transparent); }
.category-row span b { display: block; font-size: 12px; }
.category-row span small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.category-row > strong { color: var(--navy); font-family: Georgia, serif; font-size: 19px; font-weight: 500; }
.fact-category-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); background: rgba(10,58,82,.06); }
.fact-category-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--category-color); }
.empty-state { margin: 18px 0 0; padding: 18px; border: 1px dashed rgba(10,58,82,.16); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.45); font-size: 12px; text-align: center; }
.payment-empty { margin: 12px 0 0; }

.red-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); gap: 20px; }
.red-focus-card, .red-summary-card, .red-goals-card { padding: 30px; }
.red-focus-card { color: white; background: linear-gradient(130deg, #0a3a52, #167a6d); }
.red-focus-card .eyebrow { color: var(--mint); }
.red-focus-card .tab-intro { color: rgba(255,255,255,.68); }
.red-focus-amount { margin-top: 35px; }
.red-focus-amount span { display: block; color: rgba(255,255,255,.65); font-size: 11px; }
.red-focus-amount strong { display: block; margin-top: 7px; color: #f4c667; font-family: Georgia, serif; font-size: clamp(34px, 5vw, 58px); line-height: 1; font-weight: 500; letter-spacing: -.045em; }
.red-progress, .red-goal-progress { overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.14); }
.red-progress { height: 10px; margin-top: 28px; }
.red-progress i, .red-goal-progress i { display: block; width: var(--red-progress, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d9a441, #f4cf7b); transition: width .45s ease; }
.red-progress-meta { display: flex; justify-content: space-between; gap: 18px; margin-top: 9px; color: rgba(255,255,255,.66); font-size: 10px; }
.red-progress-meta b { color: white; }
.red-summary-card { display: flex; flex-direction: column; }
.red-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; gap: 1px; margin-top: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--line); }
.red-summary-grid > div { min-height: 105px; padding: 20px; background: rgba(255,255,255,.92); }
.red-summary-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.red-summary-grid strong { color: var(--navy); font-family: Georgia, serif; font-size: clamp(20px, 2.4vw, 29px); line-height: 1.05; font-weight: 500; letter-spacing: -.03em; }
.red-summary-grid > div:last-child strong { color: #a66f11; }
.red-goals-card { margin-top: 20px; }
.red-goals-head { align-items: center; }
.red-overdue-badge { padding: 8px 11px; border-radius: 999px; color: #8e3a32; background: #fce8e5; font-size: 10px; font-weight: 800; white-space: nowrap; }
.red-goals-list { display: grid; gap: 14px; margin-top: 24px; }
.red-goal { padding: 23px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.76); }
.red-goal-overdue { border-color: rgba(176,70,57,.28); background: linear-gradient(100deg, rgba(252,232,229,.72), rgba(255,255,255,.84) 52%); }
.red-goal-unknown { border-color: rgba(217,164,65,.28); }
.red-goal-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.red-goal-title { display: flex; align-items: flex-start; gap: 13px; }
.red-goal-title > span { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid rgba(44,168,160,.26); border-radius: 50%; color: var(--green); font-size: 9px; font-weight: 850; }
.red-goal-title h3 { margin: 0 0 2px; font-family: inherit; font-size: 15px; line-height: 1.3; font-weight: 800; letter-spacing: 0; }
.red-goal-title small { color: var(--muted); font-size: 9px; }
.red-goal-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.red-deadline, .red-confidence { padding: 6px 9px; border-radius: 999px; font-size: 8px; font-weight: 850; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.red-deadline.future { color: var(--navy); background: rgba(10,58,82,.07); }
.red-deadline.today { color: #865e17; background: #fff2cd; }
.red-deadline.overdue { color: #923e35; background: #fce2de; }
.red-deadline.unknown { color: var(--muted); background: #edf2f3; }
.red-confidence.confirmed { color: var(--green); background: rgba(101,195,181,.17); }
.red-confidence.estimated { color: #85601d; background: #fff2cd; }
.red-confidence.unknown { color: #8b5e12; background: rgba(217,164,65,.16); }
.red-goal-type { margin: 15px 0 17px 45px; color: var(--muted); font-size: 11px; }
.red-goal-numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-left: 45px; }
.red-goal-numbers > div { padding: 13px; border-radius: 13px; background: rgba(10,58,82,.035); }
.red-goal-numbers span, .red-goal-details span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.red-goal-numbers strong { display: block; color: var(--navy); font-size: 13px; line-height: 1.25; }
.red-goal-numbers > div:nth-child(3) strong { color: #a66f11; }
.red-goal-progress { height: 6px; margin: 13px 0 0 45px; background: #e7efed; }
.red-goal-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 17px 0 0 45px; padding-top: 16px; border-top: 1px solid var(--line); }
.red-goal-details p { margin: 0; color: var(--ink); font-size: 10px; line-height: 1.5; }
.red-goal-actions { display: flex; justify-content: flex-end; margin: 16px 0 0 45px; }
.red-goal-actions button { padding: 8px 11px; border: 1px solid rgba(44,168,160,.2); border-radius: 10px; color: var(--green); background: rgba(44,168,160,.08); cursor: pointer; font-size: 9px; font-weight: 800; }

.app-tabs { position: fixed; z-index: 30; left: 50%; bottom: 18px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(52px, 92px); gap: 5px; padding: 7px; border: 1px solid rgba(255,255,255,.9); border-radius: 22px; background: rgba(255,255,255,.9); box-shadow: 0 18px 52px rgba(4,39,54,.2); backdrop-filter: blur(18px); transform: translateX(-50%); }
.app-tab { display: grid; place-items: center; gap: 2px; padding: 8px 10px; border: 0; border-radius: 16px; color: var(--muted); background: transparent; cursor: pointer; }
.app-tab.active { color: white; background: linear-gradient(135deg, var(--navy), var(--green)); box-shadow: 0 8px 20px rgba(10,58,82,.2); }
.app-tab b { font-size: 10px; }
.tab-icon { font-size: 19px; line-height: 1; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 4px 0; color: #81979f; font-size: 10px; }

@media (max-width: 1050px) {
  .hero-grid, .content-grid, .fact-hero, .red-hero { grid-template-columns: 1fr; }
  .coverage-card { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .unknown-icon { margin-bottom: 25px; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1440px); padding-top: 18px; padding-bottom: 108px; }
  .topbar, .header-actions { align-items: flex-start; }
  .topbar, .header-actions { flex-direction: column; }
  .header-actions { width: 100%; gap: 10px; }
  .sheet-link, .manage-data { width: 100%; text-align: center; }
  .decision-card, .coverage-card, .layers-card, .unknown-card, .payments-card, .fact-summary-card, .category-card, .red-focus-card, .red-summary-card, .red-goals-card { padding: 22px; }
  .decision-heading { margin-bottom: 26px; }
  .gap-line { align-items: flex-start; flex-direction: column; }
  .coverage-card { align-items: flex-start; flex-direction: column; }
  .horizon-bar { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .horizon { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-icon { margin-bottom: 17px; }
  .payments-head { align-items: flex-start; flex-direction: column; }
  .plan-summary { grid-template-columns: 1fr; }
  .plan-total { min-height: 270px; padding: 20px; }
  .plan-filter-row { align-items: flex-start; flex-direction: column; }
  .filters { width: 100%; overflow-x: auto; }
  .payment-header { display: none; }
  .payment-row { grid-template-columns: 74px 1fr auto; gap: 8px 12px; padding: 16px 2px; }
  .payment-row > :nth-child(3) { grid-column: 2; }
  .payment-row > :nth-child(4) { grid-column: 2; font-size: 16px; }
  .payment-row > :nth-child(5) { grid-column: 3; grid-row: 1 / span 2; }
  .payment-row > :nth-child(6) { grid-column: 1 / -1; justify-content: flex-end; }
  #actualPaymentsTable .payment-row > :nth-child(5) { grid-column: 3; grid-row: 1; }
  #actualPaymentsTable .payment-row > :nth-child(6) { grid-column: 3; grid-row: 2; justify-self: start; }
  .fact-summary-card { align-items: flex-start; flex-direction: column; min-height: 0; }
  .spend-donut { align-self: center; width: min(205px, 64vw); height: min(205px, 64vw); }
  .red-summary-grid { grid-template-columns: 1fr; }
  .red-summary-grid > div { min-height: 82px; }
  .red-goal-topline, .red-goals-head { align-items: flex-start; flex-direction: column; }
  .red-goal-badges { justify-content: flex-start; margin-left: 45px; }
  .red-goal-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .red-goal-details { grid-template-columns: 1fr; }
  .red-goal-actions { margin-left: 0; }
  .finance-editor { width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .finance-editor-card { max-height: 92vh; padding: 22px; border-radius: 24px 24px 0 0; }
  .editor-action-grid { grid-template-columns: 1fr; }
  .editor-action-grid button { min-height: 112px; }
  .editor-action-grid button > span { margin-bottom: 16px; }
  .editor-fields-grid { grid-template-columns: 1fr; }
  .editor-field-wide { grid-column: auto; }
  .editor-actions { bottom: 0; padding: 15px 0 max(15px, env(safe-area-inset-bottom)); }
  .editor-actions button { flex: 1; }
  .save-toast { right: 14px; bottom: 92px; max-width: calc(100% - 28px); }
  .app-tabs { bottom: max(9px, env(safe-area-inset-bottom)); width: calc(100% - 20px); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 6px 5px; border-radius: 19px; }
  .app-tab { padding: 7px 2px; border-radius: 13px; }
  .app-tab b { font-size: 9px; }
  footer { flex-direction: column; }
}

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


.reports-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.report-message { min-height: 20px; margin: 14px 0 8px; color: var(--green); font-size: 12px; font-weight: 750; }
.report-message:empty { min-height: 0; margin: 0; }
.report-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 15px 18px; border-radius: 16px; color: inherit;
  background: rgba(255,255,255,.72); border: 1px solid rgba(10,58,82,.10);
  box-shadow: 0 6px 18px rgba(4,39,54,.06); transition: box-shadow .15s ease, transform .15s ease;
}
.report-row:hover { box-shadow: 0 12px 28px rgba(4,39,54,.12); transform: translateY(-1px); }
.report-copy { display: grid; gap: 3px; }
.report-title { font-weight: 700; color: var(--navy); }
.report-copy small { color: var(--muted); font-size: 11px; }
.report-actions { display: flex; align-items: center; gap: 8px; }
.report-open, .report-rebuild { padding: 9px 12px; border-radius: 10px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.report-open { color: var(--navy); background: rgba(44,168,160,.09); text-decoration: none; }
.report-rebuild { border: 1px solid rgba(22,122,109,.25); color: white; background: var(--green); cursor: pointer; }
.report-rebuild:disabled { cursor: wait; opacity: .65; }
@media (max-width: 560px) {
  .report-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .report-actions { width: 100%; margin-top: 8px; }
  .report-open, .report-rebuild { flex: 1; text-align: center; }
}



.payment-row.income-row strong.income-amount { color: var(--green); }



.feed-switch { display: flex; align-items: center; gap: 14px; }
.feed-total { color: var(--navy); font-size: 18px; font-weight: 800; }
.payment-table[hidden] { display: none; }
@media (max-width: 620px) {
  .feed-switch { width: 100%; justify-content: space-between; }
}


.search-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.plan-search-row { margin: 0 0 12px; }
.search-input {
  flex: 1; min-height: 44px; padding: 11px 15px; border-radius: 12px; outline: none;
  border: 1px solid rgba(10,58,82,.15); background: white; color: var(--ink);
  font: 650 14px/1.2 Inter, sans-serif;
}
.search-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(44,168,160,.12); }
.search-input::placeholder { color: #9bb0b8; font-weight: 600; }
.search-count { color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }


.fact-row-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.fact-delete-button {
  min-width: 30px; height: 30px; padding: 0; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(190, 78, 78, .22); background: rgba(190, 78, 78, .07);
  color: #a94b4b; font-size: 13px; font-weight: 800; line-height: 1;
}
.fact-delete-button:hover { background: rgba(190, 78, 78, .16); }
.payment-row.income-row { grid-template-columns: 92px minmax(0, 1fr) 116px 128px 44px; }


.payment-header .sortable { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.payment-header .sortable:hover { color: var(--navy); }
.sort-arrow { font-style: normal; opacity: .35; font-size: 11px; }
.sort-arrow.active { opacity: 1; color: var(--teal); }
.column-filter {
  max-width: 100%; padding: 5px 7px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(10,58,82,.14); background: white; color: var(--muted);
  font: 800 9px/1.2 Inter, sans-serif; letter-spacing: .03em; text-transform: uppercase;
}
.column-filter:focus { outline: none; border-color: var(--teal); }


.payment-action-overdue {
  border: 1px solid rgba(190, 78, 78, .25); background: rgba(190, 78, 78, .08);
  color: #a94b4b; font-weight: 800;
}
.payment-action-overdue:hover { background: rgba(190, 78, 78, .16); }


.accounts-list { display: flex; flex-direction: column; gap: 8px; }
.account-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 104px 74px 116px 100px 34px; gap: 7px; align-items: center; }
.account-row input, .account-row select {
  min-height: 40px; padding: 9px 11px; border-radius: 10px; outline: none; width: 100%;
  border: 1px solid rgba(10,58,82,.15); background: white; color: var(--ink);
  font: 700 13px/1.2 Inter, sans-serif;
}
.account-row input:focus, .account-row select:focus { border-color: var(--teal); }
.account-remove {
  min-height: 34px; border-radius: 9px; cursor: pointer; padding: 0;
  border: 1px solid rgba(190,78,78,.22); background: rgba(190,78,78,.07); color: #a94b4b; font-weight: 800;
}
.accounts-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 12px; }
.accounts-add {
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: 12px;
  border: 1px solid rgba(44,168,160,.3); background: rgba(44,168,160,.1); color: var(--navy);
}
.accounts-total { color: var(--muted); font-size: 12px; font-weight: 750; }
.accounts-total b { color: var(--navy); font-size: 16px; }
@media (max-width: 720px) {
  .account-row { grid-template-columns: 1fr 1fr; }
}


.wishes-hero { display: grid; grid-template-columns: minmax(340px, .8fr) minmax(0, 1.2fr); gap: 20px; }
.wishes-focus-card, .wishes-form-card, .wishes-list-card { padding: 30px; }
.wishes-focus-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 26px;
  min-height: 300px; color: white; background: linear-gradient(130deg, rgba(10,58,82,.98), rgba(22,122,109,.96));
}
.wishes-focus-card .eyebrow { color: var(--mint); }
.wishes-focus-card h2 { margin: 0 0 8px; }
.wishes-focus-card .tab-intro { color: rgba(255,255,255,.67); }
.wishes-focus-amount { display: grid; gap: 4px; }
.wishes-focus-amount span { color: rgba(255,255,255,.6); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.wishes-focus-amount strong { font-size: 34px; letter-spacing: -.01em; }
.wishes-focus-meta { display: flex; justify-content: space-between; gap: 14px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.72); font-size: 12px; font-weight: 700; }
.wishes-focus-meta b { color: white; }

.wish-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.wish-form .editor-field input, .wish-form .editor-field select { width: 100%; }
.wish-add {
  grid-column: 1 / -1; min-height: 46px; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 13px;
  color: white; border: 0; background: linear-gradient(135deg, var(--navy), var(--green));
}
.wish-add:hover { opacity: .93; }

.wishes-list-card { margin-top: 20px; }
.wishes-list { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.wish-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) 150px 158px; gap: 14px; align-items: center;
  padding: 16px 18px; border-radius: 16px; background: rgba(255,255,255,.7);
  border: 1px solid rgba(10,58,82,.08); box-shadow: 0 5px 16px rgba(4,39,54,.05);
}
.wish-main { display: grid; gap: 3px; min-width: 0; }
.wish-main b { color: var(--navy); font-size: 14px; }
.wish-main small { color: var(--muted); font-size: 11px; }
.wish-cost { color: var(--navy); font-size: 16px; text-align: right; }
.wish-actions { display: flex; gap: 8px; justify-content: flex-end; }
.wish-to-plan {
  padding: 9px 15px; border-radius: 11px; cursor: pointer; font-weight: 800; font-size: 12px;
  border: 1px solid rgba(44,168,160,.32); background: rgba(44,168,160,.12); color: var(--navy);
}
.wish-to-plan:hover { background: rgba(44,168,160,.2); }
.wish-priority-tag {
  padding: 6px 10px; border-radius: 9px; font-size: 10px; font-weight: 800; text-align: center;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: rgba(10,58,82,.07);
}
.wish-priority-tag.priority-высокий { color: #a94b4b; background: rgba(190,78,78,.1); }
.wish-priority-tag.priority-низкий { color: #6c8a93; background: rgba(108,138,147,.1); }

@media (max-width: 1050px) {
  .wishes-hero { grid-template-columns: 1fr; }
  .wishes-focus-card { min-height: 0; }
}
@media (max-width: 760px) {
  .wish-form { grid-template-columns: 1fr; }
  .wish-row { grid-template-columns: 1fr; gap: 10px; }
  .wish-cost { text-align: left; }
  .wish-actions { justify-content: flex-start; }
}


.period-picker { display: grid; gap: 5px; margin-top: 20px; max-width: 230px; }
.period-picker > span { color: rgba(255,255,255,.6); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.period-picker select {
  min-height: 42px; padding: 10px 13px; border-radius: 12px; outline: none; cursor: pointer;
  border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.12); color: white;
  font: 750 13px/1.2 Inter, sans-serif;
}
.period-picker select option { color: var(--ink); }
.period-picker select:focus { border-color: var(--mint); }

.category-list.collapsed .category-row:nth-child(n+5) { display: none; }
.category-toggle {
  width: 100%; margin-top: 14px; min-height: 42px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(44,168,160,.28); background: rgba(44,168,160,.1); color: var(--navy);
  font-weight: 800; font-size: 12px;
}
.category-toggle:hover { background: rgba(44,168,160,.18); }


.editor-danger {
  min-height: 44px; padding: 11px 17px; border-radius: 12px; cursor: pointer; font-weight: 800;
  border: 1px solid rgba(190,78,78,.28); background: rgba(190,78,78,.08); color: #a94b4b;
  margin-right: auto;
}
.editor-danger:hover { background: rgba(190,78,78,.16); }


/* Журнал изменений: широкая таблица, спокойное чтение */
.changelog-table { overflow-x: auto; }
.changelog { width: 100%; border-collapse: collapse; font-size: 13px; }
.changelog th, .changelog td { padding: 10px 12px; border-bottom: 1px solid rgba(0,0,0,.08); vertical-align: top; text-align: left; }
.changelog th { font-weight: 600; opacity: .7; white-space: nowrap; }
.changelog .cl-when { white-space: nowrap; opacity: .75; }
.changelog .cl-who { white-space: nowrap; font-weight: 600; }
.changelog .cl-where { max-width: 260px; word-break: break-word; opacity: .85; }
.changelog .cl-what { max-width: 420px; word-break: break-word; }
.changelog .cl-link { max-width: 220px; word-break: break-all; opacity: .75; }
.changelog .cl-risk { max-width: 320px; word-break: break-word; opacity: .8; }
.changelog tbody tr:hover { background: rgba(0,0,0,.03); }
