/* Marsh Light Counseling demo — Holloway brand, light clinical theme */
:root {
  --navy: #153452;
  --deep: #0C2138;
  --slate: #41607E;
  --haze: #8CA0B3;
  --wash: #E9ECEF;
  --paper: #F5F6F4;
  --line: rgba(21, 52, 82, .16);
  --white: #FFFFFF;
  --ok: #2E6B4F;
  --ok-bg: #E3EFE8;
  --warn: #8A6215;
  --warn-bg: #F6EDD9;
  --urgent: #8C3A2E;
  --urgent-bg: #F5E4E0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(12, 33, 56, .06), 0 4px 14px rgba(12, 33, 56, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--deep);
  background: var(--paper);
  display: flex;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: 'Archivo', 'IBM Plex Sans', sans-serif; font-weight: 600; color: var(--navy); margin: 0 0 .4em; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: var(--navy); }
.mono, time, .figure { font-family: 'IBM Plex Mono', monospace; }

/* ---------- sidebar ---------- */
#sidebar {
  width: 232px; min-width: 232px;
  background: var(--deep);
  color: var(--wash);
  display: flex; flex-direction: column;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
}
#sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; }
#sidebar .brand img { width: 34px; height: 34px; }
#sidebar .brand .name { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 15px; line-height: 1.25; }
#sidebar .brand .sub { font-size: 11.5px; color: var(--haze); }
#sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
#sidebar nav a {
  color: var(--wash); text-decoration: none; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; display: flex; align-items: center; gap: 10px;
}
#sidebar nav a:hover { background: rgba(255,255,255,.07); }
#sidebar nav a.active { background: rgba(255,255,255,.13); font-weight: 600; }
#sidebar .foot { margin-top: auto; padding: 12px 10px 0; font-size: 11.5px; color: var(--haze); line-height: 1.5; }

/* ---------- main ---------- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.demo-banner {
  background: var(--wash); color: var(--slate);
  font-size: 12.5px; text-align: center; padding: 6px 16px;
  border-bottom: 1px solid var(--line);
}
.page { width: 100%; max-width: 1060px; margin: 0 auto; padding: 30px 34px 60px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lede { color: var(--slate); margin: 2px 0 0; max-width: 62ch; }

/* ---------- cards & grids ---------- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.section { margin-bottom: 30px; }
.section > h2 { margin-bottom: 12px; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.empty { color: var(--slate); font-size: 14px; padding: 18px; text-align: center; background: var(--wash); border-radius: var(--radius); }

/* ---------- pills & badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--wash); color: var(--slate); white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.urgent { background: var(--urgent-bg); color: var(--urgent); }
.pill.navy { background: var(--navy); color: var(--white); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--wash); color: var(--navy); border-radius: 999px; padding: 4px 12px;
}
.chip button { border: 0; background: none; cursor: pointer; color: var(--slate); font-size: 13px; padding: 0; line-height: 1; }

/* ---------- buttons ---------- */
.btn {
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; font-weight: 600;
  border-radius: 8px; padding: 9px 18px; cursor: pointer; border: 1px solid transparent;
  background: var(--navy); color: var(--white); transition: background .15s ease;
}
.btn:hover { background: var(--deep); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--wash); }
.btn.quiet { background: none; border: none; color: var(--slate); font-weight: 500; text-decoration: underline; padding: 4px 6px; }
.btn.big { font-size: 15px; padding: 12px 26px; }
.btn.danger { background: var(--urgent); }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- alert cards ---------- */
.alert { border-left: 4px solid var(--haze); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.alert.warn { border-left-color: var(--warn); }
.alert.urgent { border-left-color: var(--urgent); }
.alert .title { font-weight: 600; color: var(--navy); }
.alert .detail { color: var(--slate); font-size: 13.5px; margin-top: 2px; }

/* ---------- schedule ---------- */
.appt { display: flex; align-items: center; gap: 16px; }
.appt time { font-size: 15px; color: var(--navy); min-width: 52px; font-weight: 500; }
.appt .who { flex: 1; }
.appt .who .name { font-weight: 600; }
.appt .who .kind { color: var(--slate); font-size: 13px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--slate); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--navy); }
label.field input, label.field select, label.field textarea {
  display: block; width: 100%; margin-top: 5px; font-family: inherit; font-size: 14px; font-weight: 400;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--deep);
}
textarea { resize: vertical; }
label.field :focus, .doc-field:focus { outline: 2px solid var(--slate); outline-offset: 1px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12,33,56,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--white); border-radius: 14px; box-shadow: 0 20px 60px rgba(12,33,56,.3); width: 480px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 26px 28px; }
.modal h2 { margin-bottom: 14px; }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--deep); color: var(--wash); padding: 11px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: toast-in .18s ease; max-width: 380px; }
.toast.error { background: var(--urgent); color: #fff; }
.toast.nudge {
  background: var(--white); color: var(--navy); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; font-family: 'Archivo', sans-serif;
}
.toast.nudge .nudge-x { border: 0; background: none; color: var(--haze); font-size: 15px; cursor: pointer; padding: 0; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- working (progress sentences, no spinners) ---------- */
.working { display: flex; align-items: center; gap: 10px; color: var(--slate); font-size: 14.5px; padding: 14px 0; }
.working::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--slate); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }

/* ---------- session flow ---------- */
.steps { display: flex; gap: 6px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.steps .step { font-size: 13px; color: var(--haze); display: flex; align-items: center; gap: 6px; }
.steps .step.done { color: var(--ok); }
.steps .step.now { color: var(--navy); font-weight: 600; }
.steps .sep { color: var(--line); }
.rec-button {
  width: 92px; height: 92px; border-radius: 50%; border: 3px solid var(--navy); background: var(--white);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease;
}
.rec-button .dot { width: 34px; height: 34px; border-radius: 50%; background: var(--urgent); transition: border-radius .2s ease; }
.rec-button.on { border-color: var(--urgent); }
.rec-button.on .dot { border-radius: 6px; width: 28px; height: 28px; }
.level-meter { display: flex; gap: 3px; align-items: flex-end; height: 34px; }
.level-meter span { width: 5px; background: var(--haze); border-radius: 2px; min-height: 4px; transition: height .08s linear; }
.doc-field {
  width: 100%; font-family: 'IBM Plex Sans', sans-serif; font-size: 14.5px; line-height: 1.6; color: var(--deep);
  border: 1px solid var(--line); border-radius: 8px; background: var(--white); padding: 12px 14px; min-height: 88px;
}
.client-pick { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.client-pick .pick {
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); padding: 10px 14px;
  cursor: pointer; text-align: left; min-width: 150px; font-family: inherit; font-size: 13.5px;
}
.client-pick .pick .nm { font-weight: 600; color: var(--navy); }
.client-pick .pick .nx { color: var(--slate); font-size: 12px; }
.client-pick .pick.sel { border-color: var(--navy); background: var(--wash); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--white); padding: 8px 16px; font-size: 13.5px; font-weight: 600; color: var(--slate); cursor: pointer; font-family: inherit; }
.seg button.sel { background: var(--navy); color: var(--white); }

/* ---------- progress ring ---------- */
.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring-num { font-family: 'Archivo', sans-serif; font-size: 22px; font-weight: 600; fill: var(--navy); }
.ring-track { stroke: var(--wash); }
.ring-bar { stroke: var(--navy); transition: stroke-dashoffset .6s ease; }

/* ---------- vault browser ---------- */
.vault-split { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.vault-tree { font-size: 13.5px; }
.vault-tree .folder { font-weight: 600; color: var(--navy); margin: 10px 0 4px; }
.vault-tree .file { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; font-family: inherit; color: var(--slate); font-size: 13.5px; padding: 4px 8px; border-radius: 6px; }
.vault-tree .file:hover { background: var(--wash); }
.vault-tree .file.sel { background: var(--wash); color: var(--navy); font-weight: 600; }
.props { background: var(--wash); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.props .prop { color: var(--slate); }
.props .prop b { color: var(--navy); font-weight: 600; }

/* ---------- rendered markdown ---------- */
.md { font-size: 14.5px; }
.md h1 { font-size: 21px; margin-top: 0; }
.md h2 { font-size: 16px; margin-top: 1.3em; }
.md blockquote { border-left: 3px solid var(--haze); margin: 0; padding: 2px 14px; color: var(--slate); }
.md table { border-collapse: collapse; margin: 10px 0; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; font-size: 13.5px; }
.md th { background: var(--wash); }
.md code { font-family: 'IBM Plex Mono', monospace; font-size: 13px; background: var(--wash); padding: 1px 5px; border-radius: 4px; }
.md a.wiki { color: var(--navy); text-decoration: none; border-bottom: 1px dashed var(--haze); }
.md li { margin: 3px 0; }

/* ---------- letter / print ---------- */
.letter { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 46px; font-size: 14.5px; line-height: 1.65; }
@media print {
  #sidebar, .demo-banner, .no-print, #toasts { display: none !important; }
  body { background: #fff; display: block; }
  .page { max-width: none; padding: 0; }
  .letter { border: 0; padding: 0; }
}

/* ---------- passcode gate ---------- */
#gate { position: fixed; inset: 0; background: var(--paper); z-index: 100; display: flex; align-items: center; justify-content: center; }
#gate .modal { text-align: center; }

/* ---------- responsive tables become cards on phones ---------- */
@media (max-width: 700px) {
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody { display: block; }
  table.data.cards tr {
    display: block; border: 1px solid var(--line); border-radius: var(--radius);
    margin: 10px 4px; padding: 8px 4px; background: var(--white);
  }
  table.data.cards td { display: flex; gap: 10px; border: 0; padding: 5px 12px; align-items: baseline; }
  table.data.cards td:empty { display: none; }
  table.data.cards td::before {
    content: attr(data-label); min-width: 64px; font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em; color: var(--haze); font-weight: 600;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .draft-grid, #appeal-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 860px) {
  body { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; height: auto; position: static; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; overflow-x: auto; }
  #sidebar .brand { padding: 0 8px 0 0; }
  #sidebar .brand .sub, #sidebar .foot { display: none; }
  #sidebar nav { flex-direction: row; margin: 0; }
  #sidebar nav a { padding: 7px 10px; white-space: nowrap; }
  .page { padding: 20px 16px 50px; }
  .vault-split { grid-template-columns: 1fr; }
  .appt { flex-wrap: wrap; }
  .appt .who { min-width: 60%; }
  .alert { flex-wrap: wrap; }
}
