:root {
    /* Brand design system — values from certcontrol.css (source of truth). */
    --bg: #070c12;
    --bg2: #0b1219;
    --bg-soft: #0b1219;
    --bg3: #0f1a24;
    --panel: #0f1a24;
    --panel-2: #13202c;
    --border: rgba(255, 255, 255, .08);
    --border2: rgba(255, 255, 255, .14);
    --text: #e8f0f8;
    --muted: #8aa0b8;
    --accent: #3b82f6;
    --accent-2: #60a5fa;
    --radius: 9px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);

    /* Brand fonts (loaded via Google Fonts in each page head) */
    --display: 'Schibsted Grotesk', sans-serif;
    --body: 'Hanken Grotesk', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;

    --g-aplus: #16a34a;
    --g-a: #22c55e;
    --g-aminus: #65a30d;
    --g-b: #a3a30d;
    --g-c: #d97706;
    --g-d: #ea580c;
    --g-e: #dc2626;
    --g-f: #b91c1c;
    --g-t: #7c3aed;
    --g-m: #6b7280;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--body);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    background: radial-gradient(1200px 600px at 50% -10%, #0f1a24 0%, var(--bg) 55%) no-repeat var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3, h4 { font-family: var(--display); }
.eyebrow, .grade-badge,
.scan-form button, .decode-form button, .cta-btn, .btn-ghost, .stat-num { font-family: var(--display); }
.mono, .g-track, .legal-code, code { font-family: var(--mono); }

/* Header, nav, footer + base tokens come from the shared certcontrol.css,
   loaded before this file. Only tool-specific styles live here. */

main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 66px 20px 60px; }

.hero { text-align: center; padding: 56px 0 28px; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); margin: 0 0 14px; letter-spacing: -.5px; }
.lede { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto 28px; }

.scan-form { display: flex; gap: 10px; max-width: 560px; margin: 0 auto; }
.scan-form input {
    flex: 1; padding: 15px 18px; font-size: 16px; color: var(--text);
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    outline: none;
}
.scan-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, .25); }
.scan-form button {
    padding: 0 26px; font-size: 16px; font-weight: 700; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #2563eb);
    border: 0; border-radius: var(--radius);
}
.scan-form button:disabled { opacity: .6; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.run-count { color: var(--accent-2); font-size: 13px; font-weight: 600; margin-top: 6px; letter-spacing: .3px; }

/* Certificate decoder */
.decode-form { display: flex; flex-direction: column; gap: 10px; max-width: 720px; margin: 0 auto; }
.decode-form textarea {
    width: 100%; padding: 14px 16px; font-size: 13px; color: var(--text);
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    outline: none; resize: vertical; font-family: "JetBrains Mono", ui-monospace, monospace;
}
.decode-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.decode-form button {
    align-self: center; padding: 13px 32px; font-size: 16px; font-weight: 700; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #2563eb); border: 0; border-radius: var(--radius);
}
.decode-form button:disabled { opacity: .6; cursor: not-allowed; }
.hint code, .tool-content code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.muted { color: var(--muted); }
.tool-content { max-width: 760px; margin: 28px auto 0; }
.tool-content h2 { font-size: 20px; margin: 0 0 10px; }
.tool-content p { color: var(--muted); line-height: 1.65; }
.tool-content .faq { margin-top: 16px; }
.tool-content details { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; background: var(--panel); }
.tool-content summary { cursor: pointer; font-weight: 600; }
.tool-content details p { margin: 10px 0 0; }
.related-tools { margin-top: 20px; font-size: 14px; }
.related-tools a { color: var(--accent-2); }
.tool-hint { color: var(--muted); font-size: 13px; margin-top: 10px; }
.tool-hint a { color: var(--accent-2); }

.scanstatus { text-align: center; padding: 30px 0; color: var(--muted); }
.spinner {
    width: 38px; height: 38px; border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; margin: 0 auto 14px; animation: spin 1s linear infinite;
}
.scanstatus.error { color: #fca5a5; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.result { margin-top: 14px; }
.grade-card {
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
.grade-badge {
    width: 110px; height: 110px; border-radius: 22px; display: grid; place-items: center;
    font-size: 46px; font-weight: 800; color: #fff; flex: 0 0 auto;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .12);
}
.grade-meta { flex: 1; min-width: 220px; }
.grade-meta .host { font-size: 22px; font-weight: 700; word-break: break-all; }
.grade-meta .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.grade-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn-ghost {
    background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 10px; padding: 9px 14px; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn-ghost:hover { border-color: var(--accent); }

.bars { margin-top: 18px; display: grid; gap: 12px; }
.bar-row { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.bar-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.bar-head .label { color: var(--muted); }
.bar-head .val { font-weight: 700; }
.bar-track { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

.notes { margin-top: 18px; display: grid; gap: 10px; }
.note { border-radius: 10px; padding: 12px 16px; font-size: 14px; border: 1px solid var(--border); }
.note.cap { background: rgba(220, 38, 38, .12); border-color: rgba(220, 38, 38, .35); }
.note.warn { background: rgba(217, 119, 6, .12); border-color: rgba(217, 119, 6, .35); }
.note .tag { font-weight: 700; margin-right: 6px; }

.panel-grid { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.detail-panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .5px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; word-break: break-word; }
.ok { color: #4ade80; }
.bad { color: #f87171; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); margin: 2px 4px 2px 0; }

.cipher-panel { margin-top: 14px; }
.cipher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .cipher-grid { grid-template-columns: 1fr; } }

.chain-panel { margin-top: 14px; }
.chain-list { list-style: none; margin: 0; padding: 0; }
.chain-cert { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.chain-cert:last-child { border-bottom: 0; }
.chain-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chain-cn { font-weight: 600; font-size: 14px; word-break: break-all; }
.chain-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.chain-fp { font-family: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, monospace; font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 4px; }
.role { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.role-leaf { color: var(--accent-2); border-color: var(--accent-2); }
.role-intermediate { color: var(--muted); }
.role-root { color: #4ade80; border-color: rgba(74, 222, 128, .5); }

.cta-box {
    margin-top: 28px; text-align: center; padding: 30px 24px;
    background: linear-gradient(135deg, var(--panel-2), var(--panel));
    border: 1px solid var(--border); border-radius: var(--radius);
}
.cta-box h2 { margin: 0 0 10px; font-size: 22px; }
.cta-box h2 em { color: var(--accent-2); font-style: normal; }
.cta-box p { color: var(--muted); max-width: 560px; margin: 0 auto 20px; }
.cta-btn {
    display: inline-block; padding: 13px 28px; font-weight: 700; color: #fff; text-decoration: none;
    background: linear-gradient(135deg, var(--accent), #2563eb); border-radius: var(--radius);
}
.cta-watch { margin: 16px 0 0; font-size: 13px; }
.cta-watch a { color: var(--muted); }
.cta-watch a:hover { color: var(--accent-2); }
/* Footer styles come from the shared certcontrol.css. */

/* Legal / terms page */
.legal { max-width: 760px; margin: 8px auto 0; }
.legal h1 { font-size: 30px; margin: 10px 0 4px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; color: var(--text); }
.legal p, .legal li { color: var(--muted); line-height: 1.65; }
.legal a { color: var(--accent-2); }
.legal-updated { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.legal ul { padding-left: 20px; }
.legal-code {
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; overflow-x: auto; color: var(--text);
    font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px;
}
.legal-footer { margin-top: 32px; font-size: 13px; }

/* Stats page */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stats-promo { color: var(--muted); font-size: 14px; margin-top: -6px; }
.stats-promo a { color: var(--accent-2); }
.stat-num { font-size: 30px; font-weight: 800; color: var(--text); }
.stat-lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.g-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; font-size: 14px; }
.g-lab { width: 28px; font-weight: 700; }
.g-track { flex: 1; height: 10px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.g-fill { height: 100%; border-radius: 999px; }
.g-cnt { width: 64px; text-align: right; color: var(--muted); }
.daily-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 6px; }
.d-bar { flex: 1; background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 2px 2px 0 0; min-height: 2px; }
.hint a { color: var(--accent-2); }

@media (max-width: 600px) {
    .panel-grid { grid-template-columns: 1fr; }
    .scan-form { flex-direction: column; }
    .grade-card { justify-content: center; text-align: center; }
}
