:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1d2330;
    --muted: #68707f;
    --accent: #0f4c81;
    --accent-dark: #0b3a63;
    --ok: #1c7c43;
    --ko: #b02a2a;
    --border: #dde1e7;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }

header { background: var(--accent); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.brand { font-weight: 600; letter-spacing: 0.4px; }
header nav { display: flex; align-items: center; gap: 12px; }
header .user { opacity: 0.85; margin-left: 12px; }
header .tab {
    color: #fff;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    opacity: 0.85;
}
header .tab:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
header .tab.active { opacity: 1; background: rgba(255, 255, 255, 0.2); font-weight: 600; }

/* Rules page */
.lead { margin-bottom: 18px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 20px; font-size: 0.95rem; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
.tag {
    display: inline-block;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    white-space: nowrap;
    color: #fff;
    background: var(--muted);
}
.tag.onenote { background: var(--accent); }
.tag.drawing { background: var(--ok); }
.tag.convention { background: #8a6d1f; }
.card ul { padding-left: 20px; }
.card li { margin-bottom: 6px; }
.card td { vertical-align: top; }

main { padding: 28px 16px 48px; }

h1 { font-size: 1.5rem; margin: 0 0 20px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.card.narrow { max-width: 420px; margin: 48px auto; }

label { display: block; margin: 12px 0 4px; font-weight: 500; }
input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

button.primary, a.button.primary {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}
button.primary:hover, a.button.primary:hover { background: var(--accent-dark); }

.link-button {
    background: none;
    border: none;
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
}
.inline-form { display: inline; }

.badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.85rem;
}
.badge.ok { background: var(--ok); }
.badge.ko { background: var(--ko); }

.error { color: var(--ko); }
.muted { color: var(--muted); }

code {
    background: #eef1f5;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }

/* run reports */
.badge.later { background: #b7791f; }
table.dense th, table.dense td { padding: 3px 8px; font-size: 0.88rem; }
pre.journal {
    background: #f6f8fa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.82rem;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre;
}
.line.check { background: #fff3cd; color: #7a5200; font-weight: 600; }
.line.failed { background: #fde2e1; color: #a12622; font-weight: 600; }
.line.rule { color: #1f5fbf; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } }

/* Wide pages (admin lists, benchmark) */
.container.wide { max-width: 1180px; }
.muted { color: var(--muted); }
.error { color: var(--ko); font-weight: 600; }
.notice { background: #e8f3ec; border: 1px solid #b9dcc5; color: var(--ok); padding: 10px 14px; border-radius: 6px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.list th, table.list td, .doc th, .doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th, .doc th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
table.facts th { text-align: left; padding: 4px 16px 4px 0; color: var(--muted); font-weight: 500; white-space: nowrap; }
table.facts td { padding: 4px 0; }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.92em; }

/* Admin forms */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 20px; }
.grid-form .full, .grid-form fieldset { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 12px 0 0; padding: 8px 14px 12px; }
legend { font-weight: 500; padding: 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 6px 0; }
label.check input { width: auto; }
.danger-zone { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 4px; }
button.danger { margin-top: 12px; padding: 10px 18px; background: var(--ko); color: #fff; border: none; border-radius: 6px; font-size: 1rem; cursor: pointer; }
button.small { padding: 4px 10px; font-size: 0.85rem; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; }

/* Documentation and benchmark */
.doc-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.doc-menu a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--accent); text-decoration: none; font-size: 0.95rem; }
.doc-menu a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.doc h1 { font-size: 1.4rem; }
.doc h2 { font-size: 1.15rem; margin: 28px 0 10px; }
.doc h3 { font-size: 1rem; margin: 20px 0 8px; }
.doc p, .doc li { max-width: 78ch; }
.doc img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.doc figure { margin: 16px 0; }
.doc figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.doc table { margin: 12px 0; font-size: 0.92rem; }
.doc pre { background: var(--bg); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.doc .formula { font-weight: 600; background: var(--bg); padding: 10px 14px; border-radius: 6px; }
