*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3e;
  --text: #e2e8f0;
  --muted: #64748b;
  /* #Fase1.5.4: cor de marca JavAnd (teal), antes era roxo #6366f1 */
  --accent: #2abfbf;
  --accent-hover: #0d8a8a;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 8px;
  --font: 'Inter', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.6; }

/* NAV */
.nav { display: flex; align-items: center; gap: 2rem; padding: 0 2rem; height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-brand { font-weight: 700; font-size: 16px; color: var(--accent); }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color .15s; }
.nav-links a:hover { color: var(--text); }

/* LAYOUT */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 22px; }
.actions { display: flex; gap: .5rem; align-items: center; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.stat-card--warn { border-color: var(--warn); }
.stat-card--info { border-color: var(--info); }
.stat-value { font-size: 32px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-top: .25rem; }

/* TABLE */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.table th { background: #12141f; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: .75rem 1rem; text-align: left; }
.table td { padding: .75rem 1rem; border-top: 1px solid var(--border); }
.table tr:hover td { background: #1f2235; }
.table a { color: var(--accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 1rem 0; }

/* BADGE */
.badge { display: inline-block; padding: .2em .6em; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge--ok { background: #14532d; color: var(--ok); }
.badge--danger { background: #450a0a; color: var(--danger); }
.badge--warn { background: #451a03; color: var(--warn); }
.badge--standard { background: #1e3a5f; color: #60a5fa; }
.badge--pro { background: #2e1065; color: #a78bfa; }
.badge--enterprise { background: #064e3b; color: #34d399; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; text-decoration: none; transition: background .15s; }
.btn:hover { background: #2a2d3e; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--danger { background: #450a0a; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: #7f1d1d; }
.btn--sm { padding: .25rem .6rem; font-size: 12px; }

/* ALERT */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: #14532d; color: var(--ok); border: 1px solid var(--ok); }
.alert-error { background: #450a0a; color: var(--danger); border: 1px solid var(--danger); }

/* FILTER BAR */
.filter-bar { display: flex; gap: .75rem; margin-bottom: 1rem; }
.filter-bar input, .filter-bar select { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .4rem .75rem; font-size: 13px; }
.total-count { color: var(--muted); font-size: 12px; margin-bottom: .75rem; }

/* PAGINATION */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }

/* DETAIL */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.detail-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.detail-section h2 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1rem; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: .5rem .75rem; }
dt { color: var(--muted); font-size: 12px; }
dd code { font-size: 11px; background: #12141f; padding: .1em .4em; border-radius: 3px; word-break: break-all; }

/* KEY BOX */
.key-box { display: flex; align-items: flex-start; gap: .75rem; background: #12141f; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.key-box code { word-break: break-all; flex: 1; font-size: 12px; line-height: 1.8; }

/* FORM */
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 800px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
legend { padding: 0 .5rem; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: .75rem; }
.form-group { margin-bottom: .75rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: 13px; color: var(--muted); }
input, select, textarea { background: #12141f; border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .45rem .75rem; font-size: 13px; font-family: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }

code { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
h1 { font-size: 20px; margin-bottom: 1rem; }
h2 { font-size: 16px; margin-bottom: .75rem; }
small { color: var(--muted); }

/* ── #Fase1.5: catálogo de módulos (checkboxes) nos forms de licença ──
   O label global é flex-column e o input width:100% — sem estas overrides,
   cada checkbox ficava numa linha própria, desalinhado do texto. */
.checks { display: flex; flex-direction: column; gap: .5rem; margin-top: .4rem; }
.check-item { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); font-size: 13px; cursor: pointer; }
.check-item input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; accent-color: #2abfbf; }
.check-item code { background: rgba(255,255,255,.07); padding: 1px 6px; border-radius: 4px; color: var(--muted); font-size: 12px; }
.check-item small { color: var(--muted); }

/* #Fase1.5.3: cartões de estatística lado a lado (o .stats-row faltava —
   sem ele os .stat-card empilhavam em coluna a ocupar o ecrã todo). */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
