/* ==========================================================================
   ZMG HomeSync — application shell + module styles
   ========================================================================== */

/* ------------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(30, 144, 255, 0.07), transparent 30%), var(--surface);
  padding: 20px 16px 16px;
  overflow-y: auto;
  z-index: 20;
}
.brandlock { display: flex; align-items: center; gap: 11px; padding: 0 6px 18px; }
.logomark { color: var(--blue); filter: drop-shadow(0 0 10px rgba(30, 144, 255, 0.85)); flex: none; }
.wordmark { font-family: var(--head); text-transform: uppercase; line-height: 1; }
.wordmark .z { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; display: block; }
.wordmark .h { font-size: 12.5px; font-weight: 300; letter-spacing: 0.3em; display: block; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-sect { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 7px; font-family: var(--head); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 11px;
  color: var(--muted); font-size: 13.5px; font-weight: 450;
  border: 1px solid transparent;
  transition: 0.18s var(--ease);
  position: relative;
}
.nav a svg { flex: none; opacity: 0.8; }
.nav a:hover { color: var(--text); background: var(--tint-2); }
.nav a.on {
  color: var(--text); background: var(--tint);
  border-color: rgba(30, 144, 255, 0.4);
  box-shadow: var(--glow-sm), inset 0 0 20px rgba(30, 144, 255, 0.08);
}
.nav a.on svg { opacity: 1; color: var(--blue); }
.nav a .badge {
  margin-left: auto; min-width: 20px; text-align: center;
  font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  background: var(--blue); color: var(--text-on-blue); box-shadow: var(--glow-sm);
}
.nav a .badge.risk { background: var(--risk); color: #fff; box-shadow: none; }

/* loan officer card */
.lo-card {
  margin-top: auto; padding: 14px; border-radius: var(--r);
  border: 1px solid var(--hair); background: var(--card);
  text-align: left; width: 100%;
  transition: 0.2s var(--ease);
}
.lo-card:hover { border-color: rgba(30, 144, 255, 0.5); box-shadow: var(--glow-sm); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--head); font-size: 14px; font-weight: 600; letter-spacing: 0.06em;
  background: linear-gradient(150deg, #123a5e, #061420);
  color: var(--ice);
  border: 1.5px solid rgba(169, 220, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.16), var(--glow-sm);
}
[data-theme='light'] .avatar { background: linear-gradient(150deg, #dcecfb, #f4f9ff); color: #1a5f9e; }
.avatar.lg { width: 58px; height: 58px; font-size: 19px; }
.lo-name { font-family: var(--head); text-transform: uppercase; font-size: 14px; letter-spacing: 0.04em; }
.lo-meta { font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }

/* main column */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 18;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--hair);
}
.topbar-in { display: flex; align-items: center; gap: 14px; padding: 12px 28px; }
.topbar .hairline { position: absolute; left: 0; right: 0; bottom: -1px; }
.askbar {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid rgba(30, 144, 255, 0.35);
  background: var(--card); color: var(--muted);
  text-align: left; font-size: 13.5px;
  transition: 0.2s var(--ease);
  box-shadow: inset 0 0 22px rgba(30, 144, 255, 0.05);
}
.askbar:hover { border-color: var(--blue); box-shadow: var(--glow-sm); color: var(--text); }
.askbar kbd {
  margin-left: auto; font-family: var(--body); font-size: 10.5px; letter-spacing: 0.06em;
  border: 1px solid var(--hair); border-radius: 5px; padding: 1px 6px; color: var(--muted);
}
.iconbtn {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  border: 1px solid var(--hair); background: var(--card); color: var(--muted);
  transition: 0.18s var(--ease);
}
.iconbtn:hover { color: var(--text); border-color: var(--blue); box-shadow: var(--glow-sm); }
.phase-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  font-family: var(--head); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid rgba(30, 144, 255, 0.45); color: var(--ice); background: var(--tint);
  white-space: nowrap;
}
.phase-pill.own { border-color: rgba(240, 169, 59, 0.55); color: var(--amber); background: transparent; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); box-shadow: var(--glow-sm); }
.dot.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

.view { padding: 26px 28px 90px; max-width: 1180px; width: 100%; }
.view-head { margin-bottom: 22px; }
.view-head h1 { margin: 6px 0 8px; }
.view-head p.lede { color: var(--muted); max-width: 66ch; font-size: 14.5px; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 30px 0 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 20px; }

/* -------------------------------------------------------------- mobile nav */
.mobilebar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .view { padding: 18px 16px 108px; }
  .topbar-in { padding: 10px 16px; }
  .g4, .g3, .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobilebar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--hair);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  }
  .mobilebar a, .mobilebar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--muted); font-family: var(--head); padding: 4px 2px; border-radius: 10px;
  }
  .mobilebar a.on { color: var(--blue); }
  .mobilebar a.on svg { filter: drop-shadow(0 0 8px rgba(30, 144, 255, 0.8)); }
  .mobilebar .fab {
    background: linear-gradient(180deg, #4facff, var(--blue)); color: #00121f;
    box-shadow: var(--glow); border-radius: 14px;
  }
}
@media (max-width: 560px) {
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .g4.keep2, .g2.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* mobile "more" sheet */
.sheet-scrim { position: fixed; inset: 0; background: rgba(0, 2, 5, 0.72); z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.25s; backdrop-filter: blur(3px); }
.sheet-scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--surface); border-top: 1px solid rgba(30, 144, 255, 0.4);
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(101%); transition: transform 0.32s var(--ease);
  max-height: 84vh; overflow-y: auto;
  box-shadow: 0 -20px 60px rgba(0, 2, 5, 0.7);
}
.sheet.on { transform: translateY(0); }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-grid a {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 13px 12px; border-radius: 13px; border: 1px solid var(--hair);
  background: var(--card); color: var(--text); font-size: 12px; line-height: 1.25;
}
.sheet-grid a.on { border-color: var(--blue); box-shadow: var(--glow-sm); }
.sheet-grid a svg { color: var(--blue); }

/* ------------------------------------------------------------------- hero */
.hero { padding: 30px 32px 0; }
.hero-in { max-width: 760px; }
.hero h1 { margin: 12px 0 14px; }
.hero .lede { color: var(--muted); font-size: 15.5px; max-width: 60ch; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 26px 0 0; }
.hero-wave { margin: 8px -1px -1px; }
@media (max-width: 900px) { .hero { padding: 20px 18px 0; } .hero-stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------- loan timeline */
.spine { position: relative; margin: 8px 0 4px; }
.spine-rail { position: absolute; top: 21px; left: 0; right: 0; height: 2px; background: rgba(143, 166, 188, 0.24); }
.spine-fill { position: absolute; top: 21px; left: 0; height: 2px; width: var(--w, 0%); background: linear-gradient(90deg, var(--blue), var(--blue-mid)); box-shadow: var(--glow-sm); transition: width 0.9s var(--ease); }
.spine-nodes { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); position: relative; }
.node { background: none; border: 0; padding: 0 2px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.node .bubble {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--hair); background: var(--card);
  font-family: var(--head); font-size: 13px; font-weight: 600; color: var(--muted);
  transition: 0.24s var(--ease); position: relative; z-index: 2;
}
.node .lbl { font-size: 10.5px; line-height: 1.25; color: var(--muted); letter-spacing: 0.02em; max-width: 92px; }
.node .stg { font-family: var(--head); font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted); opacity: 0.7; }
.node.done .bubble { background: var(--blue); color: var(--text-on-blue); border-color: transparent; box-shadow: var(--glow); }
.node.done .lbl { color: var(--text); }
.node.now .bubble { border: 2px solid var(--blue); color: var(--text); background: var(--card); box-shadow: var(--glow-lg); animation: ring 2.4s ease-in-out infinite; }
.node.now .lbl { color: var(--text); font-weight: 600; }
.node.now .stg { color: var(--ice); opacity: 1; }
.node.future { opacity: 0.55; }
.node:hover .bubble { border-color: var(--blue); }
.node.sel .bubble { outline: 2px solid var(--ice); outline-offset: 3px; }
@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30, 144, 255, 0.5), var(--glow); }
  50% { box-shadow: 0 0 0 10px rgba(30, 144, 255, 0), var(--glow-lg); }
}

@media (max-width: 900px) {
  .spine-rail { top: 0; bottom: 0; left: 21px; right: auto; width: 2px; height: auto; }
  .spine-fill { top: 0; bottom: auto; left: 21px; right: auto; width: 2px; height: var(--h, 0%); background: linear-gradient(180deg, var(--blue), var(--blue-mid)); transition: height 0.9s var(--ease); }
  .spine-nodes { grid-template-columns: 1fr; gap: 4px; }
  .node { flex-direction: row; text-align: left; gap: 12px; padding: 5px 0; }
  .node .lbl { max-width: none; font-size: 13px; }
  .node .txt { display: flex; flex-direction: column; }
}

.stage-panel { margin-top: 18px; }
.stage-panel .card { border-color: rgba(30, 144, 255, 0.32); }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--hair); }
.task:last-child { border-bottom: 0; }
.task .box { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--hair-strong); flex: none; display: grid; place-items: center; margin-top: 1px; font-size: 10px; }
.task.done .box { background: var(--blue); border-color: transparent; color: var(--text-on-blue); box-shadow: var(--glow-sm); }
.task.done .t { color: var(--muted); }
.task .t { font-size: 13.5px; }
.owner { font-family: var(--head); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--hair); border-radius: 999px; padding: 2px 7px; margin-left: auto; flex: none; }

.progress-ring { display: grid; place-items: center; position: relative; flex: none; }
.progress-ring svg { transform: rotate(-90deg); filter: drop-shadow(0 0 10px rgba(30, 144, 255, 0.55)); }
.progress-ring .pr-val { position: absolute; font-family: var(--head); font-size: 19px; font-weight: 600; }

/* --------------------------------------------------------- doc ingestion */
.dropzone {
  border: 1.5px dashed rgba(30, 144, 255, 0.5);
  border-radius: var(--r-xl);
  padding: 40px 26px;
  text-align: center;
  background: radial-gradient(70% 90% at 50% 0%, rgba(30, 144, 255, 0.1), transparent 70%), var(--card);
  transition: 0.24s var(--ease);
  position: relative; overflow: hidden;
}
.dropzone.over { border-color: var(--blue); box-shadow: var(--glow-lg); transform: scale(1.005); }
.dz-icon { color: var(--blue); filter: drop-shadow(0 0 14px rgba(30, 144, 255, 0.8)); }

.pipe { display: grid; gap: 10px; }
.pipe-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 13px; align-items: center;
  padding: 13px 15px; border-radius: var(--r);
  border: 1px solid var(--hair); background: var(--card);
  transition: 0.3s var(--ease);
  animation: rise 0.42s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.pipe-row.active { border-color: rgba(30, 144, 255, 0.5); box-shadow: 0 0 24px -6px rgba(30, 144, 255, 0.45); }
.pipe-row.filed { border-color: rgba(30, 144, 255, 0.32); }
.pipe-row .fico { width: 34px; height: 40px; border-radius: 6px; border: 1px solid var(--hair); display: grid; place-items: center; color: var(--muted); background: var(--card-2); flex: none; }
.pipe-row.filed .fico { color: var(--blue); border-color: rgba(30, 144, 255, 0.45); box-shadow: var(--glow-sm); }
.pipe-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pipe-bar { margin-top: 7px; }
.pipe-phase { font-family: var(--head); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ice); min-width: 92px; text-align: right; }
.snap { animation: snap 0.42s var(--ease) both; }
@keyframes snap { 0% { opacity: 0; transform: scale(0.8) translateY(-4px); } 60% { transform: scale(1.06); } 100% { opacity: 1; transform: none; } }

.phasetrack { display: flex; gap: 5px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.phasetrack span { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); opacity: 0.5; font-family: var(--head); }
.phasetrack span.on { color: var(--ice); opacity: 1; }
.phasetrack span.past { color: var(--blue); opacity: 0.9; }
.phasetrack i { width: 10px; height: 1px; background: var(--hair-strong); }

.countup { font-family: var(--head); font-size: clamp(26px, 3vw, 34px); font-weight: 600; color: var(--text); display: block; }

/* ------------------------------------------------------------- doc vault */
.searchwrap { position: relative; }
.searchwrap input {
  width: 100%; padding: 12px 16px 12px 42px; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--card); color: var(--text);
  font-size: 14px;
}
.searchwrap input:focus { border-color: var(--blue); box-shadow: var(--glow-sm); outline: none; }
.searchwrap svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.filters { display: flex; gap: 7px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip-btn.on { background: var(--blue); color: var(--text-on-blue); border-color: transparent; box-shadow: var(--glow-sm); }
.filters .chip-btn.on strong { color: var(--text-on-blue); }

.doccard {
  border: 1px solid var(--hair); border-radius: var(--r); background: var(--card);
  padding: 15px; text-align: left; width: 100%; transition: 0.2s var(--ease);
  display: flex; flex-direction: column; gap: 9px;
}
.doccard:hover { border-color: rgba(30, 144, 255, 0.55); box-shadow: var(--glow-sm); transform: translateY(-2px); }
.doccard .dt { font-size: 13.5px; font-weight: 550; line-height: 1.3; }
mark { background: rgba(30, 144, 255, 0.28); color: var(--text); border-radius: 3px; padding: 0 2px; }
[data-theme='light'] mark { background: #cfe6ff; }
.snippet { font-size: 12px; color: var(--muted); line-height: 1.5; border-left: 2px solid var(--hair-strong); padding-left: 10px; }

.doclist-row { display: grid; grid-template-columns: 34px minmax(0,1fr) 130px 110px 90px; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--hair); border-radius: var(--r); background: var(--card); text-align: left; width: 100%; transition: 0.18s var(--ease); }
.doclist-row:hover { border-color: rgba(30,144,255,0.5); box-shadow: var(--glow-sm); }
@media (max-width: 760px) { .doclist-row { grid-template-columns: 34px minmax(0,1fr); } .doclist-row .hide-sm { display: none; } }

/* drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0, 2, 5, 0.74); z-index: 70; opacity: 0; pointer-events: none; transition: 0.26s; backdrop-filter: blur(4px); }
.drawer-scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: min(560px, 100%);
  background: var(--surface); border-left: 1px solid rgba(30, 144, 255, 0.35);
  transform: translateX(101%); transition: transform 0.34s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: -30px 0 80px rgba(0, 2, 5, 0.6);
}
.drawer.on { transform: none; }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--hair); position: relative; }
.drawer-body { padding: 18px 22px 40px; overflow-y: auto; flex: 1; }
.parsed {
  font-family: 'SFMono-Regular', ui-monospace, monospace; font-size: 11.5px; line-height: 1.75;
  white-space: pre-wrap; color: var(--muted);
  background: var(--bg); border: 1px solid var(--hair); border-radius: var(--r-sm);
  padding: 14px; max-height: 340px; overflow-y: auto;
}
[data-theme='light'] .parsed { background: var(--card-2); }

details.acc { border: 1px solid var(--hair); border-radius: var(--r-sm); background: var(--card); }
details.acc > summary { padding: 11px 14px; cursor: pointer; font-size: 13px; font-family: var(--head); letter-spacing: 0.08em; text-transform: uppercase; list-style: none; display: flex; align-items: center; gap: 8px; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: '+'; margin-left: auto; color: var(--blue); font-size: 15px; }
details.acc[open] > summary::after { content: '−'; }
details.acc > div { padding: 0 14px 14px; }

/* ---------------------------------------------------------------- insights */
.ins-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px dashed var(--hair); }
.ins-row:last-child { border-bottom: 0; }
.ins-cat { font-family: var(--head); font-size: 9.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ice); }
.conf { font-family: var(--head); font-size: 11px; letter-spacing: 0.05em; color: var(--muted); flex: none; }
.conf b { color: var(--blue); font-weight: 600; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .dow { font-family: var(--head); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cal .cell { aspect-ratio: 1; border-radius: 9px; border: 1px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--muted); position: relative; }
.cal .cell.has { border-color: var(--hair); background: var(--card); color: var(--text); cursor: pointer; }
.cal .cell.has:hover { border-color: var(--blue); box-shadow: var(--glow-sm); }
.cal .cell.today { border-color: var(--blue); box-shadow: var(--glow-sm); color: var(--text); font-weight: 600; }
.cal .cell .dots { display: flex; gap: 2px; }
.cal .cell .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); box-shadow: var(--glow-sm); }
.cal .cell .dots i.warn { background: var(--amber); box-shadow: none; }
.cal .cell .dots i.risk { background: var(--risk); box-shadow: none; }

/* toggles */
.switch { width: 38px; height: 21px; border-radius: 999px; background: rgba(143, 166, 188, 0.3); position: relative; transition: 0.2s; flex: none; border: 0; }
.switch::after { content: ''; position: absolute; top: 2.5px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: 0.22s var(--ease); }
.switch.on { background: rgba(30, 144, 255, 0.34); box-shadow: inset 0 0 12px rgba(30, 144, 255, 0.35); }
.switch.on::after { left: 19px; background: var(--blue); box-shadow: var(--glow-sm); }

/* -------------------------------------------------------------- assistant */
.assistant {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(480px, 100%);
  background: var(--surface); border-left: 1px solid rgba(30, 144, 255, 0.4);
  transform: translateX(101%); transition: transform 0.34s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: -30px 0 80px rgba(0, 2, 5, 0.62);
}
.assistant.on { transform: none; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; font-size: 13.8px; line-height: 1.62; }
.msg.me { align-self: flex-end; background: var(--blue); color: var(--text-on-blue); padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-weight: 450; box-shadow: var(--glow-sm); }
.msg.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--hair); padding: 13px 15px; border-radius: 16px 16px 16px 4px; }
.msg.ai strong { color: var(--ice); font-weight: 600; }
[data-theme='light'] .msg.ai strong { color: #14548c; }
.msg.ai em { color: var(--muted); font-style: normal; font-size: 12.5px; }
.msg-src { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 11px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); animation: bounce 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.14s; } .typing i:nth-child(3) { animation-delay: 0.28s; }
@keyframes bounce { 0%, 100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.composer { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); }
.composer form { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; padding: 11px 15px; border-radius: 999px; border: 1px solid var(--hair); background: var(--card); }
.composer input:focus { border-color: var(--blue); outline: none; box-shadow: var(--glow-sm); }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; }

/* --------------------------------------------------------- celebration */
.celebrate { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; text-align: center; padding: 24px; background: radial-gradient(60% 60% at 50% 45%, rgba(30, 144, 255, 0.34), rgba(0, 2, 5, 0.94) 72%); animation: fadein 0.5s ease both; }
[data-theme='light'] .celebrate { background: radial-gradient(60% 60% at 50% 45%, rgba(30, 144, 255, 0.3), rgba(244, 249, 255, 0.97) 72%); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.celebrate .inner { position: relative; z-index: 2; max-width: 620px; animation: pop 0.7s var(--ease) both 0.12s; }
@keyframes pop { from { opacity: 0; transform: scale(0.9) translateY(14px); } to { opacity: 1; transform: none; } }
.bloom { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); transform: translate(-50%, -50%); animation: bloom 1.5s var(--ease) both; }
@keyframes bloom { from { box-shadow: 0 0 0 0 rgba(30, 144, 255, 0.9); opacity: 1; } to { box-shadow: 0 0 0 900px rgba(30, 144, 255, 0); opacity: 0; } }

/* ------------------------------------------------------------- vault mode */
.vault-hero {
  border-radius: var(--r-xl); padding: 28px 30px; position: relative; overflow: hidden;
  border: 1px solid rgba(240, 169, 59, 0.28);
  background: linear-gradient(135deg, rgba(240, 169, 59, 0.11), rgba(30, 144, 255, 0.07) 55%, transparent), var(--card);
  box-shadow: var(--shadow);
}
[data-theme='light'] .vault-hero { background: linear-gradient(135deg, #fff6e8, #f2f8ff 60%, #fff); }
.vault-hero h1 .gh-rest { background: linear-gradient(178deg, #ffd9a1 4%, var(--amber) 100%); -webkit-background-clip: text; background-clip: text; }
body.own .eyebrow { color: var(--amber); text-shadow: none; }
body.own .eyebrow::before { background: linear-gradient(90deg, transparent, var(--amber)); box-shadow: none; }

/* transition wipe */
.wipe { position: fixed; inset: 0; z-index: 90; pointer-events: none; background: linear-gradient(120deg, transparent, rgba(30, 144, 255, 0.9), transparent); transform: translateX(-100%); animation: wipe 1s var(--ease) both; }
@keyframes wipe { to { transform: translateX(100%); } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  z-index: 99; padding: 11px 18px; border-radius: 999px;
  background: var(--card); border: 1px solid rgba(30, 144, 255, 0.5);
  box-shadow: var(--glow); font-size: 13px;
  opacity: 0; transition: 0.3s var(--ease); max-width: calc(100% - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { .toast { bottom: 84px; } }

.strike { text-decoration: line-through; opacity: 0.5; }
.fadeout { animation: fadeout 0.5s var(--ease) both; }
@keyframes fadeout { to { opacity: 0; transform: translateX(24px) scale(0.98); height: 0; margin: 0; padding: 0; } }
.pop-in { animation: rise 0.42s var(--ease) both; }
.stagger > * { animation: rise 0.5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(7) { animation-delay: 0.26s; }
.stagger > *:nth-child(8) { animation-delay: 0.3s; }

.kv { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-size: 12px; letter-spacing: 0.02em; }
.kv dd { margin: 0; }

/* ------------------------------------------------------- key-date list rows */
.cal.stagger, .cal { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cal-row {
  display: flex; gap: 14px; align-items: flex-start; padding: 13px 16px;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-sm);
}
.cal-row.action { border-color: rgba(240, 169, 59, 0.5); }
.cal-row.ahead { border-color: rgba(30, 144, 255, 0.28); }
.cal-row.past { opacity: 0.72; }
.cal-date {
  flex: none; width: 54px; text-align: center; font-family: var(--head);
  border-right: 1px solid var(--hair); padding-right: 12px; line-height: 1.15;
}
.cal-date .mo { display: block; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); }
.cal-date .dy { display: block; font-size: 22px; font-weight: 600; color: var(--text); }
.cal-date .yr { display: block; font-size: 10px; letter-spacing: 0.1em; color: var(--muted); }

/* --------------------------------------------------------------- utilities */
.oswald { font-family: var(--head); font-weight: 600; letter-spacing: -0.01em; }
.contact-card .ct-top { display: flex; gap: 12px; align-items: flex-start; }
.contact-card .actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 13px; }
.mt-row { display: flex; gap: 13px; align-items: flex-start; padding: 14px 16px; background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-sm); }
.mt-row.over { border-color: rgba(255, 107, 92, 0.5); }
.mt-row.soon { border-color: rgba(240, 169, 59, 0.45); }
.mt-row.done { opacity: 0.6; }
.mt-row.done .mt-title { text-decoration: line-through; color: var(--muted); }
.mt-title { font-size: 14.5px; }
@media (max-width: 700px) { .hide-sm { display: none !important; } }

/* ------------------------------------------------------------ a11y helpers */
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; }
.skip:focus { left: 12px; top: 12px; padding: 9px 14px; border-radius: 10px; background: var(--blue); color: var(--text-on-blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
@media (max-width: 900px) { #menubtn { display: none !important; } }

@media (min-width: 901px) {
  .sheet, .sheet-scrim, .mobilebar { display: none !important; }
}
.node .stg { display: block; font-size: 9.5px; letter-spacing: 0.16em; color: var(--blue); margin-bottom: 2px; }

/* composer: icon left, send button right, inside the pill */
.composer .searchwrap { position: relative; }
.composer .searchwrap input { padding-right: 48px; }
.composer .searchwrap > svg { left: 15px; }
.composer .searchwrap .iconbtn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; background: transparent;
}

/* celebration: fully opaque backdrop so the overlay is legible */
.celebrate {
  background: radial-gradient(58% 58% at 50% 42%, rgba(30, 144, 255, 0.26), rgba(0, 2, 5, 0.985) 62%), #000205;
  backdrop-filter: blur(8px);
}
[data-theme='light'] .celebrate {
  background: radial-gradient(58% 58% at 50% 42%, rgba(30, 144, 255, 0.22), rgba(244, 249, 255, 0.99) 62%), #f4f9ff;
}
.celebrate .inner {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid rgba(30, 144, 255, 0.42);
  border-radius: var(--r-xl);
  padding: 34px 36px 30px;
  box-shadow: var(--glow-lg), var(--shadow);
}
@media (max-width: 560px) { .celebrate .inner { padding: 24px 20px 22px; } }

/* mobile topbar: keep the ask bar usable, trim the chrome */
@media (max-width: 900px) {
  .topbar-in { gap: 8px; }
  .askbar { padding: 8px 12px; font-size: 12.5px; }
  .askbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .askbar kbd { display: none; }
  .phase-pill { font-size: 9.5px; letter-spacing: 0.1em; padding: 5px 9px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-in .iconbtn { width: 34px; height: 34px; }
  .topbar-in .iconbtn[data-act='nav'] { display: none; }
}

/* long serial / model chips must never push the layout wide */
.chip { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.row-wrap { min-width: 0; }
.row-wrap > * { min-width: 0; }
.row-wrap { max-width: 100%; flex-wrap: wrap; }
html { background: var(--bg); color-scheme: dark; }
[data-theme='light'] { color-scheme: light; }
.composer .searchwrap input { padding-left: 48px; }
.composer .searchwrap > svg { width: 18px; height: 18px; }
