/* Dobbins Law Intake Portal */
:root {
  --green: #0B4D17; --green-2: #17652A; --green-50: #EEF4EF; --green-100: #DCE9DE;
  --gold: #AB792B; --gold-50: #FBF4E8; --gold-100: #F3E3C6;
  --ink: #18201A; --muted: #5E6A61; --line: #E1E6E2; --bg: #F5F6F3; --card: #FFFFFF;
  --red: #B42318; --red-50: #FDEDEB; --amber: #8A5A00; --amber-50: #FFF5DC; --grey-50: #F0F2F0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 18, .06), 0 1px 3px rgba(16, 24, 18, .08);
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pa-criminal: var(--green); --pa-family: var(--gold); --pa-other: #7A847D;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 1.75rem; color: var(--green); letter-spacing: -.01em; }
h2 { font-size: 1rem; font-weight: 650; }
h3 { font-size: .9rem; font-weight: 650; margin-top: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; } .red-text { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell ---------- */
.demo-bar { background: var(--gold); color: #fff; padding: .3rem 1.25rem; font-size: .85rem; display: flex; gap: .6rem; align-items: center; }
.demo-as { margin-left: auto; flex-direction: row; gap: .4rem; align-items: center; font-weight: 600; white-space: nowrap; }
.demo-as select { width: auto; min-height: 0; padding: .15rem .4rem; font-size: .82rem; border-radius: 6px; border: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .5rem 1.25rem; background: var(--card); border-bottom: 3px solid var(--gold); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--green); font-family: var(--serif); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.brand img { height: 40px; width: auto; }
.mainnav { display: flex; gap: .15rem; flex: 1; overflow-x: auto; }
.mainnav a { display: flex; align-items: center; gap: .4rem; padding: .5rem .7rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 550; font-size: .92rem; white-space: nowrap; }
.mainnav a:hover { background: var(--green-50); color: var(--green); }
.mainnav a.active { background: var(--green-50); color: var(--green); box-shadow: inset 0 -2px 0 var(--green); }
.me { display: flex; align-items: center; gap: .5rem; }
.me-name { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; line-height: 1.2; }
.me-name small { color: var(--muted); font-weight: 500; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; font-size: .8rem; font-weight: 700; letter-spacing: .02em; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; background: var(--green-100); color: var(--green); }
#view { max-width: 1440px; margin: 0 auto; padding: 1.25rem 1.25rem 4rem; outline: none; }
.bottomnav, .more-menu { display: none; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.signin-error { max-width: 560px; margin: 10vh auto; background: var(--card); padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: var(--bg); }
.signin-card { width: min(440px, 100%); background: var(--card); border-radius: 14px; border-top: 4px solid var(--gold); box-shadow: var(--shadow); padding: 2rem 1.75rem; text-align: center; display: flex; flex-direction: column; gap: .9rem; align-items: center; }
.signin-card h1 { margin: 0; }
.signin-card p { margin: 0; }
.signin-logo { width: 170px; height: auto; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; width: 100%; }
.me .btn-ghost { margin-left: .25rem; }
.idle-cover { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(11, 77, 23, .96); color: #fff; text-align: center; }
.idle-cover h2 { font-family: var(--serif); font-size: 1.6rem; }

/* ---------- buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #C5CEC7; background: #FAFBFA; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-2); border-color: var(--green-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: .25rem .6rem; font-size: .82rem; }
.icon-btn { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .25rem .5rem; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #CDD4CF; border-radius: 8px; padding: .5rem .65rem; width: 100%; min-height: 40px; }
textarea { resize: vertical; min-height: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: 3px solid rgba(11, 77, 23, .15); outline-offset: 0; }
input[readonly], select:disabled { background: var(--grey-50); color: var(--muted); }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; }
label.check, label.inline { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
label.check input, label.inline input { width: auto; min-height: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: 0; }
legend { font-weight: 650; font-size: .88rem; padding: 0 .3rem; color: var(--green); }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.actions { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; margin-top: .5rem; }
.actions.wrap { flex-wrap: wrap; }
.suffix { display: flex; align-items: center; gap: .5rem; } .suffix input { width: 7rem; } .suffix span { font-weight: 500; color: var(--muted); }
.form-narrow { max-width: 760px; display: flex; flex-direction: column; gap: .9rem; }
.form-error { color: var(--red); font-weight: 600; }
.inline-radio { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.inline-radio label { flex-direction: row; align-items: center; font-weight: 500; }
.inline-radio input { width: auto; min-height: 0; }
.inline-form { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; } .inline-form input { flex: 2 1 200px; } .inline-form select { flex: 1 1 160px; width: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.55; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: .45rem .8rem; font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--green); color: #fff; }

/* form kit (intake) */
.fk-section { margin-top: 1rem; }
.fk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.fk-field { display: flex; flex-direction: column; gap: .3rem; }
.fk-field > label { font-weight: 600; font-size: .88rem; display: block; }
.fk-textarea, .fk-people, .fk-charges, .fk-children { grid-column: 1 / -1; }
.fk-help { font-size: .8rem; color: var(--muted); }
.fk-req { color: var(--red); }
.fk-flag { color: var(--gold); margin-left: .35rem; }
.fk-badge { margin-left: .4rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--grey-50); color: var(--muted); padding: .05rem .4rem; border-radius: 4px; }
.fk-radios { display: flex; gap: .4rem; flex-wrap: wrap; }
.fk-radio { flex-direction: row; align-items: center; gap: .35rem; font-weight: 500; border: 1px solid #CDD4CF; border-radius: 8px; padding: .4rem .75rem; cursor: pointer; background: #fff; }
.fk-radio input { width: auto; min-height: 0; margin: 0; accent-color: var(--green); }
.fk-radio:has(input:checked) { border-color: var(--green); background: var(--green-50); color: var(--green); }
.fk-check { flex-direction: row; align-items: center; gap: .4rem; font-weight: 500; } .fk-check input { width: auto; min-height: 0; }
.fk-money { display: flex; align-items: center; border: 1px solid #CDD4CF; border-radius: 8px; background: #fff; padding-left: .6rem; }
.fk-money span { color: var(--muted); } .fk-money input { border: 0; outline: none; }
.fk-money:focus-within { border-color: var(--green); }
.fk-repeat { display: flex; flex-direction: column; gap: .4rem; }
.fk-row { display: flex; gap: .4rem; align-items: center; } .fk-row input { flex: 2; } .fk-row select { flex: 1; }
.fk-del { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 38px; height: 38px; cursor: pointer; color: var(--muted); font-size: 1.1rem; flex: none; }
.fk-add { align-self: flex-start; border: 0; background: none; color: var(--green); font-weight: 650; cursor: pointer; padding: .3rem 0; font: inherit; font-size: .88rem; }

/* ---------- chips, pills, badges ---------- */
.chips { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; margin-top: .35rem; }
.chip { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.chip.red { background: var(--red-50); color: var(--red); border-color: #F6C9C4; }
.chip.amber { background: var(--amber-50); color: var(--amber); border-color: #F2DDA4; }
.chip.green { background: var(--green-50); color: var(--green); border-color: var(--green-100); }
.chip.grey { background: var(--grey-50); color: var(--muted); border-color: var(--line); }
.pill { display: inline-flex; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--green-50); color: var(--green); border: 1px solid var(--green-100); }
.pill-new { background: #EEF2FF; color: #3538CD; border-color: #D9DEFF; }
.pill-agreement_sent { background: var(--gold-50); color: #7A5418; border-color: var(--gold-100); }
.pill-signed, .pill-retained { background: var(--green); color: #fff; border-color: var(--green); }
.pill-closed { background: var(--grey-50); color: var(--muted); border-color: var(--line); }
.tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--grey-50); color: var(--muted); padding: .05rem .4rem; border-radius: 4px; }
.status-badge { display: inline-block; padding: .25rem .7rem; border-radius: 8px; font-weight: 700; font-size: .85rem; }
.status-badge.green { background: var(--green-50); color: var(--green); } .status-badge.red { background: var(--red-50); color: var(--red); }
.status-badge.amber { background: var(--amber-50); color: var(--amber); } .status-badge.grey { background: var(--grey-50); color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); vertical-align: middle; }
.banner { padding: .65rem .9rem; border-radius: 8px; margin: .5rem 0; font-size: .9rem; border: 1px solid; }
.banner ul { margin: .35rem 0 .35rem 1.1rem; padding: 0; }
.banner-red { background: var(--red-50); border-color: #F6C9C4; color: #7A1A12; }
.banner-amber { background: var(--amber-50); border-color: #F2DDA4; color: #5C3D00; }
.banner-green { background: var(--green-50); border-color: var(--green-100); color: var(--green); }

/* ---------- panels and pages ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; } .page-head p { margin: .1rem 0 0; }
.head-actions, .filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filters input[type=search] { width: 240px; } .filters select { width: auto; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.panel h2 { display: flex; align-items: center; gap: .5rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.count { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .35rem; border-radius: 999px; background: var(--grey-50); color: var(--muted); font-size: .75rem; font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.span2 { grid-column: 1 / -1; }
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.attention .panel { border-top: 4px solid var(--line); }
.attention .panel.red { border-top-color: var(--red); } .attention .panel.amber { border-top-color: var(--gold); } .attention .panel.green { border-top-color: var(--green); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows a { text-decoration: none; color: inherit; display: flex; flex-direction: column; min-width: 0; }
.rows a:hover .row-name { color: var(--green); text-decoration: underline; }
.row-name { font-weight: 650; } .row-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-right { flex: none; }
.home-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.stagebars { list-style: none; margin: 0; padding: 0; }
.stagebars a { display: grid; grid-template-columns: 9rem 1fr 2rem; gap: .6rem; align-items: center; padding: .3rem 0; text-decoration: none; color: inherit; font-size: .88rem; }
.sb-bar, .hb-track { height: 10px; background: var(--grey-50); border-radius: 999px; overflow: hidden; }
.sb-bar span, .hb-fill { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.sb-n { text-align: right; font-weight: 700; }

/* tasks */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task-check input { width: 18px; height: 18px; min-height: 0; margin-top: .15rem; accent-color: var(--green); }
.task-title { font-weight: 600; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; gap: .65rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.task.overdue .task-title { color: var(--red); }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(184px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.col { background: #ECEFEB; border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.col h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .1rem .2rem .5rem; }
.col-note { font-size: .74rem; color: var(--muted); margin: -.35rem .2rem .5rem; }
.col-body { display: flex; flex-direction: column; gap: .5rem; min-height: 120px; border-radius: 8px; transition: background .15s; }
.col-body.over { background: var(--green-100); outline: 2px dashed var(--green); }
.col-empty { color: #98A29B; font-size: .82rem; text-align: center; margin: 1rem 0; }
.lead-card { display: block; background: var(--card); border-radius: 8px; padding: .6rem .7rem; text-decoration: none; color: inherit; box-shadow: var(--shadow); border-left: 4px solid var(--pa-other); }
.lead-card.pa-criminal { border-left-color: var(--pa-criminal); } .lead-card.pa-family { border-left-color: var(--pa-family); }
.lead-card:hover { box-shadow: 0 4px 12px rgba(16, 24, 18, .12); }
.lead-card[draggable="true"] { cursor: grab; } .lead-card.dragging { opacity: .5; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.card-name { font-weight: 700; }
.card-line { font-size: .82rem; } .card-foot { font-size: .74rem; margin-top: .35rem; }
.stage-tabs { display: none; }
.board-help { margin-top: .75rem; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.panel .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--line); background: #FAFBFA; }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr[data-href] { cursor: pointer; } .table tbody tr[data-href]:hover { background: var(--green-50); }
.table.compact td, .table.compact th { padding: .45rem .6rem; }
.table tr.differs td { background: var(--amber-50); }

/* lead page */
.lead-head { margin-bottom: 1rem; }
.back { text-decoration: none; font-size: .85rem; font-weight: 600; }
.lead-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin: .35rem 0 .5rem; }
.lead-title h1 { margin: 0; } .lead-title p { margin: .15rem 0 0; }
.lead-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.lead-actions .move { flex-direction: row; align-items: center; gap: .4rem; font-weight: 600; }
.lead-actions .move select { width: auto; }
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin-top: .75rem; overflow-x: auto; }
.tabs a { padding: .6rem .85rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--green); border-bottom-color: var(--green); }
.kv { display: grid; grid-template-columns: 11rem 1fr; gap: .4rem .75rem; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.quote { margin-top: .9rem; padding: .7rem .9rem; background: var(--gold-50); border-left: 3px solid var(--gold); border-radius: 6px; font-size: .9rem; }
.intake-form { padding-bottom: 0; }
.sticky-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .75rem 0; margin-top: 1rem; background: linear-gradient(to top, #fff 75%, rgba(255,255,255,0)); }
.conflict-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.conflict-head p { margin: .4rem 0 0; }
.decide { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.notes { list-style: none; margin: 1rem 0 0; padding: 0; }
.notes li { padding: .75rem 0; border-top: 1px solid var(--line); }
.note-meta { font-size: .82rem; color: var(--muted); } .note-text { white-space: pre-wrap; margin-top: .2rem; }

/* agreement */
.agreement-grid { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.agreement-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.agreement-row:first-of-type { border-top: 0; }
.row-actions { display: flex; gap: .4rem; }
.doc-preview { padding: 0; overflow: hidden; }
.doc-head { display: flex; justify-content: space-between; padding: .6rem 1rem; background: #FAFBFA; border-bottom: 1px solid var(--line); font-weight: 650; font-size: .85rem; }
.doc { font-family: "Times New Roman", Times, serif; font-size: 1rem; line-height: 1.55; padding: 2rem 2.5rem; max-height: 75vh; overflow: auto; background: #fff; }
.doc h1 { font-family: "Times New Roman", Times, serif; font-size: 1.15rem; text-align: center; color: var(--green); margin: 0 0 1rem; }
.doc h2 { font-size: 1rem; color: var(--green); margin: 1.1rem 0 .3rem; }
.doc p { margin: 0 0 .7rem; }
.doc-sm { padding: 1rem; font-size: .85rem; max-height: 420px; border: 1px solid var(--line); border-radius: 8px; }
mark.gap { background: #FFE58A; color: #5C3D00; padding: 0 .2rem; border-radius: 3px; font-family: var(--sans); font-size: .82em; font-weight: 650; }
.sigblock { margin: 1.4rem 0 .5rem; }
.sig-label { font-family: var(--sans); font-size: .72rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--green); }
.sig-lines { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; margin-top: 1.8rem; }
.sig-lines span { border-top: 1px solid #333; font-size: .78rem; padding-top: .2rem; font-family: var(--sans); color: var(--muted); }

/* templates */
.tpl-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.tpl-pdf { grid-column: span 2; min-width: 0; }
.tpl-pdf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.pdfmap select { width: 100%; min-width: 14rem; }
.pdfmap td { vertical-align: top; }
.pdfmap .fname { word-break: break-word; }
.pdfmap tr.suggested { background: #fff8e6; }
.amber-text { color: #8a5a00; }
.tpl-list { display: flex; flex-direction: column; padding: .4rem; }
.tpl-list a { display: flex; flex-direction: column; padding: .6rem .7rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .9rem; }
.tpl-list a.active { background: var(--green-50); box-shadow: inset 3px 0 0 var(--green); }
.fields { list-style: none; margin: 0 0 1rem; padding: 0; max-height: 300px; overflow: auto; }
.fields button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; font: inherit; }
.fields button:hover { background: var(--green-50); }
.fields code { font-size: .78rem; color: var(--green); } .fields span { font-size: .75rem; color: var(--muted); }

/* reports */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.kpi-n { font-family: var(--serif); font-size: 2rem; color: var(--green); font-weight: 600; line-height: 1.1; }
.kpi-l { color: var(--muted); font-size: .85rem; font-weight: 600; }
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars li { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr 4rem; gap: .6rem; align-items: center; padding: .3rem 0; font-size: .86rem; }
.hb-n { text-align: right; font-weight: 700; } .hb-n small { color: var(--muted); font-weight: 500; }
.big-n { font-family: var(--serif); font-size: 2.6rem; color: var(--green); margin: 0; }

/* settings */
.conn { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.conn:first-of-type { border-top: 0; }

/* modal and toasts */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 18, .45); display: grid; place-items: center; padding: 1rem; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem .5rem; }
.modal-head h2 { font-family: var(--serif); font-size: 1.25rem; color: var(--green); margin: 0; }
.modal-body { padding: .25rem 1.25rem 1.25rem; }
#dip-toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; font-weight: 600; font-size: .9rem; opacity: 0; transform: translateY(8px); transition: all .2s; max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--red); }

/* ---------- phones and small tablets ---------- */
@media (max-width: 860px) {
  .demo-bar { font-size: .78rem; padding: .3rem .9rem; } .demo-bar .demo-text { display: none; } .demo-as span { display: none; }
  .topbar { padding: .4rem .9rem; gap: .5rem; }
  .brand img { height: 32px; }
  .mainnav, .me-name { display: none; }
  .newlead { margin-left: auto; padding: .4rem .7rem; }
  #view { padding: .9rem .9rem 6rem; }
  h1 { font-size: 1.4rem; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
  .bottomnav a, .bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem 0; font-size: .7rem; font-weight: 650; color: var(--muted); text-decoration: none; background: none; border: 0; font-family: inherit; }
  .bottomnav a.active { color: var(--green); }
  .more-menu:not([hidden]) { display: flex; flex-direction: column; position: fixed; right: .6rem; bottom: 4.4rem; z-index: 31; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); overflow: hidden; }
  .more-menu a { padding: .75rem 1.1rem; text-decoration: none; color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); }
  .more-menu a:first-child { border-top: 0; }
  .two, .fk-grid { grid-template-columns: 1fr; }
  .home-grid, .agreement-grid, .tpl-grid, .tpl-pdf-grid { grid-template-columns: 1fr; }
  .tpl-pdf { grid-column: auto; }
  .cards { grid-template-columns: 1fr; }
  .filters { width: 100%; } .filters input[type=search] { width: 100%; } .filters select { flex: 1; }
  .stage-tabs { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: .75rem; padding-bottom: .25rem; }
  .stage-tabs button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .35rem .75rem; font: inherit; font-size: .82rem; font-weight: 650; color: var(--muted); }
  .stage-tabs button span { color: var(--ink); margin-left: .2rem; }
  .stage-tabs button[aria-selected="true"] { background: var(--green); color: #fff; border-color: var(--green); }
  .stage-tabs button[aria-selected="true"] span { color: #fff; }
  .board { display: block; }
  .col { display: none; background: transparent; padding: 0; }
  .col.on { display: block; }
  .col h2 { display: none; }
  .board-help { display: none; }
  .lead-actions { width: 100%; } .lead-actions .btn { flex: 1; }
  .kv { grid-template-columns: 1fr; gap: 0 .5rem; } .kv dd { margin-bottom: .5rem; }
  .doc { padding: 1.25rem; }
  .table th:nth-child(n+5), .table td:nth-child(n+5) { display: none; }
  .table.compact th, .table.compact td { display: table-cell; }
  .stagebars a { grid-template-columns: 7.5rem 1fr 2rem; }
  .tpl-side { order: 3; }
  .sticky-actions { bottom: 3.6rem; }
}
@media print { .topbar, .bottomnav, .demo-bar, .tabs, .lead-actions, .btn { display: none !important; } }
