/* ============================================================
   M.K. NIAZI GOODS TRANSPORT CO. — Operations Console
   ============================================================ */
:root {
  --navy: #0f2a43;
  --navy-2: #17405f;
  --navy-3: #0a1d31;
  --amber: #f79e1b;
  --amber-2: #f5b13b;
  --bg: #f3f6f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --white: #ffffff;
  --blue: #1d4ed8;
  --blue-soft: #e8effc;
  --green: #16a34a;
  --green-soft: #e7f7ec;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber-soft: #fdf3e0;
  --slate-soft: #eef2f6;
  --shadow: 0 1px 2px rgba(15, 42, 67, .06), 0 4px 14px rgba(15, 42, 67, .06);
  --shadow-lg: 0 12px 32px rgba(15, 42, 67, .16);
  --radius: 12px;
  --topbar: 62px;
  --sidebar: 264px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

.app-root { min-height: 100vh; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; transition: all .15s ease;
  background: var(--white); color: var(--ink);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-accent { background: var(--amber); color: var(--navy-3); }
.btn-accent:hover { background: var(--amber-2); }
.btn-ghost { border-color: var(--line); background: #fff; }
.btn-ghost:hover { border-color: #cbd5e1; background: var(--slate-soft); }
.btn-ghost.danger { color: var(--red); border-color: #fecaca; }
.btn-ghost.danger:hover { background: #fef2f2; border-color: var(--red); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar); z-index: 60;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; box-shadow: 0 2px 10px rgba(10, 29, 49, .35);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: var(--sidebar); }
.brand img { height: 42px; width: auto; background: #fff; padding: 4px 9px; border-radius: 9px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.brand .brand-name { font-weight: 800; font-size: 14.5px; letter-spacing: .2px; line-height: 1.15; }
.brand .brand-sub { font-size: 10px; color: #8fb3cf; letter-spacing: 1.6px; text-transform: uppercase; }
.topbar-spacer { flex: 0 0 18px; }

.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-box {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; padding: 8px 12px; color: #fff;
}
.search-box svg { width: 16px; height: 16px; opacity: .8; }
.search-box input {
  flex: 1; background: transparent; border: 0; outline: none; color: #fff; font-size: 13.5px;
}
.search-box input::placeholder { color: #b6cadd; }
.search-panel {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 70;
  background: #fff; color: var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden;
}
.search-panel .sp-head { padding: 8px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); background: var(--slate-soft); }
.search-group { padding: 6px 0; border-top: 1px solid var(--line); }
.search-group:first-of-type { border-top: 0; }
.search-group .sg-label { padding: 8px 14px 3px; font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .6px; }
.search-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; transition: background .12s; }
.search-item:hover { background: var(--blue-soft); }
.search-item .si-title { font-weight: 600; font-size: 13px; }
.search-item .si-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.search-item .si-side { text-align: right; font-size: 12px; color: var(--muted); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: #dfe9f2;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.icon-btn .badge {
  position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--amber); color: var(--navy-3); border-radius: 10px; font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.org-select {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #fff; font-size: 13px; font-weight: 600;
}
.org-select:hover { background: rgba(255,255,255,.18); }
.org-select .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.org-select .chev { width: 12px; height: 12px; opacity: .7; }

.dd-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 80; min-width: 200px;
  background: #fff; color: var(--ink); border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 6px; animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.dd-item:hover { background: var(--slate-soft); }
.dd-item .chk { margin-left: auto; color: var(--blue); font-weight: 700; }

.notif-list { max-height: 360px; overflow: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--slate-soft); }
.notif-item.unread { background: var(--blue-soft); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.notif-dot.t-warning { background: var(--amber); }
.notif-dot.t-alert { background: var(--red); }
.notif-dot.t-success { background: var(--green); }
.notif-dot.t-info { background: var(--blue); }
.notif-item .nt-title { font-weight: 600; font-size: 13px; }
.notif-item .nt-msg { font-size: 12.5px; color: var(--muted); }
.notif-item .nt-time { font-size: 11px; color: var(--muted); }

.avatar {
  display: inline-flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px;
  border-radius: 11px; cursor: pointer; transition: background .15s;
}
.avatar:hover { background: rgba(255,255,255,.12); }
.avatar .ava-circle {
  width: 32px; height: 32px; border-radius: 9px; background: var(--amber); color: var(--navy-3);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.avatar .ava-name { font-size: 13px; font-weight: 600; line-height: 1.1; }
.avatar .ava-role { font-size: 11px; color: #a9c4db; }
.avatar .role-pill {
  padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
}
.role-pill.admin { background: var(--amber); color: var(--navy-3); }
.role-pill.investor { background: #0ea5e9; color: #fff; }
.role-pill.operations { background: #0369a1; color: #fff; }
.role-pill.accountant { background: #7c3aed; color: #fff; }

/* ---------- Layout ---------- */
.shell { display: flex; padding-top: var(--topbar); min-height: 100vh; }

.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); z-index: 50;
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-inner { padding: 14px 12px 20px; flex: 1; }
.nav-section { margin-top: 16px; }
.nav-section:first-child { margin-top: 4px; }
.nav-cat {
  padding: 6px 12px 6px; font-size: 10px; font-weight: 800; letter-spacing: 1.4px;
  color: #94a3b8; text-transform: uppercase;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: #334155;
  cursor: pointer; user-select: none; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--slate-soft); color: var(--ink); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; color: #94a3b8; transition: color .12s; }
.nav-item:hover svg { color: #64748b; }
.nav-item.active {
  background: var(--navy); color: #fff; box-shadow: 0 4px 10px rgba(15, 42, 67, .22);
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3.5px;
  border-radius: 0 4px 4px 0; background: var(--amber);
}
.nav-item.active svg { color: var(--amber); }
.nav-item.nested { padding-left: 44px; font-size: 13px; }
.nav-item.nested::before {
  content: ""; position: absolute; left: 26px; top: 50%; width: 5px; height: 5px;
  margin-top: -2.5px; border-radius: 50%; background: #cbd5e1; transition: background .12s;
}
.nav-item.nested:hover::before { background: #64748b; }
.nav-item.nested.active::before { background: var(--amber); }
.nav-group { margin-top: 1px; }
.nav-group .nav-head { font-weight: 700; color: #1e293b; }
.nav-group .nav-head svg.n {
  width: 14px; height: 14px; transition: transform .18s ease;
}
.nav-group .n-chev { margin-left: auto; display: inline-flex; }
.nav-group .n-chev svg { width: 14px; height: 14px; transition: transform .18s ease; }
.nav-group.collapsed .n-chev svg { transform: rotate(-90deg); }
.nav-group.collapsed .nav-sub { display: none; }
.nav-sub { padding-top: 2px; padding-bottom: 3px; }
.nav-sub .nav-item { margin-top: 0; }
.nav-section-tier { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }

.sidebar-footer {
  padding: 14px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg);
}
.sidebar-footer .sf-name { font-weight: 700; color: #34465c; font-size: 11.5px; }
.sidebar-footer .sf-tag { opacity: .8; }

.main { flex: 1; margin-left: var(--sidebar); padding: 26px 30px 60px; min-width: 0; }

/* ---------- Cards / panels ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat-card { padding: 16px 18px; }
.stat-card .st-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.stat-card .st-value { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -.4px; }
.stat-card .st-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat-card .st-ico { float: right; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.st-ico svg { width: 20px; height: 20px; }
.si-navy { background: var(--slate-soft); color: var(--navy); }
.si-amber { background: var(--amber-soft); color: #b45309; }
.si-green { background: var(--green-soft); color: var(--green); }
.si-red { background: var(--red-soft); color: var(--red); }
.si-blue { background: var(--blue-soft); color: var(--blue); }

.page-title { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.page-title h1 { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.page-title .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.page-title .actions { margin-left: auto; display: flex; gap: 8px; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb b { color: var(--ink); font-weight: 600; }
.breadcrumb .sep { opacity: .5; }

/* Route banner */
.route-banner {
  display: flex; align-items: center; gap: 18px; padding: 18px 22px; margin-bottom: 20px;
  border-radius: var(--radius); background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
}
.route-banner .rb-node { flex: 1; text-align: center; }
.route-banner .rb-node .rb-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; color: #8fb3cf; }
.route-banner .rb-node .rb-name { font-size: 16px; font-weight: 700; margin-top: 3px; }
.route-banner .rb-line { flex: 1 0 90px; display: flex; align-items: center; gap: 6px; color: var(--amber); }
.route-banner .rb-line .ln { flex: 1; height: 2px; background: rgba(255,255,255,.3); }
.route-banner .rb-arrow { font-size: 16px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  padding: 7px 13px; border-radius: 20px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .12s;
}
.chip:hover { border-color: #cbd5e1; }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.small { padding: 4px 10px; font-size: 11.5px; }
.chip.locked { opacity: .45; pointer-events: none; }

/* Fleet — Vehicle Category selector */
.fleet-cats {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.fc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.fc-title { font-size: 10.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.fc-hint { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--slate-soft); padding: 2px 9px; border-radius: 999px; }
.fc-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.fc-pill {
  padding: 8px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--white);
  font-size: 12.5px; font-weight: 600; color: #334155; transition: all .14s ease;
}
.fc-pill:hover { border-color: var(--navy-2); background: #f8fafc; transform: translateY(-1px); }
.fc-pill.active { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 3px 10px rgba(15, 42, 67, .22); }

/* Fleet — Status filter pills */
.status-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.st-pill {
  padding: 9px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--white);
  font-size: 13px; font-weight: 600; color: var(--muted); transition: all .14s ease;
}
.st-pill:hover { border-color: #cbd5e1; color: var(--ink); }
.st-pill.active { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 3px 10px rgba(15, 42, 67, .2); }

/* Fleet — filters row: status pills (left) + investor filter (right) */
.fleet-filters { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.fleet-filters .status-pills { margin-bottom: 0; }
.inv-filter { position: relative; }
.inv-filter-btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--white); font-size: 13px; font-weight: 600; color: var(--ink);
  transition: all .14s ease;
}
.inv-filter-btn:hover { border-color: var(--navy-2); box-shadow: var(--shadow); }
.inv-filter-btn.on { border-color: var(--navy); }
.iff-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex: 0 0 auto; }
.inv-filter-btn.on .iff-dot { background: var(--green); }
.iff-label { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iff-caret { font-size: 10px; color: var(--muted); }
.inv-filter .dd-panel { min-width: 260px; max-height: 320px; overflow: auto; }
.ifm-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.ifm-item .ifm-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ifm-item .ifm-amt { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ifm-item.active .ifm-amt { color: var(--blue); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid thead th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--muted); background: var(--slate-soft); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: #f8fafc; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid thead th.num { text-align: right; }

/* Month-total dispatch footer (truck log cards) */
.card-foot.month-total {
  display: flex; align-items: center; justify-content: flex-end; gap: 42px;
  padding: 13px 20px; border-top: 1px solid var(--line); background: var(--soft, #f7f9fc);
}
.card-foot .mf-cell { text-align: right; }
.card-foot .mf-cell .mf-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.card-foot .mf-cell .mf-val { font-size: 16.5px; font-weight: 800; letter-spacing: -.3px; margin-top: 2px; }
tr.row-delivered td { opacity: .78; }
.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-state .es-ico { font-size: 30px; margin-bottom: 8px; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill .pd { width: 6px; height: 6px; border-radius: 50%; }
.p-delivered { background: var(--green-soft); color: var(--green); }
.p-delivered .pd { background: var(--green); }
.p-in-transit { background: var(--blue-soft); color: var(--blue); }
.p-in-transit .pd { background: var(--blue); animation: blink 1.2s infinite; }
.p-loaded { background: var(--amber-soft); color: #b45309; }
.p-loaded .pd { background: var(--amber); animation: blink 1.2s infinite; }
.p-scheduled { background: var(--slate-soft); color: var(--muted); }
.p-scheduled .pd { background: #94a3b8; }
.p-paid { background: var(--green-soft); color: var(--green); }
.p-partial { background: var(--amber-soft); color: #b45309; }
.p-advance { background: var(--blue-soft); color: var(--blue); }
.p-unpaid { background: var(--red-soft); color: var(--red); }
.p-issued { background: var(--blue-soft); color: var(--blue); }
.p-inbound { background: var(--green-soft); color: var(--green); }
.p-inbound .pd { background: var(--green); }
.p-outbound { background: var(--blue-soft); color: var(--blue); }
.p-outbound .pd { background: var(--blue); }
.pay-link { text-decoration: none; }
.pay-link .pill { cursor: pointer; border: 1px dashed rgba(0,0,0,.18); }
.pay-link:hover .pill { border: 1px solid var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
@keyframes blink { 50% { opacity: .25; } }

.bar-wrap { height: 7px; background: var(--slate-soft); border-radius: 6px; overflow: hidden; min-width: 90px; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--blue); }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 18px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 14px; }
.kpi-cell { padding: 13px 15px; }
.kpi-cell .k-label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.kpi-cell .k-value { font-size: 19px; font-weight: 800; margin-top: 4px; }
.kpi-cell.m-up .k-value { color: var(--green); }
.kpi-cell.m-down .k-value { color: var(--red); }
.meter-list { display: flex; flex-direction: column; gap: 11px; }
.meter { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 12px; font-size: 12.5px; }
.meter .m-label { font-weight: 600; color: #334155; }
.meter .m-tons { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 29, 49, .55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  box-shadow: var(--shadow-lg); animation: up .18s ease;
}
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.fx { display: flex; gap: 12px; }
.fx .field { flex: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.field textarea { resize: vertical; min-height: 64px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* Modal form sections */
.form-section { margin-bottom: 18px; }
.fs-title { font-size: 10.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); margin-bottom: 11px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.est-freight { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; background: var(--slate-soft); border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; color: var(--muted); }
.est-freight b { color: var(--ink); font-size: 15px; font-weight: 800; }
.est-freight .sep { opacity: .45; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 11px; font-size: 13px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: slidein .2s ease; max-width: 340px;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- Home (landing) ---------- */
.home-hero { min-height: calc(100vh - var(--topbar)); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.home-card {
  display: flex; flex-direction: column; align-items: center; gap: 34px;
  width: min(1000px, 100%); padding: 0; background: transparent; border: 0; box-shadow: none;
  transform: translateY(-48px);
}
.home-logo { width: min(820px, 90vw); height: auto; }
.home-brand { font-size: clamp(18px, 2.6vw, 28px); font-weight: 800; letter-spacing: 3px; text-transform: uppercase; color: var(--navy); text-align: center; }
.home-since { font-size: 13px; font-weight: 600; letter-spacing: 1.5px; color: var(--muted); text-align: center; margin-top: 7px; }
.home-rule { width: 130px; height: 3px; background: var(--amber); border-radius: 2px; margin: 12px auto 0; }
.home-tagline { font-size: 13.5px; color: var(--muted); letter-spacing: .6px; text-align: center; margin-top: 10px; }
.home-cta {
  display: inline-flex; align-items: center; gap: 12px; padding: 16px 36px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff;
  font-size: 16px; font-weight: 700; letter-spacing: .2px; cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 42, 67, .28); transition: transform .14s ease, box-shadow .14s ease;
}
.home-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 42, 67, .34); }
.home-cta svg { width: 20px; height: 20px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: 11px; }
.home-welcome { width: 100%; margin-top: 34px; }
.home-greet { width: 100%; display: flex; align-items: center; gap: 14px; margin-top: 34px; padding: 15px 22px; text-align: left; }
.home-greet .wc-ava {
  width: 48px; height: 48px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.home-greet .wc-name { font-weight: 600; font-size: 15px; }
.home-greet .wc-role { font-size: 13px; color: var(--muted); margin-top: 2px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .7px; text-transform: uppercase; color: #047857; background: #ecfdf5;
  border: 1px solid #a7f3d0; padding: 5px 11px; border-radius: 20px; flex-shrink: 0; white-space: nowrap;
}
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); animation: blink 2s infinite; }
.home-kpis .kpi-row { margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.home-kpis .kpi-cell { padding: 16px 19px; }
.home-kpis .kpi-cell .k-value { font-size: 22px; }

/* ---------- Investor lock badges ---------- */
.readonly-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; margin-bottom: 18px;
  background: var(--amber-soft); border: 1px solid #f2d9a6; color: #92610a; font-size: 13px; font-weight: 600;
}
.ro-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; padding: 2px 8px; border-radius: 4px; background: #e2e8f0; color: #475569; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.fs-12 { font-size: 12px; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.mb-12 { margin-bottom: 12px; }
.mb-18 { margin-bottom: 18px; }
.d-flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.right { margin-left: auto; }
table.compact tbody td { padding: 8px 12px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.ledger-note { font-size: 12px; color: var(--muted); }
.eq-bar { display: flex; align-items: center; gap: 8px; }
.eq-bar .eq-pct { font-weight: 700; font-size: 12px; }
.eq-ok { color: var(--green); }
.eq-warn { color: #b45309; }

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1100px 560px at 75% -10%, var(--navy-2) 0%, var(--navy) 48%, var(--navy-3) 100%);
}
.login-card { width: 100%; max-width: 400px; }
.login-card .lc-inner { background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); padding: 30px 32px; }
.login-card .lc-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-card .lc-logo img { height: 64px; border-radius: 8px; }
.login-card h1 { font-size: 19px; text-align: center; }
.login-card .lc-sub { text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; margin-bottom: 22px; }
.login-error { background: var(--red-soft); color: var(--red); border: 1px solid #f5c2c2; border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.login-foot { text-align: center; margin-top: 16px; font-size: 12px; color: var(--muted); }
.login-foot a { color: #8fb3cf; }

@media (max-width: 920px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 14px 60px; }
  .org-select { display: none; }
  .brand { min-width: auto; }
  .topbar { gap: 8px; padding: 0 10px; }
}

/* ---------- Investors ---------- */
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; width: 100%; }
.inv-card {
  position: relative; aspect-ratio: 1 / 1.06; border-radius: 20px; padding: 26px 28px 24px;
  width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  text-align: center; color: #fff; overflow: hidden;
  background:
    radial-gradient(460px 280px at 88% -12%, rgba(247, 158, 27, .30) 0%, rgba(247, 158, 27, 0) 55%),
    radial-gradient(520px 400px at -12% 112%, rgba(29, 78, 216, .55) 0%, rgba(29, 78, 216, 0) 60%),
    linear-gradient(160deg, #0d1b3f 0%, #14307d 52%, #1b3ea0 100%);
  box-shadow: 0 16px 40px rgba(15, 31, 71, .28), inset 0 1px 0 rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .12);
}
.inv-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.inv-top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.inv-num { font-size: 10.5px; font-weight: 800; letter-spacing: 2.6px; text-transform: uppercase; opacity: .6; }
.inv-index { font-size: 11px; font-weight: 800; letter-spacing: 1px; padding: 4px 11px; border-radius: 20px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); }
.inv-main { display: flex; flex-direction: column; align-items: center; }
.inv-avatar { width: 66px; height: 66px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 23px; font-weight: 800; color: var(--navy-3); background: linear-gradient(135deg, var(--amber), var(--amber-2)); box-shadow: 0 8px 18px rgba(247, 158, 27, .42); border: 2px solid rgba(255, 255, 255, .35); }
.inv-avatar-empty { background: rgba(255, 255, 255, .10); color: rgba(255, 255, 255, .75); border: 2px dashed rgba(255, 255, 255, .35); box-shadow: none; font-size: 30px; font-weight: 400; }
.inv-name { font-size: 23px; font-weight: 800; letter-spacing: .2px; line-height: 1.25; margin-top: 12px; }
.inv-sub { font-size: 10.5px; letter-spacing: 2.2px; text-transform: uppercase; opacity: .55; margin-top: 5px; }
.inv-divider { width: 58px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--amber), rgba(247, 158, 27, .15)); margin: 16px 0 12px; }
.inv-label { font-size: 10px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; opacity: .62; }
.inv-amount { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.05; margin-top: 6px; }
.inv-cur { font-size: 14px; font-weight: 700; color: var(--amber); margin-right: 3px; vertical-align: super; }
.inv-label-balance { margin-top: 12px; }
.inv-amount-balance { font-size: 30px; margin-top: 2px; opacity: .95; }
.inv-amount-balance.is-neg { color: #ff6b6b; }
.inv-amount-balance .inv-cur { font-size: 12px; }
.inv-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.inv-stats { width: 100%; display: flex; justify-content: center; gap: 10px; }
.inv-stat { flex: 1; max-width: 132px; padding: 9px 6px; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); font-size: 9.5px; letter-spacing: .8px; text-transform: uppercase; opacity: .9; }
.inv-stat b { display: block; font-size: 17px; letter-spacing: 0; font-variant-numeric: tabular-nums; margin-bottom: 1px; }
.inv-input { width: 100%; max-width: 220px; background: transparent; border: 0; border-bottom: 2px solid rgba(255, 255, 255, .45); color: #fff; text-align: center; outline: none; }
.inv-input:focus { border-bottom-color: #fff; }
.inv-input-name { font-size: 22px; font-weight: 700; letter-spacing: .3px; padding: 4px 6px; margin-top: 18px; }
.inv-input-money { font-size: 44px; font-weight: 800; margin: 16px 0 10px; font-variant-numeric: tabular-nums; }
.inv-input-money[readonly] { border-bottom: 0; }
.inv-input::placeholder { color: rgba(255, 255, 255, .5); }
.inv-link { color: var(--blue); font-weight: 700; cursor: pointer; text-decoration: none; }
.inv-link:hover { text-decoration: underline; }
.inv-clickable { cursor: pointer; transition: transform .14s, box-shadow .14s; }
.inv-clickable:hover { transform: translateY(-4px); box-shadow: 0 24px 52px rgba(15, 31, 71, .36), inset 0 1px 0 rgba(255, 255, 255, .14); }
.inv-open { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; opacity: .85; transition: opacity .12s; }
.inv-clickable:hover .inv-open { opacity: 1; }
.inv-hint { margin-top: 14px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 920px) { .inv-grid { grid-template-columns: 1fr; gap: 18px; } .inv-card { aspect-ratio: auto; min-height: 380px; max-width: none; } }
.empty-row { text-align: center; color: var(--muted); font-style: italic; padding: 18px 0; }