:root {
  --bg: #0e0d0c;
  --panel: #171513;
  --line: #2a2724;
  --text: #ece7df;
  --muted: #9a938a;
  --accent: #e8c36a;
  --accent-2: #7fb7a4;
  --danger: #e56b5d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.5em; }
[hidden] { display: none !important; }

button, select, input, .ghost {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none;
}
button:hover, .ghost:hover { border-color: var(--muted); }
button[type="submit"] { background: var(--accent); color: #17130a; border-color: var(--accent); font-weight: 600; }
input[type="search"], input[type="password"] { cursor: text; min-width: 220px; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login__card { width: min(360px, 100%); display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login__card h1 { margin: 0 0 8px; font-size: 28px; }

.app { max-width: 1280px; margin: 0 auto; padding: 16px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 8px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { background: transparent; }
.tabs button.is-active { background: var(--panel); border-color: var(--accent); }
.controls { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi b { display: block; font-size: 26px; letter-spacing: -0.02em; }
.kpi span { color: var(--muted); font-size: 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card h2 { margin: 0; font-size: 15px; }
.legend { color: var(--muted); font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 3px; display: inline-block; border-radius: 2px; }
.l-visits { background: var(--accent); }
.l-cv { background: var(--accent-2); }

.chart svg { width: 100%; height: 220px; display: block; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.chart .bar { fill: var(--accent-2); }
.chart .dots { color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 6px; overflow: hidden; }
.list li .bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 12%, transparent); z-index: 0; }
.list li span { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .n { flex: none; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #1d1a17; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; margin: 0 4px 2px 0; white-space: nowrap; }
.chip.cv { border-color: var(--accent-2); color: var(--accent-2); }
.chip.mail { border-color: var(--accent); color: var(--accent); }
.chip.bot { border-color: var(--danger); color: var(--danger); }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 10px; }

.drawer { position: fixed; inset: 0; background: rgb(0 0 0 / 55%); display: flex; justify-content: flex-end; z-index: 10; }
.drawer__panel { width: min(560px, 100%); height: 100%; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 20px; position: relative; }
.drawer__close { position: sticky; top: 0; float: right; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0 18px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.timeline li { padding: 4px 0 10px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -4px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.foot { padding: 20px 0; font-size: 12px; }

@media (max-width: 720px) {
  .controls { margin-left: 0; }
  input[type="search"] { min-width: 0; width: 100%; }
}
