/* ui.css — o sistema de desenho (08-interface): tokens e trinta componentes,
   no máximo. Escrito à mão, sem framework, sem build, sem fonte baixada. O
   que não está aqui é decisão de arquitetura, não style="". */

:root {
  --tinta: #0F172A;
  --dourado: #B08D57;
  --fundo: #F7F6F3;
  --linha: #E7E5E0;
  --cinza: #78716C;
  --superficie: #FFFFFF;
  --ok: #15803D;
  --alerta: #B45309;
  --erro: #B91C1C;
  --info: #1D4ED8;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(15, 23, 42, 0.06);
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --trilho: 56px;
  --barra: 52px;
}

* { box-sizing: border-box; }
html { font: 15px/1.45 var(--fonte); color: var(--tinta); background: var(--fundo); }
body { margin: 0; min-width: 1024px; }
a { color: var(--tinta); }
:focus-visible { outline: 2px solid var(--dourado); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Base ------------------------------------------------------------------ */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.columns { display: grid; grid-template-columns: 360px 1fr; gap: 0; min-height: 0; flex: 1; }
.columns > * { min-width: 0; overflow: auto; }
.columns > :first-child { border-right: 1px solid var(--linha); background: var(--superficie); }
.columns.pair { grid-template-columns: 1fr 1fr; gap: 16px; }
.columns.pair > :first-child { border: 0; background: none; }

/* Navegação -------------------------------------------------------------- */
.rail { position: fixed; inset: 0 auto 0 0; width: var(--trilho); background: var(--tinta); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; }
.rail a { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--raio); color: #E7E5E0; position: relative; }
.rail a:hover, .rail a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: #fff; }
.rail a[aria-current="page"]::before { content: ""; position: absolute; left: -8px; width: 3px; height: 20px; background: var(--dourado); border-radius: 2px; }
.rail a::after { content: attr(data-label); position: absolute; left: 48px; background: var(--tinta); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 13px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .1s; }
.rail a:hover::after { opacity: 1; }
.rail .logo { margin-bottom: 8px; }
.rail .logo svg { width: 28px; height: 28px; }
.topbar { position: fixed; top: 0; left: var(--trilho); right: 0; height: var(--barra); background: var(--superficie); border-bottom: 1px solid var(--linha); display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 2; }
.topbar .spacer { flex: 1; }
.topbar .select { min-width: 220px; width: auto; }
.topbar .conta { position: relative; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--linha); }
.tabs button { border: 0; background: none; padding: 10px 12px; font: inherit; color: var(--cinza); border-bottom: 2px solid transparent; cursor: pointer; min-height: 32px; }
.tabs button[aria-selected="true"] { color: var(--tinta); border-color: var(--dourado); }
.breadcrumb { color: var(--cinza); font-size: 14px; }
.breadcrumb a { color: var(--cinza); text-decoration: none; }

/* Conteúdo ---------------------------------------------------------------- */
.card { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--linha); cursor: pointer; min-height: 48px; }
.list-item:hover, .list-item[aria-current="true"] { background: var(--fundo); }
.list-item .meta { color: var(--cinza); font-size: 13px; }
.ficha { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.ficha-header { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--linha); position: sticky; top: 0; background: var(--fundo); }
.ficha-header h1 { font-size: 22px; margin: 0; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--linha); }
.timeline li { padding: 6px 0 6px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--dourado); }
.page > .empty { min-height: 100vh; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 48px 24px; color: var(--cinza); text-align: center; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--linha); }
.table th { color: var(--cinza); font-weight: 500; font-size: 13px; }

/* Entrada ----------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; color: var(--cinza); }
.field .hint { font-size: 13px; color: var(--erro); }
.input, .select, .search, .date { width: 100%; font: inherit; color: var(--tinta); background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); padding: 0 12px; min-height: 36px; }
.input:focus, .select:focus, .search:focus, .date:focus { border-color: var(--dourado); outline: none; box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.2); }
.select { appearance: auto; }
.search { padding-left: 34px; background-repeat: no-repeat; background-position: 10px center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips > * { border: 1px solid var(--linha); border-radius: 999px; padding: 4px 10px; font-size: 13px; background: var(--superficie); cursor: pointer; min-height: 28px; }
.chips > [aria-pressed="true"] { border-color: var(--dourado); background: rgba(176, 141, 87, 0.12); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.switch input { width: 36px; height: 20px; appearance: none; border-radius: 999px; background: var(--linha); position: relative; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 18px; }

/* Ação -------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: var(--raio); border: 1px solid var(--linha); background: var(--superficie); color: var(--tinta); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--cinza); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--tinta); color: #fff; border-color: var(--tinta); }
.btn-primary:hover { background: #1E293B; border-color: #1E293B; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--cinza); }
.btn-ghost:hover { color: var(--tinta); background: var(--fundo); border-color: transparent; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 5; }
.modal > .card { width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); padding: 6px; z-index: 3; }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; font: inherit; color: var(--tinta); border-radius: 6px; cursor: pointer; text-decoration: none; min-height: 32px; }
.menu button:hover, .menu a:hover { background: var(--fundo); }
.kbd { font: 12px/1 var(--fonte); border: 1px solid var(--linha); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--cinza); background: var(--superficie); }

/* Estado ------------------------------------------------------------------ */
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--fundo); color: var(--cinza); border: 1px solid var(--linha); }
.pill-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: rgba(21, 128, 61, 0.1); color: var(--ok); }
.pill-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-status[data-status="suspended"], .pill-status[data-status="pending"] { background: rgba(180, 83, 9, 0.12); color: var(--alerta); }
.pill-status[data-status="offboarded"] { background: rgba(185, 28, 28, 0.1); color: var(--erro); }
.skeleton { background: linear-gradient(90deg, var(--linha), #F1EFEA, var(--linha)); background-size: 200% 100%; animation: skeleton 1.2s infinite; border-radius: 6px; min-height: 14px; color: transparent; }
@keyframes skeleton { to { background-position: -200% 0; } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: var(--raio); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2); z-index: 6; max-width: 560px; }
.toast[data-kind="erro"] { background: var(--erro); }
.toast[data-kind="alerta"] { background: var(--alerta); }
.banner { border: 1px solid var(--linha); border-left: 4px solid var(--dourado); background: var(--superficie); border-radius: var(--raio); padding: 12px 16px; }
.banner[data-kind="erro"] { border-left-color: var(--erro); }
.banner[data-kind="alerta"] { border-left-color: var(--alerta); }

/* Utilitários: só espaçamento e alinhamento ------------------------------- */
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 16px; }
.pad { padding: 16px; } .pad-top { padding: 12px 16px 0; } .pad-x { padding: 0 16px; } .grow0 { min-height: 0; }
.center { text-align: center; } .right { margin-left: auto; } .muted { color: var(--cinza); } .small { font-size: 13px; }

/* O console: trilho + barra + duas colunas --------------------------------- */
.console { padding-left: var(--trilho); padding-top: var(--barra); min-height: 100vh; display: flex; flex-direction: column; }
.console > main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.entrada .card { width: min(440px, 100%); }
.entrada .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.entrada .logo svg { width: 36px; height: 36px; }
.sprite { display: none; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
