/* S4S Fintech — shared design system.
   Theme modeled on DigiCert CertCentral: white content on a light page,
   deep-blue sidebar, blue primary actions. Fixed light theme (no auto-dark).
   Charts keep the validated categorical palette. */

:root {
  --page: #f3f5f9; --surface: #ffffff; --raise: #f1f5fb;
  --ink: #17181a; --ink-2: #494d53; --muted: #7d828a;
  --grid: #e6e9ee; --axis: #c7cdd5; --border: rgba(21, 41, 71, 0.12);
  /* brand blues (sampled from the CertCentral reference) */
  --accent: #2b6cc4; --accent-deep: #1d4e8f; --accent-ink: #ffffff;
  --side: #275c9f; --side-deep: #16375f;
  /* legacy accent aliases (pages reference these) */
  --lime: #2b6cc4; --lime-deep: #1d4e8f; --lime-ink: #ffffff;
  /* categorical slots (validated, fixed order): stocks, MF, gold, lands, savings, lent, US stocks */
  --c1: #2a78d6; --c2: #1baf7a; --c3: #eda100; --c4: #008300; --c5: #4a3aa7; --c6: #e34948;
  --c7: #b2477d;
  --s-blue: #2a78d6;
  --up: #006300; --down: #d03b3b;
  --shadow: 0 1px 2px rgba(21,41,71,.05), 0 8px 24px -14px rgba(21,41,71,.18);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--page); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }

/* ---------------------------------------------------------- app shell */
.shell { display: flex; min-height: 100vh; }
aside.side {
  width: 216px; flex: none; padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, var(--side), #1f4c87);
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-weight: 750; letter-spacing: -0.01em;
  padding: 6px 6px 20px;
}
.brand img.mark {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.bname { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1; }
.bname .row { display: flex; align-items: center; gap: 7px; font-size: 23px; font-weight: 800; letter-spacing: .03em; }
.bname .row i { font-style: normal; color: #ff5fa8; font-size: 13px; }
.bname .row sup { font-size: 14px; font-weight: 800; }
.bname small {
  font-size: 10px; font-weight: 700; color: var(--muted);
  letter-spacing: .44em; margin-right: -.44em;  /* re-center the tracked text */
}
aside.side .bname .row { color: #ffffff; }
aside.side .bname small { color: #b9d2f2; }

aside.side nav { display: flex; flex-direction: column; gap: 2px; }
aside.side nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: 9px; text-decoration: none;
  color: rgba(255,255,255,.88); font-size: 13.5px; font-weight: 500;
}
aside.side nav a .ic { width: 18px; text-align: center; }
aside.side nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
aside.side nav a.active {
  background: var(--side-deep); color: #fff; font-weight: 650;
  position: relative;
}
aside.side nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: #8fc1ff;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.who {
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px; padding: 10px 12px; font-size: 12px; color: #cfe0f6;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who b { display: block; color: #ffffff; font-size: 12.5px; }
.side-foot button.icon {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.22);
}
.side-foot button.icon:hover { background: rgba(255,255,255,.22); }

main.content { flex: 1; min-width: 0; padding: 18px 22px 40px; max-width: 1220px; }
.topbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.topbar h1 { font-size: 20px; font-weight: 750; letter-spacing: -0.01em; margin-right: 4px; }
.topbar .status { color: var(--muted); font-size: 12px; }
.topbar .spacer { margin-left: auto; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  aside.side {
    width: auto; height: auto; position: static; flex-direction: row;
    align-items: center; padding: 10px 14px;
  }
  .brand { padding: 0 8px 0 0; }
  aside.side nav { flex-direction: row; }
  aside.side nav a.active::before { display: none; }
  .side-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .who { display: none; }
}

/* ------------------------------------------------------------ blocks */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
  min-width: 0;
}
.card > h2, .card .card-head h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 650; margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin-bottom: 0; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.big { font-size: 30px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.1; }
.giant { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.sub { font-size: 12px; color: var(--muted); }
.pos { color: var(--up); } .neg { color: var(--down); }
.delta { font-size: 13px; font-weight: 650; }
.empty, .empty-note { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }
.note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
#error { color: var(--down); margin: 0 0 12px; display: none; font-size: 13px; }

/* ------------------------------------------------------------ controls */
button, .btn {
  border: 0; border-radius: 10px; padding: 8px 14px; font: inherit;
  font-weight: 650; cursor: pointer; background: var(--raise); color: var(--ink);
  border: 1px solid var(--border);
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.primary:hover { background: var(--accent-deep); }
button.dark { background: var(--ink); color: var(--page); border-color: transparent; }
button.ghost { background: transparent; border-color: transparent; color: var(--down); padding: 2px 8px; font-weight: 400; }
table .cell-edit { width: 96px; padding: 5px 7px; font-size: 13px; }
table select.cell-edit { width: 116px; }
button.icon { padding: 6px 9px; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
select, input {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 11px; font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=number] { width: 130px; }
label.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--ink-2); font-weight: 500; }
.seg button.active { background: var(--accent); color: #fff; font-weight: 650; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }

/* ------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--grid); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: var(--raise); }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 700; border-top: 1px solid var(--axis); }

/* ------------------------------------------------------ lists & bars */
.legend .row {
  display: flex; align-items: center; gap: 9px; padding: 6px 2px;
  border-bottom: 1px solid var(--grid); font-size: 13px;
}
.legend .row:last-child { border-bottom: 0; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .nm { color: var(--ink-2); }
.legend .val { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.legend .pct { color: var(--muted); width: 46px; text-align: right; font-variant-numeric: tabular-nums; }

.meter { height: 12px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.meter > i {
  display: block; height: 100%; border-radius: 999px;
  background: repeating-linear-gradient(-55deg, var(--accent) 0 6px, var(--accent-deep) 6px 8px);
}
.meter.over > i { background: repeating-linear-gradient(-55deg, #ec835a 0 6px, #d03b3b 6px 8px); }

.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.split > i { min-width: 3px; }

.txn { display: flex; align-items: center; gap: 11px; padding: 8px 2px; border-bottom: 1px solid var(--grid); }
.txn:last-child { border-bottom: 0; }
.txn .badge {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 15px; background: var(--raise);
  border: 1px solid var(--border);
}
.txn .what { min-width: 0; }
.txn .what b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn .what span { font-size: 11.5px; color: var(--muted); }
.txn .amt { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------ autocomplete */
.search-wrap { position: relative; }
.search-wrap input { width: 260px; }
.dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(21,41,71,.18); max-height: 260px; overflow-y: auto; display: none;
}
.dropdown div { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.dropdown div:hover, .dropdown div.sel { background: var(--accent); color: #fff; }
.dropdown small { color: inherit; opacity: .7; margin-left: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--raise);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 7px 4px 12px; font-size: 13px;
}
.chip b { font-weight: 650; }
.chip button { background: transparent; border: 0; color: var(--muted); padding: 0 4px; font-size: 14px; }

/* --------------------------------------------------------------- misc */
#tooltip {
  position: fixed; z-index: 50; pointer-events: none; display: none;
  background: #17263c; color: #fff; border-radius: 9px;
  padding: 6px 10px; font-size: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.3);
  white-space: nowrap;
}
#tooltip b { font-variant-numeric: tabular-nums; }

dialog {
  border: 0; border-radius: 16px; padding: 20px; background: var(--surface);
  color: var(--ink); box-shadow: 0 24px 70px rgba(10,25,50,.35); max-width: 520px; width: min(92vw, 520px);
}
dialog::backdrop { background: rgba(12,26,48,.5); backdrop-filter: blur(2px); }
dialog h3 { font-size: 15px; font-weight: 750; margin-bottom: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* blue "my card" widget (was the lime card) */
.limecard {
  border-radius: 16px; padding: 16px; color: #ffffff;
  background:
    radial-gradient(120% 140% at 100% 0%, #3b82dd 0%, var(--accent) 55%, var(--accent-deep) 100%);
  position: relative; overflow: hidden;
}
.limecard::after {
  content: ""; position: absolute; right: -22px; top: -28px; width: 130px; height: 130px;
  background:
    conic-gradient(from 90deg, transparent 0 25%, rgba(255,255,255,.14) 0 50%, transparent 0 75%, rgba(255,255,255,.14) 0);
  background-size: 26px 26px; border-radius: 24px; transform: rotate(12deg); opacity: .6;
}
.limecard .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .8; font-weight: 650; }
.limecard .v { font-size: 30px; font-weight: 800; letter-spacing: -0.015em; margin: 2px 0 4px; }
.quick { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.quick a, .quick button {
  flex: 1; min-width: 62px; text-decoration: none; text-align: center;
  background: rgba(255,255,255,.20); color: #ffffff; border: 0;
  border-radius: 10px; padding: 8px 6px; font-size: 12px; font-weight: 650; cursor: pointer;
}
.quick a:hover, .quick button:hover { background: rgba(255,255,255,.30); }
