/* =========================================================
   [Lender Name] — Mortgage Management Mockup
   Design direction: Option A · "Ledger" (classic & trustworthy)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #F7F5EF;
  --side: #EFECE3;
  --card: #FFFFFF;
  --line: #E3DED1;
  --line-2: #EFEBE1;
  --hover: #E6E1D4;
  --ink: #1B2433;
  --ink-2: #3A4658;
  --muted: #5A6474;
  --navy: #1F3A5F;
  --navy-d: #142842;
  --navy-t: #E4EAF2;
  --brass: #9A6B1F;
  --green-bg: #DCEBDD; --green: #1E5A2B;
  --red-bg: #F6DCD6;   --red: #8A2414;
  --amber-bg: #F3E6CC; --amber: #6E4A0E;
  --gray-bg: #ECEAE3;  --gray: #3A4658;
  --blue-bg: #E4EAF2;  --blue: #1F3A5F;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Public Sans', 'Segoe UI', system-ui, sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  min-width: 1280px;
}
a { color: var(--navy); }
a:hover { color: var(--navy-d); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 32px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--navy); color: #F7F5EF;
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 600; font-size: 18px;
}
.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 8px;
  text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.active { background: var(--navy); color: #FFFFFF; }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--red-bg); color: var(--red); border-radius: 999px; padding: 1px 8px; }
.nav a.active .count { background: rgba(255,255,255,.18); color: #FFFFFF; }
.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }

.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 40px;
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20;
}
.content { padding: 28px 40px 48px; display: flex; flex-direction: column; gap: 24px; }

/* ---------- Page header ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-header .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #DCD6C6; background: var(--card);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #FBFAF6; border-color: #CFC8B5; color: var(--ink); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }
.btn-primary:hover { background: var(--navy-d); border-color: var(--navy-d); color: #FFFFFF; }
.btn-danger { background: var(--card); border-color: #E2B8AE; color: var(--red); }
.btn-danger:hover { background: #FCF1EE; color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn-icon { width: 40px; padding: 0; justify-content: center; }
.btn-link { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Search ---------- */
.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid #DCD6C6;
  border-radius: 8px; padding: 0 12px; height: 40px; width: 380px;
}
.search svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.search input { border: none; outline: none; font: inherit; background: transparent; width: 100%; }
.search kbd { font-family: var(--sans); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-flush { padding: 0; overflow: hidden; overflow-x: auto; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-flush .card-h { padding: 18px 20px 0; }
.card-f { padding: 12px 20px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.g-side-main { grid-template-columns: 320px minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-family: var(--serif); font-size: 32px; font-weight: 600; margin-top: 6px; line-height: 1.1; }
.kpi .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi .meta.warn { color: var(--brass); font-weight: 600; }
.kpi .meta.bad { color: var(--red); font-weight: 600; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FBFAF6; white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover td { background: #FBF9F3; }
.tbl .sub { color: var(--muted); font-size: 12px; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: #FBFAF6; }
.tbl input[type=checkbox] { width: 16px; height: 16px; }

/* ---------- Pills, chips, badges ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: var(--gray); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-gray { background: var(--gray-bg); color: var(--gray); }
.pill-navy { background: var(--navy-t); color: var(--navy); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid #DCD6C6; background: var(--card);
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: #CFC8B5; }
.chip.active { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }
.chip .n { opacity: .75; margin-left: 4px; }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: #DCE3EC; color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--gray-bg); color: var(--ink-2); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 12px 14px; margin-bottom: -1px;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.tab .n { font-size: 11px; background: var(--gray-bg); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Key/value lists ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; row-gap: 10px; column-gap: 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv.tight { grid-template-columns: 130px 1fr; row-gap: 8px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 20px; }
.fieldset { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.fieldset > h2, .fieldset > .fs-h { margin-bottom: 16px; }
.fs-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fs-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  height: 40px; border: 1px solid #D6D0C0; border-radius: 8px; padding: 0 12px; font: inherit; background: var(--card); color: var(--ink); width: 100%;
}
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid #9DB2CC; outline-offset: 0; border-color: var(--navy); }
.field input[readonly] { background: #F6F4EE; color: var(--ink-2); }
.affix { display: flex; align-items: stretch; }
.affix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid #D6D0C0; background: #F6F4EE; color: var(--muted); font-size: 13px; }
.affix span:first-child { border-right: none; border-radius: 8px 0 0 8px; }
.affix span:last-child { border-left: none; border-radius: 0 8px 8px 0; }
.affix input { border-radius: 0 !important; }
.affix span:first-child + input { border-radius: 0 8px 8px 0 !important; }
.affix input:first-child { border-radius: 8px 0 0 8px !important; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; min-height: 40px; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 20px 0 4px; }
.repeat-item { border: 1px dashed #D6D0C0; border-radius: 10px; padding: 16px; position: relative; background: #FDFCF9; }
.repeat-item + .repeat-item { margin-top: 12px; }
.repeat-item .remove { position: absolute; top: 10px; right: 10px; }
.calc-box { background: var(--navy-t); border-radius: 10px; padding: 14px 16px; display: flex; gap: 32px; flex-wrap: wrap; }
.calc-box .c-l { font-size: 12px; color: var(--ink-2); }
.calc-box .c-v { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------- Callouts ---------- */
.callout { border-radius: 10px; padding: 12px 16px; font-size: 13.5px; display: flex; gap: 12px; align-items: flex-start; }
.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; stroke: currentColor; fill: none; stroke-width: 2; }
.callout.info { background: var(--navy-t); color: var(--navy-d); }
.callout.warn { background: var(--amber-bg); color: var(--amber); }
.callout.bad { background: var(--red-bg); color: var(--red); }
.callout.good { background: var(--green-bg); color: var(--green); }

/* ---------- Stepper ---------- */
.stepper { display: flex; gap: 0; }
.step { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.step .bar { height: 6px; background: var(--line); margin-right: 4px; border-radius: 3px; }
.step.done { color: var(--ink-2); }
.step.done .bar { background: var(--navy); }
.step.current { color: var(--navy); }
.step.current .bar { background: linear-gradient(90deg, var(--navy) 50%, var(--line) 50%); }

/* ---------- Lists / timeline ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex-grow: 1; min-width: 0; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 28px; height: 28px; border-radius: 999px; background: var(--navy-t); display: flex; align-items: center; justify-content: center; }
.tl-dot svg { width: 14px; height: 14px; stroke: var(--navy); fill: none; stroke-width: 2; }
.tl-item .when { font-size: 12px; color: var(--muted); }

/* ---------- Tasks ---------- */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.task:last-child { border-bottom: none; }
.task input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--navy); flex-shrink: 0; }
.task .grow { flex-grow: 1; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.due-today { color: var(--red); font-weight: 600; }
.due-soon { color: var(--brass); font-weight: 600; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kcol { background: var(--side); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 220px; }
.kcol.drag-over { outline: 2px dashed var(--navy); outline-offset: -4px; }
.kcol-h { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; padding: 2px 4px 4px; }
.kcol-h .n { background: var(--card); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.kcol-sum { font-size: 12px; color: var(--muted); padding: 0 4px; margin-top: -6px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; cursor: grab; text-decoration: none; color: var(--ink); }
.kcard:hover { border-color: #CFC8B5; box-shadow: 0 2px 8px rgba(27,36,51,.06); color: var(--ink); }
.kcard.dragging { opacity: .5; }
.kcard .nm { font-weight: 700; }
.kcard .amt { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.kcard .tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,40,.45); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 60px 20px; overflow-y: auto; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--card); border-radius: 14px; width: 560px; max-width: 100%; box-shadow: 0 20px 60px rgba(20,28,40,.25); display: flex; flex-direction: column; }
.modal.lg { width: 820px; }
.modal.xl { width: 1040px; }
.modal-h { padding: 20px 24px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-b { padding: 8px 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-f { padding: 14px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; background: #FBFAF6; border-radius: 0 0 14px 14px; }
.x-btn { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted); }
.x-btn:hover { background: var(--hover); color: var(--ink); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; gap: 10px; align-items: center; animation: toastIn .2s ease-out; }
.toast svg { width: 16px; height: 16px; stroke: #9BD3A5; fill: none; stroke-width: 2.5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dropdown menu ---------- */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(20,28,40,.14); min-width: 220px; padding: 6px; display: none; z-index: 50; }
.menu.open { display: block; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 7px; border: none; background: none; font: inherit; font-size: 13.5px; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu hr { border: none; border-top: 1px solid var(--line-2); margin: 6px 0; }
.menu .danger { color: var(--red); }

/* ---------- Documents / files ---------- */
.file { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.file:last-child { border-bottom: none; }
.file-ic { width: 36px; height: 40px; border-radius: 6px; background: var(--navy-t); color: var(--navy); font-size: 10px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; flex-shrink: 0; }
.file-ic.pdf { background: #F6DCD6; color: var(--red); }
.file-ic.doc { background: var(--navy-t); color: var(--navy); }
.file-ic.img { background: var(--green-bg); color: var(--green); }
.file-ic.xls { background: #DDEEDC; color: #245C22; }
.dropzone { border: 2px dashed #D6D0C0; border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); background: #FDFCF9; }
.dropzone strong { color: var(--ink); }

/* ---------- Letter / statement preview ---------- */
.paper { background: #FFFFFF; border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(27,36,51,.08); padding: 48px 56px; font-size: 13.5px; }
.paper h1 { font-size: 24px; }
.paper .lh { display: flex; justify-content: space-between; border-bottom: 2px solid var(--navy); padding-bottom: 14px; margin-bottom: 24px; }

/* ---------- Bars (simple charts) ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col .b { width: 100%; max-width: 48px; background: var(--navy); border-radius: 6px 6px 0 0; }
.bar-col .b.alt { background: #B9C6D6; }
.bar-col .bl { font-size: 11.5px; color: var(--muted); }
.bar-col .bv { font-size: 11.5px; font-weight: 600; }
.meter { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--navy); border-radius: 4px; }

/* ---------- Messages (inbox) ---------- */
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 72%; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; }
.msg.in { background: var(--side); align-self: flex-start; border-top-left-radius: 4px; }
.msg.out { background: var(--navy); color: #FFFFFF; align-self: flex-end; border-top-right-radius: 4px; }
.msg .meta { font-size: 11.5px; opacity: .75; margin-top: 6px; }

/* ---------- Mockup helper ---------- */
.mock-fab { position: fixed; right: 20px; bottom: 20px; z-index: 90; background: var(--ink); color: #FFFFFF; border-radius: 999px; padding: 10px 16px; font-size: 13px; font-weight: 600; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.mock-fab:hover { background: var(--navy-d); color: #FFFFFF; }
.mock-note { border: 1px dashed var(--brass); background: #FBF5E8; color: #5E430F; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; }
.mock-note strong { color: #4A330A; }

/* ---------- Sidebar sub-links (items with several screens) ---------- */
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 30px; border-left: 1px solid var(--line); padding-left: 8px; }
.nav .nav-sub a { padding: 6px 10px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.nav .nav-sub a.on { background: var(--navy-t); color: var(--navy); font-weight: 600; }

/* ---------- Configurable lookup lists ---------- */
/* the small list icon beside a label is always visible (faint), stronger on hover, so clients can see
   at a glance which drop-downs they can configure */
.lk-manage { display: inline-flex; align-items: center; justify-content: center; vertical-align: -3px; margin-left: 4px; width: 18px; height: 18px; border-radius: 5px; color: var(--muted); opacity: .55; transition: opacity .12s, background .12s; }
.lk-manage svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.field:hover .lk-manage, .lk-manage:focus-visible { opacity: 1; }
.lk-manage:hover { color: var(--navy); background: var(--navy-t); opacity: 1; }
.lk-manage:focus-visible { outline: 2px solid #9DB2CC; }
option.lk-add { font-weight: 600; color: var(--navy); }
.lk-warn { color: var(--brass) !important; font-weight: 600; }
.lk-tip { position: fixed; left: 268px; bottom: 20px; z-index: 95; width: 380px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 12px; box-shadow: 0 12px 32px rgba(20,28,40,.18); padding: 14px 16px; animation: toastIn .25s ease-out; }
.lk-tip-h { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.lk-tip svg { width: 15px; height: 15px; stroke: var(--navy); fill: none; stroke-width: 2; vertical-align: -3px; }
.lkm-used { margin: -4px 0 12px; padding: 8px 10px; background: #FBFAF6; border: 1px solid var(--line-2); border-radius: 8px; color: var(--ink-2); line-height: 1.7; }
.lkm-used a { white-space: nowrap; }
.lkm-reqs { margin-bottom: 14px; }
.lkm-req { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid rgba(110,74,14,.15); margin-top: 6px; }
.lkm-team { background: var(--navy-t) !important; color: var(--navy) !important; }
.lkm-lbl strong { word-break: break-word; }
.lk-existing .tag, .lkm-item span:first-child { overflow-wrap: anywhere; }
.search.sm { height: 34px; }
.lk-existing .chips { margin-top: 6px; max-height: 96px; overflow-y: auto; }
.lkm-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.switch-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.switch-row input { margin-top: 3px; width: 16px; height: 16px; }
.lkm { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.lkm-side { border: 1px solid var(--line); border-radius: 10px; background: #FBFAF6; padding: 8px; max-height: 640px; overflow-y: auto; }
.lkm-side .search { width: 100%; margin-bottom: 6px; }
.lkm-mod { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 8px 4px; }
.lkm-item { display: flex; width: 100%; justify-content: space-between; align-items: center; border: none; background: none; font: inherit; font-size: 13px; color: var(--ink); text-align: left; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.lkm-item:hover { background: var(--hover); }
.lkm-item.on { background: var(--navy); color: #fff; }
.lkm-item .n { font-size: 11px; font-weight: 700; opacity: .7; }
.lkm-main { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 16px; min-width: 0; }
.lkm-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.lkm-addrow { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.lkm-addrow input { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; min-width: 220px; }
.lkm-tbl td { padding: 8px 10px; }
.lkm-tbl tr.lkm-hid td { color: var(--muted); background: #FBFAF6; }
.lkm-tbl .btn-link[disabled] { opacity: .25; cursor: default; }

.type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; }
.lk-check-links { margin-top: 6px; color: var(--muted); }

/* ---------- Shared small helpers ---------- */
.btn[disabled], .menu button[disabled] { opacity: .5; cursor: not-allowed; }
.menu-note { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }
