/* ════════════════════════════════════════════════════════════════
   HOME SCREEN — 2026-06-18 consultant redesign

   Two role-specific layouts driven by body.role-partner /
   body.role-member (stamped by applyLexRole() in app.js):

   PARTNER       firm-wide oversight
     · 5-KPI strip (members/cases/invoices/expenses/appointments)
     · For-your-attention cards + Quick Actions rail
     · Awaiting-your-review (drafts + done tasks)

   MEMBER        personal queue
     · For-your-attention cards + Quick Actions rail
     · My matters grid
     · Drafting desk (drafts in progress + submitted for review)

   Shared: top-header (2 rows, brand · search · Create · bell · avatar
   on row 1; tab nav on row 2), Get-help floating button + slide-out,
   page footer.
═════════════════════════════════════════════════════════════════ */

/* ── TOP HEADER — 2 rows, shared between home + work modes ─────── */
.lex-topheader {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper-2, #fff);
  border-bottom: 1px solid var(--paper-edge, #e6e1d3);
}
.lex-topheader-row1 {
  display: flex; align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.5rem;
  min-height: 3.5rem;
}
.lex-brand-block {
  display: inline-flex; align-items: center; gap: 0.55rem;
  background: none; border: 0; cursor: pointer;
  color: var(--ink);
  padding: 0;
  font: inherit;
  flex-shrink: 0;
}
.lex-brand-mark {
  width: 2.1rem; height: 2.1rem;
  background: var(--ink, #0F0F0D); color: var(--paper-2, #fff);
  border-radius: 0.4rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.lex-brand-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}
.lex-brand-firm {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink-4, #7a7264);
  margin-left: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 20rem;
}
.lex-search-bar {
  flex: 1; max-width: 38rem;
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--paper-3, #f4f0e6);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  color: var(--ink-5);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.lex-search-bar:hover { background: var(--paper-2, #fff); border-color: var(--paper-edge, #e6e1d3); }
.lex-search-bar svg { color: var(--ink-4); flex-shrink: 0; }
.lex-search-placeholder { font-size: 0.875rem; color: var(--ink-4); }
.lex-topactions {
  display: flex; align-items: center; gap: 0.45rem;
  flex-shrink: 0;
  /* Push the action cluster (Create / message / bell / avatar) to the
     far right edge. The header dropdowns are position:fixed anchored to
     the viewport's right edge (right: 1.5rem/4rem/6rem), so the buttons
     must sit there too — otherwise the menus open detached from them. */
  margin-left: auto;
}
.lex-create-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--ink, #0F0F0D); color: var(--paper-2, #fff);
  border: 0; border-radius: 0.6rem;
  padding: 0.55rem 0.9rem;
  font: inherit; font-size: 0.875rem; font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.lex-create-btn:hover { opacity: 0.9; }
.lex-create-btn:active { transform: translateY(1px); }
.lex-create-btn.is-open svg:last-child { transform: rotate(180deg); }
.lex-create-btn svg:last-child { transition: transform 0.15s ease; }
.lex-create-icon { font-size: 1.1rem; line-height: 1; }
.lex-bell-btn, .lex-avatar-btn, .lex-msg-btn {
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.6rem;
  padding: 0.5rem; cursor: pointer;
  color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s ease;
}
.lex-bell-btn:hover, .lex-avatar-btn:hover, .lex-msg-btn:hover { background: var(--paper-3, #f4f0e6); }
/* Message icon + unread count badge */
.lex-msg-btn { position: relative; }
.lex-msg-btn-badge {
  position: absolute; top: -0.3rem; right: -0.3rem;
  min-width: 1.05rem; height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--gold, #C9A84C);
  color: #1a1408;
  font-size: 0.62rem; font-weight: 700;
  line-height: 1.05rem; text-align: center;
  box-shadow: 0 0 0 2px var(--paper, #fff);
}
.lex-msg-btn-badge.hidden { display: none; }

/* ── GLOBAL MESSAGE DRAWER ─────────────────────────────────────── */
.mdrawer-backdrop {
  position: fixed; inset: 0; z-index: 9200;
  background: rgba(20, 22, 26, 0.36);
  transition: opacity 0.2s ease;
}
.mdrawer-backdrop.hidden { display: none; }
.mdrawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(25rem, 96vw);
  background: var(--paper, #fff);
  border-left: 1px solid var(--border, #e6e1d3);
  z-index: 9250;
  display: flex; flex-direction: column;
  box-shadow: -16px 0 40px rgba(20, 22, 26, 0.14);
  transform: translateX(0);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.mdrawer.hidden { display: flex !important; transform: translateX(105%); pointer-events: none; }
.mdrawer-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border, #e6e1d3);
  flex-shrink: 0;
}
.mdrawer-head-title {
  font-family: var(--font-serif); font-size: 1.15rem;
  color: var(--ink); flex: 1; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mdrawer-back, .mdrawer-close {
  width: 1.9rem; height: 1.9rem;
  background: transparent; border: 0; border-radius: 0.5rem;
  cursor: pointer; color: var(--muted); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.mdrawer-back:hover, .mdrawer-close:hover { background: var(--paper-3, #f4f0e6); color: var(--ink); }
.mdrawer-body { flex: 1; overflow-y: auto; }

/* Conversation list */
.mdrawer-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 1rem; cursor: pointer;
  border: 0; border-bottom: 1px solid var(--paper-edge, #f0ece0);
  text-align: left; width: 100%; background: transparent;
}
.mdrawer-row:hover { background: var(--paper-2, #faf8f2); }
.mdrawer-row.unread .mdrawer-row-name { font-weight: 700; }
.mdrawer-row-main { flex: 1; min-width: 0; }
.mdrawer-row-name { font-size: 0.9rem; color: var(--ink); display: flex; align-items: center; gap: 0.4rem; }
.mdrawer-row-preview {
  font-size: 0.8rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mdrawer-row-unread {
  flex-shrink: 0; min-width: 1.1rem; height: 1.1rem; padding: 0 0.3rem;
  border-radius: 999px; background: var(--gold, #C9A84C); color: #1a1408;
  font-size: 0.65rem; font-weight: 700; line-height: 1.1rem; text-align: center;
}
.mdrawer-section-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 700; color: var(--muted);
  padding: 0.85rem 1rem 0.4rem;
}
.mdrawer-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* Thread */
.mdrawer-thread { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.mdrawer-bubble {
  max-width: 80%; padding: 0.5rem 0.75rem; border-radius: 0.9rem;
  font-size: 0.875rem; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap;
}
.mdrawer-bubble.mine { align-self: flex-end; background: var(--gold-bg, #f6efd9); color: var(--ink); border-bottom-right-radius: 0.25rem; }
.mdrawer-bubble.theirs { align-self: flex-start; background: var(--paper-3, #f1ede2); color: var(--ink); border-bottom-left-radius: 0.25rem; }
.mdrawer-bubble-time { align-self: flex-end; font-size: 0.6rem; color: var(--muted); margin: -0.1rem 0.2rem 0.2rem; }
.mdrawer-bubble-time.theirs { align-self: flex-start; }
.mdrawer-composer {
  flex-shrink: 0; display: flex; gap: 0.5rem; align-items: flex-end;
  padding: 0.7rem; border-top: 1px solid var(--border, #e6e1d3);
}
.mdrawer-composer textarea {
  flex: 1; resize: none; max-height: 7rem; min-height: 2.4rem;
  border: 1px solid var(--border, #e6e1d3); border-radius: 0.7rem;
  padding: 0.55rem 0.7rem; font: inherit; font-size: 0.875rem; background: var(--paper-2, #fff);
}
.mdrawer-send {
  flex-shrink: 0; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 0; background: var(--gold, #C9A84C); color: #1a1408; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mdrawer-send:disabled { opacity: 0.5; cursor: default; }
.mdrawer .msg-avatar { flex-shrink: 0; display:inline-flex; align-items:center; justify-content:center; background: var(--ink); color:#fff; font-size:0.75rem; font-weight:600; border-radius:50%; }
.lex-avatar-btn {
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  background: var(--ink, #0F0F0D);
  color: var(--paper-2, #fff);
  border-color: var(--ink);
  font-weight: 600; font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.lex-avatar-btn:hover { background: var(--ink-3); }
.lex-avatar-initials { line-height: 1; }

/* ── Tabs row (row 2) ────────────────────────────────────────── */
.lex-tabs {
  display: flex; align-items: stretch;
  gap: 0;
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.lex-tabs::-webkit-scrollbar { display: none; }
.lex-tab {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.7rem 1rem;
  background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-4, #7a7264);
  font: inherit; font-size: 0.875rem; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease;
  position: relative;
}
.lex-tab svg { color: currentColor; flex-shrink: 0; }
.lex-tab:hover { color: var(--ink); }
.lex-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.lex-tab-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--err, #8a2a26);
  margin-left: 0.1rem;
}
.lex-tab-dot.hidden { display: none; }

/* ── Header dropdowns (Create / bell / avatar) ────────────────── */
.lex-create-menu,
.lex-bell-menu,
.lex-avatar-menu {
  position: fixed;
  z-index: 80;
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.7rem;
  box-shadow: 0 16px 40px rgba(20, 16, 10, 0.12);
  padding: 0.4rem;
  min-width: 18rem;
}
.lex-create-menu {
  top: 4rem; right: 6rem;
  width: 22rem;
  padding: 0.6rem 0.4rem;
}
.lex-bell-menu  { top: 4rem; right: 4rem; min-width: 22rem; padding: 1.5rem 1.25rem; }
.lex-avatar-menu{ top: 4rem; right: 1.5rem; min-width: 16rem; padding: 0.6rem 0.4rem; }

.lex-menu-eyebrow {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-5);
  padding: 0.4rem 0.7rem 0.6rem;
}
.lex-menu-item {
  display: flex; align-items: center; gap: 0.8rem;
  width: 100%; padding: 0.55rem 0.7rem;
  background: none; border: 0; border-radius: 0.45rem;
  font: inherit; text-align: left; color: var(--ink); cursor: pointer;
  transition: background 0.1s ease;
}
.lex-menu-item:hover { background: var(--paper-3, #f4f0e6); }
.lex-menu-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem;
  background: var(--paper-3, #f4f0e6);
  border-radius: 0.5rem;
  color: var(--ink-3);
  flex-shrink: 0;
}
.lex-menu-main { display: flex; flex-direction: column; min-width: 0; }
.lex-menu-title { font-size: 0.9rem; color: var(--ink); }
.lex-menu-sub { font-size: 0.75rem; color: var(--ink-4); margin-top: 0.1rem; }

.lex-bell-empty { font-size: 0.85rem; color: var(--ink-4); text-align: center; padding: 1rem 0; }

.lex-avatar-menu-head { padding: 0.7rem; border-bottom: 1px solid var(--paper-edge); margin-bottom: 0.3rem; }
.lex-avatar-menu-name { font-weight: 500; color: var(--ink); font-size: 0.95rem; }
.lex-avatar-menu-email { font-size: 0.78rem; color: var(--ink-4); margin-top: 0.1rem; }
.lex-avatar-menu-item {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.55rem 0.7rem;
  background: none; border: 0; border-radius: 0.45rem;
  font: inherit; text-align: left;
  color: var(--ink); cursor: pointer; font-size: 0.875rem;
  transition: background 0.1s ease;
}
.lex-avatar-menu-item:hover { background: var(--paper-3, #f4f0e6); }
.lex-avatar-menu-item svg { color: var(--ink-4); }

/* ── Home main scrollable body ───────────────────────────────── */
.lex-home {
  background: var(--paper, #f6f3ec);
  min-height: calc(100dvh - 7rem);
  padding-bottom: 6rem;
}
.lex-home-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

/* ── Greeting ─────────────────────────────────────────────────── */
.lex-greet {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; margin-bottom: 2rem;
}
.lex-greet-main { min-width: 0; }
.lex-greet-name {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.15;
}
.lex-greet-sub {
  font-size: 0.95rem;
  color: var(--ink-4, #7a7264);
  margin: 0.4rem 0 0;
}
.lex-greet-aside {
  display: flex; align-items: center; gap: 0.55rem;
  flex-shrink: 0;
}
.lex-greet-aside-label {
  font-size: 0.85rem; color: var(--ink-4);
}
.lex-pill-group {
  display: inline-flex; gap: 0; background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 999px;
  padding: 0.2rem;
}
.lex-pill {
  background: none; border: 0;
  padding: 0.35rem 0.85rem;
  font: inherit; font-size: 0.8125rem; font-weight: 500;
  color: var(--ink-4); cursor: pointer;
  border-radius: 999px;
  transition: background 0.12s ease, color 0.12s ease;
}
.lex-pill:hover { color: var(--ink); }
.lex-pill.active {
  background: var(--ink, #0F0F0D); color: var(--paper-2, #fff);
}

/* ── Section frame ───────────────────────────────────────────── */
.lex-section {
  margin-bottom: 2.5rem;
}
.lex-section-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-5, #a8a08e);
  margin-bottom: 0.35rem;
}
.lex-section-h {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin: 0 0 1rem;
  line-height: 1.2;
}

/* ── PARTNER · 5 KPI cards ──────────────────────────────────── */
.lex-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.lex-kpi {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.4rem 0.7rem;
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.85rem;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.lex-kpi:hover {
  border-color: var(--ink-5);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.lex-kpi-icon {
  grid-row: 1; grid-column: 1;
  width: 2.4rem; height: 2.4rem;
  border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.lex-kpi-label {
  grid-row: 1; grid-column: 2;
  align-self: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-serif);
}
.lex-kpi-value {
  grid-row: 2; grid-column: 1 / -1;
  display: flex; align-items: baseline; gap: 0.4rem;
  font-family: var(--font-serif);
  margin-top: 0.45rem;
}
.lex-kpi-num {
  font-size: 2.1rem;
  font-weight: 500;
  color: var(--kpi-tone, var(--ink));
  line-height: 1;
  letter-spacing: -0.02em;
}
.lex-kpi-money .lex-kpi-num { font-size: 1.85rem; }
.lex-kpi-unit { font-size: 0.85rem; color: var(--ink-4); font-family: var(--font-sans); }
.lex-kpi-sub {
  grid-row: 3; grid-column: 1 / -1;
  font-size: 0.8rem; color: var(--ink-4);
  margin-top: 0.25rem;
}
/* Tone palette per KPI — matches the mock's coloured icon squares */
.lex-kpi[data-tone="teal"]   { --kpi-tone: #0d7e6e; }
.lex-kpi[data-tone="teal"]   .lex-kpi-icon { background: #0d7e6e; }
.lex-kpi[data-tone="blue"]   { --kpi-tone: #2563eb; }
.lex-kpi[data-tone="blue"]   .lex-kpi-icon { background: #2563eb; }
.lex-kpi[data-tone="amber"]  { --kpi-tone: #c2570c; }
.lex-kpi[data-tone="amber"]  .lex-kpi-icon { background: #c2570c; }
.lex-kpi[data-tone="red"]    { --kpi-tone: #b91c1c; }
.lex-kpi[data-tone="red"]    .lex-kpi-icon { background: #b91c1c; }
.lex-kpi[data-tone="purple"] { --kpi-tone: #6d28d9; }
.lex-kpi[data-tone="purple"] .lex-kpi-icon { background: #6d28d9; }

/* ── For your attention — main + quick rail layout ─────────── */
.lex-attn-band {
  display: grid;
  grid-template-columns: 1fr 22rem;
  gap: 1.5rem;
  align-items: start;
}
.lex-attn-main { min-width: 0; }
.lex-attn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.lex-attn-card {
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.8rem;
  padding: 1.1rem 1.15rem 1rem;
  display: flex; flex-direction: column;
  min-height: 15rem;
}
.lex-attn-head {
  display: flex; align-items: center; gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.lex-attn-icon {
  width: 2rem; height: 2rem;
  background: var(--attn-tone-wash, var(--paper-3, #f4f0e6));
  color: var(--attn-tone, var(--ink-3));
  border-radius: 0.45rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lex-attn-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
}
.lex-attn-count {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--attn-tone, var(--ink-2));
  line-height: 1;
}
.lex-attn-list {
  list-style: none;
  margin: 0; padding: 0;
  flex: 1;
}
.lex-attn-item {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--paper-edge);
}
.lex-attn-item:first-child { border-top: 0; }
.lex-attn-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--ink-5);
  margin-top: 0.55rem;
  flex-shrink: 0;
}
.lex-attn-dot[data-state="red"]    { background: #b91c1c; }
.lex-attn-dot[data-state="orange"] { background: #d97706; }
.lex-attn-dot[data-state="blue"]   { background: #2563eb; }
.lex-attn-dot[data-state="neutral"]{ background: var(--ink-5); }
.lex-attn-dot[data-state="teal"]   { background: #0d7e6e; }
.lex-attn-item--thumb { align-items: center; gap: 0.7rem; }
.lex-attn-item-main { min-width: 0; flex: 1; }
/* Mini library book-spine cover for the "Picked for you today" item */
.picked-cover {
  position: relative;
  width: 2.5rem; aspect-ratio: 3 / 4;
  border-radius: 2px 4px 4px 2px;
  padding: 0.35rem 0.3rem 0.3rem 0.38rem;
  display: flex; flex-direction: column;
  color: #fff; overflow: hidden; flex-shrink: 0;
  box-shadow:
    inset 3px 0 0 rgba(0,0,0,0.18),
    inset 4px 0 0 rgba(255,255,255,0.08),
    0 4px 10px -4px rgba(0,0,0,0.3);
}
.picked-cover-rule { width: 13px; height: 2px; background: var(--gold); margin-bottom: 0.28rem; flex-shrink: 0; }
.picked-cover-t {
  font-family: var(--font-serif); font-size: 0.5rem; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.picked-cover-yr {
  margin-top: auto; font-family: var(--font-serif);
  font-size: 0.42rem; letter-spacing: 0.05em; color: rgba(255,255,255,0.6);
}
.lex-attn-item-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}
.lex-attn-item-sub {
  font-size: 0.78rem;
  color: var(--ink-4);
  margin-top: 0.1rem;
}
.lex-attn-empty {
  list-style: none;
  font-size: 0.85rem;
  color: var(--ink-5);
  padding: 1rem 0;
  text-align: center;
}
.lex-attn-cta {
  display: inline-block;
  margin-top: 0.85rem;
  background: none; border: 0; padding: 0;
  font: inherit; font-size: 0.85rem; font-weight: 500;
  color: var(--attn-tone, var(--ink-2));
  cursor: pointer;
  text-align: left;
}
/* Per-card tones (driven by data-tone) */
.lex-attn-card[data-tone="blue"]   { --attn-tone: #2563eb; --attn-tone-wash: #dbeafe; }
.lex-attn-card[data-tone="purple"] { --attn-tone: #6d28d9; --attn-tone-wash: #ede9fe; }
.lex-attn-card[data-tone="orange"] { --attn-tone: #c2570c; --attn-tone-wash: #fed7aa; }
.lex-attn-card[data-tone="green"]  { --attn-tone: #047857; --attn-tone-wash: #d1fae5; }
.lex-attn-card[data-tone="teal"]   { --attn-tone: #0d7e6e; --attn-tone-wash: #ccf2ea; }

/* ── Quick actions rail ──────────────────────────────────────── */
.lex-quick-rail {
  position: sticky; top: 7.5rem;
}
.lex-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.lex-quick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.7rem;
  padding: 0.9rem 0.85rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  min-height: 5.4rem;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.lex-quick:hover {
  border-color: var(--ink-5);
  transform: translateY(-1px);
}
.lex-quick-icon {
  width: 2.1rem; height: 2.1rem;
  background: var(--paper-3, #f4f0e6);
  border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  flex-shrink: 0;
}
.lex-quick-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
}

/* ── MEMBER · my matters grid ───────────────────────────────── */
.lex-matters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.lex-matter-card {
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.8rem;
  padding: 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.lex-matter-card:hover {
  border-color: var(--ink-4);
  transform: translateY(-1px);
}
.lex-matter-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 0.7rem; margin-bottom: 0.4rem;
}
.lex-matter-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}
.lex-matter-stage {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.lex-matter-num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  color: var(--ink-4);
  margin-bottom: 0.55rem;
}
.lex-matter-meta {
  font-size: 0.85rem;
  color: var(--ink-3);
  line-height: 1.5;
}
.lex-matter-meta strong { font-weight: 600; color: var(--ink); }

/* ── Review row (partner: sign-off · member: drafting desk) ─── */
.lex-review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.lex-review-card {
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge, #e6e1d3);
  border-radius: 0.8rem;
  padding: 1.1rem 1.15rem 1rem;
  display: flex; flex-direction: column;
}
.lex-review-head {
  display: flex; align-items: center; gap: 0.65rem;
  margin-bottom: 0.9rem;
}
.lex-review-icon {
  width: 2rem; height: 2rem;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 0.45rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.lex-review-title {
  font-family: var(--font-serif);
  font-size: 1rem; font-weight: 500;
  color: var(--ink);
  flex: 1;
}
.lex-review-count {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink-3);
}
.lex-review-list {
  list-style: none; margin: 0; padding: 0;
  flex: 1;
}
.lex-review-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--paper-edge);
}
.lex-review-item:first-child { border-top: 0; }
.lex-review-doc-badge {
  background: var(--paper-3, #f4f0e6);
  color: var(--ink-4);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.4rem;
  border-radius: 0.3rem;
  flex-shrink: 0;
}
.lex-review-item-main { min-width: 0; flex: 1; }
.lex-review-item-title { font-size: 0.92rem; color: var(--ink); }
.lex-review-item-sub { font-size: 0.78rem; color: var(--ink-4); margin-top: 0.1rem; }
.lex-review-action {
  background: var(--ink, #0F0F0D); color: var(--paper-2, #fff);
  border: 0; border-radius: 0.4rem;
  padding: 0.4rem 0.85rem;
  font: inherit; font-size: 0.78rem; font-weight: 500;
  cursor: pointer; flex-shrink: 0;
}
.lex-review-action:hover { opacity: 0.9; }
.lex-review-cta {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.85rem; font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
}
.lex-review-cta:hover { text-decoration: underline; }

/* ── Footer ──────────────────────────────────────────────────── */
.lex-foot {
  display: flex; align-items: center; gap: 0.6rem;
  flex-wrap: wrap;
  padding: 2.5rem 0 1.5rem;
  border-top: 1px solid var(--paper-edge);
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--ink-4);
}
.lex-foot a { color: var(--ink-3); text-decoration: none; }
.lex-foot a:hover { color: var(--ink); text-decoration: underline; }
.lex-foot-sep { color: var(--ink-5); }
.lex-foot-copy { margin-left: auto; color: var(--ink-5); }

/* ── Empty state (matters / lists) ───────────────────────────── */
.lex-empty {
  background: var(--paper-2, #fff);
  border: 1px dashed var(--paper-edge);
  border-radius: 0.7rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-4);
  font-size: 0.9rem;
}

/* ── Get Help floating button + slide-out ────────────────────── */
.lex-help-fab {
  position: fixed; bottom: 1.25rem; left: 1.25rem;
  z-index: 60;
  background: var(--ink, #0F0F0D); color: var(--paper-2, #fff);
  border: 0; border-radius: 0.5rem;
  padding: 0.55rem 0.9rem;
  font: inherit; font-size: 0.8125rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.4rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.lex-help-fab:hover { opacity: 0.95; transform: translateY(-1px); }
.lex-help-fab svg { color: currentColor; }

.lex-help-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,16,10,0.4);
  z-index: 90;
}
.lex-help-backdrop.hidden { display: none; }

.lex-help-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 28rem; max-width: 90vw;
  z-index: 100;
  background: var(--paper, #f6f3ec);
  border-left: 1px solid var(--paper-edge);
  display: flex; flex-direction: column;
  padding: 1.5rem 1.5rem 1.5rem;
  box-shadow: -10px 0 30px rgba(0,0,0,0.08);
  overflow-y: auto;
}
.lex-help-panel.hidden { display: none; }
.lex-help-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.4rem;
}
.lex-help-eyebrow {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-5);
}
.lex-help-close {
  background: none; border: 0; padding: 0.35rem; cursor: pointer;
  color: var(--ink-4);
  border-radius: 0.4rem;
}
.lex-help-close:hover { background: var(--paper-3); color: var(--ink); }
.lex-help-title {
  font-family: var(--font-serif);
  font-size: 1.4rem; font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.55rem;
  line-height: 1.2;
}
.lex-help-intro { font-size: 0.875rem; color: var(--ink-4); line-height: 1.55; margin: 0 0 1.25rem; }
.lex-help-tabs {
  display: flex; gap: 1.25rem;
  border-bottom: 1px solid var(--paper-edge);
  margin-bottom: 1.25rem;
}
.lex-help-tab {
  background: none; border: 0;
  padding: 0.55rem 0;
  font: inherit; font-size: 0.875rem; font-weight: 500;
  color: var(--ink-4);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.lex-help-tab:hover { color: var(--ink); }
.lex-help-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.lex-help-tab-count {
  display: inline-block;
  background: var(--paper-3);
  color: var(--ink-3);
  font-size: 0.7rem; font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.2rem;
}

.lex-help-pane.hidden { display: none; }
.lex-help-label {
  display: block;
  font-size: 0.85rem; font-weight: 500;
  color: var(--ink-2);
  margin: 0.85rem 0 0.4rem;
}
.lex-help-kinds {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.lex-help-kind {
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge);
  border-radius: 0.55rem;
  padding: 0.55rem 0.75rem;
  font: inherit; font-size: 0.85rem;
  color: var(--ink-2);
  cursor: pointer;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.lex-help-kind:hover { background: var(--paper-3); }
.lex-help-kind.active { border-color: var(--ink); background: var(--paper-2); color: var(--ink); }
.lex-help-subject, .lex-help-body {
  width: 100%;
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge);
  border-radius: 0.55rem;
  padding: 0.7rem 0.85rem;
  font: inherit; font-size: 0.9rem;
  color: var(--ink);
  resize: vertical;
}
.lex-help-subject:focus, .lex-help-body:focus { outline: 2px solid var(--ink); outline-offset: -2px; border-color: var(--ink); }
.lex-help-body { min-height: 8rem; line-height: 1.5; }
.lex-help-actions {
  display: flex; justify-content: space-between; gap: 0.6rem;
  margin-top: 1rem;
}
.lex-help-attach,
.lex-help-send {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--paper-edge);
  background: var(--paper-2, #fff);
  border-radius: 0.55rem;
  padding: 0.55rem 0.85rem;
  font: inherit; font-size: 0.85rem; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
}
.lex-help-attach:hover { background: var(--paper-3); }
.lex-help-send {
  background: var(--ink, #0F0F0D); color: var(--paper-2, #fff);
  border-color: var(--ink);
}
.lex-help-send:hover { opacity: 0.9; }

.lex-help-empty {
  text-align: center;
  font-size: 0.9rem; color: var(--ink-4);
  padding: 2rem 0;
}
.lex-help-list {
  display: flex; flex-direction: column;
  gap: 0.55rem;
}
.lex-help-ticket {
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge);
  border-radius: 0.6rem;
  padding: 0.9rem 1rem;
  display: flex; justify-content: space-between; gap: 0.7rem;
  align-items: flex-start;
}
.lex-help-ticket-main { min-width: 0; flex: 1; }
.lex-help-ticket-title { font-size: 0.92rem; font-weight: 500; color: var(--ink); line-height: 1.3; }
.lex-help-ticket-meta { font-size: 0.75rem; color: var(--ink-4); margin-top: 0.25rem; }
.lex-help-ticket-status {
  font-size: 0.7rem; font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lex-help-ticket-status[data-state="open"]    { background: #ffedd5; color: #c2410c; }
.lex-help-ticket-status[data-state="progress"]{ background: #dbeafe; color: #1d4ed8; }
.lex-help-ticket-status[data-state="resolved"]{ background: #d1fae5; color: #047857; }

/* ── Requisition modals (Commit 4) ──────────────────────────── */
.req-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(20, 16, 10, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
}
.req-overlay.hidden { display: none; }
.req-modal {
  background: var(--paper-2, #fff);
  border-radius: 0.85rem;
  width: 100%;
  max-width: 32rem;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  overflow: hidden;
}
.req-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--paper-edge);
}
.req-modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.2rem; font-weight: 500;
  color: var(--ink);
}
.req-modal-close {
  background: none; border: 0; font-size: 1.4rem; line-height: 1;
  color: var(--ink-4); cursor: pointer;
  padding: 0.2rem 0.5rem;
}
.req-modal-close:hover { color: var(--ink); }
.req-modal-body {
  padding: 1.1rem 1.25rem;
  overflow-y: auto;
}
.req-label {
  display: block;
  font-size: 0.8rem; font-weight: 500;
  color: var(--ink-2);
  margin: 0.85rem 0 0.35rem;
}
.req-label:first-child { margin-top: 0; }
.req-input {
  width: 100%;
  background: var(--paper-2, #fff);
  border: 1px solid var(--paper-edge);
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
  font: inherit; font-size: 0.9rem;
  color: var(--ink);
}
.req-input:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.req-textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
.req-modal-foot {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--paper-edge);
  background: var(--paper-3);
}
.req-btn {
  border: 1px solid var(--paper-edge);
  background: var(--paper-2, #fff);
  color: var(--ink-2);
  border-radius: 0.5rem;
  padding: 0.55rem 0.95rem;
  font: inherit; font-size: 0.85rem; font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
}
.req-btn:hover { background: var(--paper-3); }
.req-btn-ghost { background: transparent; }
.req-btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper-2, #fff); }
.req-btn-primary:hover { opacity: 0.9; background: var(--ink); }
.req-btn-decline { background: var(--paper-2, #fff); color: #c2410c; border-color: #c2410c; }
.req-btn-decline:hover { background: #fff7ed; }

.req-detail-amt {
  font-family: var(--font-serif);
  font-size: 2.2rem; font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.req-detail-desc {
  font-size: 1rem; color: var(--ink); font-weight: 500;
  margin-top: 0.55rem;
}
.req-detail-meta {
  font-size: 0.85rem; color: var(--ink-4); line-height: 1.6;
  margin-top: 0.85rem;
}

/* ── Role gates ──────────────────────────────────────────────── */
body:not(.role-partner) .role-partner-only { display: none !important; }
body:not(.role-member)  .role-member-only  { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .lex-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .lex-attn-band { grid-template-columns: 1fr; }
  .lex-quick-rail { position: static; }
  .lex-quick-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .lex-topheader-row1 { padding: 0.6rem 1rem; gap: 0.65rem; flex-wrap: wrap; }
  .lex-brand-firm { display: none; }
  .lex-search-bar { order: 3; flex-basis: 100%; max-width: none; padding: 0.5rem 0.85rem; }
  .lex-tabs { padding: 0 1rem; }
  .lex-tab { padding: 0.6rem 0.65rem; font-size: 0.82rem; }
  .lex-create-label { display: none; }
  .lex-create-btn { padding: 0.55rem 0.7rem; }
  .lex-home-inner { padding: 1rem 1rem 0; }
  .lex-greet { flex-direction: column; align-items: flex-start; gap: 0.85rem; }
  .lex-kpi-row { grid-template-columns: 1fr 1fr; }
  .lex-attn-grid { grid-template-columns: 1fr; }
  .lex-matters-grid { grid-template-columns: 1fr; }
  .lex-review-grid { grid-template-columns: 1fr; }
  .lex-quick-grid { grid-template-columns: 1fr 1fr; }
  .lex-help-panel { width: 100%; padding: 1.25rem; }
  .lex-help-fab { bottom: 0.85rem; left: 0.85rem; }
  .lex-create-menu { right: 0.5rem; left: 0.5rem; width: auto; }
  .lex-bell-menu, .lex-avatar-menu { right: 0.5rem; left: 0.5rem; min-width: 0; }
}
