:root {
  color-scheme: light;
  --bg: #eef3f7;
  --surface: #fff;
  --ink: #121826;
  --muted: #667085;
  --line: rgba(18, 24, 38, .11);
  --primary: #0b65d8;
  --green: #087443;
  --red: #b42318;
  --amber: #b76e00;
  --sidebar: #121826;
  --shadow: 0 18px 55px rgba(18, 24, 38, .11);
  font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: linear-gradient(135deg, rgba(11,101,216,.10), transparent 32%), linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%); }
button, input, select, textarea { font: inherit; border-radius: 8px; }
button { min-height: 42px; border: 0; padding: 0 15px; font-weight: 850; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
input, select, textarea { width: 100%; min-height: 43px; border: 1px solid var(--line); background: white; color: var(--ink); padding: 0 12px; }
textarea { padding: 10px 12px; resize: vertical; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 850; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(31px, 4vw, 46px); line-height: 1.04; letter-spacing: 0; }
h2 { font-size: 19px; letter-spacing: 0; }
h3 { font-size: 17px; }
h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0; margin: 10px 0 8px; }
small { color: var(--muted); }
.primary { color: white; background: var(--primary); box-shadow: 0 12px 28px rgba(11,101,216,.23); }
.secondary { color: var(--ink); background: #e2e8f0; }
.ghost { color: inherit; background: transparent; border: 1px solid rgba(255,255,255,.16); }
.danger:hover { background: rgba(180,35,24,.14); }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 900; text-transform: uppercase; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 430px; }
.login-visual { position: relative; overflow: hidden; padding: 48px; display: flex; align-items: flex-end; color: white; background: #0d1726; }
.login-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(1.08) contrast(1.04); }
.login-shade { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(7,18,34,.35), rgba(7,18,34,.82)); }
.login-copy { position: relative; display: grid; gap: 18px; max-width: 640px; }
.login-copy p { color: rgba(255,255,255,.84); font-size: 18px; }
.login-card { padding: 40px; display: flex; flex-direction: column; justify-content: center; gap: 16px; background: rgba(255,255,255,.95); }
.form { display: grid; gap: 14px; }
.compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-form label:last-of-type, .compact-form button { grid-column: span 2; }
.status { min-height: 18px; color: var(--red); font-size: 13px; }
.ok-text { color: var(--green); }

.material-symbols-rounded { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: 0; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; font-feature-settings: "liga"; -webkit-font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; }
.app-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; color: white; background: radial-gradient(circle at 30% 25%, #8be9c8, #0b65d8 45%, #172554); box-shadow: 0 18px 35px rgba(11,101,216,.3); }
.app-icon .material-symbols-rounded { font-size: 30px; }
.app-icon.small { width: 46px; height: 46px; border-radius: 12px; font-size: 19px; flex: 0 0 auto; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px; background: var(--sidebar); color: white; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand small { display: block; }
.brand small { max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: grid; gap: 8px; }
.tab-link { width: 100%; color: rgba(255,255,255,.72); text-align: left; background: transparent; box-shadow: none; }
.tab-link:hover, .tab-link.active { color: white; background: rgba(255,255,255,.12); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; }
.workspace { padding: 30px; min-width: 0; }
.topbar, .panel-title, .item-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.topbar { align-items: center; margin-bottom: 24px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.runtime-error { margin-bottom: 14px; padding: 12px 14px; border: 1px solid rgba(180,35,24,.26); border-radius: 8px; color: var(--red); background: #fff1f0; font-weight: 800; }
.badge { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; padding: 0 11px; border-radius: 8px; color: #075e50; background: #dff7ef; font-size: 12px; font-weight: 900; }
.badge.muted { color: var(--amber); background: #fff1d6; }
.badge.ok { color: #075e50; background: #dff7ef; }
.tab-panel { animation: rise .22s ease both; }

.market-motion { position: absolute; inset: 0; opacity: .44; background: linear-gradient(120deg, rgba(11,101,216,.18), transparent 30%, rgba(8,116,67,.20)); }
.market-motion span { position: absolute; bottom: 18%; width: 18%; height: 2px; background: rgba(255,255,255,.5); transform: rotate(-18deg); animation: ticker 5s linear infinite; }
.market-motion span:nth-child(1) { left: 5%; animation-delay: 0s; }
.market-motion span:nth-child(2) { left: 28%; bottom: 42%; animation-delay: .7s; }
.market-motion span:nth-child(3) { left: 52%; bottom: 29%; animation-delay: 1.4s; }
.market-motion span:nth-child(4) { left: 76%; bottom: 55%; animation-delay: 2.1s; }
.login-video { z-index: 1; }
.stock-video { position: absolute; inset: 0; z-index: 2; display: grid; grid-template-columns: repeat(8, 1fr); align-items: end; gap: 18px; padding: 11% 9% 12%; opacity: .92; }
.stock-video i { display: block; height: var(--h); border-radius: 8px 8px 0 0; background: linear-gradient(180deg, rgba(96, 239, 199, .95), rgba(11, 101, 216, .72)); box-shadow: 0 0 28px rgba(96,239,199,.24); animation: stockPulse 3.8s ease-in-out infinite; animation-delay: var(--d); }
.stock-video i:nth-child(2n) { background: linear-gradient(180deg, rgba(255, 112, 112, .92), rgba(180, 35, 24, .66)); }
.stock-video svg { position: absolute; inset: 12% 6% 12% 6%; width: 88%; height: 76%; filter: drop-shadow(0 8px 20px rgba(96,239,199,.28)); }
.stock-video path { fill: none; stroke: rgba(255,255,255,.86); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 980; animation: drawLine 5.2s ease-in-out infinite; }
.market-motion { z-index: 3; }
.login-shade { z-index: 3; }
.login-copy { z-index: 4; }

.hero-grid { display: grid; grid-template-columns: minmax(340px, 1.2fr) repeat(3, minmax(190px, .36fr)); gap: 18px; }
.cockpit { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.cockpit-head { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 12px; }
.kpi-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.compact-balance { min-height: 178px; }
.cockpit-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.mini-panel { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; min-width: 0; }
.trend-panel { grid-column: 1 / -1; }
.dense-list { gap: 7px; }
.balance-card, .metric-card, .panel { border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.balance-card { min-height: 240px; padding: 28px; position: relative; overflow: hidden; }
.balance-card > span, .metric-card > span { color: var(--muted); font-weight: 850; }
#balance { display: block; margin: 19px 0 12px; font-size: clamp(42px, 7vw, 78px); line-height: 1; overflow-wrap: anywhere; }
.balance-warnings { display: grid; gap: 7px; margin-top: 10px; padding-bottom: 12px; }
.balance-warnings div { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 8px; background: #fff1f0; color: var(--red); }
.balance-warnings div.ok-row { background: #ecfdf3; color: var(--green); }
.balance-warnings span { font-size: 12px; font-weight: 850; }
.balance-warnings strong { font-size: 16px; }
.flow-line { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: linear-gradient(90deg, var(--primary), #07946c, #7a5af8, var(--primary)); background-size: 220% 100%; animation: flow 4.4s linear infinite; }
.metric-card { padding: 22px; display: grid; gap: 10px; align-content: center; }
.metric-card strong { font-size: clamp(25px, 3vw, 36px); line-height: 1; overflow-wrap: anywhere; }
.income-card { border-top: 4px solid var(--green); }
.expense-card { border-top: 4px solid var(--red); }
.cashflow-card { border-top: 4px solid var(--primary); }
.content-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.wide { grid-column: span 2; }
.panel { padding: 20px; min-width: 0; }
.chart { height: 260px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: end; margin-top: 18px; }
.compact-chart { height: 230px; margin-top: 8px; }
.bar-group { min-width: 0; display: grid; gap: 8px; justify-items: center; height: 100%; }
.bars { width: 100%; height: 205px; display: flex; gap: 7px; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); }
.compact-chart .bars { height: 164px; padding-top: 22px; }
.bar { width: min(42px, 42%); min-height: 4px; border-radius: 6px 6px 0 0; position: relative; display: flex; align-items: flex-start; justify-content: center; }
.bar b { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: var(--ink); font-size: 10px; line-height: 1; white-space: nowrap; text-shadow: 0 1px 0 rgba(255,255,255,.8); }
.income-bar { background: var(--green); }
.expense-bar { background: var(--red); }

.list { margin-top: 14px; display: grid; gap: 10px; }
.budget-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.item, .stack-item, .account-card, .transaction-item { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.item, .account-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.stack-item { display: grid; gap: 9px; }
.title-with-icon { display: flex; align-items: center; gap: 10px; min-width: 0; }
.round-icon { width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; flex: 0 0 auto; background: #eef4ff; overflow: hidden; }
.round-icon img { width: 22px; height: 22px; object-fit: contain; }
.round-icon .material-symbols-rounded { color: var(--primary); }
.round-icon.big { width: 48px; height: 48px; font-size: 24px; }
.progress { width: 100%; height: 8px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #07946c); }
.money { font-weight: 950; white-space: nowrap; }
.income { color: var(--green); }
.outcome { color: var(--red); }
.neutral { color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 10px 0; }

.account-groups { gap: 16px; }
.bank-group { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.bank-title { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.account-stack { margin-top: 12px; }
.account-card { box-shadow: none; margin-top: 8px; }
.account-card.archived { opacity: .62; }

.segmented, .filters-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.segmented button { min-height: 34px; padding: 0 10px; color: var(--muted); background: #edf2f7; box-shadow: none; font-size: 12px; }
.segmented button.active { color: white; background: var(--primary); }
.filters-row { justify-content: flex-start; margin-top: 14px; }
.filters-row select, .filters-row input { width: auto; min-width: 160px; }
.transaction-list { gap: 8px; }
.transaction-item { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; box-shadow: none; }
.transaction-item:hover { background: #f8fbff; }
.compact-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; min-height: 48px; }
.compact-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-row strong small { display: block; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.paid-row { opacity: .68; background: #f6fef9; }
.payment-search { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.payment-draft { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.payment-draft strong, .payment-draft small { display: block; overflow-wrap: anywhere; }
.payment-draft button { min-height: 36px; width: 38px; padding: 0; }
.insight-item { width: 100%; text-align: left; }
.tx-main { min-width: 0; }
.tx-main strong, .tx-main small, .account-card strong, .account-card small, .item strong, .item small { display: block; overflow-wrap: anywhere; }

.tx-dialog { border: 0; padding: 0; border-radius: 8px; width: min(620px, calc(100vw - 28px)); box-shadow: 0 30px 80px rgba(18,24,38,.32); }
.tx-dialog::backdrop { background: rgba(10, 18, 32, .46); backdrop-filter: blur(4px); }
.dialog-card { position: relative; padding: 22px; display: grid; gap: 15px; }
.dialog-close { position: absolute; top: 10px; right: 10px; width: 36px; min-height: 36px; padding: 0; background: #edf2f7; }
.dialog-head { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: center; padding-right: 34px; }
.tx-details { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.tx-details dt { color: var(--muted); font-weight: 800; }
.tx-details dd { margin: 0; overflow-wrap: anywhere; }

@keyframes flow { to { background-position: 220% 0; } }
@keyframes stockPulse { 0%, 100% { transform: scaleY(.82); opacity: .72; } 50% { transform: scaleY(1.06); opacity: 1; } }
@keyframes drawLine { 0% { stroke-dashoffset: 980; } 45%, 70% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -980; } }
@keyframes ticker { 0% { transform: translateX(-20%) rotate(-18deg) scaleX(.6); opacity: .15; } 45% { opacity: .65; } 100% { transform: translateX(30%) rotate(-18deg) scaleX(1.2); opacity: .1; } }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }
@media (max-width: 1180px) { .hero-grid, .content-grid, .cockpit-head, .cockpit-grid { grid-template-columns: 1fr; } .wide { grid-column: span 1; } .trend-panel { grid-row: span 1; } }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .tabs { display: flex; flex-wrap: wrap; }
  .tab-link { width: auto; text-align: center; }
  .sidebar-bottom { display: flex; align-items: center; }
}
@media (max-width: 760px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { min-height: 310px; padding: 28px; }
  .login-card, .workspace { padding: 22px; }
  .topbar { display: grid; align-items: stretch; }
  .topbar-actions { justify-content: stretch; }
  .topbar-actions button, .topbar-actions .badge { flex: 1; text-align: center; }
  .item, .account-card, .transaction-item, .dialog-head { grid-template-columns: 1fr; }
  .compact-form { grid-template-columns: 1fr; }
  .compact-form label:last-of-type, .compact-form button { grid-column: span 1; }
  .chart { gap: 8px; }
  .kpi-strip { grid-template-columns: 1fr; }
}
