/* ============ Zoit — chambers ============ */
:root {
  /* UI shades (themeable) */
  --ui-raise: #1b1b1b;
  --ui-border: #363636;
  --ui-dim: #5b5955;
  --ui-soft: #b0ada6;
  --night: #0c0c0c;
  --night-2: #141414;
  --night-3: #1d1d1d;
  --line: #2a2a2a;
  --chalk: #f2f0eb;
  --mute: #86847f;
  --paper: #fbfaf7;
  --paper-2: #f1efea;
  --ink: #0c0c0c;
  --graphite: #55534f;
  --pencil: #a3a09a;
  --rule: #e2dfd8;
  --me: #0c0c0c;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --body: 'EB Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(.22, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--night); color: var(--chalk); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
body.role-client .team-only, body.role-team .client-only { display: none !important; }

.mark { width: 46px; height: 46px; border: 1px solid currentColor; border-radius: 50%; display: grid; place-items: center; font: 500 24px/1 var(--serif); }
.mark.sm { width: 26px; height: 26px; font-size: 14px; }
.mark.lg { width: 80px; height: 80px; font-size: 40px; opacity: .5; }
.link { font-size: 12px; color: var(--mute); transition: color .2s; }
.link:hover { color: var(--chalk); }
.btn-primary { background: var(--chalk); color: var(--night); padding: 13px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; transition: letter-spacing .4s var(--ease); }
.btn-primary:hover { letter-spacing: .22em; }
.btn-primary.sm { padding: 8px 14px; font-size: 11px; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--chalk)); color: #fff; font: 600 13px var(--serif); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes turn { from { opacity: 0; transform: rotate(-120deg) scale(.7); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { transform: scale(0); } }

/* ============ sign in ============ */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto; background: radial-gradient(1200px 600px at 50% -10%, var(--ui-raise), var(--night) 70%); }
.auth-inner { width: 100%; max-width: 380px; text-align: center; animation: rise 1s var(--ease) both; }
.auth .mark { margin: 0 auto 18px; animation: turn 1.4s var(--ease) both; }
.wordmark { font: 600 13px var(--sans); letter-spacing: .5em; text-transform: uppercase; color: var(--mute); padding-left: .5em; }
.auth-line { font: 500 44px/1.1 var(--serif); margin: 26px 0 40px; min-height: 1.1em; }
#typewriter::after { content: ''; display: inline-block; width: 1px; height: .85em; background: currentColor; margin-left: 4px; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.auth-switch { display: flex; justify-content: center; gap: 28px; margin-bottom: 22px; }
.auth-tab { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); padding-bottom: 6px; border-bottom: 1px solid transparent; transition: all .3s; }
.auth-tab.active { color: var(--chalk); border-color: var(--chalk); }
.auth-form { display: grid; gap: 10px; }
.auth-form input { background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 14px 2px; font: 18px var(--body); outline: none; transition: border-color .3s; text-align: center; }
.auth-form input:focus { border-color: var(--chalk); }
.auth-form input::placeholder { color: var(--ui-dim); }
.auth-form .btn-primary { margin-top: 14px; }
.auth-error { min-height: 22px; margin-top: 14px; font: italic 15px var(--body); color: var(--chalk); }
.demo { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 18px; font-size: 11px; flex-wrap: wrap; }
.demo span { color: var(--ui-dim); letter-spacing: .14em; text-transform: uppercase; margin-right: 6px; }
.demo button { border: 1px solid var(--line); padding: 6px 10px; color: var(--mute); transition: all .25s; }
.demo button:hover { border-color: var(--chalk); color: var(--chalk); }

/* ============ shell ============ */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: 248px 1fr; }
.rail { background: var(--night); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 0 0; min-height: 0; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 0 22px 28px; font: 600 11px var(--sans); letter-spacing: .4em; text-transform: uppercase; }
.rail-label { padding: 0 22px 10px; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ui-dim); }
.matters { overflow: auto; min-height: 0; }
.matter { display: block; width: 100%; text-align: left; padding: 12px 22px 12px 20px; border-left: 2px solid transparent; transition: background .25s, border-color .25s; }
.matter:hover { background: var(--night-2); }
.matter.on { background: var(--night-2); border-color: var(--chalk); }
.matter b { display: block; font: 500 17px/1.25 var(--serif); color: var(--chalk); }
.matter small { display: block; margin-top: 4px; font-size: 11px; color: var(--mute); }
.rail-new { margin: 10px 22px; font-size: 12px; color: var(--mute); transition: color .2s; }
.rail-new:hover { color: var(--chalk); }
.new-form { display: grid; gap: 8px; padding: 8px 22px 12px; animation: rise .4s var(--ease); }
.new-form input, .new-form select { background: var(--night-2); border: 1px solid var(--line); padding: 9px 10px; font-size: 13px; outline: none; }
.new-form input:focus, .new-form select:focus { border-color: var(--mute); }
.new-form .row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.rail-foot { margin-top: auto; padding: 16px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me b { display: block; font: 500 15px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }

.main { min-width: 0; min-height: 0; position: relative; background: radial-gradient(1400px 500px at 50% -200px, var(--ui-raise), var(--night-2) 70%); }
.empty { height: 100%; display: grid; place-items: center; align-content: center; gap: 16px; color: var(--mute); font: italic 18px var(--body); }
.workspace { height: 100%; display: flex; flex-direction: column; padding: 26px 30px 0; }

/* caption */
.caption { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-bottom: 28px; animation: rise .7s var(--ease) both; }
.caption-left { min-width: 0; }
.kicker { font: italic 15px var(--body); color: var(--mute); }
.title { font: 500 40px/1.05 var(--serif); margin: 4px 0 8px; outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid transparent; transition: border-color .3s; }
body.role-team .title:hover { border-color: var(--line); cursor: text; }
body.role-team .title:focus { border-color: var(--mute); text-overflow: clip; }
.sub { font-size: 12px; color: var(--mute); letter-spacing: .04em; }
.caption-right { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; flex: none; }
.who { display: flex; align-items: center; gap: 14px; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--mute); }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--chalk); animation: breathe 2.4s infinite; }
.live.off i { background: var(--ui-border); animation: none; }
@keyframes breathe { 0% { box-shadow: 0 0 0 0 rgba(242,240,235,.45); } 70% { box-shadow: 0 0 0 7px rgba(242,240,235,0); } 100% { box-shadow: 0 0 0 0 rgba(242,240,235,0); } }
.presence { display: flex; }
.presence .avatar { width: 26px; height: 26px; font-size: 11px; margin-left: -6px; border: 2px solid var(--night-2); animation: pop .4s var(--ease) both; }

.stepper { list-style: none; margin: 0; padding: 0; display: flex; }
.stepper li { position: relative; padding-top: 14px; width: 92px; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ui-dim); text-align: center; transition: color .4s; }
.stepper li::before { content: ''; position: absolute; top: 3px; left: 0; right: 0; height: 1px; background: var(--line); }
.stepper li::after { content: ''; position: absolute; top: 3px; left: 0; right: 0; height: 1px; background: var(--chalk); transform: scaleX(0); transform-origin: left; transition: transform .8s var(--ease); }
.stepper li i { position: absolute; top: 0; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--night-2); border: 1px solid var(--ui-dim); z-index: 1; transition: all .4s; }
.stepper li.done, .stepper li.now { color: var(--chalk); }
.stepper li.done::after { transform: scaleX(1); }
.stepper li.now::after { transform: scaleX(.5); }
.stepper li.done i, .stepper li.now i { background: var(--chalk); border-color: var(--chalk); }
.stepper li.now i { box-shadow: 0 0 0 4px rgba(242,240,235,.12); }
body.role-team .stepper li { cursor: pointer; }
body.role-team .stepper li:hover { color: var(--chalk); }

/* ============ the desk: three empty sheets ============ */
.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; padding-bottom: 6px; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 24px;
  background: var(--paper); color: var(--ink); min-height: 0;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.04);
  animation: cardIn .9s var(--ease) both; transition: transform .55s var(--ease), box-shadow .55s var(--ease); }
.card:nth-child(1) { animation-delay: .05s; } .card:nth-child(2) { animation-delay: .15s; } .card:nth-child(3) { animation-delay: .25s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(50px); } }
/* faint ruled margin, the only mark on the page */
.card::before { content: ''; position: absolute; top: 0; bottom: 0; left: 34px; width: 4px; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.card:hover { transform: translateY(-10px); box-shadow: 0 50px 80px -30px rgba(0,0,0,.95), 0 0 0 1px rgba(255,255,255,.08); }
.card:focus-visible { outline: 2px solid var(--chalk); outline-offset: 6px; }
.card-num { font: 300 clamp(90px, 11vw, 170px)/1 var(--serif); letter-spacing: .02em; transition: letter-spacing .6s var(--ease), transform .6s var(--ease); }
.card:hover .card-num { letter-spacing: .12em; transform: scale(1.04); }
.card-name { margin-top: 18px; font: 600 26px var(--serif); letter-spacing: .01em; }
.card-sub { margin-top: 6px; font: italic 15px var(--body); color: var(--graphite); }
.card-go { position: absolute; bottom: 26px; left: 0; right: 0; font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; font-weight: 600; opacity: 0; transform: translateY(8px); transition: all .45s var(--ease); }
.card-go i { font-style: normal; display: inline-block; transition: transform .45s var(--ease); }
.card:hover .card-go { opacity: 1; transform: none; }
.card:hover .card-go i { transform: translateX(6px); }
.card-badge { position: absolute; top: 20px; right: 20px; display: none; align-items: center; gap: 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; padding: 6px 10px; border: 1px solid currentColor; animation: fade .4s var(--ease); }
.card-badge.on { display: inline-flex; }
.card-badge .dot { width: 7px; height: 7px; }
.card-clean { margin-top: -14px; margin-bottom: 14px; }
.card-team { background: var(--ink); color: var(--chalk); box-shadow: 0 30px 60px -30px rgba(0,0,0,.85), 0 0 0 1px #2a2a2a; }
.card-team::before { border-color: var(--ui-border); }
.card-team .card-sub { color: var(--ui-soft); }
.card-seal { display: none; }
body.role-client .card-team { cursor: default; }
body.role-client .card-team:hover { transform: none; }
body.role-client .card-team .card-num, body.role-client .card-team .card-go { display: none; }
body.role-client .card-team .card-seal { display: grid; justify-items: center; gap: 14px; font-size: 10.5px; letter-spacing: .3em; text-transform: uppercase; font-weight: 600; order: -1; margin-bottom: 4px; }
.card-seal span { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--chalk); color: var(--ink); font: 500 40px var(--serif); box-shadow: 0 0 0 7px var(--ink), 0 0 0 8px var(--chalk); }

/* ============ full-screen document ============ */
.doc { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--night-2); }
.doc-bar { flex: none; display: flex; align-items: center; gap: 22px; height: 64px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--night); }
.back { width: 38px; height: 38px; border: 1px solid var(--line); font-size: 16px; color: var(--mute); transition: all .25s; flex: none; }
.back:hover { color: var(--chalk); border-color: var(--chalk); }
.doc-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.doc-id b { display: block; font: 600 20px/1 var(--serif); white-space: nowrap; }
.doc-id small { display: block; margin-top: 4px; font-size: 11px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.num { width: 32px; height: 32px; flex: none; border: 1px solid var(--ui-border); border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--serif); }
.doc-tabs { display: flex; gap: 26px; position: relative; align-self: stretch; margin: 0 auto; }
.doc-tabs button { font-size: 12px; color: var(--mute); transition: color .2s; white-space: nowrap; }
.doc-tabs button:hover, .doc-tabs button.on { color: var(--chalk); }
.doc-tabs em { font-style: normal; font-size: 10px; margin-left: 3px; }
.doc-tabs em.alert { color: var(--night); background: var(--chalk); padding: 1px 6px; border-radius: 9px; }
.tab-ink { position: absolute; bottom: -1px; height: 2px; background: var(--chalk); transition: left .4s var(--ease), width .4s var(--ease); pointer-events: none; }
.doc-right { display: flex; align-items: center; gap: 16px; flex: none; }
.doc-right .state { font-size: 11px; color: var(--mute); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.doc-actions { flex: none; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 22px; min-height: 0; padding: 0 22px; }
.doc-actions:not(:empty) { min-height: 50px; padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.doc-actions .note { font: italic 14px var(--body); color: var(--mute); }
.doc-actions .note button { color: var(--chalk); text-decoration: underline; text-underline-offset: 3px; font: inherit; }

.doc-scroll { flex: 1; min-height: 0; padding: 30px 30px 0; display: flex; justify-content: center; }
.page { position: relative; width: 100%; max-width: 1240px; height: 100%; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 60px -20px rgba(0,0,0,.8); animation: pageIn .7s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(30px); } }
.page::before { content: ''; position: absolute; top: 0; bottom: 0; left: 52px; width: 4px; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); pointer-events: none; z-index: 2; }
.pane { position: absolute; inset: 0; width: 100%; height: 100%; overflow: auto; }
.editor, .pane { padding: 56px 80px 80px 96px; border: 0; outline: none; background: transparent; font: 18px/1.85 var(--body); color: var(--ink); }
/* one sheet: the document, and its remarks in the right-hand margin, scrolling together */
.sheet-scroll { position: absolute; inset: 0; overflow: auto; display: flex; align-items: stretch; }
.sheet-scroll .editor { flex: 1; min-width: 0; min-height: 100%; height: max-content; }
.editor { white-space: normal; overflow-wrap: break-word; caret-color: var(--me); }
.editor ::selection { background: color-mix(in srgb, var(--me) 28%, transparent); }
.editor[contenteditable="false"] { cursor: default; }
.pane { display: none; animation: fade .35s var(--ease); }
.page > .pane.on { display: block; }
.page > .sheet-scroll:not(.on) { display: none; }
.sheet-scroll::-webkit-scrollbar, .pane::-webkit-scrollbar { width: 10px; }
.sheet-scroll::-webkit-scrollbar-thumb, .pane::-webkit-scrollbar-thumb { background: var(--rule); border: 3px solid var(--paper); }
.page.touched::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--ink)); animation: touched 1.6s var(--ease) forwards; }
@keyframes touched { to { opacity: 0; } }

/* changes: every author in their own colour */
.pane ins { text-decoration: underline; text-decoration-color: var(--c); text-decoration-thickness: 1.5px; text-underline-offset: 3px; color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); transition: background .2s; }
.pane del { color: var(--c); text-decoration: line-through; text-decoration-thickness: 1.5px; opacity: .65; transition: background .2s, opacity .2s; }
.pane .hot ins, .pane ins.hot { background: color-mix(in srgb, var(--c) 24%, transparent); }
.pane del.hot { opacity: 1; background: color-mix(in srgb, var(--c) 12%, transparent); }
.doc-text { white-space: normal; }
.ctl { display: inline-flex; gap: 2px; margin: 0 4px; vertical-align: 2px; font: 600 11px var(--sans); }
.ctl button { width: 22px; height: 20px; border: 1px solid var(--rule); background: var(--paper); color: var(--graphite); transition: all .2s; line-height: 1; }
.ctl button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.changes-head { position: sticky; top: -56px; z-index: 3; margin: -56px -80px 30px -96px; padding: 18px 80px 16px 96px; background: var(--paper); border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.changes-head .summary { font: 16px var(--body); margin-right: auto; }
.changes-head .summary b { font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; width: 100%; font: 11px var(--sans); color: var(--graphite); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.none { font: italic 17px var(--body); color: var(--pencil); }

/* remarks margin */
.margin { flex: none; width: 310px; position: relative; border-left: 1px solid var(--rule); background: linear-gradient(90deg, rgba(0,0,0,.025), transparent 18px), var(--paper); font: 15px/1.5 var(--body); }
.m-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: baseline; gap: 8px; padding: 18px 18px 8px; background: var(--paper); font: 600 10px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--graphite); }
.m-head em { font-style: normal; color: var(--pencil); }
.m-compose { position: absolute; left: 10px; right: 10px; z-index: 4; padding: 10px 12px; background: #fff; border: 1px solid var(--ink); box-shadow: 0 18px 34px -16px rgba(0,0,0,.45); animation: pop-in .25s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateX(10px); } }
.m-plus { margin-left: auto; font: 600 10px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--pencil); transition: color .2s; }
.m-plus:hover { color: var(--ink); }
.m-cancel { color: var(--pencil) !important; font-weight: 500 !important; }
.m-compose textarea { width: 100%; border: 0; resize: none; outline: none; font: 15px/1.45 var(--body); background: transparent; caret-color: var(--me); }
.m-quote { font: italic 13px/1.4 var(--body); color: var(--graphite); border-left: 2px solid var(--me); padding-left: 8px; margin-bottom: 6px; max-height: 3.9em; overflow: hidden; }
.m-row { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 4px; }
.m-row button { font: 600 10.5px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--pencil); transition: color .2s; }
.m-row button:hover { color: var(--ink); }
.m-list { position: relative; }
.m-card { position: absolute; left: 14px; right: 14px; padding: 10px 12px 10px 14px; background: #fff; border-left: 2px solid var(--c); box-shadow: 0 1px 0 var(--rule), 0 10px 22px -16px rgba(0,0,0,.35); cursor: pointer; transition: top .35s var(--ease), transform .25s var(--ease), box-shadow .25s; animation: fade .35s var(--ease) both; }
.m-card:hover, .m-card.on { transform: translateX(-6px); box-shadow: 0 1px 0 var(--rule), 0 16px 30px -16px rgba(0,0,0,.45); }
.m-card .by { font: 10.5px var(--sans); color: var(--pencil); margin-bottom: 3px; }
.m-card .by b { color: var(--c); font-weight: 600; }
.m-card .q { font: italic 13px/1.4 var(--body); color: var(--graphite); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-card .q.lost { text-decoration: line-through; opacity: .6; }
.m-card p { margin: 0; white-space: pre-wrap; color: var(--ink-2, var(--ui-raise)); }
.m-empty { padding: 18px; font: italic 14px var(--body); color: var(--pencil); }
::highlight(remarks) { background-color: rgba(0, 0, 0, .07); }
::highlight(remark-on) { background-color: rgba(255, 214, 90, .6); }

/* associate requests awaiting the Team Head */
.req { display: flex; align-items: center; gap: 10px; font: 13px var(--sans); color: var(--ui-soft); }
.req b { color: var(--chalk); font-weight: 600; }
.req .dot { width: 8px; height: 8px; }
.req .link { text-decoration: underline; text-underline-offset: 3px; }
.preview-head { position: sticky; top: -56px; z-index: 3; margin: -56px -80px 30px -96px; padding: 16px 80px 14px 96px; background: var(--ink); color: var(--chalk); display: flex; align-items: center; gap: 14px; font: 13px var(--sans); }
.preview-head b { font-weight: 600; }
.preview-head .x { margin-left: auto; color: var(--mute); text-decoration: underline; }
.preview-doc { white-space: pre-wrap; }

/* history */
.version { border-bottom: 1px solid var(--rule); padding: 14px 0; }
.version > button { display: flex; width: 100%; align-items: flex-start; justify-content: space-between; gap: 12px; text-align: left; }
.version .dot { margin-top: 9px; }
.version .v-main { flex: 1; }
.version .v-note { font: 500 17px var(--body); }
.version .v-by { display: block; font: 11px var(--sans); color: var(--pencil); margin-top: 2px; }
.version .v-when { font: 11px var(--sans); color: var(--pencil); white-space: nowrap; padding-top: 4px; }
.version .v-diff { display: none; margin-top: 12px; font-size: 16px; line-height: 1.7; white-space: pre-wrap; max-height: 360px; overflow: auto; padding: 14px 16px; background: var(--paper-2); }
.version .v-diff ins { --c: var(--ink); }
.version .v-diff del { --c: var(--graphite); }
.version.open .v-diff { display: block; animation: fade .3s var(--ease); }
.version .hold.inline { margin-top: 10px; }

/* save as word */
.word { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--chalk); padding: 9px 14px; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--chalk); white-space: nowrap; position: relative; overflow: hidden; z-index: 0; transition: color .3s var(--ease); }
.word::before { content: ''; position: absolute; inset: 0; background: var(--chalk); transform: translateY(101%); transition: transform .35s var(--ease); z-index: -1; }
.word:hover { color: var(--night); }
.word:hover::before { transform: none; }
.word svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.word.busy { pointer-events: none; opacity: .5; }

/* hold-to-confirm buttons (no dialogs) */
.hold { position: relative; overflow: hidden; z-index: 0; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 8px 14px; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); transition: color .25s, border-color .25s; user-select: none; }
.hold:hover { color: var(--chalk); border-color: var(--mute); }
.hold::after { content: ''; position: absolute; inset: 0; background: var(--chalk); transform: scaleX(0); transform-origin: left; transition: transform .15s; z-index: -1; }
.hold.holding::after { transform: scaleX(1); transition: transform .8s linear; }
.hold.holding { color: var(--night) !important; }
.hold:disabled { opacity: .3; pointer-events: none; }
.hold small { font-weight: 400; letter-spacing: .06em; text-transform: none; opacity: .6; }
.pane .hold, .hold.inline { border-color: var(--rule); color: var(--graphite); }
.pane .hold:hover { border-color: var(--ink); color: var(--ink); }
.pane .hold::after { background: var(--ink); }
.pane .hold.holding { color: var(--paper) !important; }

/* ============ rich document content (editor + changes view) ============ */
.rich > :first-child { margin-top: 0; }
.rich p { margin: 0 0 .7em; }
.rich h1 { font: 600 1.7em/1.25 var(--serif); margin: 0 0 .8em; letter-spacing: .02em; }
.rich h2 { font: 600 1.35em/1.3 var(--serif); margin: 1.2em 0 .5em; }
.rich h3 { font: 600 1.12em/1.35 var(--body); margin: 1.1em 0 .35em; letter-spacing: .02em; }
.rich h4 { font: italic 600 1em/1.4 var(--body); margin: 1em 0 .3em; }
.rich ul, .rich ol { margin: 0 0 .7em; padding-left: 1.6em; }
.rich li { margin: .15em 0; }
.rich blockquote { margin: 1em 0; padding: .2em 0 .2em 1.2em; border-left: 2px solid var(--ink); font-style: italic; color: var(--graphite); }
.rich table { border-collapse: collapse; width: 100%; margin: .8em 0 1em; }
.rich td, .rich th { border: 1px solid #9c9a95; padding: 6px 9px; vertical-align: top; min-width: 40px; }
.rich th { background: var(--paper-2); font-weight: 600; }
.rich hr { border: 0; border-top: 1px solid var(--ink); margin: 1.4em 0; }
.rich .page-break { height: 0; border-top: 1px dashed var(--pencil); margin: 2em -96px 2em -44px; position: relative; page-break-after: always; }
.rich .page-break::after { content: 'Page break'; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); background: var(--paper); padding: 0 10px; font: 600 9px/18px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--pencil); }
.rich img { max-width: 100%; height: auto; }
.rich a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.editor:empty::before { content: 'Begin drafting…'; color: var(--pencil); font-style: italic; }
.fmt { font: 600 9px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #fff; background: var(--c); padding: 3px 5px; margin: 0 2px; vertical-align: 2px; }
mark.find-hit { background: #ffe58a; color: inherit; }

/* ============ toolbar ============ */
.toolbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; padding: 8px 16px; background: var(--night); border-bottom: 1px solid var(--line); }
.toolbar.off { display: none; }
.tg { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-right: 1px solid var(--line); }
.tg:last-child { border-right: 0; }
.toolbar button, .findbar button { min-width: 30px; height: 30px; padding: 0 8px; color: var(--ui-soft); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: background .15s, color .15s; }
.toolbar button:hover, .findbar button:hover { background: var(--night-3); color: var(--chalk); }
.toolbar button.on { background: var(--chalk); color: var(--night); }
.toolbar button b, .toolbar button i, .toolbar button u, .toolbar button s { font: 600 14px var(--serif); }
.toolbar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.toolbar svg circle { fill: currentColor; stroke: none; }
.toolbar svg text { fill: currentColor; stroke: none; font: 600 5px var(--sans); }
.toolbar select { height: 30px; background: var(--night-2); border: 1px solid var(--line); color: var(--chalk); font-size: 12px; padding: 0 6px; outline: none; cursor: pointer; }
.toolbar select:hover, .toolbar select:focus { border-color: var(--mute); }
#tbStyle { width: 104px; } #tbFont { width: 138px; } #tbSize { width: 58px; }
.swatch-btn { flex-direction: column; gap: 1px !important; font: 600 13px var(--serif) !important; }
.swatch-btn i { display: block; width: 16px; height: 3px; background: var(--sw, #000); }
.swatch-btn .hl { font: 600 12px var(--sans); }
.dd { position: relative; }
.dd-panel { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--night-2); border: 1px solid var(--line); padding: 10px; box-shadow: 0 20px 40px -10px rgba(0,0,0,.7); animation: fade .2s var(--ease); }
.dd.open .dd-panel { display: block; }
.swatches { display: grid !important; grid-template-columns: repeat(6, 22px); gap: 6px; }
.dd:not(.open) .swatches { display: none !important; }
.swatches button { min-width: 0 !important; width: 22px; height: 22px !important; padding: 0 !important; background: var(--sw) !important; border: 1px solid rgba(255,255,255,.15); }
.swatches button:hover { outline: 2px solid var(--chalk); outline-offset: 1px; }
.swatches button.none { background: repeating-linear-gradient(45deg, #fff 0 3px, #c00 3px 4px) !important; }
.symbols { display: grid !important; grid-template-columns: repeat(6, 30px); gap: 2px; }
.dd:not(.open) .symbols { display: none !important; }
.symbols button { font: 16px var(--body) !important; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { width: 220px; height: 30px; background: var(--night); border: 1px solid var(--line); color: var(--chalk); padding: 0 8px; outline: none; font-size: 12px; }
.inline-form button { border: 1px solid var(--line); }
.grid-pick { display: grid; grid-template-columns: repeat(8, 16px); gap: 3px; }
.grid-pick span { width: 16px; height: 16px; border: 1px solid var(--ui-border); cursor: pointer; }
.grid-pick span.on { background: var(--chalk); border-color: var(--chalk); }
.grid-label { margin-top: 8px; font-size: 11px; color: var(--mute); text-align: center; }

.findbar { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; background: var(--night-2); border-bottom: 1px solid var(--line); animation: fade .25s var(--ease); }
.findbar input { width: 200px; height: 30px; background: var(--night); border: 1px solid var(--line); color: var(--chalk); padding: 0 10px; outline: none; font-size: 13px; }
.findbar input:focus { border-color: var(--mute); }
.findbar button { border: 1px solid var(--line); }
.findbar #findCount { font-size: 11px; color: var(--mute); min-width: 70px; }

@media print {
  body * { visibility: hidden !important; }
  #editor, #editor * { visibility: visible !important; }
  #editor { position: absolute !important; inset: 0 !important; height: auto !important; overflow: visible !important; padding: 0 !important; zoom: 1 !important; }
  .rich .page-break { border: 0; margin: 0; } .rich .page-break::after { display: none; }
}

/* ============ ledger: one quiet status line instead of pop-ups ============ */
.ledger { height: 52px; flex: none; display: flex; align-items: center; justify-content: center; font: italic 14px var(--body); color: var(--mute); text-align: center; }
#ledger { transition: opacity .35s, transform .35s var(--ease); }
#ledger.swap { opacity: 0; transform: translateY(6px); }

/* view transition: the card grows into the page */
::view-transition-group(sheet) { animation-duration: .55s; animation-timing-function: cubic-bezier(.22, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

/* ============ responsive ============ */
@media (max-width: 1280px) {
  .app { grid-template-columns: 200px 1fr; }
  .stepper li { width: 72px; font-size: 8.5px; }
  .desk { gap: 22px; }
  .doc-tabs { gap: 18px; }
  .doc-right .state { display: none; }
  .doc-id small { display: none; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { position: static; display: block; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); padding-top: 16px; }
  .rail-brand { padding: 0 16px 14px; } .rail-label { padding: 0 16px 8px; }
  .matters { display: flex; overflow-x: auto; }
  .matter { flex: none; max-width: 240px; border-left: 0; border-bottom: 2px solid transparent; padding: 10px 16px; }
  .matter.on { border-color: var(--chalk); }
  .rail-new { margin: 10px 16px; } .new-form { padding: 8px 16px 12px; }
  .rail-foot { padding: 12px 16px; }
  .workspace { height: auto; padding: 20px 16px 0; }
  .caption { flex-direction: column; align-items: flex-start; gap: 14px; }
  .caption-right { align-items: flex-start; width: 100%; }
  .title { white-space: normal; font-size: 30px; }
  .stepper { width: 100%; }
  .stepper li { width: auto; flex: 1; font-size: 8px; letter-spacing: .06em; }
  .desk { grid-template-columns: 1fr; gap: 18px; }
  .card { min-height: 260px; }
  .card-clean { margin: 0; }
  .card-go { opacity: 1; transform: none; }
  .doc-bar { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px 14px; }
  .doc-tabs { order: 3; width: 100%; margin: 0; gap: 18px; padding: 10px 0 12px; overflow-x: auto; }
  .doc-right { margin-left: auto; }
  .doc-actions { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .doc-scroll { padding: 12px 0 0; }
  .editor, .pane { padding: 28px 20px 60px 42px; font-size: 17px; }
  .page::before { left: 22px; }
  .sheet-scroll { flex-direction: column; }
  .margin { width: auto; border-left: 0; border-top: 1px solid var(--rule); padding-bottom: 20px; }
  .m-head, .m-compose { position: static; }
  .m-compose { margin: 0 14px 10px; }
  .m-list { display: grid; gap: 10px; padding: 0 14px; }
  .m-card { position: static; }
  .changes-head { top: -28px; margin: -28px -20px 24px -42px; padding: 14px 20px 14px 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.preview-head .hold { border-color: var(--ui-border); color: var(--chalk); }
.preview-head .hold::after { background: var(--chalk); }
.preview-head .hold.holding { color: var(--night) !important; }

/* a toolbar button pressed with nothing selected: a short nudge */
.toolbar.nudge { animation: nudge .35s; }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* the clean draft is just the document: no remarks margin */
.page.no-margin { max-width: 960px; }
.page.no-margin .margin { display: none; }

/* toolbar buttons: each in its own small, clearly visible box */
.toolbar { gap: 8px 10px; padding: 10px 16px; }
.tg { gap: 4px; padding: 4px; border: 1px solid var(--ui-border); border-radius: 4px; background: #111; }
.tg:last-child { border-right: 1px solid var(--ui-border); }
.toolbar button { min-width: 32px; height: 32px; border: 1px solid var(--ui-border); border-radius: 3px; background: var(--ui-raise); color: #f2f0eb; font-size: 12.5px; }
.toolbar button:hover { background: #2a2a2a; border-color: var(--ui-soft); color: #fff; }
.toolbar button.on { background: var(--chalk); border-color: var(--chalk); color: var(--night); }
.toolbar button b, .toolbar button i, .toolbar button u, .toolbar button s { font-size: 16px; }
.toolbar svg { width: 16px; height: 16px; stroke-width: 1.6; }
.toolbar select { height: 32px; border-radius: 3px; border-color: var(--ui-border); background: var(--ui-raise); }
.swatch-btn i { width: 18px; height: 3px; }

/* new matter form */
.new-form { max-height: 62vh; overflow: auto; }
.nf-label { font: 600 9.5px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--ui-dim); margin-top: 6px; }
.nf-group { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--ui-border); animation: rise .3s var(--ease); }
.nf-group small { font-size: 10.5px; color: var(--mute); line-height: 1.4; }
.nf-drop { display: block; padding: 14px 10px; border: 1px dashed var(--ui-border); text-align: center; font-size: 11.5px; color: var(--mute); cursor: pointer; transition: all .2s; }
.nf-drop:hover, .nf-drop.over { border-color: var(--chalk); color: var(--chalk); background: var(--night-2); }
.nf-drop.has { border-style: solid; color: var(--chalk); }
.nf-error { min-height: 0; font: italic 13px var(--body); color: #e8a0a0; }

/* drag a Word/PDF file onto a sheet to load it there */
.card.drop-over { transform: translateY(-10px) scale(1.02); outline: 2px dashed var(--chalk); outline-offset: 8px; }
.card-team.drop-over { outline-color: var(--chalk); }
.card.drop-no { outline: 2px dashed #7a4a4a; outline-offset: 8px; }
.card-drop { position: absolute; left: 0; right: 0; bottom: 60px; font: 600 10px var(--sans); letter-spacing: .2em; text-transform: uppercase; opacity: 0; transition: opacity .2s; }
.card.drop-over .card-drop, .card.drop-no .card-drop { opacity: 1; }
.card.busy { opacity: .6; pointer-events: none; }
.page.drop-over::after { content: 'Drop to replace this document'; position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(12,12,12,.82); color: var(--chalk); font: 600 12px var(--sans); letter-spacing: .24em; text-transform: uppercase; border: 2px dashed var(--chalk); }
.desk-hint { text-align: center; font: italic 13px var(--body); color: var(--ui-dim); padding-top: 8px; }
.new-form { overflow-x: hidden; }
.new-form input, .new-form select, .nf-drop { width: 100%; min-width: 0; }
.new-form .row .btn-primary.sm { white-space: nowrap; }

/* ============ real pages ============ */
.doc-bar { height: 56px; }
.doc-scroll { padding: 0; }
.page, .page.no-margin { max-width: none; background: transparent; box-shadow: none; animation: none; }
.page::before { display: none; }
.sheet-scroll { display: flex; justify-content: center; align-items: flex-start; gap: 28px; padding: 22px 28px 90px; overflow: auto; }
.paper-col { position: relative; flex: none; animation: pageIn .6s var(--ease) both; }
.sheets { position: absolute; left: 0; top: 0; right: 0; pointer-events: none; }
.sheet-pg { position: absolute; left: 0; right: 0; background: var(--paper); box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 18px 40px -18px rgba(0,0,0,.85); }
.pg-num { position: absolute; left: 0; right: 0; text-align: center; font: 10pt/14px var(--body); color: var(--ui-soft); letter-spacing: .04em; }
.sheet-scroll .editor { position: relative; flex: none; background: transparent; overflow: visible; height: auto; box-sizing: border-box; }
.editor .pg-gap { display: block; user-select: none; pointer-events: none; }
.sheet-scroll .rich .page-break { border: 0; margin: 0; height: auto; min-height: 0; }
.sheet-scroll .rich .page-break::after { display: none; }
/* panes that aren't paginated sit on a single sheet */
.pane { left: 0; right: 0; margin: 22px auto 0; max-width: 980px; height: calc(100% - 22px); background: var(--paper); box-shadow: 0 18px 40px -18px rgba(0,0,0,.85); }
/* the remarks margin now sits beside the sheets, on the desk */
.margin { width: 300px; background: transparent; border-left: 0; align-self: stretch; }
.m-head { background: var(--night-2); color: var(--mute); padding: 4px 4px 10px; }
.m-head em { color: var(--mute); }
.m-plus { color: var(--mute); } .m-plus:hover { color: var(--chalk); }
.m-empty { color: var(--ui-dim); padding: 8px 4px; }
.m-card { left: 0; right: 0; }
.m-compose { left: 0; right: 0; }
.m-del { margin-left: 8px; font: 600 9.5px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--pencil); opacity: 0; transition: opacity .2s, color .2s; }
.m-card:hover .m-del, .m-del.armed { opacity: 1; }
.m-del:hover { color: var(--ink); }
.m-del.armed { color: #b3261e; }

/* document bar: format toggle and zoom */
.fmt-toggle { height: 32px; padding: 0 12px; border: 1px solid var(--ui-border); border-radius: 3px; background: var(--ui-raise); color: var(--chalk); font-size: 11.5px; display: inline-flex; align-items: center; gap: 6px; transition: all .2s; }
.fmt-toggle i { font-style: normal; transition: transform .25s var(--ease); }
.fmt-toggle.on { background: var(--chalk); color: var(--night); border-color: var(--chalk); }
.fmt-toggle.on i { transform: rotate(180deg); }
body:has(#toolbar.off) #fmtToggle { display: none; }
.zoom { height: 32px; border: 1px solid var(--ui-border); border-radius: 3px; background: var(--ui-raise); color: var(--chalk); font-size: 11.5px; padding: 0 6px; outline: none; cursor: pointer; }
.toolbar.collapsed { display: none; }

/* confirmation */
.confirm { position: fixed; left: 50%; top: 76px; z-index: 120; display: flex; align-items: center; gap: 12px; padding: 14px 22px 14px 16px; background: var(--chalk); color: var(--night); box-shadow: 0 24px 50px -16px rgba(0,0,0,.8); transform: translate(-50%, -16px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .4s var(--ease); }
.confirm.show { opacity: 1; transform: translate(-50%, 0); }
.confirm .tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--night); color: var(--chalk); font-size: 14px; }
.confirm b { font: 600 17px var(--serif); letter-spacing: .01em; }

@media print {
  .sheets, .pg-gap { display: none !important; }
}
@media (max-width: 900px) {
  .sheet-scroll { padding: 12px 12px 60px; }
  .margin { width: auto; }
  .pane { margin-top: 0; height: 100%; }
}
/* holding a button must never trigger text selection or a long-press menu */
.hold { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#tbFont { width: 170px; }

/* Never centre the sheets in a way that pushes page 1 out of reach: start at the top (and the
   left), and centre only when there is room to spare ("safe" alignment). */
.sheet-scroll { justify-content: safe center; }
@media (max-width: 900px) {
  .sheet-scroll { justify-content: flex-start; align-items: safe center; }
}

/* ============ sign in with Google / Apple ============ */
.or { display: flex; align-items: center; gap: 14px; margin: 22px 0 14px; color: var(--ui-dim); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.social { display: grid; gap: 10px; }
.social-slot:empty { display: none; }
.social-slot { display: flex; justify-content: center; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border: 1px solid var(--line); background: var(--night-2); color: var(--chalk); font-size: 13px; font-weight: 500; transition: border-color .2s, background .2s; }
.social-btn:hover { border-color: var(--chalk); background: var(--night-3); }
.social-btn svg { width: 17px; height: 17px; }
#appleBtn { background: var(--chalk); color: var(--night); border-color: var(--chalk); }
#appleBtn:hover { background: #fff; }

/* ============ join by shared link ============ */
.join-kicker { margin: 26px 0 0; font: italic 16px var(--body); color: var(--mute); }
.join-title { margin: 8px 0 6px; font-size: 38px; }
.join-sub { margin: 0 0 30px; font-size: 12px; letter-spacing: .06em; color: var(--mute); }

/* ============ share matter ============ */
.share { position: relative; }
.share-btn { height: 30px; padding: 0 14px; border: 1px solid var(--chalk); color: var(--chalk); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; transition: all .2s; }
.share-btn:hover, .share-btn.on { background: var(--chalk); color: var(--night); }
.share-panel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; width: 380px; padding: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.85); animation: fade .25s var(--ease); text-align: left; }
.sp-title { font: 600 20px var(--serif); }
.sp-note { margin: 4px 0 14px; font: italic 14px/1.4 var(--body); color: var(--graphite); }
.sp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-form input { grid-column: span 2; height: 36px; border: 1px solid var(--rule); background: #fff; padding: 0 10px; font-size: 13px; outline: none; color: var(--ink); }
.sp-form input:focus { border-color: var(--ink); }
.sp-form .btn-primary { grid-column: span 2; background: var(--ink); color: #fff; }
.sp-result { margin-top: 12px; padding: 12px; background: var(--paper-2); font-size: 12.5px; line-height: 1.5; }
.sp-result .row { display: flex; gap: 6px; margin-top: 8px; }
.sp-result input { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--rule); padding: 0 8px; font-size: 12px; background: #fff; color: var(--ink); }
.sp-result button { padding: 0 12px; border: 1px solid var(--ink); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.sp-result button:hover { background: var(--ink); color: #fff; }
.sp-sub { margin: 16px 0 6px; font: 600 10px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--pencil); }
.sp-list { display: grid; gap: 2px; max-height: 220px; overflow: auto; }
.sp-person { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.sp-person .who-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-person small { color: var(--pencil); font-size: 11px; }
.sp-person .tag { font: 600 9px var(--sans); letter-spacing: .12em; text-transform: uppercase; border: 1px solid var(--ink); padding: 2px 6px; }
.sp-person .rm { color: var(--pencil); font-size: 11px; }
.sp-person .rm:hover, .sp-person .rm.armed { color: #b3261e; }

/* new document in the team draft */
.newdoc { height: 32px; border: 1px solid var(--line); background: var(--night-2); color: var(--chalk); font-size: 11.5px; padding: 0 8px; cursor: pointer; outline: none; }
.newdoc:hover { border-color: var(--mute); }
#nfTemplate { background: var(--night-2); border: 1px solid var(--line); padding: 9px 10px; font-size: 13px; outline: none; color: var(--chalk); }
@media (max-width: 900px) { .share-panel { position: fixed; left: 12px; right: 12px; top: 80px; width: auto; } }
.caption { position: relative; z-index: 30; } /* keep the share panel above the sheets */
.sp-list { overflow-x: hidden; }
.sp-person .who-name small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sp-person .tag, .sp-person .rm { flex: none; }


/* ============ themes (profile menu, top right) ============ */
:root[data-theme="white"] {
  --night: #f3f2ee; --night-2: #ffffff; --night-3: #e9e7e1; --line: #dcd9d2; --chalk: #141414; --mute: #6c6963;
  --ui-raise: #ffffff; --ui-border: #d4d1c9; --ui-dim: #8f8c85; --ui-soft: #3e3c38;
  --paper: #ffffff; --paper-2: #f4f3ef;
}
:root[data-theme="navy"] {
  --night: #0d1729; --night-2: #12203a; --night-3: #1a2b4b; --line: #26385c; --chalk: #f4efe2; --mute: #9aa6bd;
  --ui-raise: #172744; --ui-border: #2f446c; --ui-dim: #6d7c99; --ui-soft: #c7cfdf;
  --paper: #fcf9f1; --paper-2: #f3eee2; --ink: #0d1729;
}
/* things that must stay light-on-dark whatever the theme */
:root[data-theme="white"] .card-team, :root[data-theme="white"] .sheet-team .sheet-head { color: #f2f0eb; }
:root[data-theme="white"] .card-team .card-sub { color: #9a978f; }
:root[data-theme="white"] .sheet-pg, :root[data-theme="white"] .card, :root[data-theme="white"] .pane { box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 14px 34px -16px rgba(0,0,0,.28); }
:root[data-theme="white"] .card-seal span { box-shadow: 0 0 0 7px var(--ink), 0 0 0 8px #f2f0eb; background: #f2f0eb; color: var(--ink); }
:root[data-theme="white"] .live i { box-shadow: none; }
:root[data-theme="navy"] .card-team .card-sub { color: #9aa6bd; }
/* Oxblood: deep wine leather with brass */
:root[data-theme="oxblood"] {
  --night: #22090f; --night-2: #2d0e16; --night-3: #3b141e; --line: #57212e; --chalk: #f5e9dc; --mute: #c49a8f;
  --ui-raise: #35111a; --ui-border: #6a2a38; --ui-dim: #9b6f6b; --ui-soft: #e5cdb8;
  --paper: #fdf8f0; --paper-2: #f5ecdf; --ink: #2b0d14;
}
:root[data-theme="oxblood"] .card-team .card-sub { color: #c9a46b; }
/* Emerald: library green with gilt */
:root[data-theme="emerald"] {
  --night: #08201a; --night-2: #0c2a22; --night-3: #12372c; --line: #1f4d3e; --chalk: #f3ecd9; --mute: #9dbcab;
  --ui-raise: #0f3127; --ui-border: #2a5e4c; --ui-dim: #6f9283; --ui-soft: #d3e2d4;
  --paper: #fbf8ef; --paper-2: #f1ecdd; --ink: #0b2a20;
}
:root[data-theme="emerald"] .card-team .card-sub { color: #d8b878; }

/* profile button & menu */
.profile { position: relative; }
.profile-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--chalk)); color: #fff; font: 600 13px var(--serif); box-shadow: 0 0 0 2px var(--night-2), 0 0 0 3px var(--ui-border); transition: box-shadow .2s; }
.profile-btn:hover, .profile-btn.on { box-shadow: 0 0 0 2px var(--night-2), 0 0 0 3px var(--chalk); }
.profile-menu { position: absolute; right: 0; top: calc(100% + 12px); z-index: 45; width: 260px; padding: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); animation: fade .25s var(--ease); text-align: left; }
.pm-name { font: 600 19px var(--serif); }
.pm-sub { margin-top: 2px; font-size: 11.5px; color: var(--graphite); }
.pm-label { margin: 16px 0 8px; font: 600 10px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--pencil); }
.themes { display: grid; gap: 6px; }
.theme-opt { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--rule); text-align: left; color: var(--ink); transition: border-color .2s; }
.theme-opt span { font: 600 15px var(--serif); align-self: end; }
.theme-opt small { grid-column: 2; font-size: 11px; color: var(--graphite); align-self: start; }
.theme-opt:hover { border-color: var(--graphite); }
.theme-opt.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.theme-opt i { grid-row: 1 / span 2; width: 44px; height: 30px; border: 1px solid rgba(0,0,0,.15); background: linear-gradient(135deg, var(--a) 0 55%, var(--b) 55%); }
.theme-opt.on::after { content: '✓'; position: absolute; right: 12px; font-size: 13px; }
.theme-opt { position: relative; }
.pm-out { margin-top: 16px; width: 100%; padding: 9px; border: 1px solid var(--rule); font-size: 12px; color: var(--ink); }
.pm-out:hover { border-color: var(--ink); }
.profile { order: 9; } /* rightmost in the header */

/* Cursors that always show: a solid black text caret on the (always light) page, and an I-beam
   mouse pointer drawn black with a white outline, visible on light and dark alike. */
.editor, .m-compose textarea, .composer textarea, .sp-form input { caret-color: #000; }
.auth-form input, .new-form input, .findbar input, .inline-form input, .join-form input { caret-color: var(--chalk); }
.editor[contenteditable="true"], .m-compose textarea {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='26' viewBox='0 0 16 26'%3E%3Cpath d='M4.5 2.5h7M8 2.5v21M4.5 23.5h7' fill='none' stroke='white' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M4.5 2.5h7M8 2.5v21M4.5 23.5h7' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 8 13, text;
}

/* White theme: the three sheets swap colours — Client and Clean turn black, Team turns white */
:root[data-theme="white"] .card { background: var(--ink); color: #f2f0eb; box-shadow: 0 14px 34px -16px rgba(0,0,0,.45); }
:root[data-theme="white"] .card::before { border-color: #2a2a2a; }
:root[data-theme="white"] .card .card-sub { color: #9a978f; }
:root[data-theme="white"] .card-team { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 0 14px 34px -16px rgba(0,0,0,.28); }
:root[data-theme="white"] .card-team::before { border-color: var(--rule); }
:root[data-theme="white"] .card-team .card-sub { color: var(--graphite); }
:root[data-theme="white"] .card-seal span { background: var(--ink); color: #f2f0eb; box-shadow: 0 0 0 7px var(--paper), 0 0 0 8px var(--ink); }

/* toolbar colours follow the theme (they were fixed to the dark look) */
.tg { background: var(--night-2); border-color: var(--ui-border); }
.toolbar button, .findbar button { color: var(--chalk); background: var(--ui-raise); border-color: var(--ui-border); }
.toolbar button:hover, .findbar button:hover { background: var(--night-3); border-color: var(--ui-soft); color: var(--chalk); }
.toolbar button.on { background: var(--chalk); border-color: var(--chalk); color: var(--night-2); }
.toolbar select, .zoom, .fmt-toggle, .newdoc, .findbar input { color: var(--chalk); background: var(--ui-raise); border-color: var(--ui-border); }
.fmt-toggle.on { background: var(--chalk); color: var(--night-2); border-color: var(--chalk); }
.dd-panel { background: var(--night-2); border-color: var(--ui-border); }
.inline-form input { background: var(--night); color: var(--chalk); border-color: var(--ui-border); }
.swatches button { border-color: var(--ui-border) !important; }
.grid-pick span { border-color: var(--ui-border); }
.grid-pick span.on { background: var(--chalk); border-color: var(--chalk); }

/* header kept minimal: no status timeline, no presence avatars */
#stepper, #presence { display: none !important; }
.sp-form .btn-primary { grid-column: span 1; }
.sp-copy { grid-column: span 1; border: 1px solid var(--ink); color: var(--ink); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; transition: all .2s; }
.sp-copy:hover { background: var(--ink); color: #fff; }
.sp-person .cp { flex: none; color: var(--graphite); font-size: 11px; text-decoration: underline; text-underline-offset: 2px; }
.sp-person .cp:hover { color: var(--ink); }

/* ============ sidebar calendar (folds away) ============ */
.rail-head { display: flex; align-items: center; justify-content: space-between; }
.cal-toggle { width: 26px; height: 22px; display: grid; place-items: center; color: var(--ui-dim); border: 1px solid transparent; transition: all .2s; }
.cal-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.cal-toggle:hover { color: var(--chalk); border-color: var(--ui-border); }
.cal-toggle.on { color: var(--night); background: var(--chalk); border-color: var(--chalk); }
.rail-cal { margin: 0 16px 12px; padding: 10px; border: 1px solid var(--line); background: var(--night-2); animation: rise .3s var(--ease); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font: 500 14px var(--serif); color: var(--chalk); }
.cal-head button { width: 22px; height: 22px; color: var(--mute); font-size: 15px; }
.cal-head button:hover { color: var(--chalk); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid em { font: 600 9px var(--sans); font-style: normal; color: var(--ui-dim); padding-bottom: 4px; }
.cal-day { position: relative; height: 26px; font-size: 11px; color: var(--ui-dim); border-radius: 3px; }
.cal-day:disabled { cursor: default; }
.cal-day.has { color: var(--chalk); font-weight: 600; }
.cal-day.has:hover { background: var(--night-3); }
.cal-day i { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); min-width: 4px; height: 4px; border-radius: 2px; background: var(--chalk); font: 600 7px/4px var(--sans); color: var(--night); }
.cal-day i:not(:empty) { height: 8px; line-height: 8px; padding: 0 2px; bottom: 0; }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--ui-border); }
.cal-day.on { background: var(--chalk); color: var(--night); }
.cal-day.on i { background: var(--night); color: var(--chalk); }
.cal-clear { display: block; width: 100%; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--mute); text-align: left; }
.cal-clear:hover { color: var(--chalk); }
@media (max-width: 900px) { .rail-cal { margin: 0 16px 10px; } }

/* the matter's date, under the title */
.mdate { position: relative; display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; padding: 4px 10px 4px 8px; border: 1px solid var(--line); font-size: 12px; color: var(--chalk); cursor: pointer; transition: border-color .2s; }
.mdate:hover { border-color: var(--ui-soft); }
.mdate svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.mdate.empty { color: var(--mute); border-style: dashed; }
.mdate input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; color-scheme: light dark; }
.mdate input:disabled { cursor: default; }
body.role-client .mdate { cursor: default; border-style: solid; }
.new-form input[type="date"] { color-scheme: dark; }
:root[data-theme="white"] .new-form input[type="date"] { color-scheme: light; }
.mdate input { pointer-events: none; } /* the whole chip opens the picker */

/* ============ Edit details ============ */
.edit-wrap { position: relative; display: inline-block; margin: 8px 0 0 8px; vertical-align: top; }
.edit-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border: 1px solid var(--line); font-size: 12px; color: var(--mute); transition: all .2s; }
.edit-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.edit-btn:hover, .edit-btn.on { color: var(--chalk); border-color: var(--ui-soft); }
.caption-left .mdate { vertical-align: top; }
.edit-panel { position: absolute; left: 0; top: calc(100% + 10px); z-index: 45; width: 360px; padding: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.7); animation: fade .25s var(--ease); }
.ep-field { display: grid; gap: 4px; margin-top: 12px; font: 600 9.5px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--pencil); }
.ep-field input, .ep-field select { height: 36px; border: 1px solid var(--rule); background: #fff; padding: 0 10px; font: 14px var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); outline: none; color-scheme: light; }
.ep-field input:focus, .ep-field select:focus { border-color: var(--ink); }
.ep-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ep-error { min-height: 0; margin-top: 8px; font: italic 13px var(--body); color: #b3261e; }
.ep-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; }
.ep-actions .btn-primary { background: var(--ink); color: #fff; }
.ep-link { font-size: 12px; color: var(--graphite); }
.ep-link:hover { color: var(--ink); }
.ep-danger { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.ep-delete { font-size: 12px; font-weight: 600; color: #b3261e; }
.ep-delete:hover { text-decoration: underline; }
.ep-confirm { padding: 12px; background: #fbeaea; border: 1px solid #f0c4c4; animation: fade .2s var(--ease); }
.ep-confirm p { margin: 0; font: 14px/1.45 var(--body); color: #5c1a16; }
.ep-confirm .ep-actions { margin-top: 10px; }
.ep-yes { padding: 7px 14px; background: #b3261e; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.ep-yes:hover { background: #8f1d17; }
@media (max-width: 900px) { .edit-panel { position: fixed; left: 12px; right: 12px; top: 80px; width: auto; } }

/* trash can on each matter (legal team only) */
.matter { position: relative; cursor: pointer; }
.m-trash { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; display: grid; place-items: center; color: var(--ui-dim); opacity: 0; transition: opacity .2s, color .2s, background .2s; border-radius: 3px; }
.m-trash svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.matter:hover .m-trash, .matter:focus-within .m-trash, .matter.on .m-trash { opacity: 1; }
.m-trash:hover { color: #e5534b; background: var(--night-3); }
.matter b { padding-right: 26px; }
.matter.confirm-del { display: grid; gap: 8px; background: var(--night-2); border-left-color: #e5534b; cursor: default; font-size: 12.5px; color: var(--chalk); }
.matter.confirm-del b { font: 600 14px var(--serif); padding: 0; display: inline; }
.cd-actions { display: flex; gap: 8px; }
.cd-actions button { padding: 5px 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--ui-border); color: var(--chalk); }
.cd-actions [data-del-yes] { background: #b3261e; border-color: #b3261e; color: #fff; }
.cd-actions [data-del-yes]:hover { background: #8f1d17; }
.pm-form { display: grid; gap: 6px; }
.pm-form input { height: 32px; border: 1px solid var(--rule); background: #fff; padding: 0 9px; font-size: 12.5px; color: var(--ink); outline: none; }
.pm-form input:focus { border-color: var(--ink); }
.pm-form .btn-primary { background: var(--ink); color: #fff; }
.pm-msg { margin-top: 6px; font: italic 13px/1.4 var(--body); color: var(--graphite); }

/* ============ Team ============ */
.rail-team { display: flex; align-items: center; gap: 8px; margin: 8px 16px 10px; padding: 9px 10px; border: 1px solid var(--line); font-size: 12px; color: var(--mute); transition: all .2s; }
.rail-team svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.rail-team em { margin-left: auto; font-style: normal; font-size: 11px; }
.rail-team:hover, .rail-team.on { color: var(--chalk); border-color: var(--ui-soft); }
.team-panel { position: fixed; top: 0; bottom: 0; left: 248px; z-index: 60; width: 380px; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); box-shadow: 30px 0 60px -30px rgba(0,0,0,.6); animation: slideIn .35s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-16px); } }
@media (max-width: 1280px) { .team-panel { left: 200px; } }
@media (max-width: 900px) { .team-panel { left: 0; width: 100%; } }
.tp-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 22px 14px; border-bottom: 1px solid var(--rule); }
.tp-kicker { font: italic 14px var(--body); color: var(--graphite); }
.tp-head h2 { margin: 2px 0 0; font: 600 28px var(--serif); }
.tp-close { width: 30px; height: 30px; color: var(--graphite); border: 1px solid transparent; }
.tp-close:hover { border-color: var(--rule); color: var(--ink); }
.tp-add { display: grid; gap: 7px; padding: 16px 22px; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.tp-label { font: 600 10px var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--pencil); }
.tp-add input { height: 34px; border: 1px solid var(--rule); background: #fff; padding: 0 10px; font-size: 13px; color: var(--ink); outline: none; }
.tp-add input:focus { border-color: var(--ink); }
.tp-add .btn-primary { background: var(--ink); color: #fff; }
.tp-msg { margin: 0; font: italic 13px/1.4 var(--body); color: var(--graphite); }
.tp-msg:empty { display: none; }
.tp-list { flex: 1; overflow: auto; padding: 8px 22px 22px; }
.tp-person { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.tp-top { display: flex; align-items: center; gap: 10px; }
.tp-top .avatar { width: 32px; height: 32px; font-size: 13px; }
.tp-who { flex: 1; min-width: 0; }
.tp-who b { display: block; font: 600 16px var(--serif); }
.tp-who b small { font: 400 11px var(--sans); color: var(--pencil); }
.tp-who > small { display: block; font-size: 11.5px; color: var(--pencil); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-role { font: 600 9px var(--sans); letter-spacing: .12em; text-transform: uppercase; border: 1px solid var(--ink); padding: 3px 7px; white-space: nowrap; }
.tp-note { margin: 8px 0 0 42px; font: italic 13px var(--body); color: var(--graphite); }
.tp-perms { display: grid; gap: 8px; margin: 12px 0 0 42px; }
.tp-perm { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.tp-perm input { position: absolute; opacity: 0; pointer-events: none; }
.tp-switch { position: relative; width: 32px; height: 18px; flex: none; border-radius: 9px; background: var(--rule); transition: background .2s; }
.tp-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.tp-perm input:checked + .tp-switch { background: var(--ink); }
.tp-perm input:checked + .tp-switch::after { transform: translateX(14px); }
.tp-perm input:disabled + .tp-switch { opacity: .5; }
.tp-perm input:focus-visible + .tp-switch { outline: 2px solid var(--ink); outline-offset: 2px; }
.tp-remove { margin: 12px 0 0 42px; font-size: 12px; color: var(--graphite); text-decoration: underline; text-underline-offset: 2px; }
.tp-remove:hover, .tp-remove.armed { color: #b3261e; }
.caption-right { align-self: flex-start; margin-top: -6px; } /* profile and Share matter sit up at the top right */

/* ---------- client / law firm choice ---------- */
.kind { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); margin-bottom: 4px; }
.kind label { position: relative; cursor: pointer; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind span { display: block; padding: 11px 6px; text-align: center; font-size: 12px; letter-spacing: .08em; color: var(--mute); transition: background .2s, color .2s; }
.kind label + label span { border-left: 1px solid var(--line); }
.kind input:checked + span { background: var(--chalk); color: var(--night); }
.kind input:focus-visible + span { outline: 1px solid var(--chalk); outline-offset: 2px; }
.choose-hi { margin: 0 0 10px; text-align: center; font: 17px var(--body); color: var(--mute); }
.choose-hi b { color: var(--chalk); font-weight: 500; }
.kind-note { margin: 4px 0 0; text-align: center; font: italic 14px var(--body); color: var(--mute); }
.choose-back { margin-top: 4px; font-size: 12px; color: var(--mute); text-decoration: underline; text-underline-offset: 3px; }
.auth-pricing { display: block; margin-top: 22px; text-align: center; font-size: 11.5px; letter-spacing: .06em; color: var(--mute); text-decoration: none; }
.auth-pricing:hover { color: var(--chalk); }

/* ---------- plan: profile-menu entry and the panel ---------- */
.pm-plan { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; margin-top: 14px; padding: 9px 10px; border: 1px solid var(--rule); font-size: 12px; color: var(--graphite); text-align: left; }
.pm-plan b { color: var(--ink); font-weight: 600; white-space: nowrap; }
.pm-plan:hover { border-color: var(--ink); }
.plan-panel { overflow-y: auto; }
.pl-usage { display: flex; gap: 22px; padding: 14px 22px; border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--graphite); }
.pl-usage b { color: var(--ink); font: 600 18px var(--serif); margin-right: 2px; }
.pl-list { display: grid; gap: 12px; padding: 18px 22px; }
.pl-card { border: 1px solid var(--rule); padding: 16px 16px 14px; transition: border-color .2s; }
.pl-card.on { border-color: var(--ink); }
.pl-top { display: flex; justify-content: space-between; align-items: center; }
.pl-name { font: 600 20px var(--serif); }
.pl-tag { font: 600 9.5px var(--sans); letter-spacing: .18em; text-transform: uppercase; padding: 4px 7px; background: var(--ink); color: var(--paper); }
.pl-price { margin-top: 4px; font: 600 26px var(--serif); }
.pl-price small { font: 400 12px var(--sans); color: var(--graphite); }
.pl-points { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--graphite); display: grid; gap: 4px; }
.pl-points li::before { content: '§ '; color: var(--pencil); }
.pl-go { margin-top: 14px; width: 100%; padding: 10px; background: var(--ink); color: var(--paper); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.pl-go:hover { opacity: .88; }
.pl-go:disabled { opacity: .5; }
.pl-msg { padding: 0 22px 22px; }

/* ---------- first-time tour ---------- */
.pm-tour { display: block; margin-top: 12px; font-size: 12px; color: var(--graphite); text-decoration: underline; text-underline-offset: 3px; }
.pm-tour:hover { color: var(--ink); }
.tour { position: fixed; inset: 0; z-index: 200; }
.tour-shield { position: absolute; inset: 0; }
.tour.try, .tour.try .tour-shield { pointer-events: none; }  /* the "try it" step lets clicks through… */
.tour.try .tour-card { pointer-events: auto; }                 /* …except on the card itself */
.tour-spot { position: fixed; pointer-events: none; border-radius: 6px; box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 9999px rgba(6,6,8,.72);
  transition: left .55s var(--ease), top .55s var(--ease), width .55s var(--ease), height .55s var(--ease); }
.tour.centered .tour-spot { box-shadow: 0 0 0 9999px rgba(6,6,8,.78); }
.tour.try .tour-spot { animation: tourPulse 1.4s ease-in-out infinite; }
@keyframes tourPulse { 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.95), 0 0 0 9999px rgba(6,6,8,.72); } }
.tour-card { position: fixed; width: min(340px, calc(100vw - 32px)); padding: 20px 22px 16px; background: #fbfaf7; color: #141414; box-shadow: 0 24px 60px -18px rgba(0,0,0,.6);
  transition: left .55s var(--ease), top .55s var(--ease); }
.tour-card.in { animation: tourIn .45s var(--ease) both; }
@keyframes tourIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.tour-count { font: 600 10px var(--sans); letter-spacing: .22em; text-transform: uppercase; color: #8a867d; }
.tour-title { margin: 6px 0 6px; font: 600 26px/1.15 var(--serif); }
.tour-body { margin: 0; font: 16.5px/1.5 var(--body); color: #3d3b37; }
.tour-body kbd { font: 600 11px var(--sans); padding: 1px 5px; border: 1px solid #cfccc4; border-bottom-width: 2px; border-radius: 3px; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.tour-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: #dcd9d2; transition: background .3s, transform .3s; }
.tour-dots i.past { background: #8a867d; }
.tour-dots i.on { background: #141414; transform: scale(1.35); }
.tour-btns { display: flex; align-items: center; gap: 6px; flex: none; }
.tour-skip, .tour-back { padding: 8px 8px; font-size: 12px; color: #6c6963; }
.tour-skip:hover, .tour-back:hover { color: #141414; }
.tour-next { padding: 9px 16px; background: #141414; color: #fbfaf7; font: 600 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.tour-next:hover { background: #000; }
.tour-burst span { position: fixed; z-index: 210; pointer-events: none; font: 600 22px var(--serif); color: #fbfaf7; text-shadow: 0 2px 8px rgba(0,0,0,.5);
  animation: tourBurst 1.3s var(--ease) forwards; }
@keyframes tourBurst { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } .tour.try .tour-spot, .tour-card.in, .tour-burst span { animation: none; } .tour-burst { display: none; } }

/* ---------- profile menu: rows, and the theme page ---------- */
.pm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 10px 10px; border: 1px solid var(--rule); font-size: 12.5px; color: var(--graphite); text-align: left; }
.pm-row:first-of-type { margin-top: 14px; }
.pm-row b { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.pm-row:hover { border-color: var(--ink); }
.pm-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); background: linear-gradient(135deg, var(--a) 0 55%, var(--b) 55%); }
.pm-back { margin-bottom: 12px; font: 600 15px var(--serif); color: var(--ink); }
.pm-back:hover { opacity: .7; }
.pm-page { animation: pmIn .25s var(--ease); }
@keyframes pmIn { from { opacity: 0; transform: translateX(6px); } }

/* ---------- documents inside a matter: a small file explorer ---------- */
.doc-strip { margin: -10px 0 18px; padding: 12px 14px 14px; border: 1px solid var(--ui-border); background: var(--ui-raise); animation: rise .6s var(--ease) both; }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ex-path { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ex-crumb { display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ui-dim); }
.ex-crumb .ex-ico { width: 18px; height: 15px; }
button.ex-crumb:hover { color: var(--chalk); }
.ex-crumb.here { color: var(--chalk); }
.ex-sep { color: var(--ui-dim); }
.ex-actions { display: flex; gap: 8px; }
.ex-act { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border: 1px solid var(--ui-border); color: var(--chalk); font-size: 12.5px; font-weight: 500; transition: background .2s, border-color .2s; }
.ex-act .ex-ico { width: 16px; height: 16px; }
.ex-act:hover { background: var(--night-3); border-color: var(--chalk); }
.ex-tiles { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.ex-tile { position: relative; flex: none; width: 118px; display: grid; justify-items: center; align-content: start; gap: 6px; padding: 12px 8px 10px;
  border: 1px solid transparent; border-radius: 8px; color: var(--chalk); text-align: center; transition: background .18s, border-color .18s, transform .18s; }
.ex-tile:hover { background: var(--night-3); border-color: var(--ui-border); transform: translateY(-2px); }
.ex-tile .ex-ico { width: 44px; height: 40px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); transition: transform .18s; }
.ex-tile:hover .ex-ico { transform: scale(1.06); }
.ex-doc .ex-ico { width: 36px; }
.ex-name { max-width: 100%; font: 500 13px/1.25 var(--sans); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.ex-tile small { font-size: 11px; color: var(--ui-dim); margin-top: -3px; }
.ex-tile.on { background: var(--chalk); color: var(--night); border-color: var(--chalk); }
.ex-tile.on .ex-name { font-weight: 600; }
.ex-folder.holds .ex-name { text-decoration: underline; text-underline-offset: 3px; }
.ex-up { color: var(--ui-dim); }
.ex-up:hover { color: var(--chalk); }
.ex-more { position: absolute; top: 4px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-weight: 700; line-height: 1; background: rgba(0,0,0,.08); }
.ex-tile:not(.on) .ex-more { background: var(--night-2); color: var(--mute); }
.ex-more:hover { background: rgba(0,0,0,.18); }
.ex-empty { margin: 6px 4px; font: italic 14px var(--body); color: var(--ui-dim); }
.doc-edit { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: -8px 0 18px; padding: 12px 14px; border: 1px solid var(--ui-border); background: var(--night-2); animation: rise .3s var(--ease) both; }
.doc-edit input, .doc-edit select { background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 7px 2px; color: var(--chalk); font: 16px var(--body); outline: none; min-width: 180px; }
.doc-edit input:focus { border-color: var(--chalk); }
.doc-edit select option { color: #141414; }
.doc-edit .link { color: var(--mute); font-size: 12px; }
.de-del { font-size: 12px; color: #e06c75; }
.de-del.armed { font-weight: 600; text-decoration: underline; }
.de-error { flex-basis: 100%; color: #e06c75; font-size: 12.5px; }
.de-error:empty { display: none; }
@media (max-width: 900px) { .doc-strip { margin-top: 0; } .ex-tile { width: 100px; } }
.ex-toggle { width: 22px; height: 22px; display: inline-grid; place-items: center; color: var(--chalk); font-size: 13px; transition: transform .2s; }
.doc-strip.collapsed .ex-toggle { transform: rotate(-90deg); }
.doc-strip.collapsed { padding-bottom: 12px; }
.doc-strip.collapsed .ex-head { margin-bottom: 0; }
.ex-count { font-size: 12px; color: var(--ui-dim); }
.ex-tile.sel:not(.on) { background: var(--night-3); border-color: var(--chalk); }
.ex-hint { margin: 6px 2px 0; font-size: 11px; color: var(--ui-dim); }
/* going into a folder slides the tiles in from the right; leaving slides them back from the left */
.ex-tiles.slide-in > * { animation: exIn .32s var(--ease) both; }
.ex-tiles.slide-out > * { animation: exOut .32s var(--ease) both; }
.ex-tiles.slide-in > *:nth-child(2), .ex-tiles.slide-out > *:nth-child(2) { animation-delay: .03s; }
.ex-tiles.slide-in > *:nth-child(3), .ex-tiles.slide-out > *:nth-child(3) { animation-delay: .06s; }
.ex-tiles.slide-in > *:nth-child(4), .ex-tiles.slide-out > *:nth-child(4) { animation-delay: .09s; }
.ex-tiles.slide-in > *:nth-child(n+5), .ex-tiles.slide-out > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes exIn { from { opacity: 0; transform: translateX(22px) scale(.96); } }
@keyframes exOut { from { opacity: 0; transform: translateX(-22px) scale(.96); } }
.ex-confirm { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; padding: 10px 12px; border: 1px solid #b4474f; background: rgba(180, 71, 79, .12); color: var(--chalk); font-size: 13px; line-height: 1.45; animation: rise .25s var(--ease) both; }
.ex-confirm-btns { display: flex; align-items: center; gap: 12px; flex: none; }
.ex-del-yes { padding: 7px 14px; background: #b4474f; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.ex-del-yes:hover { background: #9c3a42; }
.ex-confirm .link { color: var(--mute); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .ex-tiles.slide-in > *, .ex-tiles.slide-out > * { animation: none; } }

/* compact explorer + a clear Back button */
.doc-strip { padding: 9px 12px 10px; margin-bottom: 14px; }
.ex-head { margin-bottom: 6px; }
.ex-act { padding: 5px 10px 5px 8px; font-size: 12px; }
.ex-tiles { gap: 6px; }
.ex-tile { width: 92px; gap: 4px; padding: 8px 6px 7px; border-radius: 7px; }
.ex-tile .ex-ico { width: 34px; height: 30px; }
.ex-doc .ex-ico { width: 27px; height: 32px; }
.ex-name { font-size: 12px; }
.ex-tile small { font-size: 10.5px; }
.ex-more { width: 19px; height: 19px; top: 3px; right: 4px; font-size: 12px; }
.ex-hint { margin-top: 4px; font-size: 10.5px; }
.ex-back { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; margin-right: 4px; background: var(--chalk); color: var(--night); font: 600 12px var(--sans); border-radius: 999px; transition: transform .15s, opacity .15s; animation: rise .25s var(--ease) both; }
.ex-back:hover { transform: translateX(-2px); opacity: .9; }

/* ================= phones (up to 760px wide) ================= */
.rail-menu { display: none; }
@media (max-width: 760px) {
  /* the sidebar becomes a slim top bar; "Matters ☰" opens the full list */
  .rail { position: sticky; top: 0; z-index: 40; padding: 0; border-bottom: 1px solid var(--line); }
  .rail-brand { padding: 12px 16px; margin: 0; }
  .rail-menu { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 7px 12px; border: 1px solid var(--ui-border); color: var(--chalk); font: 600 11px var(--sans); letter-spacing: .14em; text-transform: uppercase; }
  .rail-menu i { font-style: normal; font-size: 14px; letter-spacing: 0; }
  .rail > :not(.rail-brand) { display: none; }
  .rail.open > :not(.rail-brand):not(.hidden) { display: block; }
  .rail.open { max-height: 100vh; overflow-y: auto; box-shadow: 0 20px 40px -10px rgba(0,0,0,.6); }
  .rail.open .matters { display: grid; overflow: visible; }
  .rail.open .matter { max-width: none; border-bottom: 1px solid var(--line); }
  .rail.open > .rail-foot { display: flex; align-items: center; justify-content: space-between; }
  body.role-client .rail.open .team-only { display: none; }

  /* matter header */
  .workspace { padding: 16px 14px 0; }
  .caption { gap: 10px; padding-bottom: 14px; }
  .title { font-size: 26px; line-height: 1.15; }
  .caption-right { flex-direction: row; align-items: center; width: 100%; }
  .caption-right .who { width: 100%; display: flex; align-items: center; gap: 10px; }
  .share-btn { padding: 8px 12px; }

  /* the three sheets side by side, smaller */
  .desk { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card { min-height: 150px; padding: 14px 6px; }
  .card-num { font-size: 46px; }
  .card-name { margin-top: 8px; font-size: 14px; line-height: 1.2; }
  .card-sub, .card-go, .card-drop { display: none; }
  .card-badge { top: 6px; right: 6px; left: 6px; justify-content: center; padding: 3px 4px; font-size: 8.5px; letter-spacing: .06em; }

  /* documents explorer */
  .ex-head { gap: 8px; }
  .ex-actions { width: 100%; }
  .ex-act { flex: 1; justify-content: center; }
  .ex-tile { width: 84px; }

  /* an open sheet: tidy top bar, tabs on their own row, tools scroll sideways */
  .doc-bar { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; padding: 10px 12px; height: auto; }
  .doc-id { min-width: 0; }
  .doc-id b { font-size: 17px; }
  .doc-id small { max-width: 100%; }
  .doc-right { grid-column: 1 / -1; display: flex; gap: 8px; overflow-x: auto; margin: 0; padding-bottom: 2px; }
  .doc-right .state, #tbZoom { display: none; }
  .doc-right .word { padding: 8px 10px; font-size: 9.5px; letter-spacing: .08em; }
  .doc-tabs { grid-column: 1 / -1; order: 0; width: auto; margin: 0; padding: 4px 0 2px; gap: 22px; }
  .doc-actions { padding: 8px 12px; gap: 8px; justify-content: flex-start; }
  .doc-actions .hold { width: 100%; }
  .toolbar { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 6px 10px; -webkit-overflow-scrolling: touch; }
  .toolbar > * { flex: none; }
  .doc-scroll, #sheetScroll { padding: 10px 8px 0; }
  .sheets { display: none; }
  #editor { background: var(--paper); color: var(--ink); box-shadow: 0 18px 40px -18px rgba(0,0,0,.85); border-radius: 2px; }
  .paper-col { width: 100% !important; }
  .editor { font-size: 16px; }
  .pg-num { display: none; }

  /* panels fill the screen */
  .team-panel, .plan-panel { left: 0; width: 100%; }
  .profile-menu { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
  .tour-card { width: calc(100vw - 24px); }
}
/* the Documents bar opens and closes the box, with a short slide */
.ex-head { cursor: pointer; user-select: none; }
.ex-head button, .ex-head a { cursor: pointer; }
.ex-body.dropping { animation: exDrop .24s var(--ease) both; transform-origin: top; }
.ex-body.lifting { animation: exLift .2s ease-in both; transform-origin: top; }
@keyframes exDrop { from { opacity: 0; transform: translateY(-8px) scaleY(.92); } }
@keyframes exLift { to { opacity: 0; transform: translateY(-8px) scaleY(.92); } }
@media (prefers-reduced-motion: reduce) { .ex-body.dropping, .ex-body.lifting { animation: none; } }
