/* Law Offices of Mordy Gross – client intake. Mobile-first; one stylesheet for client and attorney views. */
:root {
  --ink: #1c1c1c; --muted: #5f6368; --line: #d9d9d9; --bg: #f6f6f4; --card: #ffffff;
  --brand: #1f3a5f; --brand-ink: #ffffff; --accent: #8a6d1e; --ok: #1f7a3f; --warn: #a15c00; --bad: #a12626;
  --first: #fff4d6; --radius: 10px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 17px; line-height: 1.45; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 1.35rem; margin: 0 0 .4rem; }
h2 { font-size: 1.15rem; margin: 1.2rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .8rem; }

/* layout */
.topbar { background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; position: sticky; top: 0; z-index: 10; }
.topbar .title { font-weight: 600; font-size: .95rem; letter-spacing: .01em; line-height: 1.2; }
.topbar .sub { font-size: .78rem; opacity: .85; line-height: 1.2; }
.topbar .row { flex-wrap: nowrap; white-space: nowrap; }
@media (max-width: 420px) { .topbar .title { font-size: .85rem; } .topbar a, .topbar button.link { font-size: .82rem; } }
.topbar a, .topbar button.link { color: var(--brand-ink); background: none; border: 0; padding: 0; text-decoration: underline; font-size: .9rem; cursor: pointer; }
.wrap { max-width: 760px; margin: 0 auto; padding: 1rem; }
.wide { max-width: 1180px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.banner { background: #fff8e1; border: 1px solid #f0d78c; border-radius: var(--radius); padding: .7rem 1rem; margin: 0 0 1rem; font-size: .92rem; }
.banner.priv { background: #eef3fa; border-color: #c9d7ea; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.stack > * + * { margin-top: .6rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px; padding: .65rem 1.1rem; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn.danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: .35rem .7rem; min-height: 34px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

/* progress */
.progress { height: 10px; background: #e6e6e3; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); transition: width .3s; }
.stages { display: flex; gap: 4px; margin: .5rem 0 0; }
.stages > a { flex: 1; height: 8px; border-radius: 4px; background: #e6e6e3; display: block; }
.stages > a.done { background: var(--ok); }
.stages > a.part { background: #8fb59c; }
.stages > a.current { outline: 2px solid var(--brand); outline-offset: 1px; }

/* questions */
.q { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 .9rem; }
.q.first { border-color: #e4c66f; background: var(--first); }
.q .num { font-weight: 700; margin-right: .35rem; }
.q .text { margin: 0 0 .6rem; }
.q .text.compact { white-space: pre-wrap; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 4px; background: var(--accent); color: #fff; vertical-align: middle; margin-left: .3rem; }
.tag.ok { background: var(--ok); } .tag.warn { background: var(--warn); } .tag.bad { background: var(--bad); } .tag.grey { background: #777; }
textarea, input[type=text], input[type=email], input[type=date], input[type=number], select { width: 100%; border: 1px solid #bbb; border-radius: 8px; padding: .6rem .7rem; background: #fff; min-height: 44px; }
textarea { min-height: 7rem; resize: vertical; line-height: 1.4; }
textarea.short { min-height: 4.5rem; }
label.field { display: block; font-size: .9rem; color: var(--muted); margin: .5rem 0 .2rem; }
.choices { display: flex; gap: .5rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.choices label { flex: 1 1 30%; border: 1px solid #bbb; border-radius: 8px; padding: .6rem; text-align: center; cursor: pointer; background: #fff; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: .4rem; }
.choices label.on { border-color: var(--brand); background: #eef3fa; font-weight: 600; }
.choices input { position: absolute; opacity: 0; }
.savestate { font-size: .8rem; color: var(--muted); min-height: 1rem; margin-top: .25rem; text-align: right; }
.savestate.err { color: var(--bad); }

/* tables (schedules) rendered as cards on phones, grid on wide screens */
.rows { margin: .6rem 0; }
.rowcard { border: 1px solid var(--line); border-radius: 8px; padding: .7rem; margin: 0 0 .6rem; background: #fcfcfb; }
.rowcard .rowhead { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: .3rem; }
.rowcard .cell + .cell { margin-top: .4rem; }
.rowcard .cell label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .15rem; }
.rowcard input, .rowcard select, .rowcard textarea { min-height: 40px; padding: .45rem .6rem; }
.rowcard textarea { min-height: 3rem; }
.rowsummary { font-size: .9rem; color: var(--muted); }

/* files */
.files { margin: .6rem 0 0; }
.file { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .4rem; background: #fff; font-size: .92rem; }
.file .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .bar { height: 4px; background: #e6e6e3; border-radius: 2px; margin-top: .3rem; overflow: hidden; }
.file .bar > div { height: 100%; background: var(--brand); }
.uploadbtn { position: relative; overflow: hidden; }
.uploadbtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* comments */
.thread { margin-top: .7rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.msg { border-left: 3px solid #999; padding: .35rem .6rem; margin: 0 0 .5rem; background: #fafaf8; border-radius: 0 6px 6px 0; font-size: .95rem; }
.msg.attorney { border-color: var(--brand); }
.msg.client { border-color: var(--accent); }
.msg .who { font-size: .78rem; color: var(--muted); }

/* nav */
.pager { display: flex; justify-content: space-between; gap: .6rem; margin: 1rem 0 2rem; }
.toc a { display: flex; justify-content: space-between; padding: .7rem .4rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.toc a .state { color: var(--muted); font-size: .9rem; }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: #eee; }
.pill.ok { background: #dff3e5; color: var(--ok); } .pill.warn { background: #fdebd2; color: var(--warn); } .pill.bad { background: #f8dcdc; color: var(--bad); } .pill.info { background: #e3ecf8; color: var(--brand); }

/* admin */
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
table.grid th, table.grid td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { background: #f0f0ee; font-weight: 600; position: sticky; top: 0; }
table.grid tr:hover td { background: #fafaf6; }
.split { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.split > * { min-width: 0; }
@media (min-width: 900px) { .split { grid-template-columns: 300px 1fr; } .split .side { position: sticky; top: 4rem; align-self: start; max-height: calc(100vh - 5rem); overflow: auto; } }
.answerbox { white-space: pre-wrap; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin: .3rem 0; }
.answerbox.empty { color: #999; font-style: italic; }
.versions { font-size: .85rem; }
.versions details summary { cursor: pointer; color: var(--brand); }
.verrow { border-left: 2px solid var(--line); padding: .2rem .6rem; margin: .3rem 0; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; z-index: 50; max-width: 90vw; }
.toast.err { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 1rem; }
.modal { background: #fff; border-radius: var(--radius); padding: 1.2rem; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; }
.center { text-align: center; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; background: #fff; }
.stat b { display: block; font-size: 1.4rem; }
@media print { .topbar, .pager, .btn, .savestate { display: none !important; } body { background: #fff; } .q { break-inside: avoid; } }
