/* Reading Capital CRM v2 — Monday.com-inspired */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #292f4c;          /* sidebar */
  --navy-2: #333a5e;
  --ink: #323338;
  --muted: #676879;
  --line: #e6e9ef;
  --bg: #f6f7fb;
  --card: #ffffff;
  --accent: #6161ff;        /* monday purple-blue */
  --accent-dark: #5151d5;
  --accent-soft: #ecedfd;
  /* monday status colors */
  --m-green: #00c875;
  --m-red: #e2445c;
  --m-orange: #fdab3d;
  --m-yellow: #ffcb00;
  --m-blue: #579bfc;
  --m-purple: #a25ddc;
  --m-gray: #c4c4c4;
  --m-dark-blue: #0086c0;
  --m-pink: #ff5ac4;
  --m-teal: #00d2d2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-lift: 0 6px 14px rgba(16, 24, 40, .10), 0 16px 36px rgba(16, 24, 40, .12);
  --grad-accent: linear-gradient(135deg, #7070ff 0%, #5b5bf0 55%, #7d4ff0 100%);
  --ring: 0 0 0 3.5px rgba(97, 97, 255, .18);
  --ease: cubic-bezier(.2, .8, .3, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  /* a fixed colour wash behind everything, so white cards sit ON something
     instead of dissolving into a white page */
  background:
    radial-gradient(1200px 760px at 8% -10%, rgba(97, 97, 255, .13), transparent 62%),
    radial-gradient(1000px 620px at 102% -4%, rgba(0, 200, 117, .10), transparent 58%),
    radial-gradient(900px 800px at 78% 108%, rgba(162, 93, 220, .11), transparent 62%),
    radial-gradient(700px 500px at 20% 96%, rgba(253, 171, 61, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
a { color: var(--accent); }

/* ---------- auth ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #292f4c 0%, #40477a 55%, #6161ff 130%);
  padding: 20px;
}
.auth-card {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lift);
  padding: 40px 36px; width: 100%; max-width: 400px; text-align: center;
}
.auth-logo { font-size: 44px; }
.auth-card h1 { font-size: 24px; margin: 8px 0 2px; color: var(--navy); }
.auth-sub { color: var(--muted); margin-bottom: 24px; }
.auth-note { font-size: 13.5px; color: var(--muted); text-align: left; margin-bottom: 14px; }
.auth-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 15px; outline: none;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-error { color: var(--m-red); font-size: 13.5px; min-height: 20px; margin-top: 10px; }

/* ---------- buttons: every one should look pressable ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 10px; border: 1.5px solid transparent;
  font-size: 14px; font-weight: 700; letter-spacing: -.1px;
  cursor: pointer; text-decoration: none; white-space: nowrap; font-family: inherit;
  transition: transform .13s var(--ease), box-shadow .18s var(--ease), background .18s, border-color .18s;
}
.btn:hover { transform: translateY(-1.5px); }
.btn:active { transform: translateY(0) scale(.985); }

.btn-primary {
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 2px 6px rgba(97, 97, 255, .32), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(97, 97, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .18); }

.btn-secondary {
  background: var(--accent-soft); color: #4c4ce0; border-color: #d9daff;
  box-shadow: 0 1px 2px rgba(97, 97, 255, .10);
}
.btn-secondary:hover { background: #e3e4ff; border-color: #c3c4ff; box-shadow: 0 6px 14px rgba(97, 97, 255, .18); }

/* was a near-invisible outline — now unmistakably a button */
.btn-ghost {
  background: #fff; color: #4c5170; border-color: #dfe3ee;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.btn-ghost:hover { background: #fafbff; border-color: #c2c8de; color: var(--ink); box-shadow: 0 6px 14px rgba(16, 24, 40, .10); }

.btn-danger-ghost { background: #fff; color: var(--m-red); border-color: #f6c6cd; box-shadow: 0 1px 2px rgba(226, 68, 92, .10); }
.btn-danger-ghost:hover { background: #fff5f6; border-color: #eda3ae; box-shadow: 0 6px 14px rgba(226, 68, 92, .18); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn-row-tight { display: flex; gap: 9px; flex-wrap: wrap; }

/* file pickers are <label class="btn"> — make them behave like the real thing */
label.btn { cursor: pointer; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px; color: #c3c6d4; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
  background: linear-gradient(180deg, #2b3152 0%, #262b46 60%, #23283f 100%);
}
.brand {
  display: flex; gap: 11px; align-items: center; padding: 20px 16px 16px; margin: 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-icon {
  font-size: 20px; width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad-accent); box-shadow: 0 4px 12px rgba(97, 97, 255, .45);
}
.brand-name { color: #fff; font-weight: 800; font-size: 15px; line-height: 1.2; letter-spacing: -.2px; }
.brand-sub { font-size: 10px; color: #8b90ad; letter-spacing: 2.5px; font-weight: 700; }
.sidebar nav { padding: 8px 10px; flex: 1; overflow-y: auto; }
.nav-section {
  font-size: 10px; letter-spacing: 1.7px; text-transform: uppercase; color: #757ba0;
  padding: 16px 12px 6px; font-weight: 800;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: none; color: #c3c6d4; font-size: 14px; font-weight: 600;
  padding: 7px 10px; border-radius: 10px; cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s, transform .13s var(--ease);
  margin-bottom: 1px;
}
/* each icon gets its own tile so the rail reads as a set of objects, not a text list */
.nav-item .ni {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .07); transition: background .15s, transform .15s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item:hover .ni { background: rgba(255, 255, 255, .14); transform: scale(1.06); }
.nav-item.active {
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 5px 16px rgba(97, 97, 255, .42);
}
.nav-item.active .ni { background: rgba(255, 255, 255, .22); }
.nav-badge {
  background: var(--m-red); color: #fff; font-size: 11px; font-weight: 800; border-radius: 99px;
  padding: 2px 8px; margin-left: auto; font-style: normal; box-shadow: 0 2px 6px rgba(226, 68, 92, .45);
}
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); margin: 0 10px 6px; }
.sidebar-footer .btn-ghost {
  background: rgba(255, 255, 255, .06); color: #b9bed8; border-color: rgba(255, 255, 255, .12); box-shadow: none;
}
.sidebar-footer .btn-ghost:hover { background: rgba(255, 255, 255, .13); color: #fff; border-color: rgba(255, 255, 255, .2); }

.main { flex: 1; padding: 26px 32px 72px; max-width: 1320px; min-width: 0; }
.view-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.view-header h2 { font-size: 26px; color: var(--navy); font-weight: 800; letter-spacing: -.6px; }
.view-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.header-select {
  padding: 9px 13px; border: 1.5px solid #e2e6f0; border-radius: 10px; background: #fff;
  font-size: 14px; font-family: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

/* ---------- inputs ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 220px; }
.toolbar input, .toolbar select,
.form-grid input, .form-grid select, .form-grid textarea,
.inline-form input, .inline-form select, .stack-form input, .import-row select, .import-row input {
  padding: 10px 13px; border: 1.5px solid #e2e6f0; border-radius: 10px;
  font-size: 14px; outline: none; background: #fff; font-family: inherit; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.toolbar input:hover, .form-grid input:hover, .form-grid select:hover, .form-grid textarea:hover { border-color: #cfd5e6; }
.toolbar input:focus, .toolbar select:focus,
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.inline-form input:focus, .stack-form input:focus, .import-row input:focus {
  border-color: var(--accent); box-shadow: var(--ring);
}
.header-select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }

/* ---------- stat cards ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  --c: var(--accent);
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 17px 18px 15px; cursor: pointer; border: 1px solid #eef0f7;
  transition: transform .16s var(--ease), box-shadow .18s var(--ease);
}
/* thick colour cap + a soft wash of the same colour bleeding down the card */
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--c); }
.stat-card::after {
  content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 62px;
  background: linear-gradient(180deg, var(--c), transparent); opacity: .09; pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat-card .num { font-size: 27px; font-weight: 800; color: var(--navy); line-height: 1.15; letter-spacing: -.7px; position: relative; }
.stat-card .lbl { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 600; position: relative; }
.stat-card.c-green  { --c: var(--m-green); }
.stat-card.c-red    { --c: var(--m-red); }
.stat-card.c-orange { --c: var(--m-orange); }
.stat-card.c-yellow { --c: var(--m-yellow); }
.stat-card.c-blue   { --c: var(--m-blue); }
.stat-card.c-purple { --c: var(--m-purple); }
.stat-card.c-red .num { color: var(--m-red); }
.stat-card.c-green .num { color: #009960; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 16px; min-width: 0; border: 1px solid #eef0f7;
}
/* the emoji already leads each heading — a divider makes each panel read as its own section.
   deliberately NOT flex: that collapses the space between the emoji and the words. */
.panel h3 {
  font-size: 16px; margin-bottom: 14px; color: var(--navy); font-weight: 800; letter-spacing: -.25px;
  padding-bottom: 11px; border-bottom: 1px solid #f0f2f8;
}
.panel-head { border-bottom: 1px solid #f0f2f8; padding-bottom: 11px; margin-bottom: 14px; }
.panel-head h3 { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.empty { color: var(--muted); font-size: 13.5px; padding: 14px 4px; }

.mini-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mini-row:hover { background: var(--bg); }
.mini-row .who { font-weight: 600; flex-shrink: 0; }
.mini-row .what { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.mini-row .when { font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.mini-row .when.overdue { color: var(--m-red); font-weight: 700; }

/* ---------- monday pills ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 94px; padding: 5px 13px; border-radius: 7px;
  color: #fff; font-size: 12.5px; font-weight: 700; cursor: pointer; user-select: none;
  text-align: center; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .14), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .12s var(--ease), box-shadow .16s, filter .12s;
}
.pill:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(16, 24, 40, .2); }
.pill:active { transform: translateY(0) scale(.97); }
.pill.readonly { cursor: default; }
.pill.readonly:hover { transform: none; filter: none; box-shadow: 0 1px 2px rgba(16, 24, 40, .14); }
.pill.dark-text { color: #4b3a00; }

.tag {
  display: inline-block; background: var(--accent-soft); color: #4c4ce0; border: 1px solid #dcdcff;
  border-radius: 6px; padding: 2px 9px; font-size: 11.5px; margin-right: 4px; font-weight: 700;
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%; color: #fff;
  background: var(--grad-accent); box-shadow: 0 2px 6px rgba(97, 97, 255, .3);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; font-size: 13px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------- monday table (customers) ---------- */
.table-wrap { min-width: 0; }
.tgroup { margin-bottom: 24px; }
.tgroup-head {
  display: flex; align-items: center; gap: 9px; padding: 7px 6px; cursor: pointer;
  font-weight: 800; font-size: 15px; border-radius: 8px; transition: background .14s;
}
.tgroup-head:hover { background: rgba(97, 97, 255, .05); }
.tgroup-head .arrow { transition: transform .15s var(--ease); font-size: 11px; }
.tgroup-head.collapsed .arrow { transform: rotate(-90deg); }
.tgroup-head .cnt {
  color: var(--muted); font-weight: 700; font-size: 12px; background: #eef0f7;
  border-radius: 99px; padding: 1px 9px;
}
.tgroup-body {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  overflow-x: auto; border: 1px solid #eef0f7;
}
.trow {
  display: grid; grid-template-columns: minmax(190px, 2fr) minmax(120px, 1.2fr) minmax(120px, 1.2fr) 108px 118px 118px 40px;
  align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid #f2f4fa;
  border-left: 5px solid transparent; min-width: 860px; transition: background .13s;
}
.tgroup-body .trow:last-child { border-bottom: none; }
.trow.thead { font-size: 12px; color: var(--muted); font-weight: 600; padding: 7px 14px; }
.trow:not(.thead):hover { background: #fafbff; }
.trow .cname { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.trow .cname b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .cname:hover b { color: var(--accent); }
.trow .csub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .ccell { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .fup { font-size: 12.5px; color: var(--muted); }
.trow .fup.overdue { color: var(--m-red); font-weight: 700; }
.row-del { background: none; border: none; color: #d0d4e4; cursor: pointer; font-size: 14px; padding: 4px; }
.row-del:hover { color: var(--m-red); }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 20px; align-items: flex-start; }
.kcol {
  min-width: 245px; width: 245px; flex-shrink: 0; background: #eef0f7; border-radius: 13px; padding: 9px;
  border: 1px solid #e5e9f4; transition: background .16s, outline-color .16s;
}
.kcol-head {
  padding: 10px 12px; color: #fff; font-weight: 800; font-size: 13.5px;
  display: flex; justify-content: space-between; align-items: center;
  margin: -9px -9px 10px; border-radius: 12px 12px 0 0;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.kcol-head .ksum { font-size: 12px; font-weight: 700; opacity: .95; }
.kcol.drag-over { background: #e4e7fb; outline: 2.5px dashed var(--accent); outline-offset: -3px; }
.kcard {
  background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 12px 13px; margin-bottom: 9px;
  cursor: grab; border-left: 4px solid var(--m-gray); border-top: 1px solid #f0f2f8;
  border-right: 1px solid #f0f2f8; border-bottom: 1px solid #f0f2f8;
  transition: transform .13s var(--ease), box-shadow .16s;
}
.kcard:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; transform: rotate(1.5deg) scale(.98); }
.kcard .kt { font-weight: 650; font-size: 13.5px; margin-bottom: 3px; }
.kcard .kc { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.kcard .kfoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kcard .kval { font-weight: 800; font-size: 14px; color: var(--navy); }
.kcard .kdate { font-size: 11.5px; color: var(--muted); }
.kcard .kdate.late { color: var(--m-red); font-weight: 700; }
.kadd {
  width: 100%; background: rgba(255, 255, 255, .55); border: 1.5px dashed #cbd2e6; color: #6a7091;
  font-size: 13px; font-weight: 700; padding: 9px; cursor: pointer; border-radius: 9px; font-family: inherit;
  transition: background .14s, color .14s, border-color .14s;
}
.kadd:hover { background: #fff; color: var(--accent); border-color: var(--accent); }

/* ---------- task board ---------- */
.tkgroup { margin-bottom: 22px; }
.tkgroup-head { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; padding: 7px 6px; }
.tkgroup-head .dot { width: 13px; height: 13px; border-radius: 5px; box-shadow: 0 2px 5px rgba(16, 24, 40, .2); }
.tkgroup-head .cnt {
  color: var(--muted); font-weight: 700; font-size: 12px; background: #eef0f7;
  border-radius: 99px; padding: 1px 9px;
}
.tkgroup-body {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  overflow-x: auto; border: 1px solid #eef0f7;
}
.tkrow {
  display: grid; grid-template-columns: minmax(220px, 2.4fr) 118px 108px 118px minmax(120px, 1fr) 40px;
  align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid #f2f4fa;
  border-left: 5px solid transparent; min-width: 800px; transition: background .13s;
}
.tkgroup-body .tkrow:last-child { border-bottom: none; }
.tkrow.thead { font-size: 12px; color: var(--muted); font-weight: 600; }
.tkrow:not(.thead):hover { background: #fafbff; }
.tkrow .ttitle { font-size: 13.5px; font-weight: 550; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tkrow .ttitle:hover { color: var(--accent); }
.tkrow .tdue { font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.tkrow .tdue:hover { background: var(--bg); }
.tkrow .tdue.overdue { color: var(--m-red); font-weight: 700; }
.tkrow .tcust { font-size: 12.5px; color: var(--muted); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tkrow .tcust:hover { color: var(--accent); }
.tk-quickadd { display: flex; gap: 8px; padding: 8px 14px; }
.tk-quickadd input {
  flex: 1; border: 1.5px dashed var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13.5px;
  outline: none; background: transparent; font-family: inherit;
}
.tk-quickadd input:focus { border-color: var(--accent); background: #fff; }

/* ---------- activities feed ---------- */
.act-day { margin-bottom: 18px; }
.act-day h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 8px; }
.act-item {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 8px;
  display: flex; gap: 12px; align-items: flex-start;
}
.act-icon { font-size: 18px; margin-top: 1px; }
.act-main { flex: 1; min-width: 0; }
.act-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.act-top .cust { font-weight: 700; cursor: pointer; }
.act-top .cust:hover { color: var(--accent); }
.act-top .by { font-size: 12.5px; color: var(--muted); }
.act-summary { margin-top: 3px; font-size: 13.5px; white-space: pre-wrap; }
.act-next { margin-top: 6px; font-size: 12.5px; color: #8a6d00; background: #fff3cd; border-radius: 6px; padding: 3px 10px; display: inline-block; }
.act-del { background: none; border: none; color: #d0d4e4; cursor: pointer; font-size: 13px; }
.act-del:hover { color: var(--m-red); }

/* ---------- follow-ups ---------- */
.fu-group { margin-bottom: 22px; }
.fu-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 10px; }
.fu-group h3.overdue { color: var(--m-red); }
.fu-list { display: flex; flex-direction: column; gap: 8px; }
.fu-card {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; border: 1.5px solid transparent;
}
.fu-card:hover { border-color: var(--accent); }
.fu-main { flex: 1; min-width: 0; }
.fu-name { font-weight: 650; }
.fu-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fu-right { text-align: right; flex-shrink: 0; }
.fu-when { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.fu-when.overdue { color: var(--m-red); font-weight: 700; }

/* ---------- charts ---------- */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-empty { color: var(--muted); font-size: 13.5px; padding: 20px 4px; }

/* ---------- drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(41, 47, 76, .45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(660px, 100%);
  background: var(--bg); z-index: 50; box-shadow: -8px 0 30px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; color: var(--navy); }
.btn-close { background: none; border: none; font-size: 17px; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.drawer-body { padding: 20px 24px 40px; overflow-y: auto; }
.drawer-section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.drawer-section-head h3 { font-size: 16px; color: var(--navy); }

.card-form { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: span 1; } }
.form-grid textarea { resize: vertical; }

.cd-item {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 11px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.cd-item:hover { box-shadow: var(--shadow-lift); }
.cd-title { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-value { font-weight: 800; font-size: 13.5px; color: var(--navy); }

.timeline-title { margin: 24px 0 12px; font-size: 16px; color: var(--navy); }
.timeline { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.tl-item { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 13px 16px; }
.tl-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-type { font-weight: 700; font-size: 13px; color: var(--accent); }
.tl-date, .tl-by { font-size: 12.5px; color: var(--muted); }
.tl-del { margin-left: auto; background: none; border: none; color: #d0d4e4; cursor: pointer; font-size: 13px; }
.tl-del:hover { color: var(--m-red); }
.tl-summary { margin-top: 6px; white-space: pre-wrap; font-size: 13.5px; }
.tl-next { margin-top: 6px; font-size: 12.5px; color: #8a6d00; background: #fff3cd; border-radius: 6px; padding: 4px 10px; display: inline-block; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(41, 47, 76, .45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-card { background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lift); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; animation: pop .16s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--card); border-radius: 14px 14px 0 0; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; color: var(--navy); }
.modal-body { padding: 18px 20px; }

/* ---------- popover ---------- */
.popover {
  position: absolute; z-index: 80; background: #fff; border-radius: 10px; box-shadow: var(--shadow-lift);
  padding: 8px; min-width: 170px; max-height: 320px; overflow-y: auto; border: 1px solid var(--line);
}
.popover .po-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none;
  background: none; border-radius: 7px; cursor: pointer; font-size: 13.5px; text-align: left; font-family: inherit;
}
.popover .po-item:hover { background: var(--bg); }
.popover .po-swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.popover .po-search { width: 100%; padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 7px; margin-bottom: 6px; font-size: 13px; outline: none; font-family: inherit; }
.popover .po-search:focus { border-color: var(--accent); }

/* ---------- settings / integrations ---------- */
.team-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.team-chip {
  background: var(--accent-soft); color: var(--accent); border-radius: 99px;
  padding: 5px 8px 5px 14px; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.team-chip button { background: none; border: none; cursor: pointer; color: var(--accent); opacity: .6; font-size: 13px; }
.team-chip button:hover { opacity: 1; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; max-width: 300px; }
.stack-form { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }

.import-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.imp-result { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #e6f9f1; color: #00713f; font-size: 13.5px; font-weight: 600; }
.imp-result.err { background: #fdecee; color: var(--m-red); }

.feed-url {
  display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 7px; font-size: 12.5px;
}
.feed-url code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink); }
.feed-url .lbl { font-weight: 700; min-width: 82px; color: var(--muted); font-size: 12px; }
.howto { margin-top: 12px; background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.howto summary { cursor: pointer; font-size: 14px; }
.howto ol { margin: 10px 0 4px 20px; font-size: 13.5px; color: var(--ink); }
.howto li { margin-bottom: 5px; }

/* ---------- toast & confetti ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 22px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lift); z-index: 100;
  animation: pop .2s ease; max-width: 90vw;
}
.toast.error { background: var(--m-red); }
@keyframes pop { from { transform: translate(-50%, 10px) scale(.97); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
.modal-card { animation-name: popIn; }
@keyframes popIn { from { transform: translateY(14px) scale(.98); opacity: .5; } to { transform: none; opacity: 1; } }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ---------- mobile ---------- */
@media (max-width: 780px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; overflow-x: auto; padding: 6px 8px; }
  .nav-section { display: none; }
  .nav-item { white-space: nowrap; width: auto; }
  .sidebar-footer { display: none; }
  .main { padding: 16px 12px 60px; }
}

/* ================= FUND MODULE ================= */

.fund-body { min-width: 0; }
.fund-loading { color: var(--muted); font-size: 14px; padding: 40px 4px; text-align: center; }
.err-note { color: var(--m-red); font-size: 14px; font-weight: 600; }

/* ---------- vault ---------- */
.vault-dot { font-size: 11px; margin-left: 4px; letter-spacing: 0; }
.vault-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 34px 28px; max-width: 460px; margin: 40px auto; text-align: center;
}
.vault-icon { font-size: 46px; line-height: 1; }
.vault-card h3 { font-size: 19px; color: var(--navy); margin: 10px 0 6px; }
.vault-card .muted { display: block; margin-bottom: 18px; line-height: 1.5; }
.vault-card input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 9px; font-size: 15px; font-family: inherit; margin-bottom: 10px; }
.vault-card input:focus { border-color: var(--accent); outline: none; }
.vault-err { color: var(--m-red); font-size: 13.5px; min-height: 20px; margin-top: 10px; }
.panel-warn { border-left: 4px solid var(--m-orange); }
.panel-danger { border-left: 4px solid var(--m-red); }

/* ---------- panels & layout ---------- */
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h3 { margin-bottom: 0; }
.dash-grid .panel.span2 { grid-column: 1 / -1; }
.empty-fund { text-align: center; padding: 46px 24px; }
.empty-fund-icon { font-size: 44px; }
.empty-fund h3 { font-size: 18px; color: var(--navy); margin: 8px 0 6px; }
.empty-fund .btn-row { justify-content: center; }
.verdict { margin-top: 12px; font-size: 13.5px; color: var(--navy); background: var(--accent-soft); padding: 9px 13px; border-radius: 9px; }

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex; background: #eaedf6; border-radius: 11px; padding: 4px; gap: 3px;
  border: 1px solid #e0e4f0;
}
.seg button {
  border: none; background: transparent; font-family: inherit; font-size: 13px; font-weight: 700;
  color: #616784; padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s, transform .12s var(--ease);
}
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.seg button:active { transform: scale(.97); }
.seg button.on {
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 3px 9px rgba(97, 97, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.seg button.on:hover { color: #fff; }

/* ---------- tables ---------- */
.fund-table-wrap { overflow-x: auto; margin: 0 -4px; }
.fund-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fund-table th, .fund-table td { padding: 8px 10px; text-align: left; white-space: nowrap; }
.fund-table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 1.5px solid var(--line); font-weight: 700; }
.fund-table tbody tr { border-bottom: 1px solid #f1f3f8; cursor: pointer; }
.fund-table tbody tr:hover { background: #fafbff; }
.fund-table tbody tr.unpriced { background: #fff9f0; }
.fund-table tfoot td { padding-top: 10px; border-top: 1.5px solid var(--line); font-size: 13px; }
.fund-table .r, .kv-table .r { text-align: right; }
.fund-table .ell { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.fund-table td.danger { color: var(--m-red); font-weight: 700; }
.fund-table.monthly th:first-child { font-weight: 700; color: var(--ink); }
.fund-table.monthly td { font-variant-numeric: tabular-nums; }
.fund-table.monthly td.tot { border-left: 1.5px solid var(--line); }

.kv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv-table td { padding: 6px 2px; border-bottom: 1px solid #f1f3f8; }
.kv-table tr:last-child td { border-bottom: none; }
.kv-table tr.head td { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.kv-table tr.sep td { border-top: 1.5px solid var(--line); padding-top: 9px; }
.kv-table.stats td:first-child { color: var(--muted); }
.hint {
  display: inline-block; width: 14px; height: 14px; line-height: 14px; text-align: center;
  border-radius: 50%; background: #e6e9ef; color: var(--muted); font-size: 10px; font-weight: 700; cursor: help;
}

.chg { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.chg.up, .up { color: #00913f; }
.chg.down, .down { color: var(--m-red); }

.sector-chip { display: inline-block; background: #f1f3f8; color: var(--muted); border-radius: 5px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; }
.warn-chip { display: inline-block; background: #fff3e0; color: #a56000; border-radius: 5px; padding: 1px 7px; font-size: 10.5px; font-weight: 700; }
.bench-chip { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: 1px 7px; font-size: 10.5px; font-weight: 700; }

.wcell { min-width: 92px; }
.wmini { display: inline-block; width: 34px; height: 6px; background: #eef0f6; border-radius: 3px; margin-right: 6px; vertical-align: middle; overflow: hidden; }
.wmini i { display: block; height: 6px; background: var(--accent); border-radius: 3px; }

/* ---------- bar charts ---------- */
.dbars, .wbars { display: flex; flex-direction: column; gap: 7px; }
.dbar { display: grid; grid-template-columns: 62px 1fr 74px; align-items: center; gap: 10px; font-size: 12.5px; }
.dbar-lbl { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.dbar-track { position: relative; height: 15px; background: #f4f5f9; border-radius: 4px; }
.dbar-fill { position: absolute; top: 0; height: 15px; border-radius: 3px; }
.dbar-axis { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #d6d9e5; }
.dbar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.wbar { display: grid; grid-template-columns: 72px 1fr 56px; align-items: center; gap: 10px; font-size: 12.5px; }
.wbar-lbl { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.wbar-track { height: 15px; background: #f4f5f9; border-radius: 4px; overflow: hidden; }
.wbar-fill { display: block; height: 15px; border-radius: 4px; min-width: 2px; }
.wbar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.chart-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend b { color: var(--ink); }

/* ---------- correlation heatmap ---------- */
.corr-wrap { overflow: auto; max-height: 68vh; }
.corr-table { border-collapse: separate; border-spacing: 2px; font-size: 11.5px; }
.corr-table th { position: sticky; background: var(--card); z-index: 2; font-weight: 700; color: var(--muted); }
.corr-table th.vhead { top: 0; height: 68px; vertical-align: bottom; padding-bottom: 4px; min-width: 34px; }
.corr-table th.vhead span { display: block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.corr-table th.rowhead { left: 0; text-align: right; padding-right: 8px; white-space: nowrap; }
.corr-table th.corner { top: 0; left: 0; z-index: 3; }
.corr-table td.cc {
  width: 38px; min-width: 34px; height: 30px; text-align: center; border-radius: 4px;
  color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600;
}
.corr-table td.cc.diag { font-weight: 800; }
.corr-scale { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 14px; }
.corr-gradient { flex: 1; max-width: 260px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #579bfc, #ffffff, #e2445c); border: 1px solid var(--line); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.snap-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 12.5px; font-weight: 600;
}
.snap-chip .muted { font-size: 11px; }
.snap-chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.snap-chip button:hover { color: var(--m-red); }

@media (max-width: 780px) {
  .seg { width: 100%; overflow-x: auto; }
  .dbar { grid-template-columns: 54px 1fr 62px; }
  .wbar { grid-template-columns: 58px 1fr 48px; }
}
.thin-sample {
  background: #fff6e6; border-left: 4px solid var(--m-orange); color: #7a4a00;
  padding: 11px 15px; border-radius: 9px; font-size: 13.5px; line-height: 1.55; margin-bottom: 16px;
}
/* the vault form is a stack-form but its buttons should still sit side by side */
.stack-form .btn-row { flex-direction: row; margin-top: 2px; }
#vault-form { max-width: 420px; }

/* ================= POLISH & SECURITY UI ================= */

/* ---------- login: slow-drifting aurora behind the card ---------- */
.auth-screen { position: relative; overflow: hidden; }
.auth-screen::before,
.auth-screen::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5;
  pointer-events: none;
}
.auth-screen::before {
  width: 620px; height: 620px; background: #6161ff; top: -220px; left: -160px;
  animation: drift1 22s ease-in-out infinite alternate;
}
.auth-screen::after {
  width: 520px; height: 520px; background: #00c875; bottom: -220px; right: -140px;
  animation: drift2 26s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(120px, 90px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-100px, -70px) scale(1.2); } }
.auth-card { position: relative; z-index: 1; animation: authIn .5s cubic-bezier(.2, .8, .3, 1); }
@keyframes authIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.auth-logo { display: inline-block; animation: logoIn .7s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes logoIn { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.auth-card .btn-primary { padding: 12px; font-size: 15px; }
.auth-foot {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* ---------- view + card entrances ---------- */
.view:not(.hidden) { animation: viewIn .22s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stat-card { animation: cardIn .3s ease-out both; }
.stat-cards .stat-card:nth-child(2) { animation-delay: .04s; }
.stat-cards .stat-card:nth-child(3) { animation-delay: .08s; }
.stat-cards .stat-card:nth-child(4) { animation-delay: .12s; }
.stat-cards .stat-card:nth-child(5) { animation-delay: .16s; }
.stat-cards .stat-card:nth-child(6) { animation-delay: .2s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stat-card .num { font-variant-numeric: tabular-nums; }
.panel { transition: box-shadow .18s ease; }
.panel:hover { box-shadow: var(--shadow-lift); }
.nav-item { transition: background .14s ease, color .14s ease; }

/* visible keyboard focus everywhere — it was invisible before */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible { outline-offset: 3px; }

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

/* ---------- dashboard fund strip ---------- */
.fund-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 13px;
  background: linear-gradient(120deg, #292f4c, #3b4270 60%, #4a4fa8);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; color: #fff;
  box-shadow: var(--shadow);
}
.fund-strip .fs-item { min-width: 0; }
.fund-strip .fs-num { font-size: 21px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.fund-strip .fs-lbl { font-size: 11.5px; color: #b9bede; margin-top: 1px; }
.fund-strip .fs-num.up { color: #4ce39a; }
.fund-strip .fs-num.down { color: #ff8095; }
.fund-strip-locked {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(120deg, #292f4c, #3b4270); border-radius: var(--radius);
  padding: 15px 18px; margin-bottom: 20px; color: #fff; box-shadow: var(--shadow);
}
.fund-strip-locked b { font-size: 14.5px; }
.fund-strip-locked span { color: #b9bede; font-size: 13px; }
.fund-strip-locked .btn { background: rgba(255, 255, 255, .14); color: #fff; }
.fund-strip-locked .btn:hover { background: rgba(255, 255, 255, .24); }

/* ---------- security panel ---------- */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 11px; margin-bottom: 16px; }
.sec-stat {
  background: var(--bg); border-radius: 10px; padding: 11px 13px; border-left: 3px solid var(--m-gray);
  display: flex; flex-direction: column; gap: 2px;
}
.sec-stat b { font-size: 13.5px; color: var(--navy); }
.sec-stat span { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sec-stat.good { border-left-color: var(--m-green); }
.sec-stat.warn { border-left-color: var(--m-orange); background: #fff8ee; }

.audit-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.audit-row {
  display: grid; grid-template-columns: 26px 1fr auto auto; gap: 10px; align-items: center;
  padding: 8px 12px; font-size: 13px; border-bottom: 1px solid #f1f3f8;
}
.audit-row:last-child { border-bottom: none; }
.audit-row.bad { background: #fff6f7; }
.audit-icon { text-align: center; }
.audit-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-ip { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.audit-when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

@media (max-width: 560px) {
  .audit-row { grid-template-columns: 22px 1fr; }
  .audit-ip, .audit-when { display: none; }
}

/* ================= v3 VISUAL PASS ================= */

/* activity feed — cards with a coloured type badge instead of a bare emoji */
.act-item { border: 1px solid #eef0f7; border-radius: 12px; padding: 13px 16px; transition: box-shadow .16s, transform .13s var(--ease); }
.act-item:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.act-icon {
  font-size: 16px; width: 34px; height: 34px; flex-shrink: 0; margin-top: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f2f3fb, #e9ebf7); border-radius: 10px; border: 1px solid #e6e9f4;
}
.act-day h4 { font-weight: 800; color: #7a80a0; }
.act-next { font-weight: 600; border: 1px solid #ffe08a; }

/* fund tables */
.fund-table thead th { background: #fafbff; border-bottom: 2px solid #e9ecf6; padding-top: 10px; padding-bottom: 10px; }
.fund-table thead th:first-child { border-top-left-radius: 10px; }
.fund-table thead th:last-child { border-top-right-radius: 10px; }
.fund-table tbody tr { transition: background .13s; }
.fund-table tbody tr:hover { background: #f6f7ff; }
.fund-table tfoot td { background: #fafbff; font-weight: 700; }
.sector-chip { background: #eef0f8; border: 1px solid #e3e7f3; padding: 2px 9px; border-radius: 6px; }
.bench-chip, .warn-chip { border: 1px solid currentColor; }

.kv-table tr:not(.head):hover td { background: #fafbff; }
.kv-table td:first-child { padding-left: 6px; }
.kv-table td:last-child { padding-right: 6px; }

/* weight + contribution bars get depth */
.wbar-track, .dbar-track { box-shadow: inset 0 1px 2px rgba(16, 24, 40, .07); }
.wbar-fill, .dbar-fill { box-shadow: 0 1px 3px rgba(16, 24, 40, .18); }
.wmini { box-shadow: inset 0 1px 2px rgba(16, 24, 40, .08); }

/* modals + drawer */
.modal { backdrop-filter: blur(3px); background: rgba(41, 47, 76, .5); }
.modal-card { border-radius: 18px; box-shadow: 0 24px 60px rgba(16, 24, 40, .3); }
.modal-head { border-radius: 18px 18px 0 0; }
.modal-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.btn-close {
  border-radius: 9px; width: 32px; height: 32px; display: inline-flex; align-items: center;
  justify-content: center; transition: background .14s, color .14s;
}
.btn-close:hover { background: #f0f2f8; color: var(--m-red); }

/* form labels read as labels */
.form-grid > label { font-size: 12.5px; font-weight: 700; color: #5a5f7d; display: flex; flex-direction: column; gap: 5px; }
.form-grid input, .form-grid select, .form-grid textarea { font-weight: 500; }

/* feed link rows */
.feed-url { border: 1px solid #eef0f7; border-radius: 10px; padding: 9px 12px; background: #fafbff; }
.feed-url code { background: #fff; border: 1px solid #eef0f7; border-radius: 6px; padding: 2px 7px; }
.howto { border: 1px solid #eef0f7; border-radius: 11px; }
.howto summary { font-weight: 700; padding: 3px 0; }

/* team + snapshot chips */
.team-chip, .snap-chip {
  background: #fff; border: 1.5px solid #e2e6f0; border-radius: 9px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: border-color .14s, box-shadow .14s;
}
.team-chip:hover, .snap-chip:hover { border-color: #c8cee2; box-shadow: 0 3px 8px rgba(16, 24, 40, .09); }

/* toast */
.toast { border-radius: 12px; font-weight: 700; box-shadow: 0 12px 32px rgba(16, 24, 40, .28); }

/* import result banner */
.imp-result {
  border-radius: 10px; padding: 11px 14px; font-size: 13.5px; font-weight: 600;
  background: #eefaf3; color: #0a6b43; border: 1px solid #bfe9d5;
}
.imp-result.err { background: #fff5f6; color: #a32031; border-color: #f6c6cd; }

/* charts sit on a tinted plate so they don't float on bare white */
.chart-svg { background: linear-gradient(180deg, #fbfcff, #fff); border-radius: 10px; }
.chart-empty { background: #fafbff; border: 1.5px dashed #e2e6f0; border-radius: 10px; text-align: center; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c8cee2 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c8cee2; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #aab2cc; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- sheet picker ---------- */
.sheet-list { display: flex; flex-direction: column; gap: 9px; }
.sheet-opt {
  display: flex; flex-direction: column; gap: 3px; text-align: left; width: 100%;
  background: #fff; border: 1.5px solid #e2e6f0; border-radius: 11px; padding: 12px 14px;
  cursor: pointer; font-family: inherit;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  transition: border-color .14s, box-shadow .16s, transform .13s var(--ease);
}
.sheet-opt:hover { border-color: var(--accent); box-shadow: 0 6px 16px rgba(97, 97, 255, .18); transform: translateY(-1.5px); }
.sheet-name { font-weight: 800; font-size: 14.5px; color: var(--navy); }
.sheet-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= COLOUR IN THE CONTENT AREA ================= */

/* the leading emoji of every panel heading gets a tinted tile (see decorateHeadings in app.js) */
.h3-icon {
  --ic-bg: #ececff; --ic-fg: #6161ff;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  font-size: 15px; line-height: 1; margin-right: 10px; vertical-align: -9px;
  background: var(--ic-bg); box-shadow: inset 0 0 0 1.5px var(--ic-fg);
}
.panel h3.has-icon { display: flex; align-items: center; }
.panel h3.has-icon > .h3-icon { margin-right: 10px; }

/* each panel carries a hairline of its heading colour along the top */
.panel { position: relative; overflow: hidden; }
.panel.tinted::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--panel-c, var(--accent)); opacity: .85;
}

/* empty states stop being blank white rectangles */
.empty, .chart-empty {
  background: linear-gradient(160deg, #f7f8ff, #fdfdff);
  border: 1.5px dashed #dfe4f2; border-radius: 12px;
  text-align: center; padding: 26px 18px; color: var(--muted);
}
.act-item, .tgroup-body, .tkgroup-body { position: relative; }

/* dashboard panels get a touch more presence */
.dash-grid .panel { transition: box-shadow .18s var(--ease), transform .16s var(--ease); }
.dash-grid .panel:hover { transform: translateY(-2px); }

/* the mini rows on the dashboard read as list items, not loose text */
.mini-row { border: 1px solid transparent; transition: background .14s, border-color .14s; }
.mini-row:hover { background: #f6f7ff; border-color: #e6e9f7; }

/* section eyebrow above each view title */
.view-header h2 { position: relative; }
.view-header > div:first-child { position: relative; padding-left: 14px; }
.view-header > div:first-child::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 5px;
  border-radius: 99px; background: var(--grad-accent);
}

/* ================= PHONE LAYOUT =================
   The desktop grids are 800-900px wide; on a phone they became a side-scrolling
   spreadsheet. Below 760px the rows restack into cards instead. */

@media (max-width: 760px) {
  .main { padding: 14px 12px 60px; }

  /* keep the nav reachable without scrolling back to the top */
  .sidebar {
    position: sticky; top: 0; z-index: 40;
    box-shadow: 0 4px 14px rgba(16, 24, 40, .18);
  }
  .brand { padding: 10px 12px; margin: 0; border-bottom: none; }
  .brand-icon { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  .brand-name { font-size: 13.5px; }
  .brand-sub { display: none; }
  .sidebar nav { padding: 0 8px 8px; gap: 5px; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-item { padding: 6px 11px; font-size: 13px; border-radius: 9px; margin-bottom: 0; }
  .nav-item .ni { width: 22px; height: 22px; font-size: 12px; border-radius: 7px; }
  .nav-item.active { box-shadow: 0 3px 10px rgba(97, 97, 255, .5); }

  /* headings and figures sized for a 375px screen */
  .view-header h2 { font-size: 21px; }
  .view-header > div:first-child { padding-left: 11px; }
  .view-header { margin-bottom: 14px; }
  .btn-row-tight, .view-header .btn-row-tight { width: 100%; }
  .btn-row-tight .btn { flex: 1 1 auto; justify-content: center; }

  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 13px 13px 11px; }
  /* long money figures were being clipped by the card's overflow:hidden */
  .stat-card .num { font-size: 19px; letter-spacing: -.5px; overflow-wrap: anywhere; }
  .stat-card .lbl { font-size: 11.5px; }

  .panel { padding: 15px 15px; border-radius: 13px; }
  .panel h3 { font-size: 15px; }
  .h3-icon { width: 26px; height: 26px; font-size: 13px; margin-right: 8px; vertical-align: -7px; }

  /* ---- customers: one card per person ---- */
  .trow {
    display: block; min-width: 0; position: relative;
    padding: 12px 44px 12px 13px; border-left-width: 4px;
  }
  .trow.thead { display: none; }
  .trow .cname { margin-bottom: 7px; padding-right: 88px; }
  .trow .cname b { white-space: normal; }
  .trow > [data-pick-status] { position: absolute; top: 11px; right: 40px; }
  .trow > [data-pick-status] .pill { min-width: 0; padding: 4px 10px; font-size: 11.5px; }
  .trow > .row-del { position: absolute; top: 10px; right: 8px; }
  .trow > .ccell, .trow > .fup, .trow > [data-pick-owner] {
    display: inline-flex; align-items: center; gap: 5px;
    margin: 0 12px 0 0; font-size: 12.5px; max-width: 100%;
  }
  /* a blank field renders as "—" on desktop where the column explains it; stacked on a
     phone those dashes are just noise, so drop them entirely */
  .trow > .is-empty, .trow > .ccell:empty, .trow > .fup:empty { display: none; }

  /* ---- tasks: same treatment ---- */
  .tkrow {
    display: block; min-width: 0; position: relative;
    padding: 12px 44px 12px 13px; border-left-width: 4px;
  }
  .tkrow.thead { display: none; }
  .tkrow .ttitle { white-space: normal; margin-bottom: 8px; padding-right: 4px; }
  .tkrow > div { display: inline-flex; align-items: center; gap: 6px; margin: 0 10px 5px 0; }
  .tkrow > [data-task-status] .pill, .tkrow > [data-task-priority] .pill {
    min-width: 0; padding: 4px 10px; font-size: 11.5px;
  }
  .tkrow > .row-del { position: absolute; top: 10px; right: 8px; }
  .tk-quickadd { padding: 8px 12px; }

  /* ---- kanban: near-full-width columns so cards are readable ---- */
  .kcol { min-width: 84vw; width: 84vw; }

  /* ---- toolbars stack ---- */
  .toolbar { gap: 8px; }
  .toolbar input[type=search] { min-width: 0; width: 100%; flex: 1 1 100%; }
  .toolbar select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .import-row { flex-wrap: wrap; }
  .import-row select, .import-row input, .import-row .btn { flex: 1 1 100%; }

  /* ---- wide data tables keep scrolling, but say so ---- */
  .fund-table-wrap, .corr-wrap { -webkit-overflow-scrolling: touch; }
  .fund-table-wrap::after {
    content: "swipe to see more →"; display: block; text-align: right;
    font-size: 11px; color: var(--muted); padding: 6px 2px 0;
  }
  .fund-table { font-size: 12.5px; }
  .fund-table th, .fund-table td { padding: 7px 9px; }

  .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: 1 0 auto; }

  .modal { padding: 10px; align-items: flex-end; }
  .modal-card { max-height: 88vh; border-radius: 16px; }
  .dbar { grid-template-columns: 52px 1fr 66px; }
  .wbar { grid-template-columns: 56px 1fr 50px; }
  .fund-strip { grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
  .sec-grid { grid-template-columns: 1fr; }
}

/* very narrow phones only — a 375px iPhone still fits two stat cards comfortably,
   and stacking them there just means a lot of scrolling */
@media (max-width: 359px) {
  .stat-cards { grid-template-columns: 1fr; }
  .stat-card .num { font-size: 22px; }
  .kcol { min-width: 88vw; width: 88vw; }
}
