/* Today V2 widget styles — canonical June 25 2026 attorney dashboard.
   Tokens map 1:1 to /Users/gitlabsales/familycase/docs/DESIGN-GUIDE.md.
   Sidebar tokens (--fc-sidebar-*) live in tokens.css; cards/canvas/text live here. */

:root {
  /* Core canvas + ink */
  --tv2-bg: #f6f8fb;
  --tv2-panel: #ffffff;
  --tv2-ink: #0b152b;
  --tv2-muted: #5f6d84;
  --tv2-line: #e2e6ed;
  --tv2-accent: #3b82f6;
  --tv2-accent-hover: #2563eb;

  /* Semantic palette */
  --tv2-red: #ef4444;
  --tv2-red-bg: #fef2f2;
  --tv2-amber: #d97706;
  --tv2-amber-bg: #fffbeb;
  --tv2-green: #16a34a;
  --tv2-green-bg: #f0fdf4;
  --tv2-blue: #3b82f6;
  --tv2-blue-bg: #eff6ff;
  --tv2-neutral: #475569;
  --tv2-neutral-bg: #f1f5f9;

  /* Shadow scale (per design guide §12 — barely visible) */
  --tv2-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --tv2-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ─── Page canvas ─────────────────────────────────────────────────────────── */
body {
  background: var(--tv2-bg);
  color: var(--tv2-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ─── Host scaffold layout ────────────────────────────────────────────────── */
.tv2-host {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  width: 100%;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
}
.tv2-slot { display: block; min-width: 0; }

/* Greeting + meta */
.tv2-greeting { margin: 0 0 4px; padding: 0; }
.tv2-greeting h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 6px;
  color: var(--tv2-ink);
}
.tv2-greeting-meta {
  font-size: 14px;
  font-weight: 500;
  color: var(--tv2-muted);
  margin: 0;
}

/* Quick-action bar */
.tv2-actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 8px;
}
.tv2-actionbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--tv2-panel);
  color: var(--tv2-ink);
  border: 1px solid var(--tv2-line);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.tv2-actionbar-btn:hover { background: #f8fafc; border-color: var(--tv2-accent); }
.tv2-actionbar-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  border-color: var(--tv2-accent);
}
.tv2-actionbar-kbd {
  display: inline-block;
  background: var(--tv2-neutral-bg);
  color: var(--tv2-neutral);
  border: 1px solid var(--tv2-line);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
}

/* Rows */
.tv2-row { display: grid; gap: 16px; min-width: 0; }
.tv2-row-briefing { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tv2-row-decisions { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.tv2-row-weekly { grid-template-columns: minmax(0, 1fr); }
.tv2-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ─── Canonical card ──────────────────────────────────────────────────────── */
.tv2-card {
  background: var(--tv2-panel);
  border: 1px solid var(--tv2-line);
  border-radius: 10px;
  box-shadow: var(--tv2-shadow-sm);
  padding: 24px;
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  font-family: inherit;
  color: var(--tv2-ink);
}
.tv2-card-h {
  font-size: 12px;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--tv2-muted);
}
.tv2-empty { color: var(--tv2-muted); font-size: 13px; margin: 0; }

/* ─── Shared empty-state (centered, muted, ~32px icon + heading + one line) ─── */
.tv2-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 20px 12px;
  color: var(--tv2-muted);
}
.tv2-empty-icon { width: 32px; height: 32px; color: var(--tv2-muted); flex: none; }
.tv2-empty-state-h { margin: 0; font-size: 14px; font-weight: 700; color: var(--tv2-ink); }
.tv2-empty-state-line { margin: 0; font-size: 13px; color: var(--tv2-muted); }
.tv2-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ─── Briefing strips (row 1) — color-coded by urgency family ──────────────── */
.tv2-briefing-strip {
  border-radius: 10px;
  padding: 16px 20px;
  background: var(--tv2-panel);
  border: 1px solid var(--tv2-line);
  border-left-width: 3px;
  box-shadow: var(--tv2-shadow-sm);
  box-sizing: border-box;
  min-width: 0;
}
.tv2-briefing-strip .tv2-card,
.tv2-briefing-strip > .tv2-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
.tv2-briefing-court { background: var(--tv2-red-bg); border-left: 3px solid var(--tv2-red); }
.tv2-briefing-deadlines { background: var(--tv2-amber-bg); border-left: 3px solid var(--tv2-amber); }
.tv2-briefing-trust { background: var(--tv2-red-bg); border-left: 3px solid var(--tv2-red); }

/* ─── Court card body ─────────────────────────────────────────────────────── */
.tv2-court-body { margin-bottom: 12px; }
.tv2-matter { font-size: 15px; font-weight: 700; color: var(--tv2-ink); }
.tv2-meta { font-size: 13px; color: var(--tv2-muted); margin-top: 2px; }
.tv2-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tv2-act {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--tv2-accent);
  background: var(--tv2-panel);
  border: 1px solid var(--tv2-line);
  border-radius: 8px;
  padding: 6px 12px;
  text-decoration: none;
  cursor: pointer;
}
.tv2-act:hover { background: #f8fafc; }

/* ─── Deadlines list ──────────────────────────────────────────────────────── */
.tv2-dl-list { list-style: none; margin: 0; padding: 0; }
.tv2-dl-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 6px 0; cursor: pointer; }
.tv2-dl-time { font-weight: 600; font-size: 13px; color: var(--tv2-muted); }
.tv2-dl-title { font-size: 14px; color: var(--tv2-ink); }

/* ─── Trust alerts ────────────────────────────────────────────────────────── */
.tv2-trust-list { list-style: none; margin: 0; padding: 0; }
.tv2-trust-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; font-size: 14px; }
.tv2-trust-matter { font-weight: 700; color: var(--tv2-ink); }
.tv2-trust-balance { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--tv2-muted); }
.tv2-trust-guidance { font-size: 12px; font-weight: 700; color: var(--tv2-red); text-transform: uppercase; letter-spacing: 0.04em; }
.tv2-trust-settings { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--tv2-accent); text-decoration: none; }
.tv2-trust-settings:hover { color: var(--tv2-accent-hover); text-decoration: underline; }

/* ─── Decisions queue ─────────────────────────────────────────────────────── */
.tv2-dq-hint { font-size: 12px; color: var(--tv2-muted); margin: 0 0 8px; }
.tv2-dq-list { list-style: none; margin: 0; padding: 0; }
.tv2-dq-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 64px;
  gap: 10px;
  padding: 10px;
  align-items: center;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}
.tv2-dq-row + .tv2-dq-row { margin-top: 4px; }
.tv2-dq-row:focus, .tv2-dq-row:hover {
  background: var(--tv2-blue-bg);
  box-shadow: inset 0 0 0 2px var(--tv2-accent);
}
.tv2-dq-letter { font-weight: 800; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--tv2-accent); }
.tv2-dq-title { font-weight: 600; color: var(--tv2-ink); }
.tv2-dq-sub { color: var(--tv2-muted); font-size: 13px; }
.tv2-dq-est { font-size: 12px; color: var(--tv2-muted); text-align: right; }

/* ─── Schedule grid (8:00–17:00) ──────────────────────────────────────────── */
.tv2-sched-grid { list-style: none; margin: 0; padding: 0; }
.tv2-sched-row { display: grid; grid-template-columns: 60px 1fr; gap: 8px; padding: 4px 0; align-items: start; }
.tv2-sched-row.tv2-sched-now { background: var(--tv2-red-bg); border-left: 3px solid var(--tv2-red); color: var(--tv2-red); border-radius: 6px; }
.tv2-sched-hour { font-size: 12px; font-weight: 600; color: var(--tv2-muted); padding-top: 2px; }
.tv2-sched-cells { display: flex; flex-direction: column; gap: 4px; }
.tv2-sched-entry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.tv2-sched-title { font-weight: 600; color: var(--tv2-ink); }
.tv2-sched-sub { color: var(--tv2-muted); }
.tv2-sched-open { color: var(--tv2-accent); text-decoration: none; font-size: 12px; }

/* ─── Active cases ────────────────────────────────────────────────────────── */
.tv2-ac-list { list-style: none; margin: 0; padding: 0; }
.tv2-ac-row { display: grid; grid-template-columns: 1.4fr 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--tv2-line); cursor: pointer; font-size: 14px; }
.tv2-ac-row:last-child { border-bottom: none; }
.tv2-ac-name { font-weight: 700; color: var(--tv2-ink); }
.tv2-ac-status { color: var(--tv2-muted); font-size: 13px; }
.tv2-ac-fresh { color: var(--tv2-muted); font-size: 11px; text-align: right; }
.tv2-ac-footer { margin-top: 10px; font-size: 13px; }
.tv2-ac-footer a { color: var(--tv2-accent); text-decoration: none; }

/* ─── Weekly cockpit (row 3) ──────────────────────────────────────────────── */
.tv2-slot-weekly { background: var(--tv2-panel); border: 1px solid var(--tv2-line); border-radius: 10px; box-shadow: var(--tv2-shadow-sm); padding: 24px; }
.tv2-weekly-header { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 16px; }
.tv2-weekly-header h2 { font-size: 20px; font-weight: 700; margin: 0; color: var(--tv2-ink); }
.tv2-weekly-open { font-size: 13px; color: var(--tv2-accent); text-decoration: none; font-weight: 600; }
.tv2-weekly-open:hover { color: var(--tv2-accent-hover); text-decoration: underline; }
.tv2-weekly-body .tv2-card { background: transparent; border: none; box-shadow: none; padding: 0; }

.tv2-wk-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.tv2-wk-cell { border: 1px solid var(--tv2-line); border-radius: 8px; padding: 10px; background: var(--tv2-panel); cursor: pointer; min-height: 80px; position: relative; }
.tv2-wk-cell.tv2-wk-today { background: var(--tv2-red-bg); border-color: var(--tv2-red); border-top: 3px solid var(--tv2-red); padding-top: 8px; }
.tv2-wk-label { font-weight: 700; font-size: 12px; color: var(--tv2-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tv2-wk-cell.tv2-wk-today .tv2-wk-label { color: var(--tv2-red); }
.tv2-wk-summary { font-size: 13px; color: var(--tv2-ink); margin-top: 4px; }

/* ─── Status pills (per DESIGN-GUIDE.md §5 palette) ──────────────────────── */
.tv2-pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
.tv2-pill-red     { background: var(--tv2-red-bg);     color: var(--tv2-red); }
.tv2-pill-amber   { background: var(--tv2-amber-bg);   color: var(--tv2-amber); }
.tv2-pill-green   { background: var(--tv2-green-bg);   color: var(--tv2-green); }
.tv2-pill-blue    { background: var(--tv2-blue-bg);    color: var(--tv2-blue); }
.tv2-pill-neutral { background: var(--tv2-neutral-bg); color: var(--tv2-neutral); }
/* Back-compat aliases for legacy pill names still in widget render output. */
.tv2-pill-grey    { background: var(--tv2-neutral-bg); color: var(--tv2-neutral); }

/* ─── Per-section sentinel error state ({ ok:false, reason }) ─────────────── */
.tv2-section-error {
  border: 1px solid #fecaca;
  background: var(--tv2-red-bg);
  border-radius: 8px;
  padding: 12px 16px;
}
.tv2-error-msg { color: var(--tv2-red); font-size: 13px; margin: 0; font-weight: 600; }

/* ─── Responsive collapse — narrow viewport stacks rows vertically ─────────── */
@media (max-width: 960px) {
  .tv2-row-briefing { grid-template-columns: minmax(0, 1fr); }
  .tv2-row-decisions { grid-template-columns: minmax(0, 1fr); }
  .tv2-wk-grid { grid-template-columns: repeat(2, 1fr); }
  .tv2-greeting h1 { font-size: 24px; }
  .tv2-card { padding: 16px; }
}
