/*
 * Minimal server-rendered styling for the implemented management Screens.
 * No framework, no build step (ADR-010). All behaviour works with CSS and JavaScript
 * disabled; this file is presentational only.
 */

:root {
    color-scheme: light dark;
    --edge: #8a8a8a;
    --error: #a3232b;
    --focus: #1a5fb4;
}

* {
    box-sizing: border-box;
}

html {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

body {
    margin: 0;
    padding: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    padding: 0.5rem 1rem;
    background: Canvas;
}

.skip-link:focus {
    left: 0;
    z-index: 10;
}

.app-header {
    border-bottom: 1px solid var(--edge);
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: baseline;
    justify-content: space-between;
}

.app-identity {
    font-weight: 600;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.app-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.app-main {
    padding: 1.5rem 1rem;
}

.panel {
    max-width: 26rem;
    margin: 0 auto;
}

.feed-panel {
    max-width: 52rem;
}

.private-rss-panel {
    max-width: 52rem;
}

.article-panel {
    max-width: 62rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.field input,
.field textarea {
    padding: 0.5rem;
    font-size: 1rem;
    max-width: 100%;
}

.field textarea {
    min-height: 9rem;
    resize: vertical;
}

button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
}

.button-link,
.form-actions a {
    display: inline-block;
    padding: 0.5rem 1rem;
}

.signout-form {
    margin: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

.notification {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--edge);
    margin: 0 0 1rem;
}

.notification-error {
    border-color: var(--error);
    font-weight: 600;
}

.notification-success {
    border-color: #26733a;
}

.notification-warning {
    border-color: #9a6700;
}

.field-error,
.validation-summary {
    color: var(--error);
    font-weight: 600;
}

.validation-summary:empty {
    display: none;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.25rem;
}

.private-rss-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 1rem 0 1.5rem;
}

.private-rss-details dt {
    font-weight: 600;
}

.private-rss-details dd {
    margin: 0;
}

.private-rss-one-time {
    border: 2px solid var(--edge);
    margin: 1rem 0 1.5rem;
    padding: 1rem;
}

.private-rss-secret {
    border: 1px solid var(--edge);
    font-size: 1.1rem;
    margin: 1rem 0 0;
    padding: 0.75rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.empty-state {
    padding: 1rem;
    border: 1px dashed var(--edge);
}

.feed-list {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
}

.feed-item {
    border: 1px solid var(--edge);
    padding: 1rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.feed-item p {
    margin: 0 0 0.75rem;
}

.feed-url span {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.feed-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.feed-actions form {
    margin: 0;
}

.article-list {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
}

.article-list-item {
    margin-bottom: 1.5rem;
}

.article-item {
    border: 1px solid var(--edge);
    padding: 1rem;
    min-width: 0;
}

.article-title,
.article-source span,
.ai-output,
.article-ai-region p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-item h2 {
    margin-top: 0;
}

.article-ai-region {
    border-top: 1px solid var(--edge);
    margin-top: 1rem;
    min-width: 0;
}

.article-ai-region h3 {
    margin-bottom: 0.5rem;
}

.ai-output {
    white-space: pre-wrap;
}

.article-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

/* Daily reading: quiet hierarchy, native controls and no external assets. */
:root {
    --control-edge: #77857a;
    --paper: #f7f6f1;
    --surface: #fffefa;
    --ink: #25352e;
    --muted: #5b685f;
    --edge: #c9cfc5;
    --accent: #275d48;
    --error: #a3232b;
    --focus: #1a5fb4;
}
body { background: var(--paper); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
.app-header { padding: 1.25rem max(1rem, calc((100vw - 1080px) / 2)); gap: 1rem; }
.app-identity a { color: var(--ink); text-decoration: none; letter-spacing: -.03em; font-size: 1.25rem; }
.brand-detail { font-weight: 400; font-size: .9rem; letter-spacing: 0; color: var(--muted); }
.app-nav a { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; padding: .4rem .2rem; }
.app-nav a[aria-current=page] { border-bottom: 2px solid var(--accent); font-weight: 650; }
.app-main { padding: 3rem 1rem 5rem; }
h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15; letter-spacing: -.035em; margin: .5rem 0 1.25rem; }
h2 { line-height: 1.3; }
.eyebrow { color: var(--accent); font-size: .72rem; letter-spacing: .16em; font-weight: 700; }
.lede { font-size: 1.15rem; color: var(--muted); }
.muted, .article-date, .reader-count { color: var(--muted); font-size: .9rem; }
.page-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; }
.article-panel { max-width: 52rem; }
.reader-filters { display: flex; flex-wrap: wrap; gap: .8rem; padding: 1rem 0; border-top: 1px solid var(--edge); align-items: end; }
.reader-filters .field { flex: 1 1 140px; margin: 0; min-width: 0; }
label { font-weight: 600; font-size: .9rem; }
input, textarea, select, button { font: inherit; }
.field input, .field textarea, .field select { background: var(--surface); color: var(--ink); border: 1px solid var(--control-edge); border-radius: 5px; min-height: 44px; padding: .6rem; width: 100%; }
button, .button-link { border: 1px solid var(--accent); border-radius: 5px; color: var(--accent); background: var(--surface); min-height: 44px; padding: .5rem .85rem; text-decoration: none; }
button:hover, .button-link:hover { background: var(--accent); color: var(--surface); }
.article-list { margin-top: 1.5rem; }
.article-list-item { margin: 0; }
.article-item { padding: 1.75rem 0; margin: 0; border: 0; border-top: 1px solid var(--edge); }
.article-meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: baseline; color: var(--muted); font-size: .8rem; margin-bottom: .7rem; }
.source-name { font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.article-title { font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 500; line-height: 1.35; letter-spacing: -.02em; margin-bottom: 1rem; }
.article-ai-region { margin-top: 0; border: 0; }
.article-ai-region h3 { font-size: .75rem; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.ai-output { line-height: 1.8; max-width: 72ch; }
.article-actions { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: center; margin: 1rem 0; }
.article-original-link { min-height: 44px; display: inline-flex; align-items: center; gap: .5rem; }
.article-disclosure { margin: .5rem 0; font-size: .95rem; }
.article-disclosure > summary { overflow-wrap: anywhere; }
summary { cursor: pointer; min-height: 44px; padding: .65rem 0; color: var(--accent); }
.article-disclosure[open] { padding-bottom: .5rem; }
.provenance { color: var(--muted); font-size: .85rem; }
.provenance p { overflow-wrap: anywhere; }
.ai-state { font-size: .85rem; font-weight: 600; }
.notification { background: var(--surface); border-radius: 6px; line-height: 1.6; }
.notification p { margin: .25rem 0 .5rem; }
.notification a { display: inline-block; padding: .35rem .75rem .35rem 0; }
.empty-state { background: var(--surface); padding: 2rem; border-radius: 6px; }
.empty-state h2 { font-family: Georgia, serif; font-weight: 400; }
.bulk-reading { border-top: 1px solid var(--edge); padding-top: 1.5rem; }
.article-pagination { margin-top: 2rem; }
.article-pagination a { padding: .6rem; min-height: 44px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 2rem 0; }
.settings-card { display: block; padding: 1.25rem; background: var(--surface); border: 1px solid var(--edge); border-radius: 7px; text-decoration: none; }
.settings-card h2 { font-size: 1.1rem; margin: 0; }
.settings-card p { color: var(--muted); margin-bottom: 0; }
.setup-guide { background: var(--surface); border: 1px solid var(--edge); padding: 1.25rem; margin: 1.5rem 0; border-radius: 7px; }
.setup-guide h2 { margin-top: 0; font-size: 1.1rem; }
.setup-guide li { padding: .3rem 0; }
.privacy-note { border-top: 1px solid var(--edge); margin-top: 2rem; padding-top: 1rem; font-size: .9rem; }
.feed-item { background: var(--surface); border-radius: 7px; }
.feed-actions { margin-top: 1rem; }
.feed-item h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.limit-form { margin: 2rem 0; max-width: 30rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
select:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 560px) {
    .app-main { padding-top: 1.5rem; }
    .app-header { padding: .75rem 1rem; }
    .app-nav { gap: .75rem; width: 100%; justify-content: space-between; }
    .app-nav ul { gap: .65rem; }
    .brand-detail { display: none; }
    .reader-filters .field { flex-basis: 100%; }
    .reader-filters button { width: 100%; }
    .settings-grid { grid-template-columns: 1fr; }
    .article-title { font-size: 1.35rem; }
    .article-actions { justify-content: space-between; }
    .retry-form span { display: block; margin-top: .5rem; }
}
@media (prefers-color-scheme: dark) {
    :root { --control-edge: #819785; --paper: #17201c; --surface: #202c25; --ink: #edf0e7; --muted: #b5c1b8; --edge: #536456; --accent: #aad6ba; --error: #ff999f; --focus: #8dc3ff; }
    .notification-warning { border-color: #d2b16d; }
    .notification-success { border-color: #aad6ba; }
}

.reader-filter-disclosure { border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge); }
.reader-filter-disclosure > summary { font-size: .9rem; }
.reader-filter-disclosure .reader-filters { border-top: 0; }
@media (max-width: 560px) {
    .app-nav { font-size: .85rem; gap: .4rem; }
    .app-nav ul { gap: .5rem; }
    .app-nav button { padding: .4rem .55rem; }
    .app-header { gap: .3rem; }
    .page-heading h1 { font-size: 1.7rem; margin-bottom: .5rem; }
    .page-heading { margin-bottom: .75rem; }
    .page-heading > a { min-height: 44px; display: inline-flex; align-items: center; }
}

.source-tools,.source-bulk-controls {display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;margin:1rem 0;}
.source-tools a,.feed-actions a {display:inline-flex;align-items:center;min-height:44px;}
.source-row {padding:1rem;}
.source-row-heading {display:flex;flex-wrap:wrap;align-items:center;gap:.6rem;}
.source-row-heading h2 {margin:0;}
.source-row-heading input {width:24px;height:24px;}
.source-row-heading label {font-size:.8rem;padding:.65rem .2rem;}
.source-row p {margin:.4rem 0;}
.source-bulk-controls .field {flex:1 1 100%;}
.source-bulk-controls {border:1px solid var(--edge);padding:1rem;}
@media(max-width:560px){.source-bulk-controls button {width:100%;}.source-tools {gap:.4rem 1rem;}}

.feed-panel { overflow-wrap: anywhere; }
.source-row-heading > * { min-width: 0; }

.ai-history-list { list-style: none; padding: 0; }
.ai-history-list > li { margin-block: 1rem; overflow-wrap: anywhere; }
.ai-history-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ai-history-metrics dt { color: var(--muted); }
.ai-history-metrics dd { margin: .25rem 0 0; font-weight: 600; }

/* Daily management: consistent local forms, restrained hierarchy, native interaction. */
.settings-grid { margin: 1rem 0 2rem; }
.settings-card h3 { font-size: 1.1rem; margin: 0; }
.settings-context { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.5rem; }
.settings-context a, .pagination a { display: inline-flex; min-height: 44px; align-items: center; }
.shell-outcome { max-width: 52rem; margin: 0 auto 1.5rem; }
.input-limit { color: var(--muted); font-size: .85rem; border-left: 3px solid var(--control-edge); padding-left: .65rem; }
.credential-action { border-top: 1px solid var(--edge); margin-top: 1.5rem; }
.credential-action > summary { font-weight: 600; }
.operator-failures dt { font-weight: 600; margin-top: 1rem; }
.operator-failures dd { margin: .25rem 0 1rem; }
.pagination { display: flex; flex-wrap: wrap; gap: 1rem; }
[tabindex="-1"]:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
.panel { overflow-wrap: anywhere; }
button, input, select, textarea { max-width: 100%; }
.form-actions > button:first-child, .limit-form > button { background: var(--accent); color: var(--surface); }
@media(max-width:560px) {
    .form-actions { align-items: stretch; }
    .form-actions > button { width: 100%; }
    .ai-history-metrics { gap: .75rem; }
    .private-rss-details { grid-template-columns: 1fr; }
}

.prompt-review { white-space: pre-wrap; overflow-wrap: anywhere; }

.persona-editor, .persona-comment { border-top: 1px solid var(--edge); padding-block: 1rem; }
.persona-editor > summary { min-height: 44px; cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }
.persona-editor form { margin-top: 1rem; }
.persona-enabled { display: flex; align-items: center; gap: .75rem; min-height: 44px; }
.persona-enabled input { width: auto; flex: 0 0 auto; }
.persona-comment h3 { overflow-wrap: anywhere; }

.persona-request { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.persona-request .muted { overflow-wrap: anywhere; }

.article-evaluation { border-top: 1px solid var(--edge); margin-top: 1rem; padding-top: 1rem; }
.article-evaluation h3, .article-evaluation h4 { margin: 0 0 .5rem; font-size: 1rem; }
.evaluation-state { margin: .5rem 0; }
.evaluation-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.evaluation-actions button { min-height: 44px; }
.evaluation-reasons { margin-top: .75rem; }
.evaluation-reason-form { margin-top: .75rem; }
.evaluation-form .muted { font-size: .85rem; }
.interest-evaluation { margin-bottom: 1rem; }
