/* GuaranteeHub – Clickable Prototype styles */
:root {
  --navy: #1d3f5e;
  --navy-dark: #16324b;
  --navy-light: #2c5a82;
  --ink: #1f2937;
  --muted: #6b7280;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --zebra: #f5f7fa;
  --bg: #eef2f6;
  --card: #ffffff;
  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --blue-bg: #dbeafe;
  --grey-bg: #e5e7eb;
  --gold: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 42, 67, 0.08), 0 4px 14px rgba(16, 42, 67, 0.06);
  --font: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--navy); }
.role-hidden { display: none !important; }

/* ---------- Demo toolbar (prototype chrome, not app UI) ---------- */
.demo-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 20px;
  background: #111827;
  color: #d1d5db;
  font-size: 13px;
  border-bottom: 2px solid var(--gold);
  flex-wrap: wrap;
}
.demo-bar .demo-tag {
  background: var(--gold);
  color: #111827;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
}
.demo-bar a { color: #93c5fd; text-decoration: none; }
.demo-bar a:hover { text-decoration: underline; }
.demo-bar label { display: flex; align-items: center; gap: 6px; }
.demo-bar select {
  font-family: var(--font);
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid #4b5563;
  background: #1f2937;
  color: #f9fafb;
}
.demo-persona-desc { color: #9ca3af; }
.demo-page-note {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 9px 20px;
  font-size: 13.5px;
  border-bottom: 1px solid #fcd34d;
}

/* ---------- App header ---------- */
.app-header { background: var(--navy); color: #fff; }
.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand .brand-mark { color: #7fb2e5; margin-right: 6px; }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-header:hover { background: rgba(255, 255, 255, 0.22); }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e8eef4;
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.persona-chip { text-align: right; line-height: 1.25; }
.persona-chip .p-name { font-size: 13.5px; font-weight: 600; }
.persona-chip .p-role { font-size: 12px; color: #b6c8d9; }

/* Facility sub-header (title bar of facility pages) */
.facility-bar { background: var(--navy-dark); color: #fff; }
.facility-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.facility-bar h1 { font-size: 18px; font-weight: 700; margin: 0; }
.facility-bar .crumb { font-size: 13px; }
.facility-bar .crumb a { color: #9db8d0; text-decoration: none; }
.facility-bar .crumb a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}
.page-narrow { max-width: 900px; }
.card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card h3 { margin: 18px 0 8px; font-size: 15px; }
.card .card-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 900px) {
  .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
}
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-row .spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.2;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #166534; }
.btn-danger { background: #fff; color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { background: var(--zebra); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Pills / badges / dots ---------- */
.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-active { background: var(--green-bg); color: var(--green); }
.pill-pending { background: var(--amber-bg); color: var(--amber); }
.pill-inactive { background: var(--grey-bg); color: #4b5563; }
.pill-draft { background: var(--blue-bg); color: #1e40af; }
.pill-approval { background: var(--amber-bg); color: var(--amber); }
.pill-cancelled { background: var(--red-bg); color: var(--red); }
.pill-add { background: var(--red-bg); color: var(--red); cursor: pointer; }
.pill-access { background: var(--green-bg); color: var(--green); cursor: pointer; }
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -1px;
  flex: none;
}
.dot-green { background: #22c55e; }
.dot-amber { background: #f59e0b; }
.dot-red { background: #ef4444; }
.dot-grey { background: #9ca3af; }
.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.tag-info { background: var(--blue-bg); color: #1e40af; }
.tag-warn { background: var(--amber-bg); color: var(--amber); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border-light); }
table.gh {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}
table.gh th {
  background: var(--navy);
  color: #fff;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  white-space: nowrap;
}
table.gh td {
  padding: 11px 14px;
  border-top: 1px solid var(--border-light);
  vertical-align: middle;
}
table.gh tbody tr:nth-child(even) { background: var(--zebra); }
table.gh tbody tr.row-link { cursor: pointer; }
table.gh tbody tr.row-link:hover { background: #e7eef5; }
table.gh td.num, table.gh th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.gh tr.total-row td { font-weight: 700; border-top: 2px solid var(--border); background: #eef2f6; }
table.gh .sub { color: var(--muted); font-size: 12.5px; }
.star { color: #cbd5e1; cursor: pointer; font-size: 19px; user-select: none; }
.star.on { color: var(--gold); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab-btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.tab-btn:hover { background: var(--zebra); }
.tab-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab-btn .count {
  background: rgba(29, 63, 94, 0.12);
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 6px;
  font-size: 12px;
}
.tab-btn.active .count { background: rgba(255, 255, 255, 0.25); }
[data-tab-panel] { display: none; }
[data-tab-panel].active { display: block; }

/* ---------- KPI cards ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1000px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.kpi .kpi-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.kpi .kpi-value { font-size: 22px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kpi-green .kpi-value { color: var(--green); }
.kpi-amber .kpi-value { color: #c2610c; }

/* ---------- Restriction list ---------- */
.restriction-list { list-style: none; margin: 0; padding: 0; }
.restriction-list li {
  display: flex;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 14px;
}
.restriction-list li:last-child { border-bottom: none; }
.restriction-list .pct { margin-left: auto; font-weight: 700; padding-left: 12px; white-space: nowrap; }
.pct-green { color: var(--green); }
.pct-amber { color: var(--amber); }
.pct-red { color: var(--red); }
.pct-grey { color: var(--muted); font-weight: 500; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.span-2 { grid-column: span 2; }
@media (max-width: 800px) { .field.span-2 { grid-column: span 1; } }
.field label { font-size: 13px; font-weight: 600; color: #374151; }
.field label .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="email"], .field select, .field textarea {
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #7fb2e5;
  border-color: var(--navy);
}
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-row input { width: 16px; height: 16px; }
.radio-row { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.inline-fields { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

fieldset.panel {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 14px 16px 16px;
  margin: 0;
  background: #fbfcfe;
}
fieldset.panel legend {
  font-weight: 700;
  font-size: 14px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Checklist (Vollständigkeit) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.checklist li { display: flex; gap: 9px; padding: 6px 0; align-items: baseline; }
.check-ok { color: var(--green); font-weight: 700; }
.check-bad { color: var(--red); font-weight: 700; }

/* ---------- Banners ---------- */
.banner {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.banner-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #fcd34d; }
.banner-ok { background: var(--green-bg); color: var(--green); border: 1px solid #86efac; }
.banner-info { background: var(--blue-bg); color: #1e40af; border: 1px solid #93c5fd; }
.banner-danger { background: var(--red-bg); color: var(--red); border: 1px solid #fca5a5; }

/* ---------- Modal ---------- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 300;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-backdrop.open { display: block; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  max-width: 640px;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.modal-lg { max-width: 860px; }
.modal-head {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
}
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-close {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-body { padding: 20px 22px; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fbfcfe;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #f9fafb;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 400;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ok { color: #4ade80; margin-right: 8px; font-weight: 700; }

/* ---------- Workflow / status ---------- */
.status-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.wf-steps { display: flex; gap: 0; flex-wrap: wrap; margin: 10px 0 4px; }
.wf-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
}
.wf-step:first-child { border-radius: 8px 0 0 8px; }
.wf-step:last-child { border-radius: 0 8px 8px 0; }
.wf-step + .wf-step { border-left: none; }
.wf-step.done { background: var(--green-bg); color: var(--green); border-color: #86efac; }
.wf-step.current { background: var(--amber-bg); color: var(--amber); border-color: #fcd34d; font-weight: 700; }

/* ---------- Conversation ---------- */
.msg { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border-light); }
.msg:last-child { border-bottom: none; }
.msg .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.msg .msg-body { flex: 1; }
.msg .msg-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.msg .msg-meta b { color: var(--ink); font-size: 13.5px; }
.msg .attachment {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  background: var(--zebra);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 4px 10px;
  margin-top: 6px;
  color: var(--navy);
  text-decoration: none;
}

/* ---------- Restriction builder ---------- */
.clause {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.clause .clause-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.clause select, .clause input {
  font-family: var(--font);
  font-size: 13.5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}
.clause .op {
  font-weight: 700;
  font-size: 12px;
  color: var(--navy);
  background: var(--blue-bg);
  border-radius: 4px;
  padding: 2px 8px;
}
.precondition {
  background: var(--amber-bg);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--amber);
}

/* ---------- Index / hub ---------- */
.hub-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #2a5a85 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 34px 34px;
  margin-bottom: 24px;
}
.hub-hero h1 { margin: 0 0 8px; font-size: 28px; }
.hub-hero p { margin: 0; color: #c8d9e8; max-width: 720px; }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1000px) { .hub-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .hub-grid { grid-template-columns: 1fr; } }
.hub-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: transform 0.12s, box-shadow 0.12s;
}
.hub-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(16, 42, 67, 0.14); }
.hub-card h3 { margin: 0 0 4px; font-size: 15.5px; color: var(--navy); }
.hub-card p { margin: 0; font-size: 13px; color: var(--muted); }
.hub-card .who { margin-top: 10px; font-size: 12px; }
.step-list { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.step-list li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-light);
  align-items: baseline;
}
.step-list li:last-child { border-bottom: none; }
.step-num {
  counter-increment: step;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex: none;
  align-self: center;
}
.persona-badge {
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 8px;
  white-space: nowrap;
}
.pb-agent { background: var(--blue-bg); color: #1e40af; }
.pb-borrower { background: var(--green-bg); color: var(--green); }
.pb-bank { background: #ede9fe; color: #6d28d9; }
.pb-cubera { background: #111827; color: #fbbf24; }
.pb-operator { background: var(--amber-bg); color: var(--amber); }
.pb-lender { background: var(--grey-bg); color: #374151; }

.footnote { color: var(--muted); font-size: 13px; margin-top: 14px; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
