:root {
  --bg: #0f1419;
  --surface: #1a222d;
  --surface-2: #243041;
  --text: #e8eef6;
  --muted: #9aabbd;
  --accent: #3d9cf0;
  --accent-2: #2a7fbf;
  --danger: #e85d5d;
  --ok: #3cb371;
  --border: #2e3b4d;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1c3348 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.brand { font-weight: 700; letter-spacing: .04em; color: var(--accent); margin: 0; }
.auth-card h1 { margin: .4rem 0 .75rem; font-size: 1.5rem; }
label { display: grid; gap: .35rem; margin: .85rem 0; font-size: .92rem; }
input, select, textarea, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: .65rem .75rem;
}
button {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
button:hover { filter: brightness(1.05); }
button.ghost, button.secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}
.alert {
  background: rgba(232,93,93,.15);
  border: 1px solid var(--danger);
  color: #ffc9c9;
  padding: .65rem .75rem;
  border-radius: 8px;
  margin: .75rem 0;
}
.muted { color: var(--muted); }
.fineprint { font-size: .8rem; color: var(--muted); margin-top: 1.25rem; }
.allowed-list {
  margin: 1rem 0 1.25rem;
  padding: .75rem 1rem .75rem 1.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .88rem;
  line-height: 1.55;
}
.google-btn-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0 .5rem;
  min-height: 44px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15,20,25,.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand-row { display: flex; align-items: center; gap: .6rem; }
.pill {
  font-size: .7rem;
  padding: .2rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.user-row { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }

.tabs {
  display: flex;
  gap: .35rem;
  padding: .75rem 1.25rem 0;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: .55rem .9rem;
  border-radius: 8px 8px 0 0;
}
.tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}
.panel { padding: 1rem 1.25rem 2.5rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.section-head h2 { margin: 0; font-size: 1.25rem; }
.actions { display: flex; gap: .5rem; }
.stack { display: grid; gap: 1rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.card h3 { margin: 0 0 .75rem; }
.task {
  border-top: 1px solid var(--border);
  padding: .75rem 0;
}
.task:first-of-type { border-top: 0; }
.meta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.badge {
  display: inline-block;
  font-size: .72rem;
  padding: .15rem .4rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge.open { color: #9ecbff; }
.badge.in_progress { color: #ffd48a; }
.badge.done { color: #8dffb0; }
.notes { margin-top: .5rem; font-size: .88rem; }
.note { padding: .35rem 0; border-left: 2px solid var(--border); padding-left: .6rem; margin: .35rem 0; }
.stat {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); }
th, td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { color: var(--muted); font-weight: 600; }
.folder-card h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .75rem; }
.folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .5rem;
}
.folder-actions .folder-move { min-width: 7rem; }
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.arms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.arm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem .95rem;
}
.arm-card h4 { margin: 0 0 .35rem; font-size: .95rem; }
.arm-card .big { font-size: 1.25rem; font-weight: 700; }
.arm-card .meta { margin-top: .35rem; }
.receipt-cell { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.receipt-cell img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.folder-item {
  border-top: 1px solid var(--border);
  padding: .65rem 0;
  font-size: .9rem;
}
.folder-actions { display: flex; gap: .4rem; margin-top: .4rem; }
.subhead { margin: 1.5rem 0 .5rem; }
.finance-banner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .65rem;
  margin: 0 0 1rem;
  padding: .9rem 1rem 2.1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a2e28 0%, #243b55 55%, #1c2838 100%);
  border: 1px solid rgba(255,255,255,.08);
  color: #f2f5f3;
  position: relative;
}
.banner-reconcile {
  position: absolute;
  right: .85rem;
  bottom: .45rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .15rem .5rem;
  border-radius: 999px;
}
.banner-reconcile.rec-ok {
  background: rgba(125, 222, 160, .18);
  color: #7ddea0;
}
.banner-reconcile.rec-bad {
  background: rgba(255, 155, 155, .18);
  color: #ff9b9b;
}
.banner-stat {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}
.banner-label {
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .72;
}
.banner-val {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.banner-val small {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  opacity: .85;
  margin-top: .15rem;
}
.banner-stat.pos .banner-val { color: #7ddea0; }
.banner-stat.neg .banner-val { color: #ff9b9b; }
.core-tracker { margin-bottom: 1rem; }
.core-card { padding: 1rem 1.1rem; }
.core-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.finance-charts {
  display: grid;
  grid-template-columns: 180px 1fr 1.2fr 1fr;
  gap: .75rem;
  margin: 0 0 1rem;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem 1rem;
  min-width: 0;
}
.chart-card.wide { }
.chart-card h4 {
  margin: 0 0 .65rem;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.chart-sub { font-size: .78rem; margin-top: .4rem; text-align: center; }
.ring-card { display: flex; flex-direction: column; align-items: center; }
.growth-ring { width: 120px; height: 120px; }
.ring-text {
  fill: var(--text);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
}
.capital-stack {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: .5rem;
  height: 140px;
  padding-top: .25rem;
}
.cap-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}
.cap-bar {
  width: 100%;
  max-width: 48px;
  border-radius: 8px 8px 3px 3px;
  min-height: 4px;
  transition: height .4s ease;
}
.cap-bar.inv { background: #5b8def; }
.cap-bar.bal { background: #7ddea0; }
.cap-bar.out { background: #e8a45c; }
.cap-col span { font-size: .72rem; opacity: .7; text-transform: uppercase; }
.cap-col em { font-style: normal; font-size: .78rem; font-weight: 600; }
.bar-legend {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .72rem;
  opacity: .75;
  margin-bottom: .55rem;
}
.bar-legend .lg {
  display: inline-block;
  width: 12px;
  height: 8px;
  border-radius: 2px;
}
.bar-legend .lg.tgt { background: rgba(91,141,239,.45); }
.bar-legend .lg.act { background: #5b8def; }
.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 90px;
  gap: .45rem;
  align-items: center;
  margin-bottom: .45rem;
  font-size: .8rem;
}
.bar-tracks { display: grid; gap: 3px; }
.bar-track {
  height: 8px;
  background: rgba(127,127,127,.15);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill { display: block; height: 100%; border-radius: 4px; }
.bar-fill.tgt { background: rgba(91,141,239,.4); }
.bar-fill.act { background: #5b8def; }
.bar-fill.act.neg { background: #ff9b9b; }
.bar-nums { text-align: right; font-variant-numeric: tabular-nums; font-size: .75rem; opacity: .85; }
.attn-row {
  display: grid;
  grid-template-columns: 72px 1fr 52px;
  gap: .45rem;
  align-items: center;
  margin-bottom: .5rem;
  font-size: .8rem;
}
.attn-track {
  height: 10px;
  background: rgba(127,127,127,.15);
  border-radius: 5px;
  overflow: hidden;
}
.attn-fill {
  display: block;
  height: 100%;
  background: #5b8def;
  border-radius: 5px;
  transition: width .4s ease;
}
.attn-fill.good { background: #7ddea0; }
.attn-fill.neg { background: #ff9b9b; }
.attn-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.spend-toolbar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.rate-pill {
  font-size: .82rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(91,141,239,.12);
  border: 1px solid rgba(91,141,239,.25);
}
.rate-pill strong { font-size: 1.05rem; }
.inline-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
}
.spend-grand { margin: 0 0 1rem; }
.spend-total-card {
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a2e28 0%, #243b55 100%);
  color: #f2f5f3;
  border: 1px solid rgba(255,255,255,.08);
}
.spend-total-big {
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin: .2rem 0;
  letter-spacing: -.01em;
}
.spend-total-sub { font-size: .85rem; opacity: .8; }
.spend-person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
  margin: 0 0 1rem;
}
.spend-person-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.spend-person-summary {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  background: rgba(91,141,239,.06);
}
.spend-person-lead {
  background: rgba(91,141,239,.12);
  border: 1px solid rgba(91,141,239,.35);
}
.spend-person-summary .banner-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .75;
}
.spend-person-summary h3 { margin: 0 0 .15rem; font-size: 1.15rem; }
.spend-person-summary .spend-total-big {
  font-size: 1.75rem;
  color: var(--text);
}
.spend-person-summary .spend-total-sub { color: var(--muted, #888); }
.spend-group-row td {
  background: rgba(91,141,239,.1);
  padding: .65rem .55rem !important;
  border-top: 1px solid var(--border);
  font-size: .95rem;
}
.spend-lines-wrap { margin-bottom: 1rem; overflow-x: auto; }
.spend-matrix { width: 100%; font-size: .82rem; }
.spend-matrix th, .spend-matrix td { white-space: nowrap; padding: .4rem .45rem; }
.spending-excel { margin-bottom: 1rem; }
.spend-lines { width: 100%; font-size: .92rem; }
.spend-lines th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.spend-line td { padding: .55rem .5rem; border-top: 1px solid var(--border); }
.spend-item { font-weight: 560; }
.spend-lines .num { text-align: right; font-variant-numeric: tabular-nums; }
.spend-total-row td {
  font-weight: 800;
  font-size: 1.05rem;
  background: rgba(125, 222, 160, .12);
  border-top: 2px solid rgba(125, 222, 160, .45);
  padding: .75rem .5rem;
}
.spend-total-row small { font-weight: 600; font-size: .8rem; opacity: .75; margin-left: .35rem; }
.pill-cur {
  display: inline-block;
  padding: .1rem .4rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  background: rgba(91,141,239,.15);
  color: #5b8def;
}
select.exp-currency { min-width: 4.5rem; }
@media (max-width: 1100px) {
  .finance-charts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .finance-banner { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .finance-banner { grid-template-columns: 1fr 1fr; }
  .finance-charts { grid-template-columns: 1fr; }
  .core-grid { grid-template-columns: 1fr; }
}

.idea-card {
  display: grid;
  grid-template-columns: minmax(96px, 140px) 1fr;
  gap: .85rem;
  align-items: start;
  padding: .9rem 1rem;
}
.idea-card:not(:has(.idea-thumb)) {
  grid-template-columns: 1fr;
}
.idea-thumb {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  min-height: 96px;
  aspect-ratio: 1;
}
.idea-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.idea-body { min-width: 0; }
.idea-body strong { font-size: 1.05rem; }
.idea-body p { margin: .35rem 0 0; }

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(480px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
.modal-form { padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: .65rem; }
.modal-form h3 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; }

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .user-row { width: 100%; justify-content: space-between; }
}
