/* Website Change Monitor – modernes Reader-Layout */

:root {
    --accent: #4f46e5;
    --accent-dark: #4338ca;
    --accent-weak: #eef2ff;
    --bg: #ffffff;
    --sidebar-bg: #f7f8fa;
    --border: #e6e8eb;
    --border-strong: #d3d7dc;
    --text: #1f2328;
    --muted: #6b7280;
    --muted-2: #9aa0a6;
    --green: #0a7c42;
    --green-bg: #e5f4ec;
    --amber: #92600a;
    --amber-bg: #fbf1d9;
    --red: #b3261e;
    --red-bg: #fbe9e7;
    --radius: 10px;
    --radius-sm: 7px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

/* ===================== App-Shell ===================== */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 268px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 9px;
    font-weight: 700; font-size: 16px; padding: 6px 8px 14px;
}
.brand-mark { color: var(--accent); font-size: 20px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-weight: 500;
}
.sidebar-nav a:hover { background: #eef0f3; text-decoration: none; }
.sidebar-nav a.active { background: var(--accent-weak); color: var(--accent-dark); }
.nav-ic { width: 18px; text-align: center; color: var(--muted); font-size: 15px; }
.sidebar-nav a.active .nav-ic { color: var(--accent); }

.sidebar-section-label {
    text-transform: uppercase; font-size: 11px; letter-spacing: .06em;
    color: var(--muted-2); font-weight: 600; padding: 18px 10px 6px;
    display: flex; align-items: center; justify-content: space-between;
}
.section-manage { font-size: 11px; color: var(--muted-2); text-transform: none; letter-spacing: 0; }
.section-manage:hover { color: var(--accent); text-decoration: none; }

/* Feed-Gruppen */
.feed-group { margin-bottom: 1px; }
.feed-group > summary { list-style: none; }
.feed-group > summary::-webkit-details-marker { display: none; }
.fg-head {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.fg-head:hover { background: #eef0f3; }
.fg-caret {
    color: var(--muted-2); font-size: 14px; line-height: 1; transition: transform .15s;
    flex-shrink: 0; width: 20px; text-align: center;
}
.feed-group[open] > summary .fg-caret { transform: rotate(90deg); }
.fg-name { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-name:hover { text-decoration: none; color: var(--accent-dark); }
.fg-name.active { color: var(--accent-dark); }
.fg-feeds { padding-left: 14px; }
.sidebar-feeds { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.feed-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    color: var(--text); font-size: 13.5px;
}
.feed-item:hover { background: #eef0f3; text-decoration: none; }
.feed-item.active { background: var(--accent-weak); color: var(--accent-dark); }
.feed-paused { opacity: .55; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted-2); }
.feed-dot-urls { background: var(--accent); }
.feed-dot-content { background: #0ea5e9; }
.feed-dot-rss { background: #f59e0b; }
.feed-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-count {
    background: var(--border-strong); color: #454b53;
    font-size: 11px; font-weight: 600; border-radius: 9px; padding: 1px 7px;
}
.feed-item.active .feed-count { background: var(--accent); color: #fff; }
.feed-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }

.sidebar-footer {
    border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sf-user { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-logout { font-size: 12px; }
.sidebar-legal { padding: 8px 10px 2px; }
.sidebar-legal a { font-size: 11px; color: var(--muted-2); }

.app-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content-inner { max-width: 860px; width: 100%; margin: 0 auto; padding: 28px 28px 80px; }

.mobile-topbar { display: none; }

/* ===================== Stream-Kopf ===================== */
.stream-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.stream-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.stream-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.stream-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.segmented { display: inline-flex; background: #eef0f3; border-radius: 8px; padding: 3px; }
.segmented a {
    padding: 5px 12px; font-size: 13px; color: var(--muted); border-radius: 6px; font-weight: 500;
}
.segmented a:hover { color: var(--text); text-decoration: none; }
.segmented a.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ===================== Stream ===================== */
.stream { display: flex; flex-direction: column; }
.entry {
    display: flex; gap: 14px;
    padding: 16px 4px; border-bottom: 1px solid var(--border);
}
.entry:hover { background: #fafbfc; }
.entry-rail { width: 3px; border-radius: 3px; flex-shrink: 0; background: var(--border-strong); }
.entry-new_urls, .entry-content_changed { background: var(--accent); }
.entry-article { background: #10a37f; }
.entry-error { background: var(--red); }
.entry-article-row { align-items: flex-start; }
.article-card.is-read { opacity: .5; }
.article-card.is-read:hover { opacity: 1; }
.entry-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.mark-read, .save-board {
    background: none; border: 1px solid var(--border-strong);
    color: var(--muted-2); width: 24px; height: 24px; border-radius: 50%;
    font-size: 12px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0;
}
.mark-read:hover { border-color: #10a37f; color: #10a37f; }
.save-board { border: none; font-size: 15px; background: none; }
.save-board:hover { transform: scale(1.15); }
.article-card.is-read .mark-read { background: #10a37f; border-color: #10a37f; color: #fff; }

/* Board-Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 380px;
    padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-title { font-size: 13px; color: var(--muted); margin: 4px 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.board-choice {
    text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; font-size: 14px; cursor: pointer;
}
.board-choice:hover { background: var(--accent-weak); border-color: var(--accent); }
.new-board-row { display: flex; gap: 6px; }
.new-board-row input { flex: 1; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; }
.board-modal-status { font-size: 13px; color: var(--green); margin-top: 10px; min-height: 18px; }
.feed-dot-board { background: var(--accent); }
.article-thumb { width: 128px; height: 84px; flex-shrink: 0; border-radius: 9px; overflow: hidden; background: #eef0f3; display: block; }
.article-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-title { display: block; font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.35; margin-bottom: 5px; }
.article-title:hover { color: var(--accent-dark); text-decoration: none; }
.entry-body { flex: 1; min-width: 0; }
.entry-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.entry-source { font-weight: 600; color: var(--text); }
.dot { color: var(--muted-2); }
.entry-excerpt { font-size: 14px; color: #3c4149; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.entry-excerpt.muted { color: var(--muted-2); }
.entry-error { /* text variant */ }
div.entry-error { background: none; color: var(--red); font-size: 13px; font-family: ui-monospace, Menlo, monospace; word-break: break-all; }

.entry-links { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.new-link { display: flex; flex-direction: column; padding: 8px 11px; background: var(--accent-weak); border-radius: 8px; }
.new-link:hover { background: #e4e8fd; text-decoration: none; }
.nl-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.nl-url { font-size: 12px; color: var(--accent-dark); word-break: break-all; }

.entry-diff summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 8px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.diff-old, .diff-new { border-radius: 8px; padding: 10px; overflow: auto; max-height: 300px; }
.diff-old { background: var(--red-bg); }
.diff-new { background: var(--green-bg); }
.diff span { display: block; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.diff pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; font-size: 12px; }

/* ===================== Badges ===================== */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-change { background: var(--accent-weak); color: var(--accent-dark); }
.badge-soft { background: #eef0f3; color: #565c64; }
.badge-active { background: var(--green-bg); color: var(--green); }
.badge-paused { background: var(--amber-bg); color: var(--amber); }
.badge-error { background: var(--red-bg); color: var(--red); }
.badge-mail { background: var(--accent-weak); color: var(--accent-dark); }
.badge-feed { background: #fef3c7; color: #92600a; }
.badge-group { background: #ede9fe; color: #5b21b6; }

/* ===================== Buttons ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: 8px;
    background: #fff; color: var(--text); font-size: 13px; font-weight: 500;
    cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: #f4f5f7; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-small { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn-danger { color: var(--red); border-color: #e7c9c6; }
.btn-danger:hover { background: var(--red-bg); }
.inline-form { display: inline; margin: 0; }

/* ===================== Empty / Flash ===================== */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-mark { font-size: 40px; color: var(--border-strong); margin-bottom: 8px; }
.empty p { font-size: 15px; margin-bottom: 18px; }

.flash { border-radius: 8px; padding: 12px 15px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.flash-success { background: var(--green-bg); border-color: #b7e0c7; color: var(--green); }
.flash-error { background: var(--red-bg); border-color: #f0c8c4; color: var(--red); }
.flash-info { background: var(--accent-weak); border-color: #d3d9fb; color: var(--accent-dark); }

/* ===================== Management-Karten ===================== */
.card-grid { display: grid; gap: 12px; }
.mcard { border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; }
.mcard:hover { border-color: var(--border-strong); }
.mcard-paused { opacity: .62; }
.mcard-paused:hover { opacity: 1; }
.mcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.mcard-name { font-size: 15px; font-weight: 600; color: var(--text); }
.mcard-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.mcard-url { display: block; margin: 5px 0; font-size: 12.5px; color: var(--accent-dark); word-break: break-all; }
.mcard-sel { margin: 2px 0 6px; }
.mcard-sel code { background: #eef0f3; padding: 2px 6px; border-radius: 4px; }
.mcard-group { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; }
.mcg-icon { font-size: 13px; }
.group-select {
    padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 7px;
    font-size: 13px; background: #fff; max-width: 220px; cursor: pointer; transition: border-color .2s;
}
.group-select.saved { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.mcard-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin: 8px 0 12px; }
.mcard-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ===================== Formular ===================== */
.form-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-width: 620px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.req { color: var(--red); }
.field input[type=text], .field input[type=url], .field input[type=email],
.field input[type=number], .field select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
    border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.url-status { font-size: 13px; margin-top: 8px; line-height: 1.5; }
.url-status:empty { display: none; }
.url-status.us-checking { color: var(--muted); }
.url-status.us-ok { color: var(--green); }
.url-status.us-warn { color: var(--amber); }
.url-status.us-err { color: var(--red); }
.url-status a.use-feed { color: var(--accent); word-break: break-all; }
.url-status .us-dup { color: var(--amber); font-weight: 600; }
.radio { display: flex; gap: 9px; align-items: flex-start; font-weight: 400 !important; font-size: 13.5px; padding: 7px 0; }
.radio input { margin-top: 3px; }
.radio span strong { font-weight: 600; }
details summary { cursor: pointer; color: var(--accent); font-size: 13.5px; font-weight: 500; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ===================== Info-/Users-Tabellen ===================== */
.section-h { font-size: 15px; font-weight: 700; margin: 22px 0 10px; }
.info-table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 13.5px; }
.info-table td, .info-table th { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.info-table tr:last-child td { border-bottom: none; }
.info-table td:first-child { color: var(--muted); width: 190px; }
.users-table th { background: #f7f8fa; font-size: 12px; color: var(--muted); }
.users-table td:first-child { color: var(--text); width: auto; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.due-list { margin: 6px 0 0; padding-left: 18px; }
.muted { color: var(--muted); }

/* ===================== Auth ===================== */
.auth-body { background: var(--sidebar-bg); }
.auth-wrap { max-width: 400px; margin: 8vh auto; padding: 0 20px; }
.auth-brand { display: flex; align-items: center; gap: 9px; justify-content: center; font-weight: 700; font-size: 18px; margin-bottom: 22px; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 30px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.auth-card h1 { font-size: 22px; margin: 0 0 8px; }
.auth-lead { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-weight: 600; font-size: 13px; }
.auth-form input { padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 15px; }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.auth-form .btn { margin-top: 6px; }
.auth-note { color: var(--muted-2); font-size: 12px; margin: 16px 0 0; text-align: center; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 12px; }
.auth-foot a { color: var(--muted); }

/* Impressum / Datenschutz */
.legal-wrap { max-width: 720px; margin: 6vh auto; padding: 0 20px; }
.legal-card {
    background: #fff; border: 1px solid var(--border); border-radius: 14px;
    padding: 30px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-top: 18px;
}
.legal-card h1 { font-size: 22px; margin: 26px 0 10px; }
.legal-card h1:first-child { margin-top: 0; }
.legal-card h2 { font-size: 15px; margin: 20px 0 6px; }
.legal-card p, .legal-card li { font-size: 14px; color: #33373d; line-height: 1.65; }
.legal-card ul { padding-left: 20px; }
.legal-date { color: var(--muted-2); font-size: 12px; margin-top: 20px; }
.legal-back { text-align: center; margin-top: 16px; }

/* ===================== Check-now Feedback ===================== */
.check-now.loading { opacity: .6; pointer-events: none; }
.check-result { display: inline-block; margin-left: 6px; font-size: 12.5px; font-style: italic; }
.check-result.success { color: var(--green); }
.check-result.error { color: var(--red); }

/* ===================== Mobile ===================== */
@media (max-width: 860px) {
    .app-sidebar {
        position: fixed; z-index: 40; left: 0; top: 0; bottom: 0;
        transform: translateX(-100%); transition: transform .22s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,.12);
    }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
    .sidebar-overlay.show { display: block; }
    .mobile-topbar {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 20;
    }
    .hamburger { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); padding: 0; }
    .mt-title { font-weight: 700; }
    .content-inner { padding: 20px 18px 70px; }
    .diff { grid-template-columns: 1fr; }

    /* Grössere Gruppen-Pfeile & Tap-Bereiche auf dem Handy */
    .fg-head { padding: 11px 10px; gap: 8px; }
    .fg-caret { font-size: 20px; width: 26px; }
    .fg-name { font-size: 15px; }
    .feed-item { padding: 10px 10px; font-size: 15px; }
    .sidebar-nav a { padding: 11px 10px; font-size: 15px; }
}
