/* Client Portal — shared styles
   Design tokens:
   --ink:    #16233B  deep navy-charcoal, primary surfaces/text
   --paper:  #F7F5F0  warm paper background
   --brass:  #9C7A3C  accent — trust/gravitas, used sparingly
   --sage:   #5B7065  success/positive states
   --rule:   #DAD4C6  hairline dividers
   --ink-soft: #57657C secondary text
*/

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --ink: #16233B;
  --ink-soft: #57657C;
  --paper: #F7F5F0;
  --paper-raised: #FFFFFF;
  --brass: #9C7A3C;
  --sage: #5B7065;
  --rule: #DAD4C6;
  --danger: #A23E3E;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(22,35,59,0.06), 0 4px 16px rgba(22,35,59,0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.4em;
}

h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a { color: var(--brass); }

.mono { font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.01em; }

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--ink);
  color: #E7E9EE;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail .brand {
  font-family: 'Source Serif 4', serif;
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 28px;
  letter-spacing: 0.01em;
}

.rail a {
  color: #C4CADA;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
}

.rail a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.rail a.active { background: rgba(156,122,60,0.22); color: #fff; }

.rail .signout {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 16px;
}

.main {
  padding: 40px 48px;
  max-width: 880px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin-bottom: 20px;
}

/* ---------- Case tracker (signature element) ---------- */
.tracker {
  display: flex;
  align-items: flex-start;
  margin: 22px 0 8px;
}

.tracker .stage {
  flex: 1;
  text-align: center;
  position: relative;
}

.tracker .stage .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rule);
  margin: 0 auto 10px;
  border: 2px solid var(--paper-raised);
  box-shadow: 0 0 0 2px var(--rule);
  position: relative;
  z-index: 1;
}

.tracker .stage.done .dot { background: var(--brass); box-shadow: 0 0 0 2px var(--brass); }
.tracker .stage.current .dot { background: var(--ink); box-shadow: 0 0 0 3px rgba(22,35,59,0.18); width: 16px; height: 16px; margin-top: -1px; }

.tracker .stage::before {
  content: '';
  position: absolute;
  top: 6px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--rule);
  z-index: 0;
}
.tracker .stage:first-child::before { display: none; }
.tracker .stage.done::before, .tracker .stage.current::before { background: var(--brass); }

.tracker .stage .label { font-size: 0.78rem; color: var(--ink-soft); font-weight: 500; }
.tracker .stage.current .label { color: var(--ink); font-weight: 600; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
  border-color: var(--brass);
}
textarea { min-height: 90px; resize: vertical; }

button, .btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: #223354; }
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
button.secondary:hover { background: rgba(22,35,59,0.04); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 10px; }
.hint { color: var(--ink-soft); font-size: 0.85rem; }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(91,112,101,0.14);
  color: var(--sage);
}
.status-pill.pending { background: rgba(156,122,60,0.15); color: var(--brass); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  padding: 20px;
}
.login-card {
  background: var(--paper-raised);
  padding: 40px 36px;
  border-radius: 8px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card .eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 600;
  margin-bottom: 8px;
}

/* ---------- Messages ---------- */
.msg-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.msg { max-width: 70%; padding: 10px 14px; border-radius: 10px; font-size: 0.92rem; }
.msg.client { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 2px; }
.msg.firm { align-self: flex-start; background: #fff; border: 1px solid var(--rule); border-bottom-left-radius: 2px; }
.msg .meta { font-size: 0.72rem; opacity: 0.65; margin-top: 4px; }

@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { flex-direction: row; overflow-x: auto; padding: 14px; }
  .rail .brand, .rail .signout { display: none; }
  .main { padding: 24px 20px; }
}

/* ---------- Staff inbox ---------- */
.staff-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.staff-list {
  background: var(--paper-raised);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
}

.staff-list .list-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--rule);
}

.client-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
  background: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.client-row:hover { background: rgba(22,35,59,0.03); }
.client-row.active { background: rgba(156,122,60,0.08); border-left-color: var(--brass); }

.client-row .row-top { display: flex; justify-content: space-between; align-items: center; }
.client-row .row-email { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.client-row .row-meta { font-size: 0.78rem; color: var(--ink-soft); margin-top: 3px; }

.count-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--brass); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.count-badge.quiet { background: var(--rule); color: var(--ink-soft); }

.staff-detail { padding: 32px 40px; overflow-y: auto; }
.staff-detail .empty-state { color: var(--ink-soft); padding: 60px 0; text-align: center; }

.msg.mine { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 2px; }
.msg.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--rule); border-bottom-left-radius: 2px; }

.doc-list-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.doc-list-row:last-child { border-bottom: none; }

@media (max-width: 860px) {
  .staff-shell { grid-template-columns: 1fr; }
  .staff-list { border-right: none; border-bottom: 1px solid var(--rule); max-height: 40vh; }
  .staff-detail { padding: 20px; }
}
