:root {
  color-scheme: light;
  --bg: #f5f1ea;
  --panel: #fff;
  --panel-soft: #fff7ed;
  --line: #e6dccf;
  --text: #11100e;
  --muted: #74695f;
  --navy: #050505;
  --navy-2: #1a1714;
  --gold: #ff9416;
  --green: #21865a;
  --green-soft: #e8f7ef;
  --red: #c94d54;
  --red-soft: #fff0f1;
  --accent: #ff7a00;
  --accent-soft: #fff3df;
  --amber: #b87819;
  --shadow: 0 16px 38px rgba(16, 35, 57, .08);
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); font-family: Inter, system-ui, sans-serif; }
body.auth-pending .app-shell { visibility: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(255,122,0,.28); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: #f5f1ea; }
.login-screen::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none; background-image: linear-gradient(#e6dccf 1px,transparent 1px),linear-gradient(90deg,#e6dccf 1px,transparent 1px); background-size: 48px 48px; }
.login-card { position: relative; width: min(440px,100%); display: grid; gap: 17px; padding: 32px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 28px 80px rgba(10,25,42,.16); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand img { width: 48px; height: 48px; }
.login-brand strong, .login-brand span { display: block; }
.login-brand strong { font: 800 19px Manrope,sans-serif; }
.login-brand span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.login-copy { margin-top: 4px; }
.login-copy h1 { margin: 6px 0 8px; font: 800 30px Manrope,sans-serif; letter-spacing: -.04em; }
.login-copy > p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 7px; background: var(--panel-soft); }
.auth-tab { min-height: 39px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-weight: 800; }
.auth-tab.active { color: var(--text); background: var(--panel); box-shadow: 0 1px 5px rgba(12,31,50,.12); }
.login-submit, .guest-button { width: 100%; min-height: 47px; }
.auth-error { min-height: 18px; margin: -5px 0; color: var(--red); font-size: 11px; line-height: 1.5; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.guest-note { margin: -8px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

.app-shell { display: grid; grid-template-columns: 272px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 20; display: flex; flex-direction: column; gap: 24px; height: 100vh; padding: 22px 16px 18px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 5px; }
.brand img { width: 44px; height: 44px; filter: drop-shadow(0 8px 14px rgba(15,30,48,.18)); }
.brand strong, .brand span, .profile strong, .profile span { display: block; }
.brand strong { font: 800 18px Manrope, sans-serif; letter-spacing: -.03em; }
.brand span, .profile span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.app-switcher { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: -12px 0; padding: 0 5px; }
.app-switcher a { min-width: 0; display: flex; align-items: center; gap: 8px; color: #5e5348; font-size: 10px; font-weight: 700; line-height: 1.2; text-decoration: none; transition: color .18s ease; }
.app-switcher a:hover { color: var(--text); }
.app-switcher a:focus-visible { outline: 3px solid rgba(255,122,0,.28); outline-offset: 2px; }
.app-switcher img { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 7px; }
.nav-list { display: grid; gap: 7px; }
.nav-button { min-height: 45px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border: 0; border-radius: 7px; color: #5e5348; background: transparent; font-weight: 700; text-align: left; transition: .18s ease; }
.nav-button:hover { color: var(--text); background: var(--panel-soft); }
.nav-button.active { color: #fff; background: var(--navy); }
.sidebar-card { margin-top: auto; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-soft); }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.goal-head { display: flex; justify-content: space-between; align-items: end; margin-top: 12px; }
.goal-head strong { font: 800 20px Manrope, sans-serif; }
.goal-head span { color: var(--green); font-size: 12px; font-weight: 800; }
.goal-track { height: 7px; overflow: hidden; margin: 11px 0; border-radius: 99px; background: #eadfce; }
.goal-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--green); transition: width .5s ease; }
.sidebar-card > p:last-child { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.capacity-card { margin-top: -12px; background: var(--navy); border-color: #33200f; color: #fff; }
.capacity-card .eyebrow { color: #ffc56f; }
.capacity-card > strong { display: block; margin: 10px 0 4px; font-size: 14px; }
.capacity-card > p:not(.eyebrow) { margin: 0; color: #ded6cc; font-size: 11px; line-height: 1.5; }
.capacity-meter { height: 7px; margin: 12px 0; overflow: hidden; border-radius: 99px; background: #2b241d; }
.capacity-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--gold); transition: width .4s ease; }
.capacity-card button { width: 100%; min-height: 36px; border: 1px solid #5f3a12; border-radius: 6px; color: #fff; background: #20160d; font-weight: 800; }
.capacity-card button:hover { border-color: #ff7a00; background: #3a210b; }
.capacity-card button[hidden] { display: none; }
.profile { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #33200f; border-radius: 8px; color: #fff; background: #080706; }
.profile > div { min-width: 0; flex: 1; }
.profile strong { overflow: hidden; color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile span, .profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile .profile-copy span { margin-top: 3px; color: #ffb454; font-size: 10px; }
.profile .profile-copy small { margin-top: 2px; color: #b6aca0; font-size: 9px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border-radius: 6px; color: #fff; background: #050505; font-size: 11px; font-weight: 800; line-height: 1; text-align: center; }
.profile .icon-button { width: 36px; min-height: 36px; flex: 0 0 auto; border-color: #5f3a12; color: #fff1df; background: #20160d; }
.profile .icon-button:hover { border-color: #ff7a00; color: #fff; background: #3a210b; }

.workspace { min-width: 0; padding: 24px clamp(22px,3vw,42px) 42px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: -24px calc(clamp(22px,3vw,42px) * -1) 22px; padding: 20px clamp(22px,3vw,42px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); }
.topbar-app-icon { display: none; width: 38px; height: 38px; flex: 0 0 auto; object-fit: contain; border-radius: 8px; }
.page-title h1 { margin: 4px 0 0; font: 800 29px/1 Manrope, sans-serif; letter-spacing: -.04em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.search-box { width: min(260px,24vw); min-width: 175px; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); color: var(--muted); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--panel); font-size: 11px; }
.primary-button, .ghost-button, .icon-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 7px; font-weight: 800; }
.primary-button { padding: 0 15px; border: 1px solid var(--navy); color: #fff; background: var(--navy); }
.primary-button:hover { background: var(--navy-2); }
.ghost-button { padding: 0 13px; border: 1px solid var(--line); color: #5e5348; background: var(--panel); }
.ghost-button:hover { border-color: #c9b59c; }
.icon-button { width: 38px; min-height: 38px; padding: 0; border: 1px solid var(--line); color: var(--muted); background: var(--panel); }
.menu-button { display: none; }

.hero { min-height: 130px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 27px; border: 1px solid #33200f; border-radius: var(--radius); color: #fff; background: radial-gradient(circle at 75% 0, #3a210b, transparent 42%), var(--navy); box-shadow: var(--shadow); }
.hero h2 { max-width: 620px; margin: 7px 0 6px; font: 800 clamp(23px,2.5vw,34px)/1.1 Manrope, sans-serif; letter-spacing: -.04em; }
.hero > div > p:last-child { margin: 0; color: #ded6cc; font-size: 13px; line-height: 1.6; }
.hero .eyebrow { color: var(--gold); }
.hero-date { min-width: 215px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.07); }
.hero-date > span { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 7px; color: var(--gold); background: rgba(232,180,79,.12); }
.hero-date small, .hero-date strong { display: block; }
.hero-date small { margin-bottom: 4px; color: #b6aca0; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.hero-date strong { font-size: 12px; }

.view-root { margin-top: 16px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.metric-card { padding: 17px; }
.metric-top { display: flex; justify-content: space-between; align-items: center; }
.metric-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: var(--accent-soft); }
.metric-card.positive .metric-icon { color: var(--green); background: var(--green-soft); }
.metric-card.negative .metric-icon { color: var(--red); background: var(--red-soft); }
.metric-trend { padding: 4px 7px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.metric-trend.down { color: var(--red); background: var(--red-soft); }
.metric-card > strong { display: block; margin: 16px 0 4px; font: 800 clamp(22px,2.5vw,29px) Manrope, sans-serif; letter-spacing: -.04em; }
.metric-card > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.content-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(280px,.85fr); gap: 14px; margin-top: 14px; }
.panel { min-width: 0; padding: 19px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font: 800 16px Manrope, sans-serif; letter-spacing: -.02em; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.tag { padding: 5px 8px; border-radius: 5px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.chart-wrap { position: relative; height: 245px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 60px, var(--line) 61px); }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-labels { display: flex; justify-content: space-between; padding-top: 10px; color: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; font-weight: 700; }
.legend span::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--green); }
.legend span:last-child::before { background: var(--red); }
.cash-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.cash-row:last-child { border: 0; }
.cash-row strong { font-size: 12px; }
.cash-row span { color: var(--muted); font-size: 10px; }
.cash-row b { grid-row: 1/3; grid-column: 2; align-self: center; font-size: 12px; }
.cash-row b.in { color: var(--green); }
.cash-row b.out { color: var(--red); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.quick-action { min-height: 72px; display: grid; place-items: center; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; color: #5e5348; background: var(--panel-soft); font-size: 11px; font-weight: 800; }
.quick-action:hover { border-color: #c9b59c; background: var(--panel); }
.quick-action svg { color: var(--accent); }

.view-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 2px 0 14px; }
.view-heading h2 { margin: 0 0 4px; font: 800 22px Manrope, sans-serif; }
.view-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; }
.filters select { min-height: 40px; padding: 0 32px 0 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel); }
.table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 15px; color: var(--muted); background: var(--panel-soft); font-size: 10px; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
td { padding: 14px 15px; border-top: 1px solid var(--line); font-size: 12px; }
td strong { display: block; }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.amount.in { color: var(--green); font-weight: 800; }
.amount.out { color: var(--red); font-weight: 800; }
.status { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 99px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 800; }
.status.paid, .status.cleared { color: var(--green); background: var(--green-soft); }
.status.overdue { color: var(--red); background: var(--red-soft); }
.status.pending { color: var(--amber); background: #fff6e5; }
.row-actions { display: flex; justify-content: end; gap: 5px; }
.row-actions button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); }
.empty { padding: 55px 20px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 5px; color: var(--text); }
.import-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.import-summary strong, .import-summary span { display: block; }
.import-summary span { color: var(--muted); font-size: 11px; line-height: 1.5; text-align: right; }
.import-preview { max-height: 360px; overflow: auto; display: grid; gap: 8px; padding-right: 4px; }
.import-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.import-row input { accent-color: var(--accent); }
.import-row span { min-width: 0; }
.import-row strong, .import-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-row strong { color: var(--text); font-size: 12px; }
.import-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.import-row b { font-size: 12px; }
.import-row b.in { color: var(--green); }
.import-row b.out { color: var(--red); }
.import-row.duplicate { opacity: .62; }

.report-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.report-card { padding: 20px; }
.report-card .metric-icon { margin-bottom: 18px; }
.report-card h3 { margin: 0 0 6px; font: 800 16px Manrope, sans-serif; }
.report-card p { min-height: 38px; margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.report-card button { width: 100%; }
.money-setup-grid { grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); }
.clean-start { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-soft); cursor: pointer; }
.clean-start input { margin-top: 2px; accent-color: var(--navy); }
.clean-start strong, .clean-start small { display: block; }
.clean-start strong { font-size: 12px; }
.clean-start small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; }
.balance-card { align-self: start; color: #fff; background: radial-gradient(circle at 100% 0,rgba(255,122,0,.35),transparent 44%),var(--navy); border-color: #33200f; }
.balance-card .eyebrow { color: var(--gold); }
.balance-card > strong { display: block; margin: 12px 0 20px; font: 800 34px Manrope,sans-serif; letter-spacing: -.04em; }
.balance-equation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.06); }
.balance-equation span { font-size: 12px; font-weight: 800; }
.balance-equation small { display: block; margin-top: 4px; color: #b6aca0; font-size: 9px; font-weight: 600; }
.balance-equation b { color: var(--gold); }
.balance-card button { width: 100%; margin-top: 16px; border-color: rgba(255,255,255,.18); color: #fff; background: rgba(255,255,255,.07); }
.balance-card > p:last-child { margin: 14px 0 0; color: #b6aca0; font-size: 10px; line-height: 1.6; }
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 95px 1fr 62px; align-items: center; gap: 10px; font-size: 11px; }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: #eadfce; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--red); }
.bar-row strong { text-align: right; }

.site-footer { display: grid; grid-template-columns: minmax(220px,1fr) auto minmax(220px,1fr); align-items: center; gap: 24px; margin-top: 28px; padding: 20px 22px; border: 1px solid #33200f; border-radius: var(--radius); color: #fffaf3; background: #080706; box-shadow: var(--shadow); }
.footer-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.footer-brand img { width: 54px; height: 54px; flex: 0 0 auto; object-fit: contain; border-radius: 10px; }
.footer-brand span, .footer-brand strong { display: block; }
.footer-brand span { margin-bottom: 3px; color: #b6aca0; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.footer-brand strong { font-size: 15px; }
.footer-standard { margin: 0; color: #ded6cc; font-size: 13px; font-weight: 600; text-align: center; white-space: nowrap; }
.footer-cta { min-height: 44px; justify-self: end; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 6px; color: #080706; background: #ff9416; font-size: 13px; font-weight: 800; text-align: center; text-decoration: none; transition: 180ms ease; }
.footer-cta:hover { background: #f2c86f; transform: translateY(-1px); }
.footer-cta svg { width: 17px; height: 17px; }

.modal-backdrop, .mobile-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(17,16,14,.55); backdrop-filter: blur(3px); }
.modal-backdrop { display: grid; place-items: center; padding: 20px; }
.modal { width: min(660px,100%); max-height: min(760px,calc(100vh - 40px)); overflow-y: auto; padding: 23px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 28px 80px rgba(5,16,28,.28); }
.upgrade-modal { width: min(448px,100%); padding: 27px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel); box-shadow: 0 28px 80px rgba(5,16,28,.3); }
.upgrade-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.upgrade-head img { width: 92px; height: 76px; object-fit: contain; object-position: left center; }
.upgrade-modal h2 { margin: 6px 0 14px; font: 800 22px/1.35 Manrope,sans-serif; letter-spacing: -.03em; }
.upgrade-modal > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.upgrade-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 22px; }
.upgrade-actions .primary-button { min-height: 45px; text-decoration: none; }
.upgrade-actions .ghost-button { min-height: 45px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.modal-head h2 { margin: 5px 0 0; font: 800 23px Manrope, sans-serif; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field.full { grid-column: 1/-1; }
.field input, .field select, .field textarea { width: 100%; min-height: 43px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--text); background: var(--panel-soft); }
.field textarea { min-height: 86px; resize: vertical; }
.form-actions { grid-column: 1/-1; display: flex; justify-content: end; gap: 8px; padding-top: 6px; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; }
.toast { min-width: 250px; padding: 13px 15px; border: 1px solid #33200f; border-radius: 7px; color: #fff; background: var(--navy); box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

body.dark { color-scheme: dark; --bg:#050505; --panel:#11100e; --panel-soft:#191611; --line:#332820; --text:#fffaf3; --muted:#b6aca0; --navy:#050505; --navy-2:#1a1714; --green-soft:#153528; --red-soft:#3a1d24; --accent-soft:#2a1a08; --shadow:0 16px 40px rgba(0,0,0,.22); }
body.dark .topbar { background: rgba(17,16,14,.94); }
body.dark .login-screen { background: #050505; }
body.dark .login-screen::before { background-image: linear-gradient(#332820 1px,transparent 1px),linear-gradient(90deg,#332820 1px,transparent 1px); }
body.dark .goal-track, body.dark .bar-track { background: #2b241d; }
body.dark .status.pending { background: #3a2d18; }
body.dark .app-switcher a, body.dark .nav-button { color: var(--muted); }
body.dark .app-switcher a:hover, body.dark .nav-button:hover { color: var(--text); }
body.dark .nav-button.active { color: #fff; background: var(--navy); }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2,1fr); }
  .search-box { display: none; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 272px; transition: transform .22s ease; box-shadow: 20px 0 60px rgba(5,16,28,.2); }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { display: block; z-index: 15; }
  .menu-button { display: inline-flex; }
  .topbar-app-icon { display: block; }
  .workspace { padding: 18px; }
  .topbar { margin: -18px -18px 18px; padding: 15px 18px; }
  .page-title { margin-right: auto; }
  .top-actions .ghost-button { display: none; }
  .hero { align-items: start; flex-direction: column; }
  .content-grid { grid-template-columns: 1fr; }
  .money-setup-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .site-footer { grid-template-columns: 1fr auto; }
  .footer-standard { display: none; }
}
@media (max-width: 570px) {
  .page-title .eyebrow { display: none; }
  .page-title h1 { font-size: 22px; }
  .primary-button { padding: 0 10px; }
  .primary-button span:last-child { display: none; }
  .hero { padding: 22px; }
  .hero-date { width: 100%; }
  .metrics-grid, .report-grid { grid-template-columns: 1fr; }
  .view-heading { align-items: start; flex-direction: column; }
  .filters { width: 100%; }
  .filters select { flex: 1; min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-actions { grid-column: 1; }
  .site-footer { grid-template-columns: 1fr; text-align: center; }
  .footer-brand { justify-content: center; }
  .footer-standard { display: block; white-space: normal; }
  .footer-cta { width: min(100%,310px); justify-self: center; }
}

/* SINDRI brand theme override */
:root {
  --bg: #f5f1ea;
  --panel: #ffffff;
  --panel-soft: #fff7ed;
  --line: #e6dccf;
  --text: #11100e;
  --muted: #74695f;
  --navy: #050505;
  --navy-2: #1a1714;
  --gold: #ff9416;
  --green: #22a06b;
  --green-soft: #e9f8f0;
  --red: #d9480f;
  --red-soft: #fff1f2;
  --accent: #ff7a00;
  --accent-soft: #fff3df;
  --amber: #b87819;
  --shadow: 0 16px 40px rgba(5, 5, 5, 0.12);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.app-switcher a:focus-visible {
  outline-color: rgba(255, 122, 0, 0.28);
}

.login-screen {
  background: radial-gradient(circle at 18% 10%, #ffe4bd, transparent 30%), var(--bg);
}

.login-screen::before {
  background-image: linear-gradient(rgba(17, 16, 14, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 16, 14, 0.08) 1px, transparent 1px);
}

.auth-tabs,
.sidebar-card,
.search-box,
.quick-action,
.clean-start,
th {
  background: var(--panel-soft);
}

.auth-tab.active {
  color: var(--text);
  background: var(--panel);
}

.app-switcher a,
.nav-button,
.quick-action,
.ghost-button {
  color: #5e5348;
}

.nav-button:hover,
.quick-action:hover,
.ghost-button:hover,
.icon-button:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.nav-button.active,
.primary-button {
  border-color: #ff7a00;
  color: #fff;
  background: linear-gradient(90deg, #050505, #20160d 72%, #ff7a00);
}

.primary-button:hover {
  background: linear-gradient(90deg, #18110a, #3a210b 68%, #ff9f1c);
}

.capacity-card,
.balance-card,
.hero,
.toast {
  border-color: #33200f;
  color: #fff;
  background: radial-gradient(circle at 78% 0, rgba(255, 122, 0, 0.42), transparent 42%), var(--navy);
}

.capacity-card .eyebrow,
.balance-card .eyebrow,
.hero .eyebrow {
  color: var(--gold);
}

.capacity-card > p:not(.eyebrow),
.hero > div > p:last-child,
.balance-equation small,
.balance-card > p:last-child {
  color: #ded6cc;
}

.capacity-meter {
  background: #2b241d;
}

.capacity-meter span,
.goal-track span,
.footer-cta {
  background: linear-gradient(90deg, #ff7a00, #ff9f1c);
}

.goal-track,
.bar-track {
  background: #eadfce;
}

.capacity-card button,
.profile .icon-button {
  border-color: #5f3a12;
  color: #fff;
  background: #20160d;
}

.capacity-card button:hover,
.profile .icon-button:hover {
  border-color: #ff7a00;
  background: #3a210b;
}

.profile,
.site-footer {
  border-color: #33200f;
  background: #080706;
}

.profile .profile-copy span {
  color: #ffb454;
}

.profile .profile-copy small,
.footer-brand span,
.footer-standard {
  color: #b6aca0;
}

.avatar {
  background: linear-gradient(135deg, #050505, #ff7a00);
}

.metric-icon,
.quick-action svg {
  color: #ff7a00;
  background: var(--accent-soft);
}

.status {
  color: #7a3900;
  background: var(--accent-soft);
}

.balance-card {
  background: radial-gradient(circle at 100% 0, rgba(255, 122, 0, 0.35), transparent 44%), var(--navy);
}

.topbar {
  background: rgba(255, 250, 243, 0.94);
}

body.dark {
  --bg: #050505;
  --panel: #11100e;
  --panel-soft: #191611;
  --line: #332820;
  --text: #fffaf3;
  --muted: #b6aca0;
  --navy: #050505;
  --navy-2: #1a1714;
  --green-soft: #123325;
  --red-soft: #3a1d16;
  --accent-soft: #2a1a08;
}

body.dark .login-screen {
  background: radial-gradient(circle at 18% 10%, rgba(255, 122, 0, 0.22), transparent 30%), var(--bg);
}

body.dark .login-screen::before {
  background-image: linear-gradient(rgba(255, 148, 22, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 148, 22, 0.12) 1px, transparent 1px);
}

body.dark .topbar {
  background: rgba(17, 16, 14, 0.94);
}

body.dark .auth-tab.active,
body.dark .guest-button {
  color: var(--text);
  background: #191611;
  border-color: var(--line);
}

body.dark .guest-button:hover,
body.dark .nav-button:hover,
body.dark .ghost-button:hover,
body.dark .icon-button:hover {
  border-color: #7a4a16;
  background: #21180d;
  color: #fff;
}

/* Final SINDRI auth spec shared across apps */
:root {
  --sindri-auth-bg: #050505;
  --sindri-auth-panel: #11100e;
  --sindri-auth-panel-soft: #191611;
  --sindri-auth-line: #332820;
  --sindri-auth-line-strong: #5f3a12;
  --sindri-auth-text: #fffaf3;
  --sindri-auth-muted: #b6aca0;
  --sindri-auth-accent: #ff7a00;
  --sindri-auth-accent-2: #ff9f1c;
  --sindri-auth-radius: 8px;
}

.login-screen {
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at 18% 10%, rgba(255, 122, 0, 0.18), transparent 30%), var(--sindri-auth-bg);
}

.login-screen::before {
  opacity: 0.58;
  background-image: linear-gradient(rgba(255, 148, 22, 0.10) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 148, 22, 0.10) 1px, transparent 1px);
  background-size: 48px 48px;
}

.login-card {
  width: min(440px, 100%);
  gap: 18px;
  padding: 32px;
  border: 1px solid var(--sindri-auth-line);
  border-radius: var(--sindri-auth-radius);
  color: var(--sindri-auth-text);
  background: var(--sindri-auth-panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.login-brand {
  gap: 12px;
}

.login-brand img,
.login-brand .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

.login-brand strong {
  color: var(--sindri-auth-text);
  font: 800 19px Manrope, Inter, system-ui, sans-serif;
  letter-spacing: 0;
}

.login-brand span,
.login-copy > p:last-child,
.guest-note {
  color: var(--sindri-auth-muted);
}

.login-brand span {
  margin-top: 3px;
  font-size: 11px;
}

.login-copy {
  margin-top: 4px;
}

.login-copy h1 {
  margin: 6px 0 8px;
  color: var(--sindri-auth-text);
  font: 800 30px/1.08 Manrope, Inter, system-ui, sans-serif;
  letter-spacing: 0;
}

.login-copy > p:last-child {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px;
  border: 0;
  border-radius: var(--sindri-auth-radius);
  background: var(--sindri-auth-panel-soft);
}

.auth-tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  color: var(--sindri-auth-muted);
  background: transparent;
  font-weight: 800;
}

.auth-tab.active {
  color: var(--sindri-auth-text);
  background: var(--sindri-auth-panel);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.24);
}

.auth-tab:hover {
  color: var(--sindri-auth-text);
}

.login-card label,
.login-card .field label {
  color: var(--sindri-auth-text);
  font-size: 12px;
  font-weight: 800;
}

.login-card input,
.login-card select,
.login-card textarea {
  min-height: 43px;
  border: 1px solid var(--sindri-auth-line);
  border-radius: var(--sindri-auth-radius);
  color: var(--sindri-auth-text);
  background: var(--sindri-auth-panel-soft);
}

.login-card input::placeholder {
  color: #8b837b;
  opacity: 1;
}

.login-card input:focus,
.login-card select:focus,
.login-card textarea:focus {
  border-color: var(--sindri-auth-accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.18);
}

.login-submit,
.login-card .primary-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--sindri-auth-accent);
  border-radius: var(--sindri-auth-radius);
  color: #fff;
  background: linear-gradient(90deg, #050505 0%, #11100e 58%, var(--sindri-auth-accent) 100%);
  font-weight: 800;
  box-shadow: none;
}

.login-submit:hover,
.login-card .primary-button:hover {
  border-color: var(--sindri-auth-accent-2);
  background: linear-gradient(90deg, #050505 0%, #20160d 55%, var(--sindri-auth-accent-2) 100%);
}

.auth-divider {
  gap: 12px;
  color: var(--sindri-auth-muted);
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  background: var(--sindri-auth-line);
}

.guest-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--sindri-auth-line);
  border-radius: var(--sindri-auth-radius);
  color: var(--sindri-auth-text);
  background: var(--sindri-auth-panel-soft);
  font-weight: 800;
}

.guest-button:hover {
  border-color: var(--sindri-auth-line-strong);
  color: var(--sindri-auth-text);
  background: #21180d;
}

.guest-note {
  margin: -8px 0 0;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

body.dark .login-screen,
body.dark-mode .login-screen {
  background: radial-gradient(circle at 18% 10%, rgba(255, 122, 0, 0.18), transparent 30%), var(--sindri-auth-bg);
}

body.dark .login-card,
body.dark-mode .login-card,
body.dark .auth-tabs,
body.dark-mode .auth-tabs {
  border-color: var(--sindri-auth-line);
  color: var(--sindri-auth-text);
  background: var(--sindri-auth-panel);
}

body.dark .auth-tab.active,
body.dark-mode .auth-tab.active,
body.dark .guest-button,
body.dark-mode .guest-button {
  border-color: var(--sindri-auth-line);
  color: var(--sindri-auth-text);
  background: var(--sindri-auth-panel-soft);
}

/* Final SINDRI controls pass */
input,
select,
textarea,
.search-box,
.field input,
.field select,
.field textarea,
.filters select,
.row-actions button,
.icon-button,
.ghost-button {
  border-color: #332820;
  color: #11100e;
  background: #fffaf3;
}

input::placeholder,
textarea::placeholder {
  color: #8b837b;
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #ff7a00;
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.18);
}

.primary-button,
.nav-button.active {
  border-color: #ff7a00;
  color: #fff;
  background: linear-gradient(90deg, #050505, #20160d 72%, #ff7a00);
}

.primary-button:hover {
  background: linear-gradient(90deg, #18110a, #3a210b 68%, #ff9f1c);
}

.icon-button:hover,
.ghost-button:hover,
.row-actions button:hover {
  border-color: #7a4a16;
  color: #11100e;
  background: #fff3df;
}

.balance-card {
  border-color: #33200f;
  background: radial-gradient(circle at 100% 0, rgba(255, 122, 0, 0.35), transparent 44%), #050505;
}

body.dark input,
body.dark select,
body.dark textarea,
body.dark .search-box,
body.dark .field input,
body.dark .field select,
body.dark .field textarea,
body.dark .filters select,
body.dark .row-actions button,
body.dark .icon-button,
body.dark .ghost-button {
  border-color: #332820;
  color: #fffaf3;
  background: #191611;
}

body.dark input::placeholder,
body.dark textarea::placeholder {
  color: #8b837b;
}

/* Auth inputs must stay on the SINDRI dark surface in every theme. */
.login-card input,
.login-card select,
.login-card textarea,
body.dark .login-card input,
body.dark .login-card select,
body.dark .login-card textarea {
  border-color: var(--sindri-auth-line) !important;
  color: var(--sindri-auth-text) !important;
  background: var(--sindri-auth-panel-soft) !important;
  box-shadow: none;
}

.login-card input:focus,
.login-card select:focus,
.login-card textarea:focus,
body.dark .login-card input:focus,
body.dark .login-card select:focus,
body.dark .login-card textarea:focus {
  border-color: var(--sindri-auth-accent) !important;
  background: var(--sindri-auth-panel-soft) !important;
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.18) !important;
}

.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus,
.login-card textarea:-webkit-autofill,
.login-card textarea:-webkit-autofill:hover,
.login-card textarea:-webkit-autofill:focus,
.login-card select:-webkit-autofill,
.login-card select:-webkit-autofill:hover,
.login-card select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--sindri-auth-text) !important;
  caret-color: var(--sindri-auth-text) !important;
  border-color: var(--sindri-auth-accent) !important;
  box-shadow: 0 0 0 1000px var(--sindri-auth-panel-soft) inset, 0 0 0 3px rgba(255, 122, 0, 0.18) !important;
  transition: background-color 999999s ease-in-out 0s;
}


/* Shared TrueBit Forge North footer */
.site-footer { display: block; margin-top: 28px; padding: 0; overflow: hidden; border: 1px solid #33200f; border-radius: 10px; color: #fffaf3; background: radial-gradient(circle at 100% 0, rgba(255,122,0,.16), transparent 34%), #050505; box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.tbfn-footer-link { display: grid; grid-template-columns: 72px minmax(0,1fr) auto; align-items: center; gap: 20px; min-height: 104px; padding: 16px 18px; color: inherit; text-decoration: none; }
.tbfn-footer-logo { width: 72px; height: 72px; object-fit: contain; }
.tbfn-footer-copy, .tbfn-footer-copy strong, .tbfn-footer-copy span { display: block; }
.tbfn-footer-copy strong { margin-bottom: 5px; color: #fff; font-size: 16px; line-height: 1.3; }
.tbfn-footer-copy span { max-width: 620px; color: #c9c0b6; font-size: 12px; line-height: 1.55; }
.tbfn-footer-action { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 6px; color: #050505; background: linear-gradient(90deg,#ff7a00,#ff9f1c); font-size: 13px; font-weight: 800; text-align: center; transition: 180ms ease; }
.tbfn-footer-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.tbfn-footer-link:hover .tbfn-footer-action { background: #ffb454; transform: translateY(-1px); }
.tbfn-footer-link:focus-visible { outline: 3px solid #ff9f1c; outline-offset: -3px; }
@media (max-width: 720px) { .tbfn-footer-link { grid-template-columns: 58px minmax(0,1fr); gap: 14px; padding: 18px; } .tbfn-footer-logo { width: 58px; height: 58px; } .tbfn-footer-action { grid-column: 1 / -1; width: 100%; } }
