/* ============================
   AB Intelligence — global UI
   ============================ */

:root {
  --bg: #0B1018;
  --bg-2: #111827;
  --bg-3: #161E2C;
  --border: #1E293B;
  --border-bright: #2A3A52;
  --text: #E8EEF7;
  --text-dim: #8A9BB4;
  --text-mute: #5A6B82;
  --accent: #14B89A;          /* AB emerald */
  --accent-2: #0FA98D;
  --accent-soft: #14B89A22;
  --warn: #E0B53A;
  --bad: #E5524F;
  --good: #14B89A;
  --shadow: 0 18px 48px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* The HTML `hidden` attribute relies on the UA `display: none`, which loses
   to any explicit `display: flex/grid/etc.` rule (e.g. `.full-center`). The
   rule below restores `hidden` semantics globally — without it, `el.hidden =
   true` on a flex container leaves it visible. Caused 6 May Lino issue:
   login stays on screen after successful auth. */
[hidden] { display: none !important; }

.full-center {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px;
}

/* -------- Logo -------- */
.logo-mark {
  font-family: 'DM Mono', monospace;
  letter-spacing: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.logo-bracket { color: var(--text-mute); }
.logo-trail { color: var(--text); }

/* -------- Login card -------- */
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 44px 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 28px; font-weight: 600; margin: 6px 0 4px; color: var(--text); }
.login-card .sub { font-size: 13px; color: var(--text-dim); margin-bottom: 32px; }

#login-form { display: grid; gap: 14px; text-align: left; }
#login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--text-dim); }
#login-form input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
#login-form input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #0B1018;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  margin-top: 6px;
  transition: background .15s, transform .15s;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.error { color: var(--bad); font-size: 13px; min-height: 16px; margin-top: -4px; }
.footnote { font-size: 11px; color: var(--text-mute); margin-top: 24px; font-family: 'DM Mono', monospace; }

/* -------- Top bar -------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,16,24,.7);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: 'DM Mono', monospace; letter-spacing: 4px; font-size: 13px; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-pill {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #14B89A44;
  padding: 5px 10px;
  border-radius: 6px;
}
.btn-link {
  background: none; border: none; color: var(--text-dim); font-size: 13px;
}
.btn-link:hover { color: var(--text); }

/* -------- Dashboard -------- */
.container { max-width: 1200px; margin: 0 auto; padding: 48px 32px 96px; }
.hero h1 { font-size: 36px; font-weight: 600; margin: 0 0 8px; letter-spacing: -.01em; }
.hero .sub { color: var(--text-dim); font-size: 16px; margin: 0 0 36px; }

.cards {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px 24px;
  display: block;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  background: linear-gradient(135deg, transparent 60%, var(--accent-soft) 100%);
  opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card-icon { font-size: 28px; margin-bottom: 14px; }
.card h2 { font-size: 18px; font-weight: 600; margin: 0 0 8px; color: var(--text); }
.card p { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); margin: 0 0 16px; }
.card-meta {
  font-size: 11px; font-family: 'DM Mono', monospace;
  color: var(--text-mute); border-top: 1px solid var(--border); padding-top: 10px;
}
.card-hero {
  background: linear-gradient(165deg, var(--bg-2) 0%, #122A22 100%);
  border-color: #14B89A33;
}
.card-hero h2 { color: var(--accent); }

.status-row {
  margin-top: 36px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  display: flex; align-items: center; gap: 8px;
}
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-mute);
}
.status-row .status-dot.ok  { background: var(--good); }
.status-row .status-dot.err { background: var(--bad); }

/* -------- Module page shell -------- */
.module-shell { display: grid; grid-template-columns: 1fr 380px; min-height: calc(100vh - 60px); }
.module-shell-narrow { grid-template-columns: 1fr; }

/* Tablet / narrow window — stack the chat below the main pane. The 380px
   fixed column was cramping iPad-portrait usage and any 720-1024px window. */
@media (max-width: 1100px) {
  .module-shell { grid-template-columns: 1fr; }
  .module-aside { border-top: 1px solid var(--border); }
  .chat-panel { min-height: 460px; }
}
.module-main { padding: 36px 32px 96px; max-width: 1100px; }
.module-aside {
  border-left: 1px solid var(--border);
  background: var(--bg-2);
  display: flex; flex-direction: column;
  height: calc(100vh - 60px);
  position: sticky; top: 60px;
}
.module-h1 { font-size: 26px; font-weight: 600; margin: 0 0 6px; }
.module-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 32px; }

/* -------- Drop zone -------- */
.dropzone {
  border: 2px dashed var(--border-bright);
  border-radius: 14px;
  padding: 36px 24px;
  text-align: center;
  background: var(--bg-2);
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent); background: var(--accent-soft);
}
.dropzone .dz-icon { font-size: 32px; margin-bottom: 8px; }
.dropzone .dz-title { font-weight: 600; margin-bottom: 4px; }
.dropzone .dz-sub { font-size: 13px; color: var(--text-dim); }
.dropzone input[type=file] { display: none; }   /* Hide file inputs only — radios (regime/checklist) MUST stay visible */

.dz-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .dz-row { grid-template-columns: 1fr; } }

.demo-cta {
  margin-top: 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* -------- Progress -------- */
.progress-wrap { margin: 24px 0 16px; }
.progress-bar {
  height: 6px; background: var(--bg-3); border-radius: 999px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width .3s; }
.progress-meta {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; font-family: 'DM Mono', monospace; color: var(--text-dim);
}

/* -------- Hero stat banner -------- */
.hero-stat {
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%);
  border: 1px solid #14B89A55;
  border-radius: 14px;
  padding: 22px 26px;
  margin: 24px 0;
  display: flex; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
.hero-stat .big {
  font-size: 32px; font-weight: 700; color: var(--accent); font-family: 'DM Mono', monospace;
}
.hero-stat .label { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.hero-stat .pip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border-bright);
  font-size: 12px; font-family: 'DM Mono', monospace;
}
.pip.ok { color: var(--good); border-color: #14B89A55; }
.pip.warn { color: var(--warn); border-color: #E0B53A55; }
.pip.bad { color: var(--bad); border-color: #E5524F55; }

/* -------- Doc list -------- */
.doc-list { display: grid; gap: 8px; margin-top: 18px; }
.doc-row {
  display: grid;
  grid-template-columns: 24px 1fr 1.4fr auto auto;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.doc-row:hover { border-color: var(--accent); }
.doc-row.ok    { border-left: 3px solid var(--good); }
.doc-row.warn  { border-left: 3px solid var(--warn); }
.doc-row.ko    { border-left: 3px solid var(--bad); }
.doc-row.pending { opacity: .55; }
.doc-row .filename { font-family: 'DM Mono', monospace; color: var(--text-dim); font-size: 12px; }
.doc-row .conceito { color: var(--text); }
.doc-row .timer { font-family: 'DM Mono', monospace; color: var(--text-mute); font-size: 11px; }
.doc-row .status-dot { width: 8px; height: 8px; }
.doc-row .status-dot.ok { background: var(--good); }
.doc-row .status-dot.warn { background: var(--warn); }
.doc-row .status-dot.ko { background: var(--bad); }
.doc-row .status-dot.pending { background: var(--text-mute); }

/* -------- Deep-read view -------- */
.deepread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
@media (max-width: 1100px) { .deepread { grid-template-columns: 1fr; } }
.deepread .pdf-frame {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  height: 720px;
  overflow: hidden;
}
.deepread .pdf-frame iframe {
  width: 100%; height: 100%; border: none; background: white;
}
.deepread .ai-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  height: 720px; overflow-y: auto;
}
.ai-section { margin-bottom: 22px; }
.ai-section h3 { font-size: 12px; font-family: 'DM Mono', monospace;
  letter-spacing: 2px; color: var(--text-mute); margin: 0 0 10px; text-transform: uppercase; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 16px;
  font-size: 13.5px; }
.kv .k { color: var(--text-mute); }
.kv .v { color: var(--text); font-family: 'DM Mono', monospace; }

.checklist { display: grid; gap: 8px; }
.check {
  display: grid; grid-template-columns: 22px 1fr; gap: 10px;
  font-size: 13px; align-items: start;
}
.check .icon { font-family: 'DM Mono', monospace; font-weight: 700; }
.check.ok .icon { color: var(--good); }
.check.warn .icon { color: var(--warn); }
.check.ko .icon { color: var(--bad); }
.check .body .lbl { color: var(--text); font-weight: 500; }
.check .body .nota { color: var(--text-dim); font-size: 12px; line-height: 1.5; margin-top: 2px; }

/* -------- Tables -------- */
.table {
  width: 100%; border-collapse: collapse; margin-top: 18px;
  background: var(--bg-2); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
}
.table th, .table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.table th { color: var(--text-mute); font-weight: 600; font-size: 12px;
  background: var(--bg-3); text-transform: uppercase; letter-spacing: 1px; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-family: 'DM Mono', monospace; }
.table .delta-bad { color: var(--bad); }
.table .delta-warn { color: var(--warn); }
.table .delta-ok { color: var(--good); }

/* -------- Chat panel -------- */
.chat-panel { display: flex; flex-direction: column; height: 100%; }
.chat-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.chat-head .agent-pill {
  font-size: 11px; font-family: 'DM Mono', monospace;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 6px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { font-size: 13.5px; line-height: 1.55; }
.chat-msg.user { color: var(--text-dim); }
.chat-msg.agent { color: var(--text); }
.chat-msg.agent strong { color: var(--accent); }
.chat-msg .arrow-action {
  display: block; margin-top: 6px;
  background: var(--bg-3); border: 1px solid var(--border-bright);
  border-radius: 8px; padding: 8px 12px; font-size: 12.5px;
  color: var(--accent); cursor: pointer;
}
.chat-msg .arrow-action:hover { border-color: var(--accent); }
.chat-suggestions {
  border-top: 1px solid var(--border);
  padding: 10px 14px 4px 14px;
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 130px; overflow-y: auto;
}
.chat-suggestions .chat-chip {
  background: var(--bg-3); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 11px; font-size: 11.5px; line-height: 1.3;
  cursor: pointer; text-align: left;
  transition: border-color .12s, color .12s, background .12s;
  max-width: 100%;
}
.chat-suggestions .chat-chip:hover {
  border-color: var(--accent); color: var(--text); background: var(--bg-2);
}
.chat-input {
  border-top: 1px solid var(--border); padding: 14px 16px;
  display: flex; gap: 8px;
}
.chat-input input {
  flex: 1; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 13px;
}
.chat-input input:focus { outline: none; border-color: var(--accent); }
.chat-input button {
  background: var(--accent); color: #0B1018; border: none;
  border-radius: 8px; padding: 0 14px; font-weight: 600; font-size: 13px;
}

/* -------- Server-tree -------- */
.tree-row {
  display: grid; grid-template-columns: 18px 1fr auto;
  gap: 10px; padding: 9px 12px; cursor: pointer;
  border-radius: 8px;
  font-size: 13.5px;
  align-items: center;
}
.tree-row:hover { background: var(--bg-3); }
.tree-row .ico { font-family: 'DM Mono', monospace; color: var(--text-mute); }
.tree-row.dir .name { color: var(--text); font-weight: 500; }
.tree-row.file .name { color: var(--text-dim); font-family: 'DM Mono', monospace; font-size: 12.5px; }
.tree-row .size { font-family: 'DM Mono', monospace; color: var(--text-mute); font-size: 11px; }

/* -------- Misc -------- */
.section { margin: 30px 0 6px; }
.section h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.section .desc { font-size: 13px; color: var(--text-dim); margin: 0; }
.muted { color: var(--text-mute); }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* First-visit nudge banner — "comece por aqui" hint on the dashboard */
.first-tip {
  position: relative;
  margin: -8px 0 24px;
  padding: 14px 44px 14px 18px;
  background: linear-gradient(135deg, rgba(20, 184, 154, 0.15), rgba(15, 169, 141, 0.08));
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.first-tip strong { color: var(--accent); }
.first-tip em { color: var(--text); font-style: normal; background: rgba(255,255,255,.05); padding: 1px 6px; border-radius: 4px; }
.first-tip-close {
  position: absolute;
  top: 6px; right: 8px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.first-tip-close:hover { color: var(--text); background: rgba(255,255,255,.05); }
