/* ===================================================================
   IDEIAS TRACK — estilos
   =================================================================== */
:root {
  --ink: #0d0b12;
  --ink-2: #26222f;
  --bg: #f6f5f9;
  --card: #ffffff;
  --line: #e6e3ee;
  --line-2: #f1eff6;
  --muted: #6b6878;
  --muted-2: #9b98a8;
  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --accent-light: #c4a6ff;
  --accent-soft: #ede5ff;
  --accent-ink: #ffffff;
  --pos: #18915f;
  --pos-soft: #e3f5ec;
  --neg: #cf3e3e;
  --neg-soft: #fbe7e7;
  --warn: #b26b00;
  --warn-soft: #fff1dc;
  --info: #2f62d8;
  --info-soft: #e7eefc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 4px 16px rgba(20, 20, 30, .04);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar-in {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  height: 62px; display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.brand .bulb { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.brand .bulb svg { width: 17px; height: 17px; }
.brand em { font-style: normal; color: var(--accent-light); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav button {
  background: none; border: 0; color: #b9bac4; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  font-weight: 600; white-space: nowrap;
}
.nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav button.on { color: #fff; background: var(--accent); }
.who { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 13px; color: #cfd0d8; white-space: nowrap; }
.who b { color: #fff; font-weight: 700; }
.btn-ghost-dark { background: rgba(255,255,255,.08); border: 0; color: #fff; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-ghost-dark:hover { background: rgba(255,255,255,.16); }

.demo-bar { background: var(--accent); color: var(--accent-ink); text-align: center; font-size: 12.5px; font-weight: 700; padding: 6px 12px; }
.admin-bar { background: var(--info); color: #fff; font-size: 13px; padding: 8px 16px; display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.admin-bar a { color: #fff; font-weight: 700; }

/* ---------- layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 26px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; min-width: 0; }
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .val { font-size: clamp(19px, 1.75vw, 25px); font-weight: 800; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.hl { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.hl .lbl, .kpi.hl .sub { color: #b9bac4; }
.kpi.hl .val { color: var(--accent-light); }
.kpi.warn { border-color: #f1c98a; background: var(--warn-soft); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; padding: 9px 15px; border-radius: 10px;
  font-weight: 700; cursor: pointer; white-space: nowrap; font-size: 14px; text-decoration: none;
}
.btn:hover { border-color: #cfcbc0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--neg); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field label .req { color: var(--neg); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.search { max-width: 260px; }

/* ---------- date filter ---------- */
.datefilter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.datefilter select { width: auto; }
.datefilter input[type=date] { width: 150px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.t { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #faf9fd; }
.t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .nowrap { white-space: nowrap; }
.t tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
.cell-title { font-weight: 700; }
.cell-sub { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 34px 10px !important; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.ok { background: var(--pos-soft); color: var(--pos); }
.chip.bad { background: var(--neg-soft); color: var(--neg); }
.chip.wait { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.off { background: var(--line-2); color: var(--muted); }
.chip.plain::before { display: none; }

/* ---------- notice ---------- */
.notice { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 13.5px; background: var(--warn-soft); color: #6e4300; border: 1px solid #f1d6a6; }
.notice.info { background: var(--info-soft); color: #1d3f8f; border-color: #c9d8f7; }

/* ---------- account box ---------- */
.acc-list { display: grid; gap: 0; }
.acc-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.acc-row:last-child { border-bottom: 0; }
.acc-row span:first-child { color: var(--muted); }
.acc-row b { font-variant-numeric: tabular-nums; text-align: right; }
.acc-big { background: var(--bg); border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; }
.acc-big .lbl { font-size: 12px; color: var(--muted); font-weight: 700; }
.acc-big .val { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { fill: var(--accent-2); }
.chart .axis { fill: var(--muted-2); font-size: 10.5px; font-family: var(--font); }
.chart .grid { stroke: var(--line-2); }
.chart-tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; z-index: 50; white-space: nowrap; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(21, 22, 28, .55); }
.dlg-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; background: #fff; z-index: 2; }
.dlg-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.dlg-body { padding: 20px 22px; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
details.more { margin-top: 14px; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink-2); }
details.more[open] summary { margin-bottom: 12px; }
.section-t { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-t:first-child { margin-top: 0; }
.section-t::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--neg); }

/* ---------- loading ---------- */
.loading { position: relative; pointer-events: none; }
.loading::after { content: ""; position: absolute; inset: 0; background: rgba(246,245,249,.6); border-radius: inherit; }
.sk { background: linear-gradient(90deg, #ecebf2 25%, #f6f5fa 50%, #ecebf2 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h2 { font-size: 40px; line-height: 1.08; letter-spacing: -.03em; margin: 0; max-width: 460px; font-weight: 800; }
.login-art h2 em { font-style: normal; color: var(--accent-light); }
.login-art p { color: #b9bac4; max-width: 420px; }
.login-art .rays { position: absolute; right: -120px; bottom: -120px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(124,58,237,.45), rgba(124,58,237,0) 65%); }
.login-box { display: grid; place-items: center; padding: 32px 20px; }
.login-box form { width: min(380px, 100%); }
.login-box h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.login-box .field { margin-top: 14px; }
.login-err { color: var(--neg); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- client cards (admin) ---------- */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ccard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.ccard .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.ccard h4 { margin: 0; font-size: 16px; font-weight: 800; }
.ccard .meta { font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.ccard .meta b { color: var(--ink-2); font-weight: 700; }
.ccard .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.users-list { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: #f8f7fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre; overflow: auto; max-height: 360px; }

/* ---------- responsive ---------- */
.card-head .head-actions { flex-wrap: nowrap; }
.cell-title { white-space: nowrap; }
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 28px 20px; min-height: 200px; }
  .login-art h2 { font-size: 28px; }
}
@media (max-width: 640px) {
  .wrap { padding: 18px 14px 50px; }
  .topbar-in { padding: 0 14px; gap: 12px; }
  .who span.name { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .val { font-size: 19px; }
  .card-head .head-actions { flex-wrap: wrap; }
  .card { padding: 16px 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .head-actions { width: 100%; }
  .head-actions .btn.primary { flex: 1; }
  .search { max-width: none; width: 100%; }
}
