:root {
  --bg: #080a0d;
  --bg-2: #0d1014;
  --panel: #11151a;
  --panel-2: #151a20;
  --line: #252c34;
  --line-soft: #1c2229;
  --text: #edf0f2;
  --muted: #8f99a5;
  --signal: #d7a34a;
  --signal-soft: rgba(215, 163, 74, .12);
  --good: #6db68a;
  --bad: #d46f6f;
  --radius: 14px;
  --radius-sm: 9px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.is-hidden { display: none !important; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.35), transparent 70%);
}

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-shell { width: min(1040px, 100%); display: grid; grid-template-columns: 1.2fr .8fr; gap: 84px; align-items: center; position: relative; }
.login-shell::after { content: "K4 / 02"; position: absolute; right: 0; top: -80px; font: 11px/1 var(--mono); letter-spacing: .18em; color: #4e5863; }
.brand-lockup { display: flex; align-items: center; gap: 18px; }
.brand-lockup-login h1 { margin: 8px 0 6px; font-size: clamp(52px, 7vw, 92px); line-height: .86; letter-spacing: -.055em; font-weight: 760; }
.brand-lockup-login p { margin: 0; color: var(--muted); font-size: 15px; letter-spacing: .04em; }
.brand-mark { width: 88px; height: 88px; border: 1px solid #424b55; position: relative; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--signal); opacity: .8; }
.brand-mark::before { width: 1px; height: 116px; }
.brand-mark::after { width: 116px; height: 1px; }
.brand-mark span { position: absolute; width: 15px; height: 15px; border: 1px solid #6d7782; background: var(--bg); }
.brand-mark span:nth-child(1) { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.brand-mark span:nth-child(2) { right: -1px; top: -1px; border-left: 0; border-bottom: 0; }
.brand-mark span:nth-child(3) { left: -1px; bottom: -1px; border-right: 0; border-top: 0; }
.brand-mark span:nth-child(4) { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.brand-mark b { font: 700 20px/1 var(--mono); letter-spacing: -.04em; }
.brand-mark.compact { width: 42px; height: 42px; }
.brand-mark.compact::before { height: 54px; }
.brand-mark.compact::after { width: 54px; }
.brand-mark.compact span { width: 8px; height: 8px; }
.brand-mark.compact b { font-size: 12px; }
.eyebrow, .micro-label { font: 600 10px/1.2 var(--mono); color: #8f99a5; letter-spacing: .16em; text-transform: uppercase; }

.login-panel { background: linear-gradient(180deg, rgba(20,24,29,.96), rgba(13,16,20,.96)); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: 0 24px 80px rgba(0,0,0,.32); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 38px; }
.panel-heading > div { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--good); box-shadow: 0 0 0 4px rgba(109,182,138,.08); }
.version-tag { font: 600 10px/1 var(--mono); color: var(--signal); border: 1px solid rgba(215,163,74,.28); background: var(--signal-soft); padding: 7px 8px; border-radius: 5px; letter-spacing: .08em; }
.login-panel h2, .panel h3, .modal h3, .hero-panel h3 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
.login-panel h2 { font-size: 24px; }
.muted { color: var(--muted); }
.login-panel > .muted { margin: 8px 0 26px; font-size: 14px; }
label { display: grid; gap: 8px; margin: 16px 0; }
label > span { font-size: 12px; color: #b9c0c7; font-weight: 600; }
input, textarea, select { width: 100%; color: var(--text); background: #0b0e12; border: 1px solid #2a323b; border-radius: 8px; padding: 12px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: #7f6740; box-shadow: 0 0 0 3px rgba(215,163,74,.08); }
textarea { resize: vertical; }
.form-error { color: #e18a8a; min-height: 18px; font-size: 12px; margin-top: 8px; }
.login-footer { grid-column: 1 / -1; color: #57616b; font: 10px/1.4 var(--mono); letter-spacing: .08em; }

.btn { border: 1px solid transparent; border-radius: 8px; padding: 10px 13px; cursor: pointer; font-size: 12px; font-weight: 650; letter-spacing: .01em; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: wait; transform: none; }
.btn-primary { background: var(--signal); color: #111; border-color: var(--signal); }
.btn-primary:hover { background: #e2af57; }
.btn-secondary { background: #171c22; border-color: #303842; }
.btn-secondary:hover, .btn-ghost:hover { background: #1d232a; border-color: #3a434d; }
.btn-ghost { background: transparent; border-color: #2b333c; color: #aab3bc; }
.btn-block { width: 100%; }
.text-button { border: 0; background: transparent; color: var(--signal); font: 600 10px/1 var(--mono); letter-spacing: .08em; cursor: pointer; text-transform: uppercase; }
.icon-button { border: 0; background: transparent; color: #77818c; font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { min-height: 100vh; position: sticky; top: 0; height: 100vh; background: #0b0e12; border-right: 1px solid var(--line-soft); padding: 22px 18px; display: flex; flex-direction: column; }
.brand-lockup-sidebar { padding: 4px 4px 30px; }
.brand-title { margin-top: 4px; font-weight: 750; letter-spacing: -.02em; }
.nav { display: grid; gap: 4px; }
.nav-item { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 7px; text-align: left; padding: 11px 10px; border: 1px solid transparent; background: transparent; color: #858f99; border-radius: 8px; cursor: pointer; font-size: 13px; }
.nav-item:hover { color: #dce0e4; background: #11161b; }
.nav-item.active { color: #f2f3f4; background: #151a20; border-color: #252d35; }
.nav-index { font: 10px/1 var(--mono); color: #525d68; }
.nav-item.active .nav-index { color: var(--signal); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.system-pill { font: 600 9px/1 var(--mono); letter-spacing: .09em; color: #7d8791; display: flex; align-items: center; gap: 8px; padding: 8px 2px; }

.main { min-width: 0; padding: 0 34px 46px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); margin-bottom: 28px; }
.topbar h2 { margin: 6px 0 0; font-size: 23px; letter-spacing: -.025em; }
.operator-block { display: flex; align-items: center; gap: 16px; }
.operator-meta { display: flex; align-items: center; gap: 9px; color: #9ea7b0; font-size: 12px; }
.role-badge { color: #d6d9dc; border: 1px solid #333b44; border-radius: 5px; padding: 5px 7px; font: 600 9px/1 var(--mono); text-transform: uppercase; }
.view { display: none; }
.active-view { display: block; }
.hero-panel { min-height: 176px; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; display: flex; justify-content: space-between; align-items: flex-end; background: radial-gradient(circle at 82% 22%, rgba(215,163,74,.10), transparent 30%), linear-gradient(135deg, #12171c, #0e1216); overflow: hidden; position: relative; }
.hero-panel::before { content: "K4-ROV"; position: absolute; right: -8px; top: -13px; font: 800 76px/.9 var(--font); color: rgba(255,255,255,.018); letter-spacing: -.05em; }
.hero-panel h3 { font-size: 27px; margin: 8px 0 8px; }
.hero-panel p { color: var(--muted); margin: 0; max-width: 640px; font-size: 14px; line-height: 1.55; }
.hero-actions { display: flex; gap: 8px; z-index: 1; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.metric-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 18px; min-height: 126px; display: flex; flex-direction: column; }
.metric-card span { color: #89939e; font-size: 11px; }
.metric-card strong { font: 650 32px/1 var(--mono); letter-spacing: -.06em; margin: 18px 0 8px; }
.metric-card small { color: #59636d; font-size: 10px; margin-top: auto; }
.content-grid { display: grid; gap: 12px; }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 20px; }
.panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.panel-title-row h3 { margin-top: 5px; font-size: 16px; }
.empty-state { color: #66717c; font-size: 12px; padding: 22px 0; }
.compact-feed, .source-mini-list { display: grid; gap: 0; }
.feed-row, .source-mini-row { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.feed-row:first-child, .source-mini-row:first-child { border-top: 0; }
.feed-row strong { display: block; font-size: 12px; line-height: 1.4; font-weight: 600; }
.feed-row span, .source-mini-row span { color: #6f7a84; font-size: 10px; margin-top: 5px; display: block; }
.source-mini-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.source-mini-row strong { font-size: 12px; }
.state { font: 600 9px/1 var(--mono); padding: 6px 7px; border-radius: 5px; text-transform: uppercase; }
.state.success, .state.active { color: var(--good); background: rgba(109,182,138,.08); border: 1px solid rgba(109,182,138,.2); }
.state.error { color: var(--bad); background: rgba(212,111,111,.08); border: 1px solid rgba(212,111,111,.2); }
.state.idle, .state.inactive { color: #7c8792; background: rgba(124,135,146,.06); border: 1px solid #303840; }
.section-toolbar { min-height: 66px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-toolbar p { margin: 7px 0 0; font-size: 12px; }
.watchlist-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.watch-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 19px; min-height: 170px; display: flex; flex-direction: column; }
.watch-card .card-top { display: flex; justify-content: space-between; gap: 10px; }
.watch-card h3 { font-size: 15px; margin: 8px 0; }
.watch-card p { color: #7e8994; font-size: 12px; line-height: 1.5; margin: 0; }
.watch-card .card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 20px; color: #5e6973; font: 10px/1 var(--mono); }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: #65717d; font: 600 9px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; background: #0e1216; }
td { font-size: 12px; color: #b7bec5; }
td strong { color: #edf0f2; font-weight: 600; }
td .sub { display: block; color: #67727c; font-size: 10px; margin-top: 4px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }
.table-actions .btn { padding: 7px 9px; font-size: 10px; }
.source-bulk-actions { min-height: 54px; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); background: #10151a; }
.source-bulk-actions > span { color: #aeb6be; font: 600 10px/1.3 var(--mono); letter-spacing: .04em; }
.selection-cell { width: 42px; min-width: 42px; padding-left: 14px; padding-right: 8px; text-align: center; }
.row-select { width: 16px; height: 16px; margin: 0; accent-color: var(--signal); cursor: pointer; vertical-align: middle; }
tbody tr.is-selected td { background: rgba(215,163,74,.035); }
.items-feed { display: grid; gap: 8px; }
.item-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 17px 18px; display: grid; grid-template-columns: 1fr auto; gap: 18px; }
.item-card h3 { font-size: 14px; margin: 4px 0 8px; line-height: 1.35; }
.item-card h3 a { text-decoration: none; }
.item-card h3 a:hover { color: var(--signal); }
.item-card p { color: #78838e; font-size: 12px; line-height: 1.55; margin: 0; max-width: 900px; }
.item-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
}
.item-summary.expanded {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
.item-summary-toggle { display: inline-flex; margin-top: 9px; padding: 3px 0; }
.item-meta { color: #5f6b76; font: 9px/1.4 var(--mono); letter-spacing: .04em; }
.item-side { text-align: right; min-width: 150px; }
.system-card dl { margin: 18px 0 0; }
.system-card dl div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.system-card dt { color: #6e7984; font-size: 11px; }
.system-card dd { margin: 0; color: #c6ccd1; font: 10px/1.4 var(--mono); text-align: right; }
.notice-panel { margin-top: 12px; border-left: 2px solid var(--signal); background: var(--signal-soft); padding: 14px 16px; display: flex; gap: 12px; align-items: baseline; }
.notice-panel strong { font: 650 10px/1 var(--mono); color: var(--signal); }
.notice-panel span { font-size: 12px; color: #9fa7ae; }

.modal { width: min(520px, calc(100vw - 32px)); color: var(--text); background: #11161b; border: 1px solid #2d353d; border-radius: 12px; padding: 0; box-shadow: 0 28px 90px rgba(0,0,0,.58); }
.modal::backdrop { background: rgba(2,4,6,.72); backdrop-filter: blur(5px); }
.modal form { padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal h3 { margin-top: 6px; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.security-note { color: #76818b; background: #0c1014; border: 1px solid #252d35; padding: 10px 11px; border-radius: 7px; font-size: 10px; line-height: 1.45; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #171d23; border: 1px solid #343d47; border-left: 2px solid var(--signal); color: #dce0e3; padding: 12px 14px; min-width: 220px; max-width: 380px; border-radius: 8px; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .watchlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel { align-items: flex-start; flex-direction: column; gap: 28px; }
}

@media (max-width: 780px) {
  .login-shell { grid-template-columns: 1fr; gap: 42px; }
  .brand-lockup-login { justify-content: center; }
  .login-footer { text-align: center; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; height: auto; position: static; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand-lockup-sidebar { padding-bottom: 12px; }
  .nav { grid-template-columns: repeat(5, 1fr); overflow-x: auto; }
  .nav-item { display: block; text-align: center; padding: 9px 5px; font-size: 10px; }
  .nav-index { display: none; }
  .sidebar-bottom { display: none; }
  .main { padding: 0 16px 34px; }
  .topbar { min-height: 76px; }
  .operator-meta { display: none; }
  .two-cols, .watchlist-grid { grid-template-columns: 1fr; }
  .item-card { grid-template-columns: 1fr; }
  .item-side { text-align: left; }
}

@media (max-width: 520px) {
  .login-screen { padding: 20px; }
  .brand-mark { width: 66px; height: 66px; }
  .brand-mark::before { height: 88px; }
  .brand-mark::after { width: 88px; }
  .metric-grid { grid-template-columns: 1fr; }
  .hero-actions { width: 100%; flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .section-toolbar { flex-direction: column; }
  .section-toolbar .btn { width: 100%; }
}

/* K4-ROV V0.4.2 — official branding + scheduler */
.brand-lockup-login { justify-content: center; }
.brand-logo-full {
  display: block;
  width: min(520px, 100%);
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.brand-emblem {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  background-image: url('/ui/k4rov-mark-on-dark.png');
  background-repeat: no-repeat;
  background-size: 240%;
  background-position: 50% 39%;
  border-radius: 50%;
}
.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--signal);
}
.check-row span { margin: 0; }
.modal-subtitle { margin: 7px 0 0; font-size: 12px; }
select:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 1180px) {
  .three-cols { grid-template-columns: 1fr 1fr; }
  .three-cols .system-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
  .brand-logo-full { width: min(420px, 100%); }
  .three-cols { grid-template-columns: 1fr; }
  .three-cols .system-card:last-child { grid-column: auto; }
}

/* K4-ROV V0.4.2 — intelligence feed & search */
.filter-panel { margin-bottom: 12px; }
.filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.filter-grid label { margin: 0; }
.filter-actions { display: flex; gap: 7px; align-items: center; padding-bottom: 1px; }
.intel-state {
  display: inline-flex;
  align-items: center;
  padding: 4px 6px;
  border-radius: 4px;
  font: 650 8px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-right: 7px;
}
.intel-state.discovered { color: var(--signal); border: 1px solid rgba(215,163,74,.25); background: rgba(215,163,74,.07); }
.intel-state.updated { color: #e8bd75; border: 1px solid rgba(232,189,117,.28); background: rgba(232,189,117,.09); }
.intel-state.unchanged { color: #7e8994; border: 1px solid #303840; background: rgba(124,135,146,.05); }
.item-updated { border-left: 2px solid var(--signal); }
.source-error { color: var(--bad) !important; }
.source-shared-badge,
.relevance-badge,
.platform-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid #3b4650;
  border-radius: 4px;
  padding: 3px 6px;
  font: 650 8px/1 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #c9d1d8;
  background: rgba(124,135,146,.08);
}
.source-shared-badge { margin-top: 5px; }
.relevance-badge,
.platform-badge { margin-right: 7px; }
.new-item-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid rgba(215,163,74,.34);
  border-radius: 4px;
  padding: 3px 6px;
  margin-right: 7px;
  font: 700 8px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--signal);
  background: var(--signal-soft);
}

.new-to-k4-badge::before {
  content: "◇ ";
  font-weight: 700;
}


@media (max-width: 1180px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; }
  .filter-actions .btn { flex: 1; }
}

/* K4-ROV V0.5.1 — branding assets */
.brand-logo-full {
  width: min(560px, 100%);
  height: clamp(72px, 10vw, 108px);
  object-fit: cover;
  object-position: 50% 50%;
}

.brand-emblem {
  background-image: url('/ui/k4rov-mark-on-dark.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* K4-ROV V0.6.0 — productization / Discovery / destructive controls */
.toolbar-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-select {
  min-width: 220px;
  margin: 0;
}
.toolbar-select span {
  margin-bottom: 5px;
}
.btn-danger {
  color: #ffe5e5;
  background: rgba(212,111,111,.18);
  border-color: rgba(212,111,111,.5);
}
.btn-danger:hover { background: rgba(212,111,111,.28); }
.btn-danger-soft {
  color: #d98b8b;
  background: transparent;
  border-color: rgba(212,111,111,.22);
}
.btn-danger-soft:hover {
  color: #ffd8d8;
  background: rgba(212,111,111,.09);
  border-color: rgba(212,111,111,.38);
}
.danger-text { color: var(--bad); }
.danger-note {
  border-color: rgba(212,111,111,.28);
  background: rgba(212,111,111,.06);
}
.delete-message { line-height: 1.55; }

.watch-meta {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding-top: 18px;
  color: #5e6973;
  font: 10px/1.35 var(--mono);
}
.discovery-status {
  display: block;
  width: fit-content;
  padding: 4px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.discovery-status.active {
  color: var(--good);
  border: 1px solid rgba(109,182,138,.2);
  background: rgba(109,182,138,.06);
}
.discovery-status.idle {
  color: #7c8792;
  border: 1px solid #303840;
  background: rgba(124,135,146,.04);
}
.discovery-status.missing {
  color: var(--signal);
  border: 1px solid rgba(215,163,74,.2);
  background: rgba(215,163,74,.05);
}
.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.card-actions .btn { padding: 7px 9px; font-size: 10px; }

.modal-wide { width: min(920px, calc(100vw - 32px)); }
.bulk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.bulk-preview-summary {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #2b343d;
  background: #0d1115;
  color: #9ca6af;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.5;
}
.bulk-preview-wrap {
  margin-top: 10px;
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}
.bulk-preview-wrap th,
.bulk-preview-wrap td {
  padding: 9px 10px;
  font-size: 10px;
}
.bulk-preview-wrap td:last-child {
  white-space: normal;
  min-width: 280px;
  word-break: break-word;
}

.discovery-toolbar .toolbar-actions { align-items: flex-end; }
.discovery-top-grid { align-items: stretch; }
.discovery-panel-spaced { margin-top: 12px; }
.profile-dl { margin: 14px 0 0; }
.profile-dl div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.profile-dl dt { color: #6e7984; font-size: 11px; }
.profile-dl dd {
  margin: 0;
  color: #c6ccd1;
  font: 10px/1.4 var(--mono);
  text-align: right;
}
.profile-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.term-list { display: grid; gap: 0; }
.term-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}
.term-row:first-child { border-top: 0; }
.term-row strong { display: block; font-size: 12px; }
.term-row .sub { display: block; margin-top: 4px; color: #65717c; font: 9px/1.4 var(--mono); }
.term-row.is-disabled { opacity: .48; }
.candidate-link {
  display: block;
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #edf0f2;
  font-weight: 600;
  text-decoration: none;
}
.candidate-link:hover { color: var(--signal); }
#candidates-table td:first-child { max-width: 470px; white-space: normal; }
#candidates-table .sub { white-space: normal; max-width: 440px; }

.state.pending {
  color: var(--signal);
  background: rgba(215,163,74,.07);
  border: 1px solid rgba(215,163,74,.2);
}

@media (max-width: 900px) {
  .toolbar-actions { width: 100%; justify-content: flex-start; }
  .toolbar-select { min-width: min(100%, 260px); }
  .bulk-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .nav { grid-template-columns: repeat(6, minmax(78px, 1fr)); }
  .card-actions .btn { flex: 1 1 auto; }
  .profile-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .toolbar-actions,
  .profile-actions,
  .card-actions { flex-direction: column; align-items: stretch; }
  .toolbar-actions .btn,
  .profile-actions .btn,
  .card-actions .btn,
  .toolbar-select { width: 100%; }
  .term-row { grid-template-columns: 1fr; }
  .modal-actions { flex-wrap: wrap; }
}


/* V0.6.1 — Discovery content/source distinction */
.candidate-content-cell, .candidate-parent-cell { min-width: 0; max-width: none; }
.candidate-link, .candidate-source-link { display: block; font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.candidate-source-link { color: var(--accent); }
.candidate-url { overflow-wrap: anywhere; }
.candidate-evidence { display: inline-block; margin-top: 7px; }
.candidate-needs-review { display: block; font-weight: 700; color: var(--warning, #d5a64b); }

/* V0.8.0 — stable Discovery candidate column alignment */
.candidate-table { table-layout: fixed; min-width: 1080px; }
.candidate-table th,
.candidate-table td { vertical-align: top; }
.candidate-table .candidate-col-content { width: 27%; }
.candidate-table .candidate-col-source { width: 22%; }
.candidate-table .candidate-col-type { width: 7%; }
.candidate-table .candidate-col-score { width: 6%; }
.candidate-table .candidate-col-state { width: 10%; }
.candidate-table .candidate-col-seen { width: 12%; }
.candidate-table .candidate-col-actions { width: 16%; }
.candidate-table .table-actions {
  justify-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  white-space: normal;
}
#candidates-table td:first-child,
#candidates-table .sub { max-width: none; }


/* K4-ROV V0.6.2 — admin journals UI */
.admin-journals-panel{margin-top:18px}
.journal-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:16px 0}
.journal-metric{border:1px solid #252d35;border-radius:8px;background:#10151a;padding:12px}
.journal-metric span{display:block;color:#78838e;font-size:11px;margin-bottom:6px}
.journal-metric strong{font:700 16px/1.2 var(--mono);color:#e8ebed}
.journal-tabs{display:flex;gap:6px;flex-wrap:wrap;border-bottom:1px solid #252d35;margin:10px 0 16px;padding-bottom:8px}
.journal-tab{border:1px solid #2b343d;border-radius:7px;background:#10151a;color:#8e99a4;padding:8px 12px;cursor:pointer}
.journal-tab.active{color:#f1f3f4;border-color:#5b6671;background:#171d23}
.journal-pane{display:none}.journal-pane.active{display:block}
.journal-filter-grid,.journal-retention-grid{display:grid;grid-template-columns:repeat(5,minmax(140px,1fr));gap:10px;align-items:end;margin-bottom:14px}
.journal-filter-grid label,.journal-retention-grid label{display:grid;gap:6px;color:#8b96a0;font-size:11px}
.journal-filter-actions,.journal-retention-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.journal-table-wrap{max-height:520px;overflow:auto}.journal-table{width:100%;min-width:980px;border-collapse:collapse}
.journal-table th,.journal-table td{text-align:left;vertical-align:top;padding:9px 10px;border-bottom:1px solid #202830;font-size:12px}
.journal-table th{position:sticky;top:0;z-index:1;background:#11171c;color:#86919c;font-size:10px;text-transform:uppercase}
.journal-table td:first-child{white-space:nowrap;font-family:var(--mono)}
.journal-pagination{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:12px}
.journal-retention-meta{display:grid;gap:5px;padding:9px 0}.journal-retention-meta span{color:#7f8a95;font-size:11px}
.journal-detail-box{margin-top:14px;border:1px solid #252d35;border-radius:8px;padding:10px 12px;background:#0e1317}
.journal-detail-box pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:420px;overflow:auto;color:#bec6cc;font:11px/1.55 var(--mono)}
.journal-status-success{color:#8fbf9b}.journal-status-error,.journal-status-failed,.journal-severity-error,.journal-severity-critical{color:#e89292}.journal-severity-warning{color:#d7b46a}
@media(max-width:1100px){.journal-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.journal-filter-grid,.journal-retention-grid{grid-template-columns:repeat(2,minmax(160px,1fr))}}
@media(max-width:650px){.journal-summary-grid,.journal-filter-grid,.journal-retention-grid{grid-template-columns:1fr}}

#journal-export-dialog { width: min(560px, calc(100vw - 32px)); }
#journal-export-dialog form { width: 100%; min-width: 0; }

/* K4-ROV V0.8.0 — button UX/accessibility */

/*
 * Common interaction contract for every native button.
 *
 * - keyboard focus is visible independently of colour;
 * - pressed state has a geometric/inset signal;
 * - disabled state is visually and semantically distinct;
 * - motion is reduced when requested by the OS.
 */
button {
  transition:
    background-color .15s ease,
    border-color .15s ease,
    color .15s ease,
    transform .12s ease,
    box-shadow .15s ease,
    opacity .15s ease;
}

button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(215, 163, 74, .16);
}

button:not(:disabled):active {
  transform: translateY(1px) scale(.985);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
  box-shadow: none;
}

button:disabled:hover {
  transform: none;
}

/*
 * Harmonise the Activity Journal export modal with the
 * application's normal primary / secondary hierarchy.
 */
.primary-button,
.secondary-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 13px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
}

.btn-primary,
.primary-button {
  background: var(--signal);
  color: #111;
  border-color: var(--signal);
}

.btn-primary:hover,
.primary-button:hover {
  background: #e2af57;
  border-color: #e2af57;
}

.btn-secondary,
.secondary-button {
  background: #171c22;
  color: #e8ebed;
  border-color: #3a434d;
}

.btn-secondary:hover,
.secondary-button:hover {
  background: #1d232a;
  border-color: #56616c;
}

/*
 * Improve contrast and add missing hover affordances to
 * lightweight controls.
 */
.btn-ghost {
  color: #c3cbd3;
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon-button {
  color: #aab3bc;
  border-radius: 6px;
}

.icon-button:hover {
  color: #f1f3f4;
  background: #171d23;
}

.journal-tab:hover {
  color: #dce0e4;
  background: #151b20;
  border-color: #46515c;
}

/*
 * Selected navigation/tab state is not communicated by
 * colour alone.
 */
.nav-item.active {
  box-shadow: inset 3px 0 0 var(--signal);
  font-weight: 650;
}

.journal-tab.active {
  box-shadow: inset 0 -2px 0 var(--signal);
  font-weight: 650;
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }

  button:not(:disabled):active {
    transform: none;
  }
}

/* K4-ROV V0.11.0 — social/community visibility */
.items-scope-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0d1115;
}
.items-scope-button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 13px;
  background: transparent;
  color: #7f8a95;
  font: 650 10px/1 var(--mono);
  letter-spacing: .04em;
  cursor: pointer;
}
.items-scope-button.is-active {
  color: var(--signal);
  border-color: rgba(215,163,74,.35);
  background: var(--signal-soft);
}
.items-scope-button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}
.item-card.is-social {
  border-left: 2px solid rgba(215,163,74,.62);
}
.item-context {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin: 7px 0 5px;
}
.item-context-entry {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  min-width: 0;
}
.item-context-label {
  color: #5f6b76;
  font: 650 8px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.item-context-value {
  color: #aeb6be;
  font-size: 10px;
}
@media (max-width: 650px) {
  .items-scope-switch { display: flex; width: 100%; }
  .items-scope-button { flex: 1; }
}

/* K4-ROV V0.11.0 — source coverage visibility */
.source-coverage-panel { margin-bottom: 12px; }
.coverage-title-row { align-items: center; }
.coverage-title-row .micro-label { text-align: right; }
.coverage-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.coverage-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #0d1115;
}
.coverage-metric span { color: #737f8a; font-size: 10px; }
.coverage-metric strong { font: 650 17px/1 var(--mono); }
.coverage-group + .coverage-group { margin-top: 16px; }
.coverage-platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}
.coverage-platform-card {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #0d1115;
}
.coverage-platform-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.coverage-platform-head > strong { font-size: 11px; line-height: 1.35; }
.coverage-platform-badges { display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.coverage-capability {
  font: 600 8px/1 var(--mono);
  padding: 5px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  color: #8b96a0;
  border: 1px solid #303840;
  background: rgba(124,135,146,.05);
}
.coverage-capability.native_connector { color: var(--good); border-color: rgba(109,182,138,.2); background: rgba(109,182,138,.05); }
.coverage-capability.connector_required { color: var(--signal); border-color: rgba(215,163,74,.2); background: var(--signal-soft); }
.coverage-platform-meta, .coverage-platform-sub, .coverage-platform-errors { margin-top: 8px; font: 9px/1.45 var(--mono); }
.coverage-platform-meta { color: #79848e; }
.coverage-platform-sub { color: #5f6a75; }
.coverage-platform-errors { color: var(--bad); white-space: normal; overflow-wrap: anywhere; }
.coverage-platform-gate { margin-top: 8px; color: #8b96a0; font: 9px/1.45 var(--mono); }
.coverage-platform-actions { display: flex; margin-top: 10px; }
.coverage-platform-actions .btn { width: 100%; min-height: 32px; justify-content: center; }
.coverage-configure-button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.coverage-details > summary {
  cursor: pointer;
  color: #9aa4ad;
  font: 600 10px/1.4 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.coverage-details > summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }

@media (max-width: 1180px) {
  .coverage-platform-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .coverage-metrics, .coverage-platform-grid { grid-template-columns: 1fr; }
  .coverage-title-row { align-items: flex-start; gap: 12px; }
  .coverage-title-row .micro-label { text-align: left; }
}

/* K4-ROV V0.11.0+ — safe source onboarding guidance */
.source-platform-context { margin-bottom: 12px; padding: 10px 12px; border: 1px solid rgba(109,182,138,.24); border-radius: 7px; background: rgba(109,182,138,.05); color: #9aa4ad; font: 10px/1.5 var(--mono); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.source-platform-context.is-hidden { display: none; }
.source-capability-guidance { min-height: 42px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.source-capability-guidance.is-ready { border-color: rgba(109,182,138,.24); }
.source-capability-guidance.is-blocked { border-color: rgba(212,111,111,.28); background: rgba(212,111,111,.05); }

/* Shared public-source registry: visible only to authenticated admins. */
#source-library-panel { margin-bottom: 14px; }
#source-library-panel .panel-title-row p { color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 860px; margin: 8px 0 0; }
.source-library-form { display: grid; grid-template-columns: 1fr minmax(240px, 2fr) 120px 110px; gap: 10px; align-items: end; margin-bottom: 12px; }
.source-library-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--muted); font-size: 11px; }
.source-library-form input:not([type="checkbox"]), .source-library-form select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); padding: 9px; }
.source-library-form .source-library-check { flex-direction: row; align-items: center; min-height: 36px; }
.source-library-form .source-library-check input { width: 16px; height: 16px; accent-color: var(--signal); }
.source-library-form > button { min-height: 36px; }
.source-library-index-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.source-library-index-panel h4 { margin: 0 0 8px; font-size: 14px; }
.source-library-index-panel p { font-size: 12px; line-height: 1.5; }
.source-library-index-form { display: grid; grid-template-columns: minmax(240px, 2fr) 110px minmax(140px, 1fr); gap: 10px; align-items: end; margin: 12px 0; }
.source-library-index-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--muted); font-size: 11px; }
.source-library-index-form input[type="url"], .source-library-index-form select { width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel); }
.source-library-index-form .source-library-check { flex-direction: row; align-items: center; min-height: 36px; }
.source-library-index-form input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--signal); }
.source-library-index-form .toolbar-actions { grid-column: 1 / -1; }
@media (max-width: 760px) { .source-library-index-form { grid-template-columns: minmax(0, 1fr); } }
.source-library-footer { display: flex; justify-content: flex-end; padding-top: 12px; }
#source-library-message { font-size: 12px; min-height: 18px; }
@media (max-width: 1060px) { .source-library-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .source-library-form { grid-template-columns: minmax(0, 1fr); } }

/* V0.12.1 — Source-centred, responsive register. Technical tables are opt-in. */
.source-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.source-tab { border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 9px; padding: 11px 15px; cursor: pointer; font-size: 13px; font-weight: 650; }
.source-tab:hover, .source-tab:focus-visible { border-color: var(--signal); color: var(--text); }
.source-tab.is-current { color: var(--signal); border-color: var(--signal); background: var(--signal-soft); }
.source-tab-hint { font-size: 11px; font-weight: 400; margin-left: 5px; }
.source-main-panel { margin-bottom: 14px; }
.source-main-heading { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.source-main-heading p { font-size: 12px; max-width: 680px; line-height: 1.6; }
.source-main-filters { display: grid; grid-template-columns: minmax(210px, 2fr) repeat(2, minmax(140px, 1fr)); gap: 12px; }
.source-main-filters label { margin: 8px 0 16px; }
.source-main-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,310px),1fr)); gap: 12px; }
.source-entry { display: grid; align-content: start; gap: 13px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel-2); padding: 16px; min-width: 0; }
.source-entry-heading { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.source-entry-heading > div { min-width: 0; flex: 1 1 155px; }
.source-entry-heading strong { display: block; overflow-wrap: anywhere; font-size: 14px; }
.source-entry-url { display: block; color: var(--muted); overflow-wrap: anywhere; font-size: 11px; margin-top: 5px; }
.source-entry-state { border: 1px solid var(--line); font-size: 10px; padding: 5px 7px; border-radius: 6px; align-self: start; }
.source-entry-available { color: var(--good); border-color: rgba(109,182,138,.35); }
.source-entry-paused, .source-entry-connector { color: var(--muted); }
.source-entry-needs-attention { color: var(--bad); border-color: rgba(212,111,111,.35); }
.source-entry-watches { display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; min-height: 20px; }
.source-watch-pill { border: 1px solid var(--line); border-radius: 4px; color: #bbc4cc; padding: 4px 7px; overflow-wrap: anywhere; }
.source-entry-meta { font-size: 11px; color: var(--muted); margin: 0; }
.source-entry > .btn { justify-self: start; }
.source-main-footer { display: flex; justify-content: flex-end; margin-top: 15px; }
.source-technical { display: grid; gap: 12px; }
.source-detail { margin-bottom: 14px; }
.source-detail-heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.source-detail-heading h3, .source-detail h4 { margin: 4px 0 9px; }
.source-detail-url { overflow-wrap: anywhere; font-size: 12px; }
.source-detail-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.source-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0; }
.source-detail-association { display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.source-detail-association > strong { margin-right: auto; overflow-wrap: anywhere; }
.source-detail-association > span { font-size: 12px; }
.source-detail-health { margin-bottom: 14px; }
#source-detail-message { margin: 12px 0 0; min-height: 18px; color: var(--signal); font-size: 12px; }
@media (max-width: 840px) {
  .source-main-filters { grid-template-columns: 1fr; }
  .source-main-heading { flex-direction: column; }
  .source-detail-heading { flex-wrap: wrap; }
  .source-main-list { grid-template-columns: minmax(0,1fr); }
}
