:root {
  --bg: #0f1115;
  --surface: #1a1d24;
  --surface-2: #232732;
  --border: #2c3140;
  --text: #e6e8ee;
  --muted: #9aa1b1;
  --accent: #4f8cff;
  --accent-2: #3ad29f;
  --danger: #ff6b6b;
  --warning: #f7c948;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}
.nav { display: flex; gap: 6px; }
.nav a {
  padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); }

.container { max-width: 1040px; margin: 0 auto; padding: 28px 24px 60px; }
.container-wide { max-width: 1280px; }
/* Grows with the viewport (with side gutters) but stays capped on huge screens. */
.container-xwide { max-width: min(1800px, calc(100vw - 48px)); }
.container-full { max-width: none; }

.muted { color: var(--muted); }
.hero h1 { margin-bottom: 6px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; }
.tile {
  display: block; padding: 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tile h2 { margin: 0 0 6px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }

.search { display: flex; gap: 10px; margin-bottom: 22px; }
.search input {
  flex: 1; padding: 11px 14px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search button, .btn {
  padding: 11px 18px; background: var(--accent); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.search button:hover, .btn:hover { filter: brightness(1.08); }

.data-table, .kv { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }
.row-action { text-align: right; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 780px) { .detail-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel h3 { margin-top: 0; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 12px 8px 0; vertical-align: top; white-space: nowrap; }
.kv td { padding: 8px 0; word-break: break-word; }
.kv tr { border-bottom: 1px solid var(--border); }
.assoc-list { list-style: none; padding: 0; margin: 0; }
.assoc-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.assoc-list li:last-child { border-bottom: none; }

.back { color: var(--muted); }
.empty { padding: 30px 0; }

.enrich-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.hidden { display: none; }
.suggestion-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); margin-right: 6px; }
.badge-accent { background: rgba(58,210,159,.15); color: var(--accent-2); }
.badge-ok { background: rgba(58,210,159,.12); color: var(--accent-2); }
.badge-warn { background: rgba(247,201,72,.14); color: var(--warning); }
.dt-row-warn td { background: rgba(247,201,72,.04); }

.dt-local-select {
  padding: 5px 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px; min-width: 120px;
}
.dt-local-select:focus { outline: none; border-color: var(--accent); }
.dt-local-select.dt-select-unset { color: var(--muted); border-style: dashed; }

.type-bar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
}
.local-select-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.type-bar label { font-weight: 600; }
.type-bar select {
  padding: 8px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px; min-width: 180px;
}
.type-bar select:focus { outline: none; border-color: var(--accent); }
.cache-stats { margin: 16px 0 8px; }

.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.tag-accent { background: rgba(58,210,159,.15); color: var(--accent-2); }

.btn-group { display: flex; gap: 8px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.enrichment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  align-items: start;
}
.enrichment-list > .muted,
.enrichment-list > #enrichment-empty { grid-column: 1 / -1; }
.enrich-row {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; transition: border-color .12s, background .12s;
}
.enrich-row:hover { border-color: var(--accent); }
.enrich-row-wide {
  grid-column: 1 / -1;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 14px 16px;
}
.enrich-row-compact {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; min-height: 0;
}
.enrich-row-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  width: 100%;
}
.enrich-row.locked { border-left: 3px solid var(--accent-2); }
.enrich-row-hs { border-left: 3px solid var(--border); }
.enrich-row-main { min-width: 0; flex: 1; }
.enrich-row-compact .enrich-field { margin-bottom: 0; }
.enrich-row-compact .enrich-value { font-size: 14px; line-height: 1.4; }
.enrich-row-compact .enrich-actions { gap: 2px; }
.enrich-row-compact .icon-btn { width: 26px; height: 26px; font-size: 12px; }
.enrich-row-compact .link-btn { font-size: 11px; }
.enrich-field {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; margin-bottom: 6px;
}
.enrich-value { word-break: break-word; line-height: 1.55; color: var(--text); }
.value-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.value-list-cards { gap: 10px; }
.value-list-cards > li { list-style: none; }
.value-card {
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
}
.value-card-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.value-card-subtitle { color: var(--accent); font-size: 13px; margin-bottom: 8px; }
.value-card-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.value-meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.value-meta-label { color: var(--muted); font-size: 12px; font-weight: 600; min-width: 48px; }
.value-list .value-list { margin-top: 6px; padding-left: 14px; }
.enrich-value > .value-list:not(.value-list-cards) > li {
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
}
.value-kv { margin: 3px 0; font-size: 14px; }
.value-key { color: var(--muted); font-weight: 600; margin-right: 6px; }
.enrich-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); cursor: pointer; font-size: 14px; line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-danger:hover { border-color: var(--danger); color: var(--danger); }
.kv-action { text-align: right; width: 1%; white-space: nowrap; }
.link-btn {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px;
  padding: 2px 4px; text-decoration: underline;
}
.link-btn:hover { color: var(--accent); }

.enrichment-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.enrichment-form h4 { margin: 0 0 10px; font-size: 14px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row input {
  flex: 1; min-width: 120px; padding: 9px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
.form-row input:focus { outline: none; border-color: var(--accent); }
.form-hint { font-size: 12px; margin-top: 8px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-danger { background: rgba(255,107,107,.12); border-color: var(--danger); color: #ffb4b4; }
.alert-warning { background: rgba(247,201,72,.12); border-color: var(--warning); color: #ffe08a; }
.alert-info, .alert-message { background: rgba(79,140,255,.12); border-color: var(--accent); color: #b9d0ff; }

.footer { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; border-top: 1px solid var(--border); }

/* DataTable */
.datatable { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dt-toolbar, .dt-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.dt-footer { border-bottom: none; border-top: 1px solid var(--border); }
.dt-toolbar-left, .dt-toolbar-right, .dt-pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dt-search input {
  width: 280px; max-width: 100%; padding: 9px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
.dt-search input:focus { outline: none; border-color: var(--accent); }
.dt-toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.dt-toggle input { cursor: pointer; }
.dt-per-page { font-size: 13px; color: var(--muted); }
.dt-per-page select {
  margin: 0 4px; padding: 6px 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
}
.dt-scroll { overflow-x: auto; }
.dt-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.dt-table th, .dt-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dt-table thead tr:first-child th {
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface); position: sticky; top: 0; z-index: 2;
}
.dt-table thead tr:nth-child(2) th { background: var(--surface); padding: 6px 8px; }
.dt-col-filter {
  width: 100%; min-width: 80px; padding: 6px 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; font-size: 13px;
}
.dt-col-filter:focus { outline: none; border-color: var(--accent); }
.dt-sortable { cursor: pointer; user-select: none; }
.dt-sortable:hover { color: var(--text); background: var(--surface-2); }
.dt-sorted { color: var(--accent); }
.dt-table tbody tr:hover td { background: rgba(79,140,255,.06); }
.dt-actions-col { width: 80px; text-align: center; }
.dt-name-link { font-weight: 600; }
.dt-bool-col { width: 52px; text-align: center; vertical-align: middle; }
.dt-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: transparent; cursor: pointer;
  line-height: 0;
}
.dt-toggle:disabled { opacity: .45; cursor: not-allowed; }
.dt-toggle-track {
  display: block; width: 34px; height: 18px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  position: relative; transition: background .15s ease, border-color .15s ease;
}
.dt-toggle.is-on .dt-toggle-track {
  background: var(--accent); border-color: var(--accent);
}
.dt-toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff;
  transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.28);
}
.dt-toggle.is-on .dt-toggle-thumb { transform: translateX(16px); }
.dt-select-col { width: 36px; text-align: center; }
.dt-select-col input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.dt-loading, .dt-empty { text-align: center; color: var(--muted); padding: 32px 16px !important; }
.dt-info { font-size: 13px; }
.dt-page-label { font-size: 13px; color: var(--muted); min-width: 70px; text-align: center; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Email draft */
.email-draft-panel { margin-top: 18px; }
.email-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.email-draft-form label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; color: var(--muted); }
.email-draft-form input[type="text"],
.email-draft-form textarea {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
  line-height: 1.5; resize: vertical;
}
.email-draft-form input:focus, .email-draft-form textarea:focus { outline: none; border-color: var(--accent); }
.email-meta { margin-top: 10px; font-size: 12px; }
.dt-draft-label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; color: var(--muted); }
.dt-draft-subject { padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.dt-draft-col { white-space: nowrap; }
.dt-draft-btns { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.email-sources { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.email-sources li { padding: 3px 0; }
.email-settings-form { display: flex; flex-direction: column; gap: 18px; }
.email-settings-field label { font-size: 14px; font-weight: 600; }
.email-settings-field-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.email-settings-field input[type="text"],
.email-settings-field textarea,
.email-settings-field select {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
  line-height: 1.5; resize: vertical;
}
.email-settings-field input:focus,
.email-settings-field textarea:focus,
.email-settings-field select:focus { outline: none; border-color: var(--accent); }
.prompt-details { margin: 12px 0; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: var(--bg); }
.prompt-details summary { cursor: pointer; font-weight: 600; }
.prompt-textarea, .prompt-preview {
  width: 100%; margin-top: 10px; padding: 12px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: ui-monospace, monospace;
  line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.prompt-textarea { resize: vertical; min-height: 200px; }
.prompt-preview { max-height: 320px; overflow: auto; }

/* Kanban */
.kanban-head-right { display: flex; align-items: center; gap: 10px; }
.kanban-board {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start;
  justify-content: flex-start; width: 100%;
}
.kanban-col {
  flex: 1 1 260px; min-width: 260px; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px);
}
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600;
  position: sticky; top: 0; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-col-count {
  background: var(--surface-2); color: var(--muted); border-radius: 999px;
  padding: 1px 9px; font-size: 12px; font-weight: 600;
}
.kanban-col[data-stage="Licensed"] .kanban-col-head {
  background: rgba(58, 210, 159, .18);
  border-bottom-color: rgba(58, 210, 159, .35);
  color: var(--accent-2);
}
.kanban-col[data-stage="Licensed"] .kanban-col-count {
  background: rgba(58, 210, 159, .22);
  color: var(--accent-2);
}
.kanban-col-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 10px; }
.kanban-col-body.drop-target { background: rgba(79,140,255,.08); outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 8px; }
.kanban-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  cursor: grab; transition: border-color .12s, transform .05s;
}
.kanban-card:hover { border-color: var(--accent); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .5; }
.kanban-card-title { font-weight: 600; margin-bottom: 3px; }
.kanban-card-sub { font-size: 12px; color: var(--accent); margin-bottom: 4px; word-break: break-all; }
.kanban-card-meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kanban-card-link { font-size: 12px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; z-index: 1000; overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 560px; padding: 20px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.modal-wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-pre {
  margin-top: 14px; max-height: 60vh; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.modal-body { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.unstaged-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
}
.unstaged-row-info { min-width: 0; }
.unstaged-row-title { font-weight: 600; margin-bottom: 3px; }
.unstaged-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Dioceses */
.dioceses-progress { margin-bottom: 18px; }
.dioceses-progress-bar {
  height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.dioceses-progress-bar > span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}
#dioceses-progress-label { margin-top: 6px; }
.diocese-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.diocese-form input {
  padding: 8px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
.diocese-form input[name="name"] { min-width: 280px; flex: 1; }
.diocese-form-modal { display: block; margin-top: 0; }
.diocese-form-modal .field {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
}
.diocese-form-modal .field > span { font-size: 13px; color: var(--muted); }
.diocese-form-modal .field input { width: 100%; min-width: 0; }
.diocese-form-modal .modal-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 4px;
}
.di-field {
  width: 100%; padding: 6px 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.di-field:focus { outline: none; border-color: var(--accent); }
#dioceses-table td { white-space: normal; vertical-align: middle; }
#dioceses-table .dt-actions-col { width: 1%; white-space: nowrap; text-align: left; }
.di-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.di-actions .btn { flex: 0 0 auto; }

.enrich-diocese {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin: 10px 0;
}
.enrich-connections {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin: 10px 0;
}
.enrich-connections h4 { margin: 0 0 10px; font-size: 14px; }
.enrich-conn-row {
  border-top: 1px solid var(--border); padding: 10px 0;
  display: flex; flex-direction: column; gap: 6px;
}
.enrich-conn-row:first-of-type { border-top: none; padding-top: 0; }

/* Connections panel (detail page) */
.connections-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.conn-row {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: var(--bg);
}
.conn-row.conn-dotted { border-style: dashed; }
.conn-row-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-style-badge {
  font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700;
  color: var(--accent); min-width: 20px;
}
.conn-row.conn-dotted .conn-style-badge { color: var(--warning); }
.conn-label-tag {
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: 12px;
}
.conn-explanation { margin: 6px 0 8px 28px; font-size: 13px; }
.connection-form { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.connection-form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.connection-form input[type="search"],
.connection-form input[type="text"],
.connection-form select,
.connection-form textarea {
  padding: 8px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
}
.connection-form input[type="search"] { flex: 1; min-width: 220px; }
.connection-form textarea { width: 100%; resize: vertical; }
.conn-search-results {
  list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); max-height: 200px; overflow-y: auto;
}
.conn-search-results li {
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.conn-search-results li:hover { background: rgba(79,140,255,.08); }
.conn-search-results li:last-child { border-bottom: none; }

/* Connection graph */
.conn-legend-solid { border-bottom: 2px solid var(--accent); padding-bottom: 1px; }
.conn-legend-dotted { border-bottom: 2px dashed var(--warning); padding-bottom: 1px; }
.graph-wrap {
  position: relative; overflow: auto; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); min-height: 320px;
}
.graph-svg {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.graph-edge { stroke: var(--accent); stroke-width: 2; pointer-events: stroke; }
.graph-edge-dotted { stroke: var(--warning); stroke-dasharray: 6 5; }
.graph-nodes { position: relative; z-index: 1; min-height: 200px; }
.graph-node {
  position: absolute; display: flex; align-items: center; gap: 8px;
  width: 220px; padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; text-decoration: none;
  color: var(--text); font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.graph-node:hover { border-color: var(--accent); }
.graph-node-company { border-left: 3px solid var(--accent); }
.graph-node-contact { border-left: 3px solid var(--accent-2); }
.graph-node-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 2px 5px;
}

.prompts-grid { display: flex; flex-direction: column; gap: 20px; }
.prompt-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.prompt-card-head h2 { margin: 0; font-size: 1.15rem; }
.prompt-card.prompt-custom { border-color: rgba(58,210,159,.35); }

/* User guide / process page (rendered from README.md) */
.guide {
  max-width: 820px;
  margin: 0 auto;
}
.guide h1 {
  margin: 0 0 12px;
  font-size: 1.75rem;
  line-height: 1.25;
}
.guide h2 {
  margin: 2.2em 0 0.6em;
  font-size: 1.35rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.guide h3 {
  margin: 1.6em 0 0.5em;
  font-size: 1.1rem;
  color: var(--text);
}
.guide p { margin: 0.75em 0; }
.guide ul, .guide ol {
  margin: 0.5em 0 1em;
  padding-left: 1.4em;
}
.guide li { margin: 0.35em 0; }
.guide li > ul, .guide li > ol { margin-top: 0.25em; }
.guide hr {
  margin: 2em 0;
  border: none;
  border-top: 1px solid var(--border);
}
.guide table {
  width: 100%;
  margin: 1em 0 1.25em;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.95rem;
}
.guide th, .guide td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.guide th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}
.guide tr:last-child td { border-bottom: none; }
.guide pre {
  margin: 1em 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}
.guide strong { color: var(--text); font-weight: 600; }
.guide em { color: var(--muted); }

.nav-logout { margin-left: 8px; color: var(--muted) !important; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
}

.login-icon {
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 16px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.login-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.login-form label {
  font-size: 0.9rem;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-submit {
  margin-top: 8px;
  width: 100%;
}
