/* unsolved-lab shared kit — base theme. Refined neutral dark default; apps override --accent etc. */
:root {
  --bg: #101216;
  --panel: #171a20;
  --panel2: #1e232c;
  --ink: #eef1f6;
  --muted: #9aa3b2;
  --line: #2a303b;
  --accent: #5b8def;
  --accent2: #9a6cf3;
  --good: #3fbf7f;
  --warn: #e0a63c;
  --bad: #e05c5c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  padding-top: 64px; /* room for fixed .k-nav */
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.25; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); text-decoration: none; }
img, svg { max-width: 100%; }

/* ---------- layout ---------- */
.k-wrap { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
.k-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.k-split { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .k-split { grid-template-columns: 1fr 1fr; } }
.k-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.k-hero { padding: 40px 16px 32px; text-align: left; }
.k-hero h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -0.02em; }
.k-hero p { color: var(--muted); font-size: 17px; max-width: 640px; }
.k-muted { color: var(--muted); }

/* ---------- nav ---------- */
.k-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(16, 18, 22, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.k-nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.k-nav-title { font-weight: 700; font-size: 17px; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; overflow: hidden; }
.k-nav-sub { font-weight: 400; font-size: 13px; color: var(--muted); }
.k-nav-actions { display: flex; gap: 8px; }

/* ---------- buttons / inputs ---------- */
.k-btn, button.k-btn, a.k-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.k-btn:hover { background: #252b36; border-color: #39414f; }
.k-btn:active { transform: scale(0.97); }
.k-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.k-btn.k-primary, a.k-btn.k-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.k-btn.k-primary:hover { filter: brightness(1.1); }
button, a, input, select, textarea, .k-tab { touch-action: manipulation; }

.k-input, .k-select, input[type="search"].k-input {
  background: var(--panel2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 14px; width: 100%;
}
.k-input:focus, .k-select:focus { outline: none; border-color: var(--accent); }
.k-select { width: auto; }

/* ---------- tabs ---------- */
.k-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.k-tab {
  background: none; border: none; color: var(--muted);
  padding: 10px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.k-tab:hover { color: var(--ink); }
.k-tab.k-active { color: var(--ink); border-bottom-color: var(--accent); }
.k-tab-pane { min-height: 80px; }

/* ---------- table ---------- */
.k-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.k-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.k-table th, .k-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.k-table th { background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; user-select: none; }
.k-table th:hover { color: var(--ink); }
.k-table tbody tr:last-child td { border-bottom: none; }
.k-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.k-num { text-align: right; font-variant-numeric: tabular-nums; }
.k-table-search { margin-bottom: 12px; max-width: 320px; }
.k-table-pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.k-table-pager .k-muted { margin-right: auto; }

/* ---------- charts ---------- */
.k-chart { display: block; }
.k-chart-label { fill: var(--muted); font-size: 12px; }
.k-chart-val { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.k-gridline { stroke: var(--line); stroke-width: 1; }
.k-donut-total { fill: var(--ink); font-size: 22px; font-weight: 700; }
.k-graph-node { fill: var(--panel); stroke-width: 1.5; }
.k-graph-label { fill: var(--ink); font-size: 13px; font-weight: 600; }

/* ---------- timeline ---------- */
.k-timeline { position: relative; padding-left: 26px; }
.k-timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.k-tl-item { position: relative; padding: 10px 0 18px; }
.k-tl-dot { position: absolute; left: -24px; top: 14px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.k-tl-t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.k-tl-title { font-weight: 700; margin: 2px 0; }
.k-tl-desc { color: var(--muted); font-size: 14px; }

/* ---------- badge / kpi ---------- */
.k-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  background: rgba(91, 141, 239, 0.15); color: var(--accent);
}
.k-badge-ok { background: rgba(63, 191, 127, 0.15); color: var(--good); }
.k-badge-warn { background: rgba(224, 166, 60, 0.15); color: var(--warn); }
.k-badge-bad { background: rgba(224, 92, 92, 0.15); color: var(--bad); }
.k-badge-info { background: rgba(91, 141, 239, 0.15); color: var(--accent); }

.k-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.k-kpis { display: flex; gap: 12px; flex-wrap: wrap; }
.k-kpis .k-kpi { flex: 1; min-width: 140px; }
.k-kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.k-kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0; font-variant-numeric: tabular-nums; }
.k-kpi-delta { font-size: 13px; font-weight: 700; }
.k-kpi-delta.k-pos { color: var(--good); }
.k-kpi-delta.k-neg { color: var(--bad); }
.k-kpi-hint { font-size: 12px; margin-top: 4px; }

/* ---------- toast ---------- */
.k-toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
.k-toast {
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(12px); transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); max-width: 100%;
}
.k-toast-show { opacity: 1; transform: translateY(0); }
.k-toast-ok { border-color: var(--good); }
.k-toast-warn { border-color: var(--warn); }
.k-toast-bad { border-color: var(--bad); }

/* ---------- modal ---------- */
.k-modal-overlay {
  position: fixed; inset: 0; z-index: 1500; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; transition: opacity 0.2s ease;
}
.k-modal-overlay.k-modal-show { opacity: 1; }
.k-modal-overlay.k-modal-hide { opacity: 0; }
.k-modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(92vw, 520px); max-height: 86vh; overflow: auto;
  transform: translateY(8px); transition: transform 0.2s ease;
}
.k-modal-overlay.k-modal-show .k-modal { transform: translateY(0); }
.k-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.k-modal-head h3 { margin: 0; font-size: 18px; }
.k-modal-x { background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.k-modal-x:hover { color: var(--ink); }
.k-modal-body { padding: 14px 18px; color: var(--ink); }
.k-modal-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 0 18px 18px; flex-wrap: wrap; }

/* ---------- empty ---------- */
.k-empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--line); border-radius: 14px; background: var(--panel); }
.k-empty-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.k-empty .k-muted { margin-bottom: 16px; }
