:root {
    --bg: #fafaf9;
    --ink: #0c0a09;
    --accent: #fef08a;
    --line: #0c0a09;
}

* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

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

a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

header.app-header {
    background: var(--ink);
    color: white;
    padding: 12px 24px;
}

header.app-header a {
    color: white;
    font-size: 18px;
    font-weight: 700;
}

main {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
}

.sidebar {
    border: 2px solid var(--line);
    background: white;
    padding: 16px;
}

.sidebar h3 {
    margin: 0 0 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar fieldset {
    border: none;
    padding: 0;
    margin: 0 0 14px;
}

.sidebar legend {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 0;
    margin-bottom: 6px;
}

.sidebar label {
    display: block;
    font-size: 13px;
    padding: 2px 0;
}

.sidebar input[type="checkbox"] {
    margin-right: 6px;
}

.form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.form-actions button {
    background: var(--ink);
    color: white;
    border: 2px solid var(--ink);
    padding: 6px 14px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
}

.form-actions a {
    font-size: 13px;
}

.results h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.fetch-panel { background: #fdfaf5; }
.fetch-row {
    display: flex; gap: 14px; flex-wrap: wrap;
    align-items: center; margin: 0 0 12px;
    font-size: 13.5px;
}
.fetch-strategy {
    font-family: monospace; font-size: 12px;
    background: rgba(107, 44, 44, 0.07); color: #6b2c2c;
    padding: 2px 8px; border-radius: 2px;
    text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em;
}
.fetch-status {
    font-size: 13px; font-weight: 600;
}
.fetch-status.on { color: #2f5d3c; }
.fetch-status.off { color: #8a2222; }
.fetch-freq, .fetch-lang { color: #5a5853; font-size: 13px; }
.fetch-endpoints {
    list-style: none; padding: 0; margin: 8px 0 12px;
    font-size: 13px;
}
.fetch-endpoints li {
    padding: 4px 0;
}
.fetch-endpoints code {
    font-family: monospace; font-size: 11.5px;
    background: rgba(107, 44, 44, 0.05); padding: 2px 6px;
    border-radius: 2px; word-break: break-all;
}
.fetch-endpoints .ep-tag {
    color: #5a5853; font-size: 11.5px; margin-left: 8px;
}
.fetch-note { font-size: 13px; color: #5a5853; margin: 4px 0; }
.fetch-toggle-form { margin-top: 12px; }
.fetch-toggle {
    background: transparent; border: 1px solid #d8d2c8;
    color: #1a1d23; padding: 6px 14px;
    font-family: inherit; font-size: 13px; font-weight: 600;
    border-radius: 2px; cursor: pointer;
    letter-spacing: 0.03em;
}
.fetch-toggle:hover { border-color: #6b2c2c; color: #6b2c2c; }

.results-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}
.results-header h2 { margin: 0; }
.page-nav {
    display: flex;
    gap: 18px;
    font-size: 13px;
}
.page-nav a {
    color: var(--accent, #6b2c2c);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.page-nav a:hover { border-bottom-color: currentColor; }

.sender-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 2px solid var(--line);
    background: white;
}

.sender-row {
    border-bottom: 2px solid var(--line);
}

.sender-row:last-child {
    border-bottom: none;
}

.sender-row a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
}

.sender-row a:hover {
    background: var(--accent);
}

.sender-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.sender-name {
    font-size: 16px;
    font-weight: 700;
}

.sender-fullname {
    font-size: 12px;
    opacity: 0.7;
    display: block;
    margin-top: 2px;
}

.star {
    color: var(--ink);
    font-size: 18px;
}

.sender-meta {
    font-size: 12px;
    margin-top: 2px;
    opacity: 0.7;
}

.sender-mandate {
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.4;
}

.empty {
    padding: 24px;
    text-align: center;
    border: 2px dashed var(--line);
    background: white;
}

.source {
    background: var(--bg);
    border: 2px solid var(--line);
    padding: 28px;
}

.source-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.source-tagline {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.source h1 {
    font-size: 30px;
    margin: 6px 0 8px;
    line-height: 1.1;
}

.source-sub {
    font-size: 14px;
    font-weight: 500;
}

.marking {
    background: var(--accent);
    border: 2px solid var(--line);
    padding: 14px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.marking-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.marking-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.marking-toggle input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.marking textarea {
    font-size: 13px;
    padding: 8px;
    border: 2px solid var(--line);
    resize: vertical;
    min-height: 64px;
    font-family: inherit;
    background: white;
}

.marking button {
    background: var(--ink);
    color: white;
    border: 2px solid var(--ink);
    padding: 6px 14px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    align-self: flex-start;
}

.marking-saved {
    font-size: 12px;
    font-weight: 700;
    align-self: flex-start;
}

.panel {
    background: white;
    border: 2px solid var(--line);
    padding: 16px;
    margin-bottom: 14px;
}

.panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 10px;
}

.panel p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: var(--ink);
    color: white;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

.pub-row {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    margin: 0 -12px;
    align-items: center;
}

.pub-row:last-child {
    border-bottom: none;
}

.pub-info {
    flex: 1;
}

.pub-title {
    font-size: 14px;
    font-weight: 600;
}

.pub-type {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 400;
}

.pub-row-link {
    text-decoration: none;
    color: var(--ink);
    cursor: pointer;
}

.pub-row-link:hover {
    background: var(--accent);
    text-decoration: none;
}

.pub-arrow {
    font-size: 16px;
    font-weight: 700;
}

.footer-meta {
    background: var(--ink);
    color: white;
    padding: 12px 16px;
    display: flex;
    gap: 20px;
    font-size: 13px;
}

.footer-meta .accent {
    color: var(--accent);
}

.footer-link {
    color: white;
}

.back-link {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    opacity: 0.7;
    margin-bottom: 24px;
    padding: 4px 0;
}
.back-link:hover { opacity: 1; text-decoration: underline; }
