/* workspace/workspace.css — on top of ../tools/tools.css */
.w-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 640px) { .w-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.w-stat { background: var(--t-card); border: 1px solid var(--t-border); border-radius: 10px; padding: 12px 14px; }
.w-stat b { display: block; font-family: var(--t-serif); font-size: 24px; color: var(--t-ox-dark); }
.w-stat span { font-size: 13px; color: var(--t-muted); }
.w-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
           background: var(--t-ok-soft); color: var(--t-ok); margin-left: 6px; vertical-align: middle; }
.w-badge.grey { background: var(--t-soft); color: var(--t-muted); }
.w-badge.warn { background: var(--t-warn-soft); color: var(--t-warn); }
.w-badge.bad { background: var(--t-bad-soft); color: var(--t-bad); }
.w-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.w-row .t-field { flex: 1 1 180px; }
.w-list { list-style: none; margin: 0; padding: 0; }
.w-item { border-top: 1px solid var(--t-border); padding: 12px 0; }
.w-item:first-child { border-top: 0; }
.w-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.w-item h3 { margin: 0; font-size: 16px; color: var(--t-text); }
.w-meta { font-size: 13px; color: var(--t-muted); margin-top: 2px; }
.w-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.w-btn { border: 1px solid var(--t-border); background: var(--t-card); color: var(--t-text2); border-radius: 7px;
         padding: 6px 10px; font: 600 13px var(--t-sans); cursor: pointer; text-decoration: none; }
.w-btn:hover { border-color: var(--t-ox); color: var(--t-ox); }
.w-btn.danger:hover { border-color: var(--t-bad); color: var(--t-bad); }
.w-btn.primary { background: var(--t-ox); border-color: var(--t-ox); color: #fff; }
.w-events { margin: 8px 0 0; padding: 0; list-style: none; }
.w-events li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; padding: 5px 0; }
.w-events li.done { color: var(--t-muted); text-decoration: line-through; }
.w-date { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 112px; }
.w-sub { background: var(--t-soft); border-radius: 10px; padding: 12px; margin-top: 10px; }
.w-msg { font-size: 13.5px; margin-top: 8px; min-height: 1em; }
.w-msg.err { color: var(--t-bad); }
.w-msg.ok { color: var(--t-ok); }
.w-empty { color: var(--t-muted); font-size: 14px; padding: 8px 0; }
.w-dialog-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
                 padding: 16px; z-index: 50; }
.w-dialog { background: var(--t-card); border-radius: 12px; padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.w-dialog h2 { margin: 0 0 4px; font-family: var(--t-serif); color: var(--t-ox-dark); font-size: 20px; }
.w-choice { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.w-choice label { flex: 1 1 180px; border: 1px solid var(--t-border); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 14px; }
.w-choice label:has(input:checked) { border-color: var(--t-ox); background: var(--t-ox-soft); }
.w-choice input { margin-right: 6px; }
.w-link { display: flex; gap: 6px; margin-top: 10px; }
.w-link input { flex: 1; min-width: 0; padding: 8px; border: 1px solid var(--t-border); border-radius: 7px; font: 13px var(--t-sans);
                background: var(--t-bg); color: var(--t-text); }
.w-shares { margin-top: 8px; font-size: 13px; }
.w-shares li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 3px 0; }
/* court fees chat (calculators page) */
.cf-chat { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cf-msg { border-radius: 10px; padding: 12px 14px; font-size: 14.5px; }
.cf-msg.you { background: var(--t-ox-soft); align-self: flex-end; max-width: 85%; }
.cf-msg.bot { background: var(--t-soft); }
.cf-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cf-chip { border: 1px solid var(--t-border); background: var(--t-card); color: var(--t-text2); border-radius: 999px; padding: 6px 11px;
           font: 13px var(--t-sans); cursor: pointer; text-align: left; }
.cf-chip:hover { border-color: var(--t-ox); color: var(--t-ox); }
.cf-ask { display: flex; gap: 8px; margin-top: 12px; }
.cf-ask input { flex: 1; min-width: 0; padding: 10px 11px; border: 1px solid var(--t-border); border-radius: 8px; font: 15px var(--t-sans);
                background: var(--t-bg); color: var(--t-text); }

/* contact & notifications (v3) */
.w-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 14px; margin: 10px 0; }
.w-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #374151; }
.w-field input { border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; font: inherit; }
.w-field small { color: #6b7280; font-size: 11.5px; }
.w-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin: 8px 0; line-height: 1.4; }
.w-check input { margin-top: 3px; }
@media (max-width: 600px) { .w-grid { grid-template-columns: 1fr; } }

/* v4: Premium banner */
.w-prem { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; margin: 0 0 14px;
          border-radius: 10px; border: 1px solid #e7d9b5; background: #fffaf0; font-size: 14px; line-height: 1.45; }
.w-prem.quiet { background: #f6f8f6; border-color: #dfe7df; font-size: 13px; color: #44614a; }
.w-prem.warn { background: #fff3e0; border-color: #f0c27a; }
.w-prem.lock { background: #fdf5f5; border-color: #e8c9c9; }
.w-prem-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.w-prem .t-btn { margin: 0; padding: 7px 14px; }

/* v5: document retention */
.w-ret { margin-top: 6px; font-size: 13px; color: #555; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.w-ret.soon { color: #8a4b00; }
.w-inline { padding: 3px 6px; font-size: 13px; }

/* v6: letterheads */
.lh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.lh-card { border: 1px solid #e6ddd2; border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.lh-card.def { border: 2px solid #721c24; }
.lh-card-b { padding: 10px 12px; } .lh-card-b .w-actions { margin-top: 8px; flex-wrap: wrap; }
.lh-new { align-items: center; justify-content: center; min-height: 200px; font-weight: 600; color: #721c24; cursor: pointer; border-style: dashed; font: inherit; }
.lh-new span { font-size: 34px; display: block; }
.lh-mini { background: #f4f1ec; padding: 10px; }
.lh-paper { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.12); border-radius: 3px; overflow: hidden; display: flex; flex-direction: column; min-height: 420px; }
.lh-paper.small { min-height: 150px; font-size: 9px; }
.lh-body { padding: 16px 22px; font-size: 12.5px; line-height: 1.5; flex: 1; }
.lh-body p { margin: 0 0 9px; }
.lh-paper.small .lh-body { padding: 8px 10px; }
.lh-paper.small .lh-body i { display: block; height: 5px; background: #e8e4de; border-radius: 3px; margin: 6px 0; }
.lh-foot { text-align: center; font-size: 9px; color: #666; padding: 8px 12px 10px; border-top: 1px solid #eee; }
.lh-paper.small .lh-foot { font-size: 6px; padding: 4px; }
.lh-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.lh-side { position: sticky; top: 12px; }
.lh-big { background: #f4f1ec; padding: 14px; border-radius: 10px; }
.lh-fs { border: 1px solid #ece4da; border-radius: 10px; padding: 10px 12px 12px; margin: 0 0 12px; }
.lh-fs legend { font-weight: 600; padding: 0 6px; color: #5a1219; }
.w-field.wide { grid-column: 1 / -1; }
.lh-logo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lh-logo-row small { color: #777; flex-basis: 100%; }
.lh-logo-box { width: 90px; height: 60px; border: 1px dashed #ccc; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #999; overflow: hidden; }
.lh-logo-box img { max-width: 100%; max-height: 100%; }
.lh-pal { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lh-pal-b { border: 1px solid #ddd; background: #fff; border-radius: 18px; padding: 4px 10px 4px 6px; font-size: 12px; cursor: pointer; display: inline-flex; gap: 3px; align-items: center; }
.lh-pal-b i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.w-field input[type=color] { height: 38px; padding: 2px; }
@media (max-width: 860px) { .lh-edit { grid-template-columns: 1fr; } .lh-side { position: static; } }

/* v7: the Designer */
.dz { position: relative; left: 50%; transform: translateX(-50%); width: min(1340px, calc(100vw - 24px)); background: #fff;
      border: 1px solid #e6ddd2; border-radius: 14px; padding: 12px; box-sizing: border-box; }
.dz-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.dz-top select, .dz-name { padding: 6px 8px; border: 1px solid #d9d2c7; border-radius: 8px; font: inherit; font-size: 13px; }
.dz-name { width: 150px; } .dz-title { font-size: 15px; margin-right: 6px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-sp { flex: 1; } .dz-top .t-btn { padding: 7px 14px; margin: 0; }
.dz-court { background: #f6f3ec; border: 1px solid #e4dccb; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #4d4535; margin: 8px 0 12px; }
.dz-court.small { font-size: 12px; padding: 7px 10px; margin: 0 0 10px; }
.dz-cols { display: grid; grid-template-columns: 230px minmax(0, 1fr) 270px; gap: 12px; align-items: start; }
.dz-left, .dz-right { background: #faf8f5; border: 1px solid #eee6da; border-radius: 10px; padding: 10px; max-height: 78vh; overflow: auto; font-size: 13px; }
.dz-left h4, .dz-right h4 { margin: 10px 0 6px; font-size: 13px; color: #5a1219; } .dz-left h4:first-child, .dz-right h4:first-child { margin-top: 0; }
.dz-pal { display: flex; flex-direction: column; gap: 5px; }
.dz-chip { background: #fff; border: 1px solid #e0d6c8; border-radius: 8px; padding: 6px 8px; cursor: grab; user-select: none; font-size: 12.5px; }
.dz-chip:hover { border-color: #721c24; } .dz-chip:active { cursor: grabbing; }
.dz-up { display: block; background: #fff; border: 1px dashed #cdbfae; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; cursor: pointer; }
.dz-up input { display: block; margin-top: 4px; font-size: 11px; max-width: 100%; }
.dz-f { display: block; margin-bottom: 6px; } .dz-f span { display: block; font-size: 11.5px; color: #666; margin-bottom: 2px; }
.dz-f input, .dz-f select { width: 100%; box-sizing: border-box; padding: 5px 7px; border: 1px solid #d9d2c7; border-radius: 6px; font: inherit; font-size: 12.5px; }
.dz-f input[type=color] { height: 32px; padding: 2px; }
.dz-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.dz-tog { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 8px; }
.dz-right .w-actions { margin: 8px 0; flex-wrap: wrap; }
.dz-stage { background: #ece7df; border-radius: 10px; padding: 18px; overflow: auto; max-height: 82vh; }
.dz-page { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); min-height: 842px; display: flex; flex-direction: column; color: #222; }
.dz-head, .dz-foot { position: relative; z-index: 1; }
.dz-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.dz-zone { min-height: 26px; border: 1px dashed transparent; border-radius: 6px; padding: 3px; transition: background .12s; }
.dz-page:hover .dz-zone { border-color: #d8cdbd; }
.dz-zone.act { border-color: #c9a35b !important; background: rgba(201,163,91,.06); }
.dz-zone.over { background: rgba(114,28,36,.08); border-color: #721c24 !important; }
.dz-el { cursor: grab; border: 1px solid transparent; border-radius: 4px; padding: 1px 3px; line-height: 1.25; margin-bottom: 2px; }
.dz-el:hover { border-color: #c9b8a2; } .dz-el.on { border-color: #721c24; background: rgba(114,28,36,.05); }
.dz-el img { max-width: 100%; object-fit: contain; vertical-align: middle; }
.dz-ph { display: inline-flex; align-items: center; justify-content: center; border: 1px dashed #bbb; border-radius: 6px; font-size: 9px; color: #999; }
.dz-body { flex: 1; position: relative; z-index: 1; } .dz-body p { margin: 0; } .dz-gap { height: .6em; }
.dz-tb { border-collapse: collapse; width: 100%; margin: 4px 0 8px; font-size: .92em; }
.dz-tb th, .dz-tb td { border: 1px solid #ccc; padding: 3px 6px; text-align: left; }
.dz-tb-minimal th, .dz-tb-minimal td { border: 0; border-bottom: 1px solid #ccc; }
.dz-wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 64px; font-weight: 700;
         opacity: .45; transform: rotate(-45deg); pointer-events: none; z-index: 0; white-space: nowrap; }
.dz-mh { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(114,28,36,.35); cursor: ew-resize; z-index: 3; }
.dz-mh::after { content: ''; position: absolute; top: 0; bottom: 0; left: -6px; width: 12px; }
.dz-mh:hover { border-left-color: #721c24; }
.dz-mlab { position: absolute; top: 2px; font-size: 10px; color: #8a6d3b; background: #fff8e8; padding: 0 4px; border-radius: 4px; z-index: 3; pointer-events: none; opacity: 0; }
.dz-page:hover .dz-mlab { opacity: 1; }
.dz-h3 { font-size: 15px; margin: 16px 0 8px; color: #5a1219; }
.dz-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.dz-doc { text-align: left; background: #fff; border: 1px solid #e6ddd2; border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; }
.dz-doc b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dz-doc small { color: #777; }
.dz-doc:hover { border-color: #721c24; } .dz-saved { cursor: default; }
@media (max-width: 1100px) { .dz-cols { grid-template-columns: 1fr; } .dz-left, .dz-right { max-height: none; } }
.dz-row > .dz-zone { min-width: 0; overflow: hidden; }
.dz-fn { overflow: hidden; }

/* v8: case budget */
.bg-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.bg-top h2 { margin: 0; flex: 1 1 300px; }
.bg-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0 6px; }
.bg-checks { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.bg-ai { background: #fbf7ef; border: 1px solid #ecdfc4; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.bg-ai textarea { width: 100%; box-sizing: border-box; margin: 8px 0; padding: 8px; border: 1px solid #ddd2c0; border-radius: 8px; font: inherit; }
.bg-h3 { font-size: 16px; color: #5a1219; margin: 18px 0 8px; }
.bg-stage { border: 1px solid #ece4da; border-radius: 10px; margin-bottom: 8px; background: #fff; }
.bg-stage > summary { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; cursor: pointer; }
.bg-stage[open] > summary { border-bottom: 1px solid #f0e9df; }
.bg-st-tot { font-size: 13px; color: #555; }
.bg-tbl-wrap { overflow-x: auto; padding: 6px 8px; }
.bg-tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.bg-tbl th { text-align: left; font-weight: 600; color: #666; font-size: 12px; padding: 4px; }
.bg-tbl td { padding: 3px 4px; vertical-align: middle; }
.bg-tbl input, .bg-tbl select { width: 100%; box-sizing: border-box; padding: 5px 6px; border: 1px solid #ddd5c9; border-radius: 6px; font: inherit; font-size: 13px; }
.bg-tbl td:first-child { min-width: 240px; } .bg-tbl td:first-child input { width: calc(100% - 4px); }
.bg-q { width: 58px !important; } .bg-u { width: 110px !important; }
.bg-amt { white-space: nowrap; text-align: right; font-weight: 600; }
.bg-x { padding: 3px 8px; }
.bg-stage .w-btn[data-add] { margin: 4px 10px 10px; }
.bg-src { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 9px; margin-top: 2px; cursor: help; }
.bg-src.ok { background: #e7f4ea; color: #24683a; } .bg-src.chk { background: #fff1d9; color: #8a5300; } .bg-src.ai { background: #eef1f8; color: #34508a; }
.bg-sum { border-collapse: collapse; width: 100%; max-width: 680px; font-size: 13.5px; margin-bottom: 8px; }
.bg-sum th, .bg-sum td { padding: 5px 8px; border-bottom: 1px solid #eee; text-align: right; }
.bg-sum th:first-child, .bg-sum td:first-child { text-align: left; }
.bg-total td { font-weight: 700; border-top: 2px solid #721c24; }
.bg-alert { border-radius: 9px; padding: 8px 12px; margin-bottom: 6px; font-size: 13.5px; }
.bg-alert.bad { background: #fdecec; border: 1px solid #f0b7b7; } .bg-alert.warn { background: #fff5e2; border: 1px solid #f0d29a; }
.bg-alert.info { background: #eef3fb; border: 1px solid #c9d8f0; }
.bg-alert details { margin-top: 4px; font-size: 12.5px; } .bg-alert summary { cursor: pointer; color: #555; }
.bg-act-form { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bg-act-form input, .bg-act-form select { padding: 7px 8px; border: 1px solid #ddd5c9; border-radius: 8px; font: inherit; font-size: 13px; }
.bg-act-form #baDesc { flex: 1 1 200px; } .bg-act-form .t-btn { margin: 0; }
.bg-bar { display: grid; grid-template-columns: 190px 1fr 190px; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 5px; }
.bg-track { height: 9px; background: #eee8df; border-radius: 6px; overflow: hidden; }
.bg-track i { display: block; height: 100%; border-radius: 6px; } .bg-track i.ok { background: #2f8a4c; } .bg-track i.warn { background: #e0a030; } .bg-track i.bad { background: #c0392b; }
@media (max-width: 640px) { .bg-bar { grid-template-columns: 1fr; gap: 2px; } }
/* budget v1.1: "How to fill Low · Likely · High — and why" */
.bg-help { background: #fbf7ef; border: 1px solid #ecdcb8; border-radius: 10px; padding: 10px 14px; margin: 6px 0 12px; font-size: 13.5px; line-height: 1.6; }
.bg-help summary { cursor: pointer; font-weight: 600; color: #721c24; }
.bg-help ul { margin: 8px 0 6px 18px; } .bg-help li { margin-bottom: 6px; } .bg-help p { margin: 8px 0 0; }
