:root {
  --primary: #0f3d5c; --primary-dark: #0a2a40; --accent: #e8642c; --bg: #f4f6f8; --card: #ffffff; --text: #1d2a35; --muted: #667585;
  --border: #dfe5eb; --ok: #1f8a4c; --warn: #c77700; --danger: #b3261e; --info: #2b6cb0;
  --vis-critical: #b3261e; --vis-important: #e8642c; --vis-normal: #2b6cb0; --vis-history: #8a97a5; --vis-hidden: #b8c1cb;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .35rem 0 .75rem; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.inline { display: inline; }
.narrow { max-width: 560px; }
.topbar { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 56px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.brand-mark { background: var(--accent); border-radius: 6px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.brand-sub { font-weight: 400; font-size: .85rem; opacity: .8; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { color: rgba(255,255,255,.85); padding: .45rem .8rem; border-radius: 6px; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.userbox { display: flex; gap: .75rem; align-items: center; font-size: .9rem; }
.userbox a { color: #fff; }
button.link { background: none; border: 0; color: rgba(255,255,255,.85); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { text-decoration: underline; }
main { padding: 1.5rem 1.25rem 3rem; }
.footer { color: var(--muted); font-size: .8rem; padding-bottom: 2rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card.empty { color: var(--muted); text-align: center; padding: 2rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-info { background: #eaf2fb; border-color: #bcd4ee; color: #1d4a7a; }
.flash-success { background: #e8f6ee; border-color: #b7e0c7; color: #175c34; }
.flash-error { background: #fbeae9; border-color: #efc1bd; color: #8a1c16; }
.btn { display: inline-block; padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; font: inherit; font-size: .92rem; line-height: 1.2; }
.btn:hover { background: #f1f4f7; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .9rem 1rem; display: flex; flex-direction: column; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat-n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-l { font-size: .82rem; color: var(--muted); }
.stat-accent .stat-n { color: var(--accent); }
.stat-warn .stat-n { color: var(--danger); }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .grid-2-1 { grid-template-columns: 1fr; } }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem 1rem; }
form.filters select, form.filters input, .filters select, .filters input { width: auto; margin: 0; padding: .42rem .55rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: .88rem; background: #fff; }
.feed { display: flex; flex-direction: column; gap: .6rem; }
.signal { background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--vis-normal); border-radius: 10px; padding: .8rem 1rem; }
.signal.sev-critical { border-left-color: var(--vis-critical); }
.signal.sev-important { border-left-color: var(--vis-important); }
.signal.sev-history { border-left-color: var(--vis-history); opacity: .85; }
.signal.sev-hidden { border-left-color: var(--vis-hidden); opacity: .7; }
.signal.unread .signal-title a { font-weight: 700; }
.signal-head { display: flex; gap: .8rem; align-items: flex-start; }
.score { min-width: 42px; height: 42px; border-radius: 8px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; }
.sev-critical .score { background: var(--vis-critical); } .sev-important .score { background: var(--vis-important); } .sev-history .score, .sev-hidden .score { background: var(--vis-history); }
.signal-title a { font-size: 1.02rem; }
.signal-meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .2rem; }
.signal-summary { margin: .5rem 0 .25rem; }
.badge { display: inline-block; font-size: .74rem; padding: .1rem .5rem; border-radius: 999px; background: #e9eef3; color: #3b4a59; white-space: nowrap; }
.badge-cat { background: #e3ecf7; color: #1d4a7a; }
.badge-type-strategic { background: #f3e8fb; color: #5b2d8a; }
.badge-type-commercial { background: #fdf0e4; color: #8a4a12; }
.badge-vis-critical { background: #fbe4e2; color: var(--vis-critical); }
.badge-vis-important { background: #fdeadf; color: #a1411a; }
.badge-vis-history, .badge-vis-hidden { background: #eef1f4; color: #66727f; }
.badge-ok { background: #e6f5ec; color: var(--ok); } .badge-warn { background: #fdf1dc; color: var(--warn); } .badge-err { background: #fbe4e2; color: var(--danger); } .badge-running { background: #e3ecf7; color: var(--info); }
.pill { display: inline-block; background: #e9eef3; border-radius: 999px; padding: 0 .55rem; font-size: .8rem; }
.pill-accent { background: var(--accent); color: #fff; }
.tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.tag { font-size: .74rem; background: #f1f4f7; border-radius: 4px; padding: .05rem .4rem; color: var(--muted); }
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain li { padding: .3rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; } ul.plain li:last-child { border-bottom: 0; }
.pagination { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1rem 0; }
.pagination a { padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
.table-wrap { overflow-x: auto; padding: 0; }
.table-wrap table { min-width: 720px; }
form label { display: block; margin-bottom: .7rem; font-size: .9rem; font-weight: 500; }
form input[type=text], form input[type=email], form input[type=password], form input[type=number], form input[type=search], form input[type=url], form textarea, form select { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 7px; font: inherit; margin-top: .25rem; background: #fff; }
form textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; } @media (max-width: 700px) { .cols-2 { grid-template-columns: 1fr; } }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .2rem .8rem; margin-bottom: .75rem; }
.check { font-weight: 400; display: flex; gap: .4rem; align-items: center; margin: 0; }
.check input { width: auto; margin: 0; }
.auth-card { max-width: 420px; margin: 3rem auto; }
.danger-zone { border-color: #efc1bd; }
.tabs { display: flex; gap: .15rem; border-bottom: 2px solid var(--border); margin: 1rem 0; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; border-radius: 7px 7px 0 0; color: var(--muted); font-weight: 500; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; background: #eef2f6; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: .3rem 1rem; font-size: .92rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } }
.job-banner { background: #eaf2fb; border: 1px solid #bcd4ee; border-radius: 8px; padding: .6rem 1rem; margin-bottom: 1rem; display: flex; gap: .75rem; align-items: center; }
.spinner { width: 16px; height: 16px; border: 2px solid #bcd4ee; border-top-color: var(--info); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.timeline { border-left: 3px solid var(--border); margin-left: .5rem; padding-left: 1.25rem; }
.timeline-month { font-weight: 700; color: var(--primary); margin: 1.2rem 0 .5rem; position: relative; }
.timeline-month::before { content: ""; position: absolute; left: -1.75rem; top: .45rem; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.timeline-item { padding: .45rem 0 .45rem; border-bottom: 1px dashed var(--border); } .timeline-item:last-child { border-bottom: 0; }
.timeline-item .when { color: var(--muted); font-size: .8rem; }
.evidence { background: #f7f9fb; border-left: 3px solid var(--accent); padding: .5rem .8rem; margin: .4rem 0; font-size: .92rem; border-radius: 0 6px 6px 0; }
.evidence .src { display: block; font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.state-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } @media (max-width: 800px) { .state-grid { grid-template-columns: 1fr; } }
.state-grid .card { margin: 0; }
.commercial { background: #fdf6ee; border: 1px dashed #e8b98a; }
.diff-added { background: #e8f6ee; color: #175c34; padding: .1rem .3rem; display: block; border-radius: 3px; margin: .1rem 0; }
.diff-removed { background: #fbeae9; color: #8a1c16; padding: .1rem .3rem; display: block; border-radius: 3px; margin: .1rem 0; text-decoration: line-through; }
pre.text { white-space: pre-wrap; font: inherit; font-size: .88rem; background: #f7f9fb; padding: .75rem; border-radius: 6px; max-height: 480px; overflow: auto; }
.prose { max-width: 820px; } .prose pre { white-space: pre-wrap; font: inherit; }
.feedback-buttons { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.source-row form { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.source-row select, .source-row input[type=number] { padding: .25rem .4rem; border: 1px solid var(--border); border-radius: 5px; font: inherit; font-size: .82rem; margin: 0; width: auto; }
.source-row .url { word-break: break-all; }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.entity { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; background: #fff; }
.entity.inactive { opacity: .6; }
.progress { height: 6px; background: #e9eef3; border-radius: 3px; overflow: hidden; } .progress span { display: block; height: 100%; background: var(--primary); }
.warn-text { color: var(--danger); }
.ok-text { color: var(--ok); }
details summary { cursor: pointer; color: var(--primary); }
