/* ==========================================================================
   Leigh HQ — screen UI
   Brand: Milc Design. Monochrome, Montserrat, no accent colour, status by
   weight/fill. Derived from brands/milc/design-system/milc-doc.css but
   built for a screen app rather than an A4 document. Light only.
   ========================================================================== */

:root{
  --ink:      #231f20;
  --ink-80:   #3a3735;
  --mid:      #6f6c69;
  --soft:     #9b9895;
  --rule:     #d9d7d2;
  --wash:     #f4f3ef;
  --wash-2:   #e9e7e1;
  --paper:    #ffffff;

  --f-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --nav-w: 236px;
  --radius: 3px;
  --shell-max: 920px;
}

*, *::before, *::after{ box-sizing:border-box; }

html, body{
  margin:0; padding:0; height:100%;
  background:var(--wash-2);
  color-scheme: light;
}

body{
  font-family:var(--f-sans);
  color:var(--ink);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}

#app{ min-height:100vh; }

button, input, textarea, select{ font-family:inherit; font-size:inherit; color:inherit; }
button{ cursor:pointer; }
a{ color:var(--ink); }

h1,h2,h3,h4{ margin:0; letter-spacing:-.01em; font-weight:800; }

.hidden{ display:none !important; }
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ---------- sample-data badge --------------------------------------------- */

.sample-badge{
  display:inline-flex; align-items:center; gap:1px;
  font-size:9px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--mid); border:1px solid var(--rule); border-radius:var(--radius);
  padding:3px 7px; background:var(--paper);
}

/* ---------- sign-in --------------------------------------------------------- */

.signin{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding:24px;
}
.signin-card{
  width:100%; max-width:340px;
  background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius);
  padding:32px 28px;
}
.signin-mark{ display:flex; align-items:center; gap:10px; margin-bottom:22px; }
.signin-mark .sq{ width:30px; height:30px; background:var(--ink); flex:0 0 auto; display:flex; align-items:center; justify-content:center; }
.signin-mark .sq span{ color:var(--paper); font-weight:800; font-size:15px; }
.signin-mark strong{ font-size:16px; font-weight:800; }
.signin h1{ font-size:19px; margin-bottom:4px; }
.signin p.lead{ color:var(--mid); font-size:13px; margin:0 0 20px; }

.field{ margin-bottom:14px; }
.field label{
  display:block; font-size:10.5px; font-weight:700; letter-spacing:.08em;
  text-transform:uppercase; color:var(--soft); margin-bottom:5px;
}
.field input, .field textarea, .field select{
  width:100%; border:1px solid var(--rule); border-radius:var(--radius);
  background:var(--paper); padding:9px 10px; line-height:1.3;
}
.field input:focus, .field textarea:focus, .field select:focus{
  outline:2px solid var(--ink); outline-offset:0;
}
.field textarea{ resize:vertical; min-height:64px; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border:1px solid var(--ink); border-radius:var(--radius);
  background:var(--ink); color:var(--paper);
  font-weight:700; font-size:12.5px; letter-spacing:.02em;
  padding:9px 16px; line-height:1.2;
}
.btn:hover{ background:var(--ink-80); border-color:var(--ink-80); }
.btn:disabled{ opacity:.45; cursor:default; }
.btn--ghost{
  background:transparent; color:var(--ink); border-color:var(--rule);
}
.btn--ghost:hover{ border-color:var(--ink); background:var(--wash); }
.btn--sm{ padding:5px 10px; font-size:11px; }
.btn--full{ width:100%; }
.btn--danger{ border-color:var(--ink); background:var(--paper); color:var(--ink-80); }
.btn--danger:hover{ background:var(--wash); }
.btn--icon{
  background:transparent; border:1px solid transparent; color:var(--mid);
  padding:6px; border-radius:var(--radius); line-height:1;
}
.btn--icon:hover{ background:var(--wash); color:var(--ink); }

.err-text{
  color:var(--ink); background:var(--wash); border-left:3px solid var(--ink);
  padding:8px 10px; font-size:12.5px; margin:0 0 14px; border-radius:0 var(--radius) var(--radius) 0;
}

/* ---------- shell ----------------------------------------------------------- */

.shell{ display:flex; min-height:100vh; }

.nav{
  width:var(--nav-w); flex:0 0 auto;
  background:var(--paper); border-right:1px solid var(--rule);
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
}
.nav-brand{
  display:flex; align-items:center; gap:10px;
  padding:20px 18px 16px;
  min-width:0;
}
.nav-brand .sq{ width:26px; height:26px; background:var(--ink); flex:0 0 auto; display:flex; align-items:center; justify-content:center; }
.nav-brand .sq span{ color:var(--paper); font-weight:800; font-size:13px; }
.nav-brand .text-block{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.nav-brand strong{
  font-size:14.5px; font-weight:800; letter-spacing:-.01em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.nav-list{
  list-style:none; margin:0; padding:6px 10px; flex:1 1 auto; overflow-y:auto;
}
.nav-list li + li{ margin-top:2px; }
.nav-btn{
  display:block; width:100%; text-align:left; background:none; border:none;
  border-radius:var(--radius);
  padding:9px 10px; font-size:13px; font-weight:600; color:var(--mid);
}
.nav-btn:hover{ background:var(--wash); color:var(--ink); }
.nav-btn[aria-current="page"]{
  background:var(--ink); color:var(--paper); font-weight:700;
}

.nav-foot{
  border-top:1px solid var(--rule); padding:10px; display:flex; gap:6px;
}
.nav-foot .btn--icon{ flex:1 1 auto; display:flex; justify-content:center; }

/* persistent Talk control — reachable from every section, never interrupted
   by switching sections. Sidebar footer on desktop, top-strip end on phone. */
.talk-pill{
  display:flex; align-items:center; justify-content:center; gap:6px;
  border:1px solid var(--rule); border-radius:var(--radius);
  background:var(--paper); color:var(--ink); padding:6px 10px;
  font-size:11px; font-weight:700; flex:1 1 auto;
}
.talk-pill:hover{ border-color:var(--ink); background:var(--wash); }
.talk-pill svg{ width:13px; height:13px; flex:0 0 auto; }
.talk-pill svg path{ stroke:currentColor; }
.talk-pill .dot{ width:6px; height:6px; border-radius:50%; background:var(--rule); flex:0 0 auto; }
.talk-pill.is-live .dot{ background:var(--ink); }
.talk-pill.is-connecting .dot{ background:var(--mid); }
.talk-pill .tp-label{ white-space:nowrap; }

/* mobile: nav becomes a top strip */
@media (max-width: 860px){
  .shell{ flex-direction:column; }
  .nav{
    width:100%; height:auto; position:sticky; top:0; z-index:20;
    border-right:none; border-bottom:1px solid var(--rule);
    flex-direction:row; align-items:center;
  }
  .nav-brand{ padding:10px 8px 10px 14px; flex:0 0 auto; }
  .nav-brand strong{ display:none; }
  .nav-list{
    display:flex; flex-direction:row; gap:2px; padding:8px 6px;
    overflow-x:auto; overflow-y:hidden; flex:1 1 auto; min-width:0;
  }
  .nav-list li{ flex:0 0 auto; }
  .nav-list li + li{ margin-top:0; }
  .nav-btn{ white-space:nowrap; }
  .nav-foot{ border-top:none; border-left:1px solid var(--rule); flex:0 0 auto; }
  .talk-pill .tp-label{ display:none; }
  .talk-pill{ padding:6px; }
}

.main{ flex:1 1 auto; min-width:0; }
.view{
  max-width:var(--shell-max); margin:0 auto; padding:26px 24px 60px;
}
@media (max-width:520px){
  .view{ padding:18px 14px 48px; }
}

.view-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  padding-bottom:12px; margin-bottom:20px; border-bottom:2px solid var(--ink);
}
.view-head h1{ font-size:19px; }
.view-head .meta{ font-size:11.5px; color:var(--soft); font-weight:600; letter-spacing:.03em; }

.empty{
  color:var(--soft); font-size:13px; padding:18px 0; font-style:normal;
}

/* ---------- shared list / row patterns -------------------------------------- */

.rows{ list-style:none; margin:0 0 18px; padding:0; }
.row{
  display:flex; align-items:flex-start; gap:12px;
  padding:11px 0; border-bottom:1px solid var(--rule);
}
.row:first-child{ border-top:1px solid var(--rule); }
.row-main{ flex:1 1 auto; min-width:0; }
.row-title{ font-weight:700; font-size:13.5px; line-height:1.35; }
.row-sub{ font-size:11.5px; color:var(--mid); margin-top:2px; }
.row-actions{ flex:0 0 auto; display:flex; gap:4px; align-items:center; }

.check{
  width:18px; height:18px; flex:0 0 auto; margin-top:1px;
  border:1.5px solid var(--ink); border-radius:2px; background:var(--paper);
  display:flex; align-items:center; justify-content:center;
}
.check svg{ width:11px; height:11px; display:none; }
.check[aria-pressed="true"]{ background:var(--ink); }
.check[aria-pressed="true"] svg{ display:block; }
.check[aria-pressed="true"] svg path{ stroke:var(--paper); }
.row.is-done .row-title{ color:var(--mid); text-decoration:line-through; text-decoration-color:var(--rule); }

.chip{
  display:inline-block; font-size:9.5px; font-weight:800; letter-spacing:.09em;
  text-transform:uppercase; padding:2px 6px; border:1px solid var(--ink);
  border-radius:var(--radius); white-space:nowrap;
}
.chip--fill{ background:var(--ink); color:var(--paper); }
.chip--dashed{ border-style:dashed; color:var(--mid); border-color:var(--soft); }
.chip--due{ border-color:var(--rule); color:var(--mid); font-weight:700; }
.chip--overdue{ border-color:var(--ink); color:var(--ink); background:var(--wash); }

/* inline add-forms */
.addbar{
  display:flex; gap:8px; margin:0 0 16px; flex-wrap:wrap;
}
.addbar input, .addbar select{
  border:1px solid var(--rule); border-radius:var(--radius); padding:8px 10px;
  background:var(--paper);
}
.addbar .grow{ flex:1 1 200px; min-width:140px; }
.addbar input:focus, .addbar select:focus{ outline:2px solid var(--ink); }

/* panel (matches doc system: wash fill, ink rule left) */
.panel{
  background:var(--wash); padding:14px 16px; margin:0 0 16px;
  border-left:3px solid var(--ink); border-radius:0 var(--radius) var(--radius) 0;
}

/* ---------- today ------------------------------------------------------------ */

.today-grid{ display:grid; gap:20px; grid-template-columns:1fr; }
@media (min-width:680px){ .today-grid{ grid-template-columns:1fr 1fr; } }
.today-block h2{
  font-size:11px; letter-spacing:.11em; text-transform:uppercase; color:var(--soft);
  margin-bottom:8px; font-weight:800;
}
.topic-pill{
  display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:700;
  border:1px solid var(--rule); border-radius:var(--radius); padding:5px 9px; margin:0 6px 6px 0;
  background:var(--paper);
}
.topic-pill b{ color:var(--soft); font-weight:800; font-size:10px; }

/* ---------- memories ---------------------------------------------------------- */

.search-row{ display:flex; gap:8px; margin-bottom:16px; }
.search-row input{
  flex:1 1 auto; border:1px solid var(--rule); border-radius:var(--radius); padding:9px 11px;
}
.search-row input:focus{ outline:2px solid var(--ink); }
.memory-body{ font-size:13px; line-height:1.5; color:var(--ink-80); margin-top:3px; }
.memory-tags{ margin-top:5px; display:flex; gap:4px; flex-wrap:wrap; }
.memory-tags span{
  font-size:9.5px; color:var(--mid); border:1px solid var(--rule); border-radius:var(--radius);
  padding:1px 5px;
}
.kind-tag{
  font-size:9px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--soft);
}
.new-memory{
  border-top:2px solid var(--ink); padding-top:14px; margin-top:6px;
}
.new-memory h2{ font-size:11px; letter-spacing:.11em; text-transform:uppercase; color:var(--soft); font-weight:800; margin-bottom:10px; }
.new-memory .grid{ display:grid; gap:8px; grid-template-columns:1fr 1fr; margin-bottom:8px; }
@media (max-width:520px){ .new-memory .grid{ grid-template-columns:1fr; } }

/* ---------- note kind ---------------------------------------------------------- */

.note-text{ white-space:pre-wrap; font-size:13.5px; line-height:1.6; color:var(--ink-80); max-width:64ch; }

/* ---------- embed ---------------------------------------------------------------- */

.embed-open{
  display:inline-flex; align-items:center; gap:5px;
  font-size:12.5px; font-weight:700; color:var(--ink);
  margin-bottom:10px;
}
.embed-open:hover{ color:var(--ink-80); }
.embed-frame{
  display:block; width:100%; border:1px solid var(--rule); border-radius:var(--radius);
  background:var(--paper);
}
.embed-hint{ margin-top:8px; font-size:11.5px; color:var(--mid); }

/* ---------- links --------------------------------------------------------------- */

.link-url{ font-size:11px; color:var(--mid); word-break:break-all; }

/* ---------- brain map ------------------------------------------------------------ */

.map-wrap{
  border:1px solid var(--rule); background:var(--paper); height:min(62vh, 560px);
  position:relative; overflow:hidden; border-radius:var(--radius);
}
.map-legend{
  display:flex; gap:14px; flex-wrap:wrap; margin:12px 0 0; font-size:10.5px; color:var(--mid);
}
.map-legend span{ display:inline-flex; align-items:center; gap:5px; }
.map-legend i{ width:9px; height:9px; border-radius:50%; display:block; background:var(--ink); }
.map-note{
  position:absolute; left:14px; right:14px; bottom:14px; max-width:320px;
  background:var(--paper); border:1px solid var(--ink); padding:10px 12px;
  font-size:12px; box-shadow:0 4px 16px rgba(35,31,32,.14); border-radius:var(--radius);
}
.map-note .mn-kind{ font-size:9px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:var(--soft); margin-bottom:3px; }
.map-loading{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--soft); font-size:12.5px; }

/* ---------- voice / call --------------------------------------------------------- */

.call-wrap{ display:flex; flex-direction:column; align-items:center; padding:20px 0 8px; min-width:0; }
.orb{
  width:132px; height:132px; border-radius:50%;
  background:var(--ink); border:none; padding:0; font:inherit; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  position:relative; margin-bottom:16px; flex:0 0 auto;
  transition: box-shadow .12s ease-out;
}
.orb:hover{ background:var(--ink-80); }
.orb:disabled{ cursor:default; opacity:.6; }
.orb::before{
  content:''; position:absolute; inset:-10px; border-radius:50%;
  border:1px solid var(--rule);
  transform:scale(var(--orb-scale, 1));
  transition:transform .08s linear;
}
.orb-icon{ width:34px; height:34px; }
.orb-icon path, .orb-icon circle{ stroke:var(--paper); }
.call-status{ font-size:12.5px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--soft); margin-bottom:18px; }
.call-status.is-live{ color:var(--ink); }
.call-actions{ display:flex; gap:10px; margin-bottom:22px; }

.transcript{
  width:100%; max-width:480px; border:1px solid var(--rule); border-radius:var(--radius);
  background:var(--paper); padding:12px 14px; min-height:120px; max-height:280px; overflow-y:auto;
}
.transcript .line{ font-size:13px; line-height:1.5; margin-bottom:8px; }
.transcript .line b{ font-weight:800; font-size:10px; letter-spacing:.08em; text-transform:uppercase; color:var(--soft); display:block; margin-bottom:2px; }
.transcript .line.you b{ color:var(--mid); }
.transcript .empty-hint{ color:var(--soft); font-size:12.5px; }

/* ---------- settings panel -------------------------------------------------------- */

.overlay{
  position:fixed; inset:0; background:rgba(35,31,32,.4);
  display:flex; align-items:flex-start; justify-content:center;
  padding:6vh 16px; z-index:100; overflow-y:auto;
}
.dialog{
  width:100%; max-width:560px; background:var(--paper); border-radius:var(--radius);
  border:1px solid var(--rule);
}
.dialog-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px; border-bottom:1px solid var(--rule);
}
.dialog-head h2{ font-size:15px; }
.dialog-body{ padding:16px 18px 20px; }

.sec-row{
  display:flex; align-items:center; gap:8px; padding:9px 0; border-bottom:1px solid var(--rule);
}
.sec-row input[type="text"]{
  flex:1 1 auto; border:1px solid var(--rule); border-radius:var(--radius); padding:6px 8px;
}
.sec-row .kind-label{
  font-size:9.5px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--soft);
  width:72px; flex:0 0 auto;
}
.sec-row .ord{ display:flex; flex-direction:column; gap:1px; }
.sec-row .ord button{ padding:2px 5px; font-size:9px; line-height:1; }
.sec-row label.hide{ display:flex; align-items:center; gap:5px; font-size:10.5px; color:var(--mid); flex:0 0 auto; }

.add-note-section{ margin-top:16px; padding-top:14px; border-top:2px solid var(--ink); }
.add-note-section h3{ font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--soft); margin-bottom:10px; }

.loading-line{ color:var(--soft); font-size:12.5px; padding:10px 0; }

/* ---------- overflow containment --------------------------------------------
   Only .nav-list is meant to scroll sideways. Everything else must fit the
   viewport: these stop a flex/grid child's automatic minimum size (or a long
   unbroken string — a URL, a title) from pushing the whole page wider than
   the screen. Belt-and-suspenders: html/body overflow-x:hidden is the hard
   backstop in case anything downstream still tries. */
html, body{ overflow-x:hidden; }
body{ overflow-wrap:break-word; }
.shell, .main, .view, .view-head, .today-grid, .today-block,
.addbar, .search-row, .row, .row-main, .sec-row, .new-memory .grid{
  min-width:0;
}
.transcript, .addbar input, .search-row input, .note-text{ max-width:100%; }
