/* Project Revelare: single shared stylesheet. Design tokens live in :root. Pages must not add inline styles. */
:root {
  --bg: #0b1220; --bg-elev: #111a2e; --bg-card: #152038; --bg-input: #0e1729;
  --border: #24324f; --border-strong: #33456b;
  --text: #e6ebf5; --text-muted: #9aa8c3; --text-dim: #6f7f9e;
  --brand: #3b82f6; --brand-hover: #2563eb; --brand-ink: #ffffff;
  --ok: #22c55e; --warn: #f59e0b; --danger: #ef4444; --info: #38bdf8;
  --warn-bg: #3a2708; --warn-border: #7c5410; --danger-bg: #3b1116; --ok-bg: #0d2e1b; --info-bg: #0b2a3d;
  --radius: 10px; --radius-sm: 6px; --gap: 16px; --maxw: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: #7fb0ff; text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; } h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; } code, pre, .mono { font-family: var(--mono); font-size: .9em; }
pre { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow: auto; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); } .dim { color: var(--text-dim); } .small { font-size: .875rem; } .center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header + nav */
.site-header { background: var(--bg-elev); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand:hover { text-decoration: none; } .brand img { width: 32px; height: 32px; border-radius: 6px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--text-muted); padding: 8px 10px; border-radius: var(--radius-sm); font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--bg-card); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--bg-card); }
.user-area { display: flex; align-items: center; gap: 8px; min-width: 150px; justify-content: flex-end; }
.user-name { color: var(--text-muted); font-size: .9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 6px 10px; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; margin-left: auto; }
  .site-header .container { flex-wrap: wrap; }
  .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; padding-bottom: 10px; }
  .nav.open { display: flex; }
  .user-area { order: 2; min-width: 0; }
}

/* Disclaimer banner + breadcrumbs */
.disclaimer { background: var(--warn-bg); border-bottom: 1px solid var(--warn-border); color: #fde6b8; font-size: .875rem; }
.disclaimer .container { padding-top: 8px; padding-bottom: 8px; }
.disclaimer strong { color: #fcd34d; }
.breadcrumbs { border-bottom: 1px solid var(--border); background: var(--bg); font-size: .875rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 10px 0; }
.breadcrumbs li { color: var(--text-muted); } .breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--text-dim); }
.breadcrumbs li[aria-current="page"] { color: var(--text); font-weight: 600; }

/* Main + footer */
main { flex: 1; padding: 28px 0 40px; }
.page-head { margin-bottom: 20px; } .page-head p { color: var(--text-muted); max-width: 760px; }
.site-footer { border-top: 1px solid var(--border); background: var(--bg-elev); color: var(--text-muted); font-size: .875rem; padding: 24px 0; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px 28px; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; } .site-footer a { color: var(--text-muted); }

/* Layout helpers */
.grid { display: grid; gap: var(--gap); } .grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } .grid-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stack > * + * { margin-top: var(--gap); } .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .spacer { flex: 1; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
a.card { display: block; color: var(--text); transition: border-color .15s; } a.card:hover { border-color: var(--brand); text-decoration: none; }
.card .card-meta { color: var(--text-muted); font-size: .9rem; margin: 0; }
.tool-card .tag { float: right; }
.stat { text-align: left; } .stat .value { font-size: 1.8rem; font-weight: 700; } .stat .label { color: var(--text-muted); font-size: .875rem; }
.hero { padding: 36px 0 20px; } .hero h1 { font-size: 2.4rem; } .hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 720px; }

/* Tags / badges */
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-muted); vertical-align: middle; }
.tag-ok { color: #86efac; border-color: #166534; } .tag-warn { color: #fcd34d; border-color: var(--warn-border); } .tag-danger { color: #fca5a5; border-color: #7f1d1d; } .tag-info { color: #7dd3fc; border-color: #075985; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .95rem; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--brand); text-decoration: none; } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); } .btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; } .btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .85rem; } .btn-lg { padding: 12px 22px; font-size: 1.05rem; } .btn-block { width: 100%; }

/* Forms */
form .field { margin-bottom: 14px; } label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; } .hint { color: var(--text-dim); font-size: .8rem; margin-top: 4px; }
input[type=file] { color: var(--text-muted); } .form-narrow { max-width: 440px; margin: 0 auto; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--text-muted); }
.dropzone.drag { border-color: var(--brand); background: var(--info-bg); }

/* Alerts */
.alert { border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid; font-size: .95rem; margin-bottom: 14px; }
.alert-info { background: var(--info-bg); border-color: #075985; color: #bae6fd; } .alert-ok { background: var(--ok-bg); border-color: #166534; color: #bbf7d0; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: #fde6b8; } .alert-danger { background: var(--danger-bg); border-color: #7f1d1d; color: #fecaca; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; } th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-elev); color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; } td.mono, .break { word-break: break-all; }
.empty { color: var(--text-muted); text-align: center; padding: 24px; }

/* Ad slot (one per page, end of content) */
.ad-slot { margin: 32px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.ad-slot .ad-label { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }

/* Dialog */
dialog { background: var(--bg-card); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 22px; max-width: 520px; width: calc(100% - 40px); }
dialog::backdrop { background: rgba(0,0,0,.6); }

/* Graph (link analysis) */
.graph { width: 100%; height: 460px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); }
.graph text { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }

/* Print (reports) */
@media print {
  .site-header, .disclaimer, .breadcrumbs, .site-footer, .no-print, .ad-slot { display: none !important; }
  body { background: #fff; color: #000; } .card { box-shadow: none; border-color: #ccc; background: #fff; }
  th { background: #eee; color: #000; } a { color: #000; }
}
.section-title { margin: 28px 0 12px; }
.pre-wrap { white-space: pre-wrap; } details summary { cursor: pointer; } details[open] summary { margin-bottom: 10px; }
/* Vertical rhythm for top-level blocks inside main, and inline controls in rows */
main > .container > * + * { margin-top: var(--gap); }
main > .container > .page-head + * { margin-top: 0; }
.row > input[type=search], .row > input[type=text], .row > select { width: auto; flex: 1 1 220px; }
.row > label { margin: 0; }
