/*
 * Kit das demonstrações do Lark Hub.
 * Mesmos tokens do produto (src/app/globals.css) para a demo parecer o painel de verdade.
 * Tudo roda no navegador com dados fictícios: nada é enviado ou salvo em servidor.
 */
@font-face {
  font-family: "Geist";
  src: url("/demos/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sunken: #eef0f3;
  --ink: #172033;
  --ink-2: #4f5869;
  --ink-3: #8a93a3;
  --line: #e2e5ea;
  --line-strong: #cdd2da;
  --accent: #0b6e5f;
  --accent-hover: #085a4e;
  --accent-soft: #e6f2ef;
  --accent-ink: #064a40;
  --warn: #93560a;
  --warn-soft: #fdf4e3;
  --danger: #b42318;
  --danger-soft: #fdf0ef;
  --info: #2b56a0;
  --info-soft: #edf2fb;
  --r-control: 9px;
  --r-panel: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabular { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Faixa que deixa claro que é uma demonstração */
.demo-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 16px; background: var(--ink); color: #fff; font-size: 12.5px;
}
.demo-bar b { font-weight: 600; }
.demo-bar button { border: 1px solid rgba(255,255,255,.28); background: transparent; color: #fff; border-radius: 7px; padding: 3px 10px; font-size: 12.5px; }
.demo-bar button:hover { background: rgba(255,255,255,.1); }

/* Moldura do painel: barra lateral + conteúdo */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 34px); }
.side { border-right: 1px solid var(--line); background: var(--bg); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.side__brand { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 4px 8px 14px; }
.side__brand svg { width: 22px; height: 22px; }
.side__company { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }
.side__company small { display: block; color: var(--ink-3); font-size: 11.5px; }
.side__label { font-size: 12px; color: var(--ink-3); padding: 10px 8px 4px; }
.side a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
.side a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 550; box-shadow: 0 0 0 1px var(--line); }
.side a svg { width: 17px; height: 17px; color: var(--ink-3); }
.side a[aria-current="page"] svg { color: var(--accent); }

.main { padding: 22px 26px 40px; min-width: 0; }
.tool-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tool-head__icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.tool-head__icon svg { width: 20px; height: 20px; }
.tool-head p { margin: 0; }
.tool-head .t { font-weight: 600; line-height: 1.2; }
.tool-head .s { font-size: 13.5px; color: var(--ink-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
.tabs button { border: 0; background: none; padding: 9px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--ink-2); white-space: nowrap; font-size: 14.5px; }
.tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--ink); font-weight: 550; }
[role="tabpanel"][hidden] { display: none; }

/* Superfícies */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.panel__head h2, .panel__head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel__head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.panel__body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 13px 16px; }
.stat p { margin: 0; }
.stat .l { font-size: 13.5px; color: var(--ink-2); }
.stat .v { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .h { font-size: 12px; color: var(--ink-3); }
.v.accent { color: var(--accent); } .v.warn { color: var(--warn); } .v.danger { color: var(--danger); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .s { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows button.rowbtn { all: unset; display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer; }

/* Controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: var(--r-control); border: 1px solid transparent; background: var(--accent); color: #fff; font-weight: 550; font-size: 14.5px; white-space: nowrap; transition: background-color .15s; }
.btn:hover { background: var(--accent-hover); }
.btn--sm { height: 34px; padding: 0 11px; font-size: 13.5px; }
.btn--lg { height: 46px; padding: 0 18px; font-size: 15.5px; }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--sunken); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--sunken); color: var(--ink); }
.btn--danger { background: var(--surface); color: var(--danger); border-color: rgba(180,35,24,.3); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field .lbl { font-size: 13.5px; font-weight: 550; }
.control { width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); padding: 0 11px; }
textarea.control { height: auto; padding: 9px 11px; resize: vertical; }
.control:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--sunken); }
.seg button { border: 0; background: none; border-radius: 9px; height: 38px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { border: 0; border-radius: 999px; padding: 6px 13px; font-size: 13.5px; background: transparent; color: var(--ink-2); }
.chips button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chips button:hover:not([aria-pressed="true"]) { background: var(--sunken); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 550; line-height: 20px; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge--accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }

.notice { border-radius: var(--r-panel); padding: 11px 15px; font-size: 14px; border: 1px solid; }
.notice--info { background: var(--info-soft); color: var(--info); border-color: rgba(43,86,160,.18); }
.notice--warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(147,86,10,.22); }
.notice--accent { background: var(--accent-soft); color: var(--accent-ink); border-color: rgba(11,110,95,.18); }

.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-2); font-size: 14px; }
.right { text-align: right; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.hint { font-size: 12.5px; color: var(--ink-3); }

/* Toast: confirma o que mudou depois de cada ação */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: min(440px, calc(100vw - 32px)); transition: opacity .2s, transform .3s var(--ease); pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Diálogo */
dialog { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 0; width: min(30rem, calc(100vw - 2rem)); color: var(--ink); box-shadow: 0 20px 50px rgba(23,32,51,.18); }
dialog::backdrop { background: rgba(23,32,51,.4); }
dialog header { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
dialog header h3 { margin: 0; font-size: 16px; }
dialog header p { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }
dialog .body { padding: 16px 18px; }
dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.x { border: 0; background: none; width: 34px; height: 34px; border-radius: 8px; color: var(--ink-3); display: grid; place-items: center; }
.x:hover { background: var(--sunken); color: var(--ink); }

.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 14px 32px; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .split { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .form-row { grid-template-columns: 1fr; }
  .demo-bar span.long { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
