/* proto.css — turns the fixed 1440px design canvas into a responsive, clickable prototype.
   Loaded after caseos.html styles and m1.css. */

/* ---------- Fluid canvas ---------- */
html, body { overflow-x: hidden; }
body { width: auto; min-height: 100vh; }
.app { min-height: 100vh; }
.auth { min-height: 100vh; padding: 40px 20px; }
.main, .page, .page > *, .card, .col, .stack, .grid-12 > * { min-width: 0; }
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; }

/* ---------- Clickable affordances ---------- */
[data-to] { cursor: pointer; }
.nav a[data-to]:not(.active):hover { background: var(--sunken); }
tr[data-to]:hover td { background: #F7FAFF; }
.row[data-to]:hover, .kcard[data-to]:hover { background: #F7FAFF; }
.btn[data-to]:hover, .chip[data-to]:hover, .icon-btn[data-to]:hover { filter: brightness(0.96); }
.btn.cta[data-to]:hover { background: var(--cta-hover); border-color: var(--cta-hover); filter: none; }
.tabs span[data-to]:not(.on):hover, .seg span[data-to]:not(.on):hover { color: var(--ink); }
.card[data-to]:hover, .card-h[data-to]:hover { box-shadow: 0 0 0 2px var(--accent-tonal), 0 1px 2px rgba(16,24,40,.04); }

/* Figma-style hint: clicking a dead area flashes every hotspot */
body.hs-flash [data-to] { outline: 2px solid rgba(25,148,255,.55); outline-offset: 1px; background-color: rgba(25,148,255,.08); transition: outline-color .2s; }

/* ---------- Mobile menu button + scrim (injected by router) ---------- */
.menu-btn { display: none; }
.scrim { display: none; }

/* ---------- Tables and wide content scroll inside their card ---------- */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Prototype chrome: screen jumper ---------- */
.proto-fab { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--cta-2); color: #fff; font: 600 13px/1 var(--font-ui); box-shadow: 0 8px 24px rgba(21,56,96,.28); cursor: pointer; }
.proto-fab svg { width: 16px; height: 16px; }
.proto-fab b { font-weight: 700; opacity: .7; }
.proto-menu { position: fixed; right: 16px; bottom: 64px; z-index: 91; width: 340px; max-height: min(640px, calc(100vh - 96px)); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 64px rgba(16,24,40,.18); padding: 8px; display: none; }
body.menu-open .proto-menu { display: block; }
.proto-menu .pm-h { padding: 10px 12px 6px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.proto-menu .pm-h b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 2px; }
.proto-menu .pm-g { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 4px; }
.proto-menu a { display: flex; gap: 10px; align-items: baseline; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--body); text-decoration: none; }
.proto-menu a span { font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 700; color: var(--muted); min-width: 34px; }
.proto-menu a:hover { background: var(--sunken); }
.proto-menu a.on { background: var(--accent-tonal); color: var(--accent-deep); font-weight: 600; }
.proto-menu a.on span { color: var(--accent-deep); }

/* ---------- ≤1280: tighten wide grids ---------- */
@media (max-width: 1280px) {
  .kpis, .kpis[style] { grid-template-columns: repeat(3, 1fr) !important; }
  .board { grid-template-columns: repeat(6, minmax(200px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
  .case-grid { grid-template-columns: 1fr 320px; }
  .hbar { grid-template-columns: 150px 1fr 72px; }
}

/* ---------- ≤1100: single-column content, sidebar becomes a drawer ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; height: auto; z-index: 70; transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; }
  body.nav-open .nav { transform: none; box-shadow: 0 24px 64px rgba(16,24,40,.22); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.24); }
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); flex: none; cursor: pointer; }
  .menu-btn svg { width: 18px; height: 18px; }
  .top { position: sticky; top: 0; z-index: 40; }
  .grid-2, .grid-2[style], .grid-3, .case-grid { grid-template-columns: 1fr !important; }
  .grid-12 > .c3, .grid-12 > .c4 { grid-column: span 6; }
  .grid-12 > .c5, .grid-12 > .c6, .grid-12 > .c7, .grid-12 > .c8, .grid-12 > .c9 { grid-column: span 12; }
  .pill-status { display: none; }
  .tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs span { white-space: nowrap; flex: none; }
}

/* ---------- ≤760: phone ---------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .top { height: 60px; padding: 0 12px; gap: 8px; }
  .search { min-width: 0; height: 40px; }
  .search kbd { display: none; }
  .search > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top .spacer { display: none; }
  .top .btn.cta { font-size: 0; gap: 0; padding: 0 11px; }
  .top .btn.cta svg { width: 18px; height: 18px; }
  .page { padding: 16px; gap: 16px; }
  .page-head { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .page-head .t { flex-basis: 100%; }
  h1 { font-size: 26px; }
  .case-head h1, .case-head h1[style] { font-size: 22px !important; }
  .card-h { flex-wrap: wrap; padding: 16px 16px 0; }
  .card-b { padding: 12px 16px 16px; }
  .kpis, .kpis[style] { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 24px; }
  .kpi .l { white-space: normal; }
  .grid-12 > [class*="c"] { grid-column: span 12; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  [style*="grid-template-columns:200px 140px"] { grid-template-columns: 1fr 1fr 36px !important; }
  [style*="grid-template-columns:200px 140px"] > :nth-child(3) { grid-column: 1 / 3; }
  .hstack, .toolbar, .meta, .stepper { flex-wrap: wrap; }
  .hbar { grid-template-columns: 1fr 64px; }
  .hbar > span:first-child { grid-column: 1 / -1; }
  .stage { grid-template-columns: 110px 1fr 32px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg span { white-space: nowrap; }
  .case-head, .case-head[style] { flex-wrap: wrap; padding: 16px !important; gap: 12px; }
  .case-av { display: none !important; }
  .case-head .who { flex-basis: 100%; }
  .progress { overflow-x: auto; grid-template-columns: repeat(7, minmax(92px, 1fr)); padding: 0 16px 16px; }
  .matter-desc { margin: 0 16px 12px; }
  .matter-desc .md-h { flex-wrap: wrap; gap: 4px; }
  .matter-desc .md-e { margin-left: 0; }
  [data-hs="case-tabs"] { margin: 0 -8px; }
  .entry { grid-template-columns: 64px 1fr; gap: 12px; }
  .entry.pin { margin: 0 -16px; padding: 14px 16px; }
  .row.sel { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .kv { grid-template-columns: 120px 1fr; }
  .banner { flex-wrap: wrap; }
  .banner .b-actions { margin-left: 0; }
  .cal-grid { min-width: 720px; }
  .pdf { width: 100%; padding: 24px; min-height: 0; }
  .doc-preview { padding: 20px; }
  .panel { left: 8px; right: 8px; top: 8px; bottom: 8px; width: auto; }
  .auth > div[style] { flex-direction: column; width: 100%; max-width: 440px; }
  .auth-card, .auth-card[style] { width: 100% !important; padding: 28px 22px; }
  .code span { width: 40px; height: 48px; }
  .auth .wave { bottom: -20px; }
  .proto-fab { right: 12px; bottom: 12px; height: 36px; padding: 0 12px; }
  .proto-fab .lbl { display: none; }
  .proto-menu { left: 12px; right: 12px; width: auto; bottom: 56px; }
}

/* ======================================================================
   Coded controls (interact.js)
   ====================================================================== */
#root [hidden] { display: none !important; }
.input input.in, .search input.in, .compose input.in { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); padding: 0; height: 38px; }
.search input.in { height: 100%; font-size: 14px; }
.compose input.in { height: 32px; font-size: 14px; }
input.in::placeholder { color: var(--muted); opacity: 1; }
.input:focus-within, .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tonal); }
.compose:focus-within { border-color: var(--accent); background: var(--surface); }
.input.is-select { cursor: pointer; }
.input.is-select:hover, .chip:hover { border-color: #C9C9C9; }
.editable { outline: none; cursor: text; min-height: 1.5em; }
.editable:empty::before { content: attr(data-ph); color: var(--muted); }
.md-b[contenteditable="true"] { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 4px; background: var(--surface); }
.toggle, .chk, .radio, .chip, .seg span, .tabs span, .tree a, .q-nav a, .rail a, .thumb, .cal-cell, .btn, .icon-btn, .link, .call, .masked { cursor: pointer; }
.btn, .icon-btn, .chip, .seg span, .tabs span { user-select: none; }
.toggle { transition: background .15s; }
.toggle::after { transition: left .15s; }
.seg span:not(.on):hover, .tabs span:not(.on):hover { color: var(--ink); }
.tree a:not(.on):hover, .q-nav a:not(.on):hover { background: var(--sunken); }
.btn:active, .chip:active, .icon-btn:active { transform: translateY(1px); }
tr.sel td { background: var(--accent-tonal); }
.row.sel { background: var(--accent-tonal); }
.c5 .row:not([data-to]) { cursor: pointer; }
.masked { cursor: help; transition: color .15s; }
.masked.revealed { letter-spacing: 0; color: var(--cta); }
.empty-note { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.code { position: relative; }
.code .code-in { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; cursor: text; }
.cite[data-to] { cursor: pointer; }
.cite[data-to]:hover { filter: brightness(.95); text-decoration: underline; }
.drawer > div { cursor: pointer; }
.drawer > div:hover { background: var(--sunken); }
.cal-cell:hover { background: #FAFCFF; }
.ev { cursor: default; }
.ev[data-to] { cursor: pointer; }

/* Kanban drag */
.kcard { user-select: none; cursor: grab; }
.kcard.kplace { opacity: .35; border-style: dashed; box-shadow: none; }
.kghost { position: fixed; z-index: 120; margin: 0; pointer-events: none; transform: rotate(-1.5deg); box-shadow: 0 14px 32px rgba(16,24,40,.18); border-color: var(--accent); }
.colm { transition: background .12s; }
.colm.over { background: var(--accent-tonal); outline: 1.5px dashed var(--accent); outline-offset: -1.5px; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

/* Research typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 130; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px; background: #111; color: #fff; font: 500 13px/1.4 var(--font-ui); box-shadow: 0 12px 32px rgba(0,0,0,.22); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast svg { width: 16px; height: 16px; flex: none; color: #7CC0FF; }

/* Dropdown menu */
.pop { position: absolute; z-index: 110; max-width: calc(100vw - 16px); max-height: 320px; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,24,40,.14); }
.pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--body); font: 500 13px/1.3 var(--font-ui); text-align: left; cursor: pointer; white-space: nowrap; }
.pop button span { flex: 1; }
.pop button svg { width: 14px; height: 14px; color: var(--accent-deep); }
.pop button:hover { background: var(--sunken); }
.pop button.on { color: var(--accent-deep); font-weight: 600; }

/* Global search palette */
.palette { position: absolute; z-index: 110; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 48px rgba(16,24,40,.16); font-family: var(--font-ui); }
.pal-h { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pal-i, .pal-all { display: flex; width: 100%; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font: inherit; cursor: pointer; }
.pal-i .ico-sq { width: 32px; height: 32px; }
.pal-i .grow, .pal-all .grow { flex: 1; min-width: 0; }
.pal-i b { display: block; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.pal-i small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.pal-i.on, .pal-i:hover, .pal-all:hover { background: var(--accent-tonal); }
.pal-all { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; color: var(--accent-deep); font-size: 13px; font-weight: 600; }
.pal-all svg { width: 16px; height: 16px; }
.pal-all kbd { font-family: var(--font-ui); font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.pal-empty, .pal-foot { padding: 10px; font-size: 12px; color: var(--muted); }

/* Modal */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.24); }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 18px; box-shadow: 0 24px 64px rgba(16,24,40,.22); }
.modal .card-h { padding: 22px 24px 0; }
.modal .card-h h2 { flex: 1; }
.modal .card-b { padding: 16px 24px 20px; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 22px; }

/* Dialpad call bar */
.callbar { position: fixed; top: 12px; left: 50%; z-index: 125; display: flex; align-items: center; gap: 12px; min-width: 340px; padding: 10px 10px 10px 16px; border-radius: 14px; background: #0F1B2D; color: #fff; font-family: var(--font-ui); box-shadow: 0 16px 40px rgba(0,0,0,.28); transform: translateX(-50%); }
.callbar .grow { flex: 1; min-width: 0; }
.callbar b { display: block; font-size: 14px; }
.callbar small { color: rgba(255,255,255,.72); font-size: 12px; }
.callbar .cb-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: #FFB000; animation: blink 1.2s infinite; }
.callbar.live .cb-dot { background: #1FA971; animation: none; }
.callbar .icon-btn { width: 36px; height: 36px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; }
.callbar .icon-btn.on { background: #fff; color: #0F1B2D; }
.callbar .cb-end { background: #B42318; border-color: #B42318; color: #fff; }

@media (max-width: 760px) {
  .callbar { left: 8px; right: 8px; min-width: 0; transform: none; }
  .toast { bottom: 64px; }
  .modal-wrap { align-items: end; padding: 8px; }
}

/* Reset link in the screens menu */
.proto-menu .pm-reset { display: block; width: calc(100% - 8px); margin: 10px 4px 4px; padding: 9px 12px; border: 1px dashed var(--line); border-radius: 8px; background: none; color: var(--muted); font: 600 12px/1 var(--font-ui); cursor: pointer; }
.proto-menu .pm-reset:hover { color: var(--cta); border-color: var(--cta); }
