@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

/* ─── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  /* Backgrounds — zinc scale, predominante */
  --bg:          #18181b;
  --bg-panel:    #1f1f23;
  --bg-card:     #27272a;
  --bg-input:    #3f3f46;
  --bg-hover:    rgba(255,255,255,0.04);
  --bg-hover-md: rgba(255,255,255,0.07);

  /* Borders — neutros */
  --border:    rgba(255,255,255,0.07);
  --border-md: rgba(255,255,255,0.12);
  --border-hi: rgba(255,255,255,0.20);

  /* Texto */
  --text:   #fafafa;
  --text-2: #e4e4e7;
  --text-3: #a1a1aa;
  --text-4: #71717a;
  --text-5: #52525b;

  /* Acento verde — usado em exatamente 4 pontos */
  --accent:      #22c55e;
  --accent-dim:  rgba(34,197,94,0.12);
  --accent-ring: rgba(34,197,94,0.20);

  /* Status semânticos — só em badges */
  --s-ok-bg:    rgba(74,222,128,0.08);
  --s-ok-txt:   #4ade80;
  --s-ok-bdr:   rgba(74,222,128,0.20);

  --s-info-bg:  rgba(96,165,250,0.08);
  --s-info-txt: #60a5fa;
  --s-info-bdr: rgba(96,165,250,0.20);

  --s-warn-bg:  rgba(251,146,60,0.08);
  --s-warn-txt: #fb923c;
  --s-warn-bdr: rgba(251,146,60,0.20);

  --s-err-bg:   rgba(248,113,113,0.08);
  --s-err-txt:  #f87171;
  --s-err-bdr:  rgba(248,113,113,0.20);

  /* Layout */
  --sidebar-w: 220px;
}

/* ─── BASE ─────────────────────────────────────────────────── */
html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* gradiente sutil de profundidade no fundo */
  background-image: radial-gradient(ellipse 80% 50% at 110% 0%, rgba(34,197,94,0.04) 0%, transparent 60%);
}

a { color: var(--text-2); text-decoration: none; }
a:hover { color: var(--text); }

button, input, select, textarea { font: inherit; }

code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-hover-md);
  color: var(--text-2);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
  border: 1px solid var(--border-md);
}

/* ─── SCROLLBAR — ponto verde nº 4 ────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(34,197,94,0.25); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(34,197,94,0.4); }

/* ─── SHELL ────────────────────────────────────────────────── */
.page-shell { display: flex; min-height: 100vh; }

/* ─── SIDEBAR — fixo, destoa do cinza ─────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1.25rem 0.875rem 1rem;
  /* near-black com leve matiz frio — destoa claramente do --bg */
  background: #0d0d10;
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 50;
  /* linha de acento verde no topo */
  box-shadow: inset 0 1px 0 rgba(34,197,94,0.25);
}

/* brand */
.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.125rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 1rem;
  width: 100%;
}

.brand-icon {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.brand-copy { display: flex; flex-direction: column; gap: 2px; }

.brand-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.brand-copy span {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-5);
  white-space: nowrap;
}

/* separador de seção nav */
.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-5);
  padding: 0 0.5rem;
  margin: 0.5rem 0 0.25rem;
}

/* nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.625rem;
  border-radius: 8px;
  color: var(--text-4);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  width: 100%;
}

.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
}

/* item ativo */
.nav-link.is-active {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: rgba(255,255,255,0.08);
}

/* barra verde lateral — ponto verde nº 1 */
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.75;
}

.nav-link.is-active .nav-icon,
.nav-link:hover .nav-icon { opacity: 1; }

.nav-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.nav-copy strong {
  font-size: 12px;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-copy small {
  font-size: 10px;
  color: var(--text-5);
  font-weight: 400;
  white-space: nowrap;
}

.nav-link.is-active .nav-copy small { color: var(--text-4); }

/* footer */
.sidebar-footer {
  margin-top: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.avatar-dot {
  width: 1.875rem;
  height: 1.875rem;
  flex-shrink: 0;
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}

.user-chip .user-info { min-width: 0; }

.user-chip strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip .muted {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-5);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.625rem;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.06);
  background: transparent;
  color: var(--text-5);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.btn-logout:hover {
  background: var(--s-err-bg);
  border-color: var(--s-err-bdr);
  color: var(--s-err-txt);
}

/* ─── APP FRAME ────────────────────────────────────────────── */
.app-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  /* leve separação do sidebar */
  border-left: 1px solid rgba(255,255,255,0.04);
}

.main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.5rem;
  background: rgba(20,20,23,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-copy { display: flex; flex-direction: column; gap: 2px; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; }

.eyebrow {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-4);
}

.topbar-copy h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar-copy p { display: none; }

/* ─── CONTENT ──────────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.375rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  animation: fadeIn 0.18s ease both;
}

.card:hover {
  border-color: var(--border-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 6px 18px rgba(0,0,0,0.25);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.headline-group { display: flex; flex-direction: column; gap: 4px; }

.headline-group h2,
.title-reset {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.headline-group .eyebrow { color: var(--text-4); }

.headline-group p,
.muted {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ─── FORM ─────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field, .checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label,
.checkbox-field > label:first-child {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}

/* inputs — ponto verde nº 2 (focus ring) */
input:not([type="checkbox"]):not([type="file"]),
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="checkbox"]):not([type="file"])::placeholder,
textarea::placeholder { color: var(--text-5); }

input:not([type="checkbox"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  border-color: rgba(34,197,94,0.4);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

input[type="file"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-input);
  border: 1px dashed var(--border-md);
  border-radius: 7px;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

input[type="file"]:hover { border-color: var(--border-hi); }
input[type="file"]:focus { border-color: rgba(34,197,94,0.4); box-shadow: 0 0 0 3px var(--accent-ring); }

select {
  background-color: var(--bg-input);
  cursor: pointer;
  color: var(--text);
}

select option { background: #27272a; color: var(--text); }

textarea { min-height: 80px; resize: vertical; }

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checkbox-field {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.75rem 0.875rem;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.field-note {
  font-size: 11px;
  color: var(--text-4);
  line-height: 1.5;
}

/* ─── BUTTONS ──────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.actions-spaced { margin-top: 1.125rem; }

/* botão primário — neutro, sem acento colorido */
button[type="submit"],
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--bg-hover-md);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

button[type="submit"]:hover,
.btn-primary:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.25);
  color: var(--text);
}

button[type="submit"]:active,
.btn-primary:active { transform: scale(0.98); }

.button-link,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.875rem;
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.button-link:hover,
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-2);
  border-color: var(--border-md);
}

.button-link.secondary { color: var(--text-3); }
.button-link.secondary:hover { background: var(--bg-hover); color: var(--text-2); }

button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── BADGES ───────────────────────────────────────────────── */
.status, .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  background: var(--s-info-bg);
  color: var(--s-info-txt);
  border: 1px solid var(--s-info-bdr);
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status.active, .status.ok {
  background: var(--s-ok-bg);
  color: var(--s-ok-txt);
  border-color: var(--s-ok-bdr);
}

.pill-row { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.pill-row.spaced-top { margin-top: 0.5rem; }

/* ─── QUEUE LIST ───────────────────────────────────────────── */
.queue-list { display: flex; flex-direction: column; gap: 0.375rem; }

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.queue-item:hover {
  background: var(--bg-hover-md);
  border-color: var(--border-md);
}

.queue-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.queue-item span { font-size: 11px; color: var(--text-3); }

/* ─── MESSAGES ─────────────────────────────────────────────── */
.messages {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.messages li {
  padding: 0.75rem 1rem;
  border-radius: 9px;
  background: var(--s-warn-bg);
  border: 1px solid var(--s-warn-bdr);
  color: var(--s-warn-txt);
  font-size: 13px;
  line-height: 1.6;
}

.hint {
  padding: 0.75rem 1rem;
  border-radius: 9px;
  background: var(--s-info-bg);
  border: 1px solid var(--s-info-bdr);
  color: var(--s-info-txt);
  font-size: 12px;
  line-height: 1.6;
}

.warning { font-size: 11px; font-weight: 600; color: var(--s-err-txt); }

.warning-box {
  padding: 0.75rem 1rem;
  border-radius: 9px;
  background: var(--s-err-bg);
  border: 1px solid var(--s-err-bdr);
  color: var(--s-err-txt);
  font-size: 12px;
}

/* ─── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  padding: 1.375rem;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px dashed var(--border-md);
  color: var(--text-4);
  font-size: 13px;
  text-align: center;
}

/* ─── PRE / LOG ────────────────────────────────────────────── */
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 1rem 1.125rem;
  border-radius: 10px;
  background: #111113;
  color: var(--text-2);
  border: 1px solid var(--border-md);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
  line-height: 1.8;
}

.log-shell { min-height: 280px; max-height: 520px; overflow: auto; }

/* ─── TABLE ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 580px; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 13px;
  color: var(--text-2);
}

th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-4);
  padding-bottom: 9px;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

.table-strong {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

/* ─── METRIC GRID ──────────────────────────────────────────── */
.metric-grid { display: grid; gap: 0.875rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-grid.offset-top { margin-top: 1rem; }

.metric-card {
  padding: 1.125rem;
  border-radius: 11px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.metric-card:hover { border-color: var(--border-md); }

.metric-card strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.metric-card span { font-size: 11px; color: var(--text-3); }

.kicker {
  margin-bottom: 0.625rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-4);
}

/* ─── CONTENT GRID ─────────────────────────────────────────── */
.content-grid { display: grid; gap: 1rem; }
.content-grid.two { grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.9fr); }
.content-grid.detail { grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.85fr); }

/* ─── PROGRESS — ponto verde nº 3 ─────────────────────────── */
.progress-summary { display: grid; gap: 4px; margin-bottom: 0.75rem; }

.progress-track {
  height: 4px;
  border-radius: 9999px;
  background: var(--bg-hover-md);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ─── LISTS ────────────────────────────────────────────────── */
ul.plain-list,
.artifact-list, .feature-list, .module-list,
.checks-list, .insight-list, .stack {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.artifact-list li, .feature-list li,
.module-list li, .checks-list li {
  padding: 0.75rem 0.875rem;
  border-radius: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.artifact-list a { font-weight: 600; color: var(--text); }

/* ─── MODULE PICKER ────────────────────────────────────────── */
.module-picker {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.module-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}

.module-option input { width: auto; margin: 0; }

/* ─── AUTH ─────────────────────────────────────────────────── */
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-layout-single {
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-card p {
  margin: 0 0 1.375rem;
  font-size: 13px;
  color: var(--text-3);
}

.auth-form { display: flex; flex-direction: column; gap: 0.875rem; }

/* ─── MISC ─────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .content-grid.two, .content-grid.detail { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .app-frame { margin-left: 0; border-left: none; }
  .form-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid.two { grid-template-columns: repeat(2, 1fr); }
  .content-area { padding: 1rem; }
}
