/* =====================================================================
   LARA — WORKSPACE VIEWS  (app.html)
   Tool screens beside the chat + the workspace refinements that make
   Lara its own product: folding rail, area picker, depth switch,
   follow-up questions, account menu.
   Tokens only from styles.css — no new colour, radius or shadow.
   ===================================================================== */

/* bare <svg><use/></svg> icons get a sane default; component rules override */
svg:has(> use){ width:18px; height:18px; flex:none; }
/* the hidden attribute must win over any display rule below */
[hidden]{ display:none !important; }
.sr-only{ position:absolute !important; width:1px; height:1px; padding:0; margin:-2px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
:focus-visible{ outline:2px solid var(--green-600); outline-offset:2px; }
/* fields that draw their own focus ring on the container */
.comp__ta:focus-visible, .rail__search input:focus-visible, .rsearch input:focus-visible,
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .sel select:focus-visible,
.pg__title:focus-visible{ outline:none; }

/* ===================================================================
   1. PANES
   =================================================================== */
.pane{ position:relative; z-index:2; flex:1; min-height:0; display:flex; flex-direction:column; }
.pane:not(.pane--chat){ overflow-y:auto; scroll-behavior:smooth; padding-inline:clamp(16px,3vw,32px); }
.pane:not(.pane--chat)::-webkit-scrollbar{ width:9px; }
.pane:not(.pane--chat)::-webkit-scrollbar-thumb{ background:rgba(30,40,36,.13); border-radius:99px; border:3px solid transparent; background-clip:content-box; }

.main:not([data-view="chat"]) [data-chat-only]{ display:none; }
.main:not([data-view="chat"]) .ws__bg{ opacity:.22; }

.pg{ width:min(880px,100%); margin-inline:auto; padding-block:12px 64px; }
.pg--wide{ width:min(1120px,100%); }
.pg--narrow{ width:min(720px,100%); }

.pg__head{ display:flex; align-items:flex-start; gap:16px; margin-bottom:24px; }
.pg__head--center{ flex-direction:column; align-items:center; text-align:center; gap:8px; }
.pg__ic{
  width:48px; height:48px; flex:none; border-radius:15px; display:grid; place-items:center;
  background:var(--paper); border:1px solid var(--green-line); color:var(--green-700); box-shadow:var(--sh-sm);
}
.pg__ic svg{ width:22px; height:22px; }
.pg__ic--sm{ width:40px; height:40px; border-radius:12px; }
.pg__ic--sm svg{ width:19px; height:19px; }
.pg__title{ font-size:clamp(22px,2.6vw,28px); font-weight:800; font-variation-settings:"wght" 800; letter-spacing:normal; line-height:1.4; outline:none; }
.pg__sub{ margin-top:8px; font-size:16px; line-height:1.9; color:var(--ink-3); max-width:62ch; text-wrap:pretty; }
.pg__head--center .pg__sub{ margin-inline:auto; }

/* ===================================================================
   2. PRIMITIVES
   =================================================================== */
.card{ background:var(--paper); border:1px solid rgba(30,40,36,.075); border-radius:24px; box-shadow:var(--sh-xs); padding:clamp(18px,2.4vw,26px); }
.card__title{ font-size:16px; font-weight:700; font-variation-settings:"wght" 700; margin-bottom:16px; }
.card__title--sep{ margin-top:24px; padding-top:24px; border-top:1px solid var(--line); }
.card__foot{ display:flex; justify-content:flex-end; margin-top:24px; padding-top:16px; border-top:1px solid var(--line); }

/* same numbers as .btn on the landing — both read the --btn-* tokens */
.btn2{
  display:inline-flex; align-items:center; justify-content:center; gap:var(--btn-gap);
  min-height:var(--btn-h); padding-inline:var(--btn-pad); border-radius:var(--btn-r);
  background:var(--green-700); color:#F6FAF6; font-size:var(--btn-fs); font-weight:600;
  box-shadow:var(--btn-sh), inset 0 1px 0 rgba(255,255,255,.14);
  transition:background .22s, transform .2s, border-color .2s, color .2s;
}
.btn2:hover:not([disabled]){ background:var(--green-900); transform:translateY(-1px); }
.btn2 svg{ width:17px; height:17px; }
.btn2--ghost{ background:var(--paper); color:var(--ink); border:1px solid var(--line-2); box-shadow:var(--sh-xs); }
.btn2--ghost:hover:not([disabled]){ background:var(--paper); border-color:var(--green-600); color:var(--green-800); }
.btn2--text{ background:none; color:var(--green-700); box-shadow:none; padding-inline:8px; }
.btn2--text:hover:not([disabled]){ background:var(--green-tint-2); transform:none; }
.btn2--sm{ min-height:36px; padding-inline:16px; font-size:var(--t-label); }
.btn2[disabled]{ opacity:.55; cursor:default; }

.field{ display:flex; flex-direction:column; gap:8px; min-width:0; }
.field + .field, .field-row + .field, .field + .field-row, .field-row + .field-row{ margin-top:16px; }
.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.field-row > .field{ margin-top:0; }
.field label, .field__lbl{ font-size:13px; font-weight:600; color:var(--ink-2); }
.field label small{ font-weight:400; color:var(--ink-4); }
.field input, .field select, .field textarea, .sel select{
  width:100%; min-height:46px; padding:8px 16px; border-radius:14px;
  background:var(--paper-warm); border:1px solid var(--line-2); color:var(--ink);
  font:inherit; font-size:var(--t-input); outline:none; transition:border-color .2s, box-shadow .2s, background .2s;
}
.field textarea{ resize:vertical; line-height:1.9; }
.field input::placeholder, .field textarea::placeholder{ color:var(--ink-4); }
.field input:focus, .field select:focus, .field textarea:focus, .sel select:focus{
  border-color:var(--green-600); background:var(--paper); box-shadow:0 0 0 4px rgba(var(--green-rgb),.09);
}
.field input[readonly]{ background:var(--cream); color:var(--ink-3); }
.field input[aria-invalid="true"]{ border-color:var(--coral); box-shadow:0 0 0 4px rgba(var(--coral-rgb),.1); }
.field__err{ font-size:var(--t-caption); color:var(--coral-ink); }
.is-ltr{ direction:ltr; text-align:right; }
.field select, .sel select{ appearance:none; -webkit-appearance:none; padding-inline-start:14px; padding-inline-end:38px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2368736D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-size:16px; background-position:left 14px center; }
.hint{ font-size:12px; line-height:1.8; color:var(--ink-4); }
.calc__form .hint{ margin-top:12px; }

.demo-note{
  display:flex; align-items:center; gap:8px; margin-block:16px; padding:8px 16px; border-radius:12px;
  background:var(--amber-bg); border:1px solid var(--amber-tile); color:var(--amber-ink); font-size:var(--t-caption); line-height:1.8;
}
.demo-note svg{ width:16px; height:16px; color:var(--amber); }

/* tabs */
.tabs{ display:flex; gap:4px; padding:4px; border-radius:var(--r-pill); background:rgba(30,40,36,.045); width:max-content; max-width:100%; overflow-x:auto; scrollbar-width:none; }
.tabs [role="tab"]{ flex:none; min-height:36px; padding-inline:16px; border-radius:var(--r-pill); font-size:13px; font-weight:500; color:var(--ink-3); transition:background .2s, color .2s, box-shadow .2s; }
.tabs [role="tab"]:hover{ color:var(--ink); }
.tabs [role="tab"][aria-selected="true"]{ background:var(--paper); color:var(--ink); font-weight:600; box-shadow:var(--sh-sm); }
.tabs--lg [role="tab"]{ min-height:42px; padding-inline:20px; font-size:14px; }

/* segmented radio (depth, billing, answer length) */
.depth{ display:inline-flex; gap:2px; padding:4px; border-radius:var(--r-pill); background:rgba(30,40,36,.05); }
.depth [role="radio"]{ min-height:30px; padding-inline:12px; border-radius:var(--r-pill); font-size:12px; font-weight:500; color:var(--ink-3); transition:background .2s, color .2s, box-shadow .2s; }
.depth [role="radio"][aria-checked="true"]{ background:var(--paper); color:var(--green-800); font-weight:600; box-shadow:var(--sh-sm); }
.depth [data-depth="deep"][aria-checked="true"]{ background:var(--green-700); color:#F6FAF6; }
.depth--wide [role="radio"]{ min-height:38px; padding-inline:16px; font-size:13px; }
.depth em{ font-style:normal; font-size:12px; color:var(--green-600); margin-inline-start:4px; }

/* toggle switch */
.tgl{ display:flex; align-items:flex-start; gap:16px; margin-top:16px; cursor:pointer; }
.tgl input{ position:absolute; opacity:0; width:1px; height:1px; }
.tgl__ui{ position:relative; width:42px; height:24px; flex:none; margin-top:2px; border-radius:99px; background:var(--line-strong); transition:background .22s; }
.tgl__ui::after{ content:""; position:absolute; inset-block-start:4px; inset-inline-start:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.18); transition:transform .22s var(--ease); }
.tgl input:checked + .tgl__ui{ background:var(--green-700); }
.tgl input:checked + .tgl__ui::after{ transform:translateX(-18px); }
.tgl input:focus-visible + .tgl__ui{ outline:2px solid var(--green-600); outline-offset:2px; }
.tgl b{ display:block; font-size:14px; font-weight:600; }
.tgl small{ display:block; margin-top:4px; font-size:12px; line-height:1.8; color:var(--ink-3); }

/* toast */
.toast{
  position:fixed; z-index:400; inset-block-start:calc(72px + env(safe-area-inset-top,0px)); inset-inline-start:50%;
  transform:translate(50%,-12px); opacity:0; padding:12px 20px; border-radius:var(--r-pill);
  background:var(--green-900); color:#EEF4EF; font-size:14px; box-shadow:var(--sh-lg);
  transition:opacity .25s, transform .3s var(--ease); max-width:calc(100vw - 32px); text-align:center;
}
.toast.is-on{ opacity:1; transform:translate(50%,0); }

/* empty result */
.empty{ display:flex; flex-direction:column; align-items:center; gap:8px; padding:48px 20px; text-align:center; color:var(--ink-3); }
.empty svg{ width:30px; height:30px; color:var(--ink-4); }
.empty b{ color:var(--ink); font-size:16px; }
.empty span{ font-size:13px; margin-bottom:8px; }

/* ===================================================================
   3. RAIL REFINEMENTS — fold, kbd hint, account menu
   =================================================================== */
.ws{ transition:grid-template-columns .32s var(--ease); }
.rail__kbd{ font:inherit; font-size:11px; color:var(--ink-4); padding:2px 8px; border-radius:6px; border:1px solid var(--line-2); background:var(--cream); direction:ltr; }
.rail__search input:focus + .rail__kbd, .rail__search input:not(:placeholder-shown) + .rail__kbd{ display:none; }
.rail__empty{ padding:8px; text-align:center; font-size:13px; color:var(--ink-4); }
.rail__item{ text-decoration:none; }
.rail__top{ gap:4px; }
.rail__brand{ margin-inline-end:auto; }

@media (min-width:861px){
  .is-folded .ws{ grid-template-columns:76px 1fr; }
  .is-folded .rail{ padding-inline:12px; align-items:stretch; }
  .is-folded .rail__top{ flex-direction:column; gap:8px; padding-inline:0; }
  .is-folded .rail__brand{ margin:0 auto; }
  .is-folded .rail__name,
  .is-folded .rail__new span,
  .is-folded .rail__search,
  .is-folded .rail__cap,
  .is-folded .rail__hist,
  .is-folded .rail__item span,
  .is-folded .quota,
  .is-folded .me__tx,
  .is-folded .me > svg{ display:none; }
  .is-folded .rail__fold{ margin-inline:auto; }
  .is-folded .rail__new{ width:46px; margin-inline:auto; padding:0; }
  .is-folded .rail__item{ justify-content:center; padding-inline:0; }
  .is-folded .rail__item svg{ width:20px; height:20px; }
  .is-folded .me{ justify-content:center; padding-inline:0; }
  .is-folded .menu{ inset-inline-start:0; width:220px; }
}
@media (max-width:860px){ .rail__fold{ display:none; } .rail__kbd{ display:none; } }

.me-wrap{ position:relative; }
.menu{
  position:absolute; z-index:40; inset-block-end:calc(100% + 6px); inset-inline:0;
  padding:8px; border-radius:16px; background:var(--paper); border:1px solid var(--line-2); box-shadow:var(--sh-lg);
  animation:menuIn .18s var(--ease) both;
}
@keyframes menuIn{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:none; } }
.menu [role="menuitem"]{ display:flex; align-items:center; gap:8px; width:100%; min-height:40px; padding-inline:8px; border-radius:10px; font-size:14px; color:var(--ink-2); text-align:start; }
.menu [role="menuitem"]:hover, .menu [role="menuitem"]:focus-visible{ background:var(--green-tint-2); color:var(--ink); outline:none; }
.menu [role="menuitem"] svg{ width:17px; height:17px; color:var(--ink-4); }
.menu hr{ border:0; border-top:1px solid var(--line); margin:4px 4px; }
.menu [data-logout]{ color:var(--coral-ink); }
.menu [data-logout] svg{ color:var(--coral-ink); }

/* ===================================================================
   4. CHAT REFINEMENTS — composer, follow-ups
   =================================================================== */
.quick__c{ text-decoration:none; color:inherit; }

/* the send button becomes a stop button while an answer is being written */
.comp__send.is-stop{ background:var(--ink); }
.comp__send.is-stop:hover{ background:var(--ink-2); }
.comp__send.is-stop svg{ display:none; }
.comp__send.is-stop::after{ content:""; width:13px; height:13px; border-radius:3px; background:currentColor; }

.comp__ic{ width:36px; height:36px; flex:none; border-radius:50%; display:grid; place-items:center; color:var(--ink-3); transition:background .2s, color .2s; }
.comp__ic:hover{ background:rgba(30,40,36,.06); color:var(--ink); }
.comp__ic svg{ width:18px; height:18px; }
.comp__bar{ gap:8px; }

.dd{ position:relative; }
.dd__btn{ display:inline-flex; align-items:center; gap:8px; height:34px; padding-inline:12px; border-radius:var(--r-pill);
  border:1px solid var(--line-2); background:var(--paper); font-size:12px; font-weight:500; color:var(--ink-2); transition:border-color .2s, background .2s; }
.dd__btn:hover{ border-color:var(--line-strong); }
.dd__btn svg{ width:15px; height:15px; color:var(--ink-4); }
.dd__btn .dd__chev{ width:13px; height:13px; }
.dd.is-set .dd__btn{ background:var(--green-tint); border-color:var(--green-line); color:var(--green-800); font-weight:600; }
.dd.is-set .dd__btn svg{ color:var(--green-700); }
.dd__list{ position:absolute; z-index:30; inset-block-end:calc(100% + 8px); inset-inline-start:0; min-width:200px; padding:8px; list-style:none;
  background:var(--paper); border:1px solid var(--line-2); border-radius:16px; box-shadow:var(--sh-lg); animation:menuIn .18s var(--ease) both; }
.dd__list li{ display:flex; align-items:center; min-height:38px; padding-inline:12px; border-radius:10px; font-size:13px; color:var(--ink-2); cursor:pointer; outline:none; }
.dd__list li:hover, .dd__list li:focus{ background:var(--green-tint-2); color:var(--ink); }
.dd__list li[aria-selected="true"]{ color:var(--green-800); font-weight:600; }
.dd__list li[aria-selected="true"]::after{ content:"✓"; margin-inline-start:auto; color:var(--green-600); }

.comp__files{ padding:12px 16px 0; }
.fchip{ display:inline-flex; align-items:center; gap:8px; max-width:100%; padding:8px 8px 8px 12px; padding-inline-start:12px; border-radius:12px;
  background:var(--green-tint-2); border:1px solid var(--green-line); font-size:13px; }
.fchip svg{ width:16px; height:16px; color:var(--green-700); }
.fchip b{ font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:28ch; }
.fchip small{ color:var(--ink-4); }
.fchip button{ width:26px; height:26px; border-radius:8px; display:grid; place-items:center; color:var(--ink-3); }
.fchip button:hover{ background:rgba(30,40,36,.07); color:var(--ink); }
.fchip button svg{ width:14px; height:14px; color:currentColor; }
/* edit & ask again — sits beside the question, shows on hover/focus */
.msg--me{ align-items:flex-start; gap:6px; }
.msg__edit{ width:32px; height:32px; flex:none; margin-top:4px; border-radius:10px; display:grid;
  place-items:center; color:var(--ink-4); opacity:0; transition:opacity .2s, background .2s, color .2s; }
.msg__edit svg{ width:15px; height:15px; }
.msg--me:hover .msg__edit, .msg__edit:focus-visible{ opacity:1; }
.msg__edit:hover{ background:rgba(30,40,36,.06); color:var(--ink); }
@media (pointer: coarse){ .msg__edit{ opacity:1; width:40px; height:40px; } }

.msg__file{ display:flex; align-items:center; gap:8px; margin-bottom:8px; padding-bottom:8px; border-bottom:1px solid rgba(255,255,255,.14); font-size:13px; opacity:.9; }
.msg__file svg{ width:15px; height:15px; }

.next{ margin-top:16px; display:flex; flex-direction:column; align-items:flex-start; gap:8px; }
.next__cap{ font-size:12px; font-weight:600; color:var(--ink-4); }
.next__q{ display:inline-flex; align-items:center; gap:8px; padding:8px 16px; border-radius:14px; background:var(--paper);
  border:1px solid var(--line-2); font-size:13px; color:var(--ink-2); text-align:start; box-shadow:var(--sh-xs);
  transition:border-color .2s, color .2s, transform .2s; }
.next__q:hover{ border-color:var(--green-600); color:var(--green-800); transform:translateX(-2px); }
.next__q svg{ width:14px; height:14px; color:var(--green-600); }

/* ===================================================================
   5. DOCUMENT REVIEW
   =================================================================== */
.rv{ display:flex; flex-direction:column; align-items:center; gap:16px; }
.drop{
  display:flex; flex-direction:column; align-items:center; gap:8px; width:100%; padding:clamp(36px,6vw,56px) 20px;
  background:rgba(255,255,255,.8); border:1.5px dashed var(--line-strong); border-radius:24px; text-align:center; cursor:pointer;
  transition:border-color .2s, background .2s, transform .2s;
}
.drop:hover, .drop.is-over{ border-color:var(--green-600); background:var(--paper); }
.drop.is-over{ transform:scale(1.01); }
.drop:focus-within{ border-color:var(--green-600); box-shadow:0 0 0 4px rgba(var(--green-rgb),.09); }
.drop__ic{ width:56px; height:56px; border-radius:18px; display:grid; place-items:center; background:var(--green-tint); color:var(--green-700); margin-bottom:8px; }
.drop__ic svg{ width:26px; height:26px; }
.drop b{ font-size:16px; font-weight:600; }
.drop u{ color:var(--green-700); text-underline-offset:4px; }
.drop > span:last-child{ font-size:13px; color:var(--ink-4); }
.rv__or{ display:flex; align-items:center; gap:12px; width:min(320px,100%); color:var(--ink-4); font-size:12px; }
.rv__or::before, .rv__or::after{ content:""; flex:1; height:1px; background:var(--line-2); }
.rv__trust{ list-style:none; display:flex; flex-wrap:wrap; justify-content:center; gap:8px 24px; margin-top:8px; font-size:13px; color:var(--ink-3); }
.rv__trust li{ display:flex; align-items:center; gap:8px; }
.rv__trust svg{ width:16px; height:16px; color:var(--green-600); }

.rv-run{ display:flex; flex-direction:column; align-items:center; gap:24px; padding:48px 20px; }
.rv-run__file{ display:flex; align-items:center; gap:8px; padding:12px 16px; border-radius:16px; background:var(--paper); border:1px solid var(--line-2); box-shadow:var(--sh-sm); }
.rv-run__file svg{ color:var(--green-700); }
.rv-run__steps{ list-style:none; display:flex; flex-direction:column; gap:12px; min-width:min(300px,100%); }
.rv-run__steps li{ display:flex; align-items:center; gap:12px; font-size:14px; color:var(--ink-4); transition:color .3s; }
.rv-run__steps li::before{ content:""; width:20px; height:20px; flex:none; border-radius:50%; border:2px solid var(--line-strong); transition:all .3s; }
.rv-run__steps li.is-on{ color:var(--ink); font-weight:600; }
.rv-run__steps li.is-on::before{ border-color:var(--green-600); border-inline-start-color:transparent; animation:spin .8s linear infinite; }
.rv-run__steps li.is-done{ color:var(--ink-2); }
.rv-run__steps li.is-done::before{ border-color:var(--green-600); background:var(--green-600)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/12px no-repeat; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.rv-sum{ display:flex; flex-wrap:wrap; align-items:center; gap:16px; padding:16px 20px; border-radius:22px; background:var(--paper); border:1px solid rgba(30,40,36,.075); box-shadow:var(--sh-sm); }
.rv-sum__file{ display:flex; align-items:center; gap:12px; flex:1; min-width:220px; }
.rv-sum__file b{ display:block; font-size:16px; font-weight:600; overflow-wrap:anywhere; }
.rv-sum__file span{ display:block; font-size:12px; color:var(--ink-4); margin-top:2px; }
.rv-sum__stats{ display:flex; gap:24px; }
.rv-sum__stats div{ text-align:center; }
.rv-sum__stats b{ display:block; font-size:21px; font-weight:800; line-height:1.2; }
.rv-sum__stats span{ font-size:12px; color:var(--ink-3); }
.sev-h{ color:var(--coral-ink); } .sev-m{ color:var(--amber-ink); } .sev-l{ color:var(--green-600); }
.rv-out .tabs{ margin-block:4px 16px; }

.finds{ display:flex; flex-direction:column; gap:16px; }
.find{ padding:20px 24px; border-radius:22px; background:var(--paper); border:1px solid rgba(30,40,36,.075); border-inline-start:4px solid var(--c); box-shadow:var(--sh-xs); animation:msgIn .4s var(--ease) both; }
.find--h{ --c:var(--coral); } .find--m{ --c:var(--amber); } .find--l{ --c:var(--green-600); }
.find header{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.find h3{ flex:1; min-width:200px; font-size:16px; font-weight:700; font-variation-settings:"wght" 700; }
.sev{ padding:4px 8px; border-radius:var(--r-pill); font-size:12px; font-weight:600; }
.sev--h{ background:var(--coral-bg); color:var(--coral-ink); } .sev--m{ background:var(--amber-bg); color:var(--amber-ink); } .sev--l{ background:var(--green-tint); color:var(--green-800); }
.find__law{ font-size:12px; color:var(--ink-4); }
.find blockquote{ margin-top:12px; padding:8px 16px; border-radius:12px; background:var(--cream); font-size:14px; line-height:1.9; color:var(--ink-2); }
.find > p{ margin-top:8px; font-size:14px; line-height:2; color:var(--ink-2); }
.find__fix{ margin-top:12px; padding:12px 16px; border-radius:12px; background:var(--green-tint-2); border:1px solid var(--green-line); }
.find__fix span{ font-size:12px; font-weight:600; color:var(--green-700); }
.find__fix p{ margin-top:4px; font-size:14px; line-height:1.95; color:var(--ink); }
.find footer{ display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }

/* ===================================================================
   6. BUILDER (contracts + filings)
   =================================================================== */
.tpls{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px; }
.tpl{ display:flex; flex-direction:column; align-items:flex-start; gap:8px; padding:16px; border-radius:18px; text-align:start;
  background:var(--paper); border:1px solid rgba(30,40,36,.075); box-shadow:var(--sh-xs);
  transition:border-color .2s, box-shadow .2s, transform .2s; }
.tpl:hover{ transform:translateY(-2px); box-shadow:var(--sh-md); }
.tpl[aria-checked="true"]{ border-color:var(--green-600); box-shadow:0 0 0 3px rgba(var(--green-rgb),.1); }
.tpl__ic{ width:34px; height:34px; border-radius:11px; display:grid; place-items:center; background:var(--green-tint-2); border:1px solid var(--green-line); color:var(--green-700); margin-bottom:4px; }
.tpl[aria-checked="true"] .tpl__ic{ background:var(--green-700); border-color:var(--green-700); color:#F6FAF6; }
.tpl b{ font-size:14px; font-weight:600; }
.tpl > span:last-child{ font-size:12px; line-height:1.7; color:var(--ink-3); }

.bld{ display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); gap:20px; align-items:start; }
.bld__form{ position:sticky; top:8px; }
.bld__prog{ margin-top:20px; padding-top:16px; border-top:1px solid var(--line); }
.bld__prog span{ font-size:12px; color:var(--ink-3); }
.bld__prog i{ display:block; height:5px; margin-top:8px; border-radius:99px; background:var(--line); overflow:hidden; }
.bld__prog i b{ display:block; height:100%; width:0; border-radius:99px; background:linear-gradient(90deg,var(--green-600),var(--green-400)); transition:width .35s var(--ease); }

.doc__bar{ display:flex; align-items:center; gap:4px; margin-bottom:8px; }
.doc__lbl{ flex:1; font-size:13px; font-weight:600; color:var(--ink-3); }
.doc{
  padding:clamp(24px,4vw,44px) clamp(20px,4vw,44px); border-radius:6px 6px 22px 22px; background:#fff;
  border:1px solid rgba(30,40,36,.08); box-shadow:var(--sh-md); font-size:14px; line-height:2.15; color:var(--ink-2);
  position:relative;
}
.doc::before{ content:""; position:absolute; inset-inline:0; inset-block-start:0; height:4px; border-radius:6px 6px 0 0; background:linear-gradient(90deg,var(--green-700),var(--green-400)); }
.doc h3{ text-align:center; font-size:18px; font-weight:800; font-variation-settings:"wght" 800; color:var(--ink); margin-bottom:24px; padding-bottom:16px; border-bottom:1px solid var(--line); }
.doc h4{ margin-top:16px; font-size:14px; font-weight:700; color:var(--green-800); }
.doc p{ margin-top:4px; text-align:justify; }
.doc b{ color:var(--ink); font-weight:600; }
.doc ol{ margin:8px 0; padding-inline-start:22px; }
.doc li{ margin-top:4px; }
.blank{ background:var(--amber-bg); color:var(--amber-ink); padding:2px 8px; border-radius:6px; border:1px dashed var(--amber-tile); font-size:13px; }
.doc__tbl{ display:grid; grid-template-columns:max-content 1fr; border:1px solid var(--line-2); border-radius:12px; overflow:hidden; margin-bottom:16px; }
.doc__tbl dt, .doc__tbl dd{ padding:8px 16px; border-bottom:1px solid var(--line); }
.doc__tbl dt{ background:var(--cream); font-weight:600; font-size:13px; color:var(--ink-2); }
.doc__tbl > :nth-last-child(-n+2){ border-bottom:0; }
.doc__sign{ display:flex; flex-wrap:wrap; justify-content:space-around; gap:20px; margin-top:32px; padding-top:16px; border-top:1px dashed var(--line-strong); }
.doc__sign span{ min-width:110px; text-align:center; font-size:13px; color:var(--ink-3); padding-top:32px; }
.doc__note{ margin-top:8px; font-size:12px; color:var(--ink-4); text-align:center; }

/* ===================================================================
   7. RULINGS
   =================================================================== */
.rsearch{ display:flex; align-items:center; gap:8px; padding:8px 8px 8px 8px; padding-inline-start:18px; border-radius:var(--r-pill);
  background:var(--paper); border:1px solid rgba(30,40,36,.09); box-shadow:var(--sh-md); transition:border-color .2s, box-shadow .2s; }
.rsearch:focus-within{ border-color:rgba(var(--green-rgb),.45); box-shadow:var(--sh-md), 0 0 0 4px rgba(var(--green-rgb),.09); }
.rsearch > svg{ width:20px; height:20px; color:var(--ink-4); }
.rsearch input{ flex:1; min-width:0; border:0; outline:none; background:none; font:inherit; font-size:var(--t-input); min-height:44px; }
.rfilters{ display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; }
.fchips{ display:flex; flex-wrap:wrap; gap:8px; }
.fchips button{ min-height:34px; padding-inline:16px; border-radius:var(--r-pill); border:1px solid var(--line-2); background:rgba(255,255,255,.7); font-size:13px; color:var(--ink-2); transition:all .2s; }
.fchips button:hover{ border-color:var(--line-strong); }
.fchips button[aria-pressed="true"]{ background:var(--green-800); border-color:var(--green-800); color:#F0F6F1; font-weight:600; }
.sel select{ min-height:38px; width:auto; font-size:13px; border-radius:var(--r-pill); background-color:var(--paper); }
.rcount{ font-size:13px; color:var(--ink-3); margin-bottom:8px; }
.rlist{ display:flex; flex-direction:column; gap:12px; }
.rcard{ padding:16px 20px; border-radius:20px; background:var(--paper); border:1px solid rgba(30,40,36,.075); box-shadow:var(--sh-xs); transition:border-color .2s, box-shadow .2s; }
.rcard:hover{ border-color:var(--green-line); box-shadow:var(--sh-md); }
.rcard header{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; font-size:12px; }
.rcard__court{ font-weight:600; color:var(--green-800); }
.rcard__y{ color:var(--ink-4); }
.rcard__y::before{ content:"·"; margin-inline-end:8px; }
.rcard__area{ margin-inline-start:auto; padding:2px 8px; border-radius:var(--r-pill); background:var(--cream); color:var(--ink-3); }
.rcard h3{ margin-top:8px; font-size:16px; font-weight:700; font-variation-settings:"wght" 700; line-height:1.7; }
.rcard p{ margin-top:8px; font-size:14px; line-height:2; color:var(--ink-2); }
.rcard__tags{ display:flex; flex-wrap:wrap; gap:8px; margin-block:8px 4px; }
.rcard__tags span{ font-size:12px; padding:2px 8px; border-radius:var(--r-pill); background:var(--green-tint-2); color:var(--green-800); }
.rcard .btn2--text{ margin-inline-start:-10px; }

/* ===================================================================
   8. CALCULATORS
   =================================================================== */
.calc{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; margin-top:20px; align-items:start; }
.calc__form{ background:var(--paper); border:1px solid rgba(30,40,36,.075); border-radius:24px; padding:clamp(18px,2.4vw,26px); box-shadow:var(--sh-xs); }
.calc__form .btn2{ width:100%; margin-top:16px; }
.calc__out{ position:sticky; top:8px; padding:24px; border-radius:24px; background:linear-gradient(160deg,var(--green-tint) 0%,var(--paper) 70%);
  border:1px solid var(--green-line); box-shadow:var(--glow-green); }
.calc__out.is-fresh{ animation:msgIn .45s var(--ease); }
.calc__cap{ font-size:13px; font-weight:600; color:var(--green-700); }
.calc__num{ display:block; margin-top:8px; font-size:clamp(28px,3.6vw,38px); font-weight:800; font-variation-settings:"wght" 800; letter-spacing:normal; color:var(--ink); overflow-wrap:anywhere; line-height:1.3; }
.calc__unit{ font-size:13px; color:var(--ink-3); }
.calc__words{ margin-top:4px; font-size:14px; font-weight:600; color:var(--green-800); }
.calc__rows{ margin-top:16px; border-top:1px solid var(--green-line); }
.calc__rows div{ display:flex; justify-content:space-between; gap:12px; padding-block:8px; border-bottom:1px solid rgba(var(--green-rgb),.1); font-size:13px; }
.calc__rows dt{ color:var(--ink-3); }
.calc__rows dd{ font-weight:600; color:var(--ink); text-align:end; }
.calc__law{ display:flex; gap:8px; margin-top:16px; font-size:12px; line-height:1.9; color:var(--ink-3); }
.calc__law svg{ width:16px; height:16px; margin-top:4px; color:var(--green-600); }
.stepper{ display:flex; align-items:stretch; width:max-content; border:1px solid var(--line-2); border-radius:14px; overflow:hidden; background:var(--paper-warm); }
.stepper button{ width:46px; font-size:20px; color:var(--ink-2); transition:background .2s; }
.stepper button:hover{ background:var(--green-tint-2); color:var(--green-800); }
.field .stepper input{ width:64px; min-height:44px; text-align:center; border:0; border-radius:0; border-inline:1px solid var(--line-2); box-shadow:none; }

/* ===================================================================
   9. ACCOUNT + PLANS
   =================================================================== */
.acc-danger{ display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:16px; margin-top:16px; }
.acc-danger .card__title{ margin-bottom:4px; }
.acc-danger p{ font-size:13px; color:var(--ink-3); }
.acc-danger .btn2{ color:var(--coral-ink); }
.acc-danger .btn2:hover{ border-color:var(--coral-ink); color:var(--coral-ink); }

.pg__head--center .depth{ margin-top:8px; }
.plans{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; align-items:stretch; }
.plan{ position:relative; display:flex; flex-direction:column; padding:24px 24px; border-radius:26px; background:var(--paper); border:1px solid rgba(30,40,36,.075); box-shadow:var(--sh-xs); }
.plan--pop{ border-color:var(--green-600); box-shadow:var(--glow-green), var(--sh-md); transform:translateY(-8px); }
.plan__badge{ position:absolute; inset-block-start:-12px; inset-inline-start:22px; padding:4px 12px; border-radius:var(--r-pill); background:var(--green-700); color:#F6FAF6; font-size:12px; font-weight:600; }
.plan__badge--muted{ background:var(--cream); color:var(--ink-3); border:1px solid var(--line-2); }
.plan h3{ font-size:18px; font-weight:700; font-variation-settings:"wght" 700; }
.plan__amt{ display:flex; align-items:baseline; gap:8px; margin-top:12px; }
.plan__amt b{ font-size:30px; font-weight:800; font-variation-settings:"wght" 800; letter-spacing:normal; }
.plan__amt span{ font-size:13px; color:var(--ink-3); }
.plan > p{ margin-top:8px; font-size:13px; line-height:1.9; color:var(--ink-3); }
.plan ul{ list-style:none; margin-block:16px 24px; display:flex; flex-direction:column; gap:8px; flex:1; }
.plan li{ display:flex; gap:8px; font-size:14px; color:var(--ink-2); }
.plan li::before{ content:""; width:18px; height:18px; flex:none; margin-top:4px; border-radius:50%; background:var(--green-tint)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F6B52' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/11px no-repeat; }
.plan .btn2{ width:100%; }
.plans__note{ margin-top:24px; text-align:center; font-size:13px; color:var(--ink-3); }

/* ===================================================================
   10. RESPONSIVE
   =================================================================== */
@media (max-width:1080px){
  .tpls{ grid-template-columns:repeat(2,1fr); }
  .bld{ grid-template-columns:1fr; }
  .bld__form{ position:static; }
}
@media (max-width:860px){
  .calc{ grid-template-columns:1fr; }
  .calc__out{ position:static; }
  .plans{ grid-template-columns:1fr; max-width:460px; margin-inline:auto; }
  .plan--pop{ transform:none; }
}
@media (max-width:560px){
  /* the send button stays with the field; the mode controls wrap under it */
  .comp__bar{ display:grid; grid-template-columns:auto auto 1fr auto; gap:8px; align-items:center; }
  .comp__ic{ grid-area:1 / 1; }
  .comp__bar .dd{ grid-area:1 / 2; }
  .comp__send{ grid-area:1 / 4; }
  .comp__bar .depth{ grid-area:2 / 1 / 2 / -1; justify-self:start; }
  .comp__spacer, .comp__count{ display:none; }
  .pg__head{ gap:12px; }
  .pg__ic{ width:42px; height:42px; }
  .field-row{ grid-template-columns:1fr; }
  .tpls{ grid-template-columns:1fr 1fr; gap:8px; }
  .tpl{ padding:12px; }
  .tpl > span:last-child{ display:none; }
  .rv-sum__stats{ width:100%; justify-content:space-around; }
  .dd__btn span{ max-width:9ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .depth [data-depth]{ padding-inline:8px; }
  .rsearch .btn2{ display:none; }
  .find{ padding:16px; }
}

@media (prefers-reduced-motion: reduce){
  .ws, .menu, .dd__list, .find, .calc__out.is-fresh, .toast{ transition:none !important; animation:none !important; }
  .rv-run__steps li.is-on::before{ animation:none; }
}


/* ===================================================================
   12. Touch targets — Material asks for 48dp; on a mouse the denser
   desktop sizes stay. Only pointer-coarse devices get the bigger hit
   area, so nothing about the desktop layout changes.
   =================================================================== */
@media (pointer: coarse){
  .btn2--sm, .tabs [role="tab"], .fchips button, .dd__btn, .sugg__q, .next__q{ min-height:44px; }
  .depth [role="radio"]{ min-height:40px; }
  .depth--wide [role="radio"]{ min-height:44px; }
  .iconbtn, .comp__ic{ width:44px; height:44px; }
  .rail__item{ min-height:48px; }
  .menu [role="menuitem"]{ min-height:48px; }
  .dd__list li{ min-height:44px; }
  .stepper button{ width:52px; }
  .tools button{ width:44px; height:44px; }
  .cite{ padding:4px 8px; }
}


/* ===================================================================
   13. PREVIEW MODE  (app.html?preview=1)
   The landing shows the real tool pages inside a scaled iframe, so what a
   visitor sees before signing up is the product itself, not a drawing.
   =================================================================== */
.is-preview .rail,
.is-preview .top__burger,
.is-preview .comp,
.is-preview .skip,
.is-preview .drw,
.is-preview .scrim,
.is-preview .toast{ display:none !important; }
.is-preview .ws{ grid-template-columns:1fr; }
/* a preview should read as a screen seen from a distance, not as a page you
   are meant to read — so the whole thing renders smaller inside the card */
.is-preview .ws{ zoom:.72; }
@supports not (zoom:1){ .is-preview{ font-size:11.5px; } }
.is-preview .main{ background:var(--stone); }
.is-preview .top{ background:rgba(251,248,242,.9); border-block-end:1px solid rgba(30,40,36,.07); }
.is-preview .pane:not(.pane--chat),
.is-preview .stream{ overflow:hidden; }
.is-preview .pg{ padding-block:12px 16px; }
/* the top bar already names the page; the preview should spend its height on
   the thing the visitor came to see — the report, the draft, the result */
.is-preview .pg__head,
.is-preview .demo-note,
.is-preview .tpls,
.is-preview .bld__prog,
.is-preview .rv__trust{ display:none; }
.is-preview .bld{ grid-template-columns:1fr; }
.is-preview .bld__form{ display:none; }
.is-preview *{ cursor:default !important; }
.is-preview body{ pointer-events:none; }

/* ===================================================================
   14. Same restraint inside the workspace
   Green marks the active tool, the primary action and the proof
   (citations, sources, checks). Tiles and chrome go back to stone.
   =================================================================== */
.pg__ic,
.quick__ic{
  background:linear-gradient(180deg, #F4F1EA, #EFEBE2);
  border:1px solid rgba(30,40,36,.06);
  color:var(--ink-2);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7);
}
.quick__c:hover .quick__ic{ background:var(--green-700); border-color:var(--green-700); color:#F6FAF6; }
.pg__ic{ border-radius:18px; }
.quick__ic{ border-radius:14px; }

/* softer bodies, fewer hard edges */
.card, .plan, .find, .rcard, .calc__form{ border-color:rgba(30,40,36,.06); }
.card{ border-radius:26px; }
.find{ border-radius:24px; }
.rcard{ border-radius:22px; }
.plan{ border-radius:28px; }
.calc__form{ border-radius:26px; }
.tpl{ border-radius:20px; }
.tpl__ic{ border-radius:14px; background:linear-gradient(180deg,#F4F1EA,#EFEBE2); border-color:rgba(30,40,36,.06); color:var(--ink-2); }
.tpl[aria-checked="true"] .tpl__ic{ background:var(--green-700); border-color:var(--green-700); color:#F6FAF6; }

/* the result panel keeps its green — it is the proof, and it should glow */
.calc__out{ border-radius:26px; }
