/* WATHEEQ Dashboard — builds on /shared/tokens.css (navy #0D1B3D · teal #1FA285). Light, calm, card-based. */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.55; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 48px; text-align: center; color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 34px; height: 34px; background: #fff; border-radius: 10px; padding: 4px; }
.brand b { font-size: 17px; display: block; }
.brand span { font-size: 11px; opacity: .7; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #C9D3E8; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(31,162,133,.18); color: #fff; box-shadow: inset -3px 0 0 var(--teal); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; font-size: 11px; color: #8FA0C2; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.side .foot button { background: none; border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; margin-top: 8px; width: 100%; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.top .menu { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 6px 9px; cursor: pointer; }
.search { flex: 1 1 220px; max-width: 360px; position: relative; }
.search input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; }
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); font-weight: 700; }
.period input[type=date] { border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; background: var(--card); }
.sync { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.sync .dot.bad { background: var(--danger); }
.sync .dot.busy { background: var(--gold); }
.btn { border: 1px solid var(--border); background: var(--card); border-radius: 10px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn:hover { border-color: var(--border-strong); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

.badge-demo { background: var(--gold-soft); color: var(--gold-text); border: 1px solid #EBD3A6; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-share { background: var(--info-soft); color: var(--info); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }

.content { padding: 22px 24px 48px; max-width: 1320px; width: 100%; }
.page-h { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; margin-bottom: 16px; }
.page-h h1 { font-size: 22px; margin: 0; }
.page-h p { margin: 0; color: var(--text-2); }
.page-h .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.banner { border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner.warn { background: var(--warning-soft); color: #7A4A0B; }
.banner.err { background: var(--danger-soft); color: #842B2B; }
.banner.info { background: var(--info-soft); color: #1F3F73; }
.banner.note { background: var(--mint); color: var(--text-2); }

/* ---------- cards */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 2px; }
.card .sub { font-size: 12px; color: var(--text-3); margin: 0 0 12px; }
.card-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-h .more { margin-inline-start: auto; font-size: 12px; color: var(--teal); text-decoration: none; font-weight: 700; }

.kpi { display: block; text-decoration: none; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.kpi:hover { border-color: var(--teal); }
.kpi:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.kpi .lbl { color: var(--text-2); font-weight: 500; }
.kpi .val { font-size: 30px; font-weight: 800; margin: 6px 0 2px; line-height: 1.2; }
.kpi .val small { font-size: 14px; font-weight: 500; color: var(--text-2); }
.kpi .meta { font-size: 12px; color: var(--text-3); }
.basis { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-inline-start: 6px; vertical-align: 2px; }
.basis.period { background: var(--info-soft); color: var(--info); }
.basis.current { background: var(--accent-soft); color: #11705B; }
.kpi .go { position: absolute; inset-inline-end: 14px; bottom: 12px; color: var(--teal); font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.kpi:hover .go, .kpi:focus-visible .go { opacity: 1; }
.kpi .meta { padding-inline-end: 64px; }

.na { color: var(--text-3); }
.na .why { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); margin-top: 2px; }

/* ---------- bars (single hue, direct labels) */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 8px; text-decoration: none; cursor: pointer; }
.bar-row:hover { background: var(--surface); }
.bar-row .name { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 10px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--teal); border-radius: 4px; min-width: 2px; }
.bar-row .v { font-weight: 700; min-width: 28px; text-align: left; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .axis-t { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.chart .col { fill: var(--teal); cursor: pointer; }
.chart .col:hover, .chart .col.hl { fill: #178069; }
.chart .hit { fill: transparent; cursor: pointer; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--navy); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow-lg); max-width: 260px; }

/* ---------- lists / tables */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list a.row-link { text-decoration: none; display: flex; gap: 10px; align-items: center; width: 100%; }
.ref { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--surface); border-radius: 6px; padding: 1px 6px; direction: ltr; unicode-bidi: isolate; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface); color: var(--text-2); }
.pill.ok { background: var(--accent-soft); color: #11705B; }
.pill.warn { background: var(--warning-soft); color: #8A5310; }
.pill.bad { background: var(--danger-soft); color: #9B3535; }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.gold { background: var(--gold-soft); color: var(--gold-text); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-2); }
.filters input, .filters select { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--card); min-width: 0; }
.filters input[type=number] { width: 110px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--teal); font-weight: 700; }
.tabs .count { font-size: 11px; background: var(--surface); border-radius: 999px; padding: 0 7px; margin-inline-start: 4px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--text-3); font-weight: 500; background: var(--surface); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--mint); }
td.wrap { white-space: normal; min-width: 220px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 2px; color: var(--text-2); font-size: 12px; flex-wrap: wrap; }

.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 10px; }

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--text-3); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { padding: 0 18px 12px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; right: 3px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.timeline li::after { content: ""; position: absolute; right: 6.5px; top: 17px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t { font-size: 12px; color: var(--text-3); }

.stat-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { flex: 1 1 150px; background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.stat .l { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 20px; font-weight: 800; }
a.stat { text-decoration: none; }
a.stat:hover { outline: 1px solid var(--teal); }

.disclaimer { font-size: 12px; color: var(--text-2); background: var(--mint); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }

/* ---------- network */
.net-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 14px; }
.net { width: 100%; height: 560px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; touch-action: none; }
.net .edge { stroke: #9AA6BF; stroke-width: 1.5; fill: none; }
.net .edge.TRANSACTION { stroke: #6E7C99; }
.net .edge.PAYOUT { stroke: var(--gold); }
.net .edge.SHARED_DEVICE { stroke: var(--danger); stroke-dasharray: 5 4; }
.net .edge.SHARED_PHONE { stroke: var(--warning); stroke-dasharray: 2 3; }
.net .edge.EXTERNAL_TRANSFER { stroke: var(--info); stroke-dasharray: 8 4; }
.net .edge.TRANSACTION { cursor: pointer; }
.net .edge.dim, .net .node.dim { opacity: .15; }
.net .node { cursor: pointer; }
.net .node .shape { fill: var(--card); stroke: var(--navy); stroke-width: 2; }
.net .node.MERCHANT .shape { fill: var(--mint); stroke: var(--teal); }
.net .node.BANK_ACCOUNT .shape { fill: var(--gold-soft); stroke: var(--gold); }
.net .node.EXTERNAL .shape { fill: var(--info-soft); stroke: var(--info); stroke-dasharray: 3 2; }
.net .node.case .ring { fill: none; stroke: var(--danger); stroke-width: 2.5; }
.net .node.sel .shape { stroke-width: 3.5; }
.net text { font-size: 10px; fill: var(--text-2); font-family: var(--font); pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin: 8px 0; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-inline-end: 4px; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--navy), #13306A); }
.login form { background: var(--card); border-radius: 20px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-lg); }
.login h1 { margin: 0; font-size: 20px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.login input { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; direction: ltr; text-align: left; }
.login .err { color: var(--danger); font-size: 13px; min-height: 18px; }
.login img { width: 46px; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .net-wrap { grid-template-columns: 1fr; }
  .thirds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; right: 0; width: 250px; z-index: 30; transform: translateX(100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .top { padding: 10px 16px; }
  .top .menu { display: inline-flex; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .sync { margin-inline-start: 0; }
  .content { padding: 16px 16px 40px; }
  .kpis, .halves, .thirds { grid-template-columns: 1fr; }
  .kpi .val { font-size: 26px; }
  .net { height: 420px; }
  .filters label { flex: 1 1 140px; }
  .filters input[type=number] { width: 100%; }
}
