/* Management portal DEMO (KAN-405). A light, dense admin layout for desks and tablets; the Kruze accent comes from
   the tenant (switching tenant changes --accent). */
:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --ink: #0f2133;
  --muted: #5d6f80;
  --line: #dde5ec;
  --accent: #0aa7c2;
  --accent-ink: #ffffff;
  --navy: #0b1f35;
  --ok: #1f9d55;
  --warn: #c77700;
  --bad: #c83a3a;
  --radius: 10px;
  --sans: 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Top bar */
.m-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--navy); color: #fff; }
.m-menu { display: none; background: none; border: 0; color: #fff; width: 40px; height: 40px; }
.m-menu svg { width: 24px; height: 24px; }
.m-brand { display: flex; align-items: center; gap: 10px; }
.m-brand b { display: block; letter-spacing: .04em; }
.m-brand small { color: #a9bccd; font-size: 12px; }
.m-logo { width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); }
.m-logo svg { width: 100%; height: 100%; }
.m-tenant { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #a9bccd; }
.m-tenant select { padding: 6px 8px; border-radius: 8px; border: 1px solid #2c4a68; background: #10294a; color: #fff; }
.m-user { font-size: 13px; color: #a9bccd; }
.m-banner { padding: 8px 16px; background: #fff4e0; color: #7a4b00; font-size: 13px; }

/* Shell */
.m-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 92px); }
.m-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.m-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.m-nav a:hover { background: var(--bg); }
.m-nav a.on { background: color-mix(in srgb, var(--accent) 14%, white); color: var(--navy); }
.m-nav a .tag { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px; background: var(--navy); color: #fff; letter-spacing: .04em; }
.m-nav .sep { margin: 10px 12px 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.m-main { padding: 18px 20px 48px; min-width: 0; }
.m-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.m-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-size: 24px; font-weight: 800; }
.kpi .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .s { font-size: 12px; color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 12px; font-weight: 600; font-size: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: #e3f5ea; color: var(--ok); }
.pill.warn { background: #fff1dc; color: var(--warn); }
.pill.bad { background: #fde6e6; color: var(--bad); }
.pill.info { background: #e6f2fb; color: #1d5f8f; }
.pill.dim { background: #eef2f5; color: var(--muted); }
.diff { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--navy); color: #fff; vertical-align: middle; margin-left: 6px; }
.note { font-size: 13px; color: var(--muted); }
.lock { font-size: 12px; color: #6b4b00; background: #fff8e8; border: 1px solid #f1dfb6; padding: 6px 8px; border-radius: 6px; }
.bar { height: 8px; border-radius: 99px; background: #e8eef3; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.warn { background: var(--warn); }
.bar i.bad { background: var(--bad); }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar select, .toolbar input, .field input, .field select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 10%, white); }
.tbl tr[data-id] { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Map */
.map { width: 100%; height: auto; display: block; background: #eaf3f8; border-radius: 8px; touch-action: none; user-select: none; }
.map .area { stroke-width: 2; fill-opacity: .18; }
.map .area.sel { fill-opacity: .32; stroke-width: 3; }
.map .lbl { font: 600 11px var(--sans); fill: #23384d; pointer-events: none; }
.map .dot { stroke: #fff; stroke-width: 2; cursor: pointer; }
.map .dot.sel { stroke: var(--navy); stroke-width: 3; }
.map .handle { fill: #fff; stroke: var(--navy); stroke-width: 2; cursor: grab; }
.map .draft { fill: none; stroke: var(--navy); stroke-dasharray: 5 4; stroke-width: 2; }
.map .car { fill: var(--navy); }
.map.drawing { cursor: crosshair; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* Content */
.zone-list { display: grid; gap: 8px; }
.zone { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.zone b { display: flex; gap: 8px; align-items: center; }
.items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.item { font-size: 12px; padding: 4px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.item.night { background: #1d2b53; color: #ffd6e0; border-color: #1d2b53; }
.preview { width: 100%; aspect-ratio: 16 / 10; border: 0; border-radius: 8px; background: #030c18; display: block; }
.steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.steps li.done::before { content: '✓ '; color: var(--ok); font-weight: 800; }
.steps li.wait { color: var(--muted); }
.chart { width: 100%; height: 150px; display: block; }
.chart rect { fill: var(--accent); }
.chart text { font: 10px var(--sans); fill: var(--muted); }
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.pipeline div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.pipeline b { display: block; font-size: 22px; }
.feature-card { border-radius: 8px; padding: 12px; background: linear-gradient(135deg, #0b1f35, #12406a); color: #fff; min-height: 90px; }
.feature-card small { color: #9fd9e6; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; font-size: 11px; }
.feature-card b { display: block; font-size: 18px; margin-top: 6px; }
.honest { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.honest div { font-size: 13px; border-left: 3px solid var(--accent); padding: 4px 10px; background: var(--bg); }

@media (max-width: 900px) {
  .m-menu { display: block; }
  .m-user { display: none; }
  .m-tenant span { display: none; }
  .m-shell { grid-template-columns: 1fr; }
  .m-nav { display: none; position: fixed; top: 56px; left: 0; bottom: 0; width: 240px; z-index: 30; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
  .m-nav.open { display: flex; }
  .g2, .g3, .split { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-main { padding: 14px 12px 40px; }
  .m-tenant select { max-width: 150px; }
}

/* Report tabs and the partner value summary */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.on { color: var(--navy); border-bottom-color: var(--accent); }
.value-card { display: grid; gap: 6px; border-left: 4px solid var(--accent); }
.value-card b { font-size: 17px; line-height: 1.4; }
@media print {
  .m-top, .m-banner, .m-nav, .actions, .tabs { display: none !important; }
  .m-shell { display: block; }
  body { background: #fff; }
  .card, .kpi { break-inside: avoid; }
}
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
