/*
 * FamilyCase Design System — Hero Components (v2.6)
 * ------------------------------------------------------------------
 * Five reference components that demonstrate token usage and define
 * the target visual quality bar (Brex / Stripe Dashboard / HubSpot):
 *
 *   1. Button   .fc-btn
 *   2. Input    .fc-input
 *   3. Card     .fc-card
 *   4. Modal    .fc-modal
 *   5. Table    .fc-table
 *
 * These classes are namespaced `fc-` and are PURELY ADDITIVE. Legacy
 * `.btn`, `.panel`, etc. in ../styles.css are untouched. Screens
 * migrate per docs/ui-ux-audit-v2.6.md priority.
 *
 * Requires tokens.css to be loaded first.
 */

/* ==================================================================
 * 1. BUTTON  .fc-btn
 *    Variants:  primary (default) | secondary | ghost | danger
 *    Sizes:     sm | md (default) | lg
 *    States:    :hover :active :focus-visible :disabled [aria-busy]
 * ================================================================== */
.fc-btn {
  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fc-space-3);
  height: 36px;
  padding: 0 var(--fc-space-5);
  border-radius: var(--fc-radius-md);

  /* Type */
  font-family: var(--fc-font-sans);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
  font-weight: var(--fc-font-weight-semibold);
  letter-spacing: var(--fc-letter-spacing-normal);

  /* Color (primary default) */
  color: var(--fc-text-inverse);
  background: var(--fc-color-brand-500);
  border: 1px solid var(--fc-color-brand-500);
  box-shadow: var(--fc-shadow-xs);

  /* Behavior */
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    background var(--fc-motion-duration-fast) var(--fc-motion-ease-standard),
    border-color var(--fc-motion-duration-fast) var(--fc-motion-ease-standard),
    box-shadow var(--fc-motion-duration-fast) var(--fc-motion-ease-standard),
    transform var(--fc-motion-duration-instant) var(--fc-motion-ease-standard);
}

.fc-btn:hover {
  background: var(--fc-color-brand-600);
  border-color: var(--fc-color-brand-600);
}

.fc-btn:active {
  background: var(--fc-color-brand-700);
  border-color: var(--fc-color-brand-700);
  transform: translateY(1px);
}

.fc-btn:focus-visible {
  outline: none;
  box-shadow: var(--fc-shadow-focus);
}

.fc-btn:disabled,
.fc-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.fc-btn[aria-busy="true"] {
  cursor: progress;
  position: relative;
  color: transparent;
}

.fc-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: var(--fc-radius-pill);
  border: 2px solid currentColor;
  border-top-color: transparent;
  color: var(--fc-text-inverse);
  animation: fc-spin 0.7s linear infinite;
}

@keyframes fc-spin {
  to { transform: rotate(360deg); }
}

/* Variants */
.fc-btn--secondary {
  color: var(--fc-text-strong);
  background: var(--fc-surface-raised);
  border-color: var(--fc-border-default);
}
.fc-btn--secondary:hover {
  background: var(--fc-surface-sunken);
  border-color: var(--fc-border-strong);
}
.fc-btn--secondary:active {
  background: var(--fc-color-neutral-150);
}

.fc-btn--ghost {
  color: var(--fc-text-default);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.fc-btn--ghost:hover {
  background: var(--fc-surface-sunken);
}

.fc-btn--danger {
  background: var(--fc-color-danger-500);
  border-color: var(--fc-color-danger-500);
}
.fc-btn--danger:hover {
  background: var(--fc-color-danger-700);
  border-color: var(--fc-color-danger-700);
}
.fc-btn--coral {
  background: #e8735a;
  border-color: #e8735a;
  color: #fff;
  font-weight: 600;
}
.fc-btn--coral:hover {
  background: #d4624a;
  border-color: #d4624a;
}

/* Sizes */
.fc-btn--sm {
  height: 28px;
  padding: 0 var(--fc-space-4);
  font-size: var(--fc-font-size-xs);
  line-height: var(--fc-line-height-xs);
  border-radius: var(--fc-radius-sm);
}
.fc-btn--lg {
  height: 44px;
  padding: 0 var(--fc-space-6);
  font-size: var(--fc-font-size-md);
  line-height: var(--fc-line-height-md);
}

/* ==================================================================
 * 2. INPUT  .fc-input
 *    Pair with <label class="fc-label"> and .fc-field for wrapper.
 *    States: :focus-visible :disabled [aria-invalid]
 * ================================================================== */
.fc-field {
  display: flex;
  flex-direction: column;
  gap: var(--fc-space-2);
}

.fc-label {
  font-family: var(--fc-font-sans);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
  font-weight: var(--fc-font-weight-medium);
  color: var(--fc-text-default);
}

.fc-label__required {
  color: var(--fc-color-danger-500);
  margin-left: var(--fc-space-1);
}

.fc-input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 var(--fc-space-4);
  font-family: var(--fc-font-sans);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
  color: var(--fc-text-strong);
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-md);
  box-shadow: var(--fc-shadow-xs);
  transition:
    border-color var(--fc-motion-duration-fast) var(--fc-motion-ease-standard),
    box-shadow var(--fc-motion-duration-fast) var(--fc-motion-ease-standard);
}

.fc-input::placeholder {
  color: var(--fc-text-subtle);
}

.fc-input:hover:not(:disabled) {
  border-color: var(--fc-border-strong);
}

.fc-input:focus-visible {
  outline: none;
  border-color: var(--fc-border-focus);
  box-shadow: var(--fc-shadow-focus);
}

.fc-input:disabled {
  cursor: not-allowed;
  background: var(--fc-surface-sunken);
  color: var(--fc-text-muted);
}

.fc-input[aria-invalid="true"] {
  border-color: var(--fc-color-danger-500);
}
.fc-input[aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(214, 52, 42, 0.28);
}

.fc-field__hint {
  font-size: var(--fc-font-size-xs);
  line-height: var(--fc-line-height-xs);
  color: var(--fc-text-muted);
}

.fc-field__error {
  font-size: var(--fc-font-size-xs);
  line-height: var(--fc-line-height-xs);
  color: var(--fc-color-danger-700);
}

textarea.fc-input {
  height: auto;
  min-height: 80px;
  padding: var(--fc-space-3) var(--fc-space-4);
  line-height: var(--fc-line-height-md);
  resize: vertical;
}

/* ==================================================================
 * 3. CARD  .fc-card
 *    Subdued elevation, generous interior spacing. Use for grouping.
 * ================================================================== */
.fc-card {
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  box-shadow: var(--fc-shadow-sm);
  overflow: hidden;
}

.fc-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-5);
  padding: var(--fc-space-6) var(--fc-space-7);
  border-bottom: 1px solid var(--fc-border-subtle);
}

.fc-card__title {
  margin: 0;
  font-family: var(--fc-font-sans);
  font-size: var(--fc-font-size-md);
  line-height: var(--fc-line-height-md);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  letter-spacing: var(--fc-letter-spacing-tight);
}

.fc-card__subtitle {
  margin: var(--fc-space-1) 0 0;
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
  color: var(--fc-text-muted);
}

.fc-card__body {
  padding: var(--fc-space-7);
  color: var(--fc-text-default);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-md);
}

.fc-card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--fc-space-3);
  padding: var(--fc-space-5) var(--fc-space-7);
  border-top: 1px solid var(--fc-border-subtle);
  background: var(--fc-surface-canvas);
}

.fc-card--interactive {
  cursor: pointer;
  transition:
    box-shadow var(--fc-motion-duration-base) var(--fc-motion-ease-standard),
    border-color var(--fc-motion-duration-base) var(--fc-motion-ease-standard),
    transform var(--fc-motion-duration-base) var(--fc-motion-ease-standard);
}
.fc-card--interactive:hover {
  border-color: var(--fc-border-default);
  box-shadow: var(--fc-shadow-md);
  transform: translateY(-1px);
}

/* ==================================================================
 * 4. MODAL  .fc-modal
 *    Centered dialog with backdrop. Pair with <dialog> for native
 *    a11y if available; otherwise role="dialog" aria-modal="true".
 * ================================================================== */
.fc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--fc-surface-overlay);
  z-index: var(--fc-z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--fc-space-7);
  animation: fc-fade-in var(--fc-motion-duration-base) var(--fc-motion-ease-enter);
}

dialog.fc-modal:not([open]) { display: none; }

.fc-modal {
  position: relative;
  z-index: var(--fc-z-modal);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--fc-space-13));
  display: flex;
  flex-direction: column;
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  box-shadow: var(--fc-shadow-xl);
  overflow: hidden;
  animation: fc-modal-in var(--fc-motion-duration-slow) var(--fc-motion-ease-enter);
}

.fc-modal--lg  { max-width: 720px; }
.fc-modal--xl  { max-width: 960px; }

.fc-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fc-space-5);
  padding: var(--fc-space-6) var(--fc-space-7);
  border-bottom: 1px solid var(--fc-border-subtle);
}

.fc-modal__title {
  margin: 0;
  font-size: var(--fc-font-size-lg);
  line-height: var(--fc-line-height-lg);
  font-weight: var(--fc-font-weight-semibold);
  letter-spacing: var(--fc-letter-spacing-tight);
  color: var(--fc-text-strong);
}

.fc-modal__close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--fc-text-muted);
  border-radius: var(--fc-radius-sm);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.fc-modal__close:hover { background: var(--fc-surface-sunken); color: var(--fc-text-strong); }
.fc-modal__close:focus-visible { outline: none; box-shadow: var(--fc-shadow-focus); }

.fc-modal__body {
  padding: var(--fc-space-7);
  overflow-y: auto;
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-md);
  color: var(--fc-text-default);
}

.fc-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--fc-space-3);
  padding: var(--fc-space-5) var(--fc-space-7);
  border-top: 1px solid var(--fc-border-subtle);
  background: var(--fc-surface-canvas);
}

@keyframes fc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fc-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ==================================================================
 * 5. TABLE  .fc-table
 *    Dense, scannable, no zebra stripes by default. Use sticky head
 *    inside scrollable parent. Row hover for affordance.
 * ================================================================== */
.fc-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  background: var(--fc-surface-raised);
}

.fc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--fc-font-sans);
  font-size: var(--fc-font-size-sm);
  line-height: var(--fc-line-height-sm);
  color: var(--fc-text-default);
}

.fc-table thead th {
  position: sticky;
  top: 0;
  z-index: var(--fc-z-raised);
  text-align: left;
  font-weight: var(--fc-font-weight-semibold);
  font-size: var(--fc-font-size-xs);
  line-height: var(--fc-line-height-xs);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
  color: var(--fc-text-muted);
  background: var(--fc-surface-canvas);
  padding: var(--fc-space-4) var(--fc-space-5);
  border-bottom: 1px solid var(--fc-border-default);
  white-space: nowrap;
}

.fc-table tbody td {
  padding: var(--fc-space-4) var(--fc-space-5);
  border-top: 1px solid var(--fc-border-subtle);
  color: var(--fc-text-default);
  vertical-align: middle;
}

.fc-table tbody tr:first-child td {
  border-top: none;
}

.fc-table tbody tr:hover td {
  background: var(--fc-surface-canvas);
}

.fc-table td.fc-table__cell--numeric,
.fc-table th.fc-table__cell--numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--fc-font-mono);
  font-size: var(--fc-font-size-xs);
}

.fc-table__cell--muted { color: var(--fc-text-muted); }
.fc-table__cell--strong { color: var(--fc-text-strong); font-weight: var(--fc-font-weight-medium); }

/* Status pills — reuse inside table cells */
.fc-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--fc-space-2);
  padding: 2px var(--fc-space-3);
  font-size: var(--fc-font-size-xs);
  line-height: var(--fc-line-height-xs);
  font-weight: var(--fc-font-weight-medium);
  border-radius: var(--fc-radius-pill);
  background: var(--fc-color-neutral-100);
  color: var(--fc-text-default);
  border: 1px solid var(--fc-border-subtle);
}
.fc-pill--success { background: var(--fc-color-success-50); color: var(--fc-color-success-700); border-color: transparent; }
.fc-pill--warning { background: var(--fc-color-warning-50); color: var(--fc-color-warning-700); border-color: transparent; }
.fc-pill--danger  { background: var(--fc-color-danger-50);  color: var(--fc-color-danger-700);  border-color: transparent; }
.fc-pill--info    { background: var(--fc-color-info-50);    color: var(--fc-color-info-700);    border-color: transparent; }

/* ==================================================================
 * 6. DASHBOARD — v5 redesign components
 *    Morning briefing, case command center, practice health, weekly
 *    cockpit. All classes fc-dash-* to avoid collision.
 * ================================================================== */

/* --- Layout --- */
.fc-dash-greeting { font-size: var(--fc-font-size-xl); font-weight: var(--fc-font-weight-semibold); color: var(--fc-text-strong); }
.fc-dash-greeting-date { font-size: var(--fc-font-size-sm); font-weight: var(--fc-font-weight-regular); color: var(--fc-text-muted); margin-left: var(--fc-space-3); }
.fc-dash-subtitle { font-size: var(--fc-font-size-sm); color: var(--fc-text-muted); margin: var(--fc-space-2) 0 var(--fc-space-7); }
.fc-dash-subtitle strong { color: var(--fc-color-danger-500); font-weight: var(--fc-font-weight-semibold); }
.fc-dash-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--fc-space-6); }
.fc-dash-section-title { font-size: var(--fc-font-size-lg); font-weight: var(--fc-font-weight-semibold); color: var(--fc-text-strong); margin: 0; }
.fc-dash-divider { height: 1px; background: var(--fc-border-subtle); margin: var(--fc-space-8) 0; }

/* --- Briefing grid (2-col) --- */
.fc-dash-briefing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--fc-space-6);
  margin-bottom: var(--fc-space-5);
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-6);
  box-shadow: var(--fc-shadow-sm);
}
@media (max-width: 767px) { .fc-dash-briefing { grid-template-columns: 1fr; } }

/* --- Priority item (left-border card) --- */
.fc-priority-item {
  padding: var(--fc-space-4) var(--fc-space-5);
  margin-bottom: var(--fc-space-3);
  border-radius: 0 var(--fc-radius-lg) var(--fc-radius-lg) 0;
  border-left: 4px solid var(--fc-border-default);
}
.fc-priority-item--critical { border-left-color: var(--fc-color-danger-500); background: var(--fc-color-danger-50); }
.fc-priority-item--warning  { border-left-color: var(--fc-color-warning-500); background: var(--fc-color-warning-50); }
.fc-priority-item--normal   { border-left-color: var(--fc-border-default); background: var(--fc-surface-canvas); }
.fc-priority-item__title { font-size: var(--fc-font-size-sm); font-weight: var(--fc-font-weight-medium); color: var(--fc-text-strong); }
.fc-priority-item__meta  { font-size: var(--fc-font-size-xs); margin-top: var(--fc-space-1); }
.fc-priority-item--critical .fc-priority-item__meta { color: var(--fc-color-danger-500); }
.fc-priority-item--warning  .fc-priority-item__meta { color: var(--fc-color-warning-700); }
.fc-priority-item--normal   .fc-priority-item__meta { color: var(--fc-text-muted); }

/* --- Schedule row --- */
.fc-schedule-row {
  display: flex;
  gap: var(--fc-space-5);
  align-items: flex-start;
  padding: var(--fc-space-4) 0;
  border-bottom: 1px solid var(--fc-border-subtle);
}
.fc-schedule-row:last-child { border-bottom: none; }
.fc-schedule-time { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); min-width: 44px; padding-top: var(--fc-space-1); }
.fc-schedule-title { font-size: var(--fc-font-size-sm); color: var(--fc-text-strong); }
.fc-schedule-sub { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); margin-top: var(--fc-space-1); }
.fc-schedule-row--highlight {
  background: var(--fc-color-info-50);
  margin: 0 calc(-1 * var(--fc-space-7));
  padding: var(--fc-space-4) var(--fc-space-7);
}
.fc-schedule-row--highlight .fc-schedule-time { color: var(--fc-color-info-500); font-weight: var(--fc-font-weight-semibold); }
.fc-schedule-row--highlight .fc-schedule-title { color: var(--fc-color-info-500); font-weight: var(--fc-font-weight-medium); }
.fc-schedule-row--highlight .fc-schedule-sub { color: var(--fc-color-info-500); }

/* --- Billing bar --- */
.fc-billing-bar {
  background: var(--fc-surface-canvas);
  border-radius: var(--fc-radius-md);
  padding: var(--fc-space-4) var(--fc-space-5);
  display: flex;
  align-items: center;
  gap: var(--fc-space-5);
  margin-top: var(--fc-space-4);
}
.fc-billing-bar__text { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); }
.fc-billing-bar__text strong { color: var(--fc-text-strong); font-weight: var(--fc-font-weight-semibold); }
.fc-billing-bar__track { flex: 1; background: var(--fc-color-neutral-100); border-radius: var(--fc-radius-pill); height: 8px; overflow: hidden; }
.fc-billing-bar__fill { height: 100%; background: var(--fc-color-brand-500); border-radius: var(--fc-radius-pill); transition: width 0.6s ease; }
.fc-billing-bar__amount { font-size: var(--fc-font-size-xs); font-weight: var(--fc-font-weight-semibold); color: var(--fc-text-strong); white-space: nowrap; }

/* --- Case kanban (3-col) --- */
.fc-case-kanban {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--fc-space-5);
  margin-bottom: var(--fc-space-8);
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-6);
  box-shadow: var(--fc-shadow-sm);
}
@media (max-width: 767px) { .fc-case-kanban { grid-template-columns: 1fr; } }
.fc-case-col-header {
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
  padding: 0 var(--fc-space-2) var(--fc-space-4);
  display: flex;
  align-items: center;
  gap: var(--fc-space-2);
}
.fc-case-col-header--danger  { color: var(--fc-color-danger-500); }
.fc-case-col-header--warning { color: var(--fc-color-warning-500); }
.fc-case-col-header--success { color: var(--fc-color-success-500); }

.fc-case-card {
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5) var(--fc-space-5);
  margin-bottom: var(--fc-space-3);
  border-left: 4px solid var(--fc-border-default);
  transition: box-shadow var(--fc-motion-duration-base) var(--fc-motion-ease-standard);
  cursor: pointer;
}
.fc-case-card:hover { box-shadow: var(--fc-shadow-md); }
.fc-case-card--danger  { border-left-color: var(--fc-color-danger-500); }
.fc-case-card--warning { border-left-color: var(--fc-color-warning-500); }
.fc-case-card--info    { border-left-color: var(--fc-color-info-500); }
.fc-case-card--success { border-left-color: var(--fc-color-success-500); }
.fc-case-card__name { font-size: var(--fc-font-size-sm); font-weight: var(--fc-font-weight-semibold); color: var(--fc-text-strong); }
.fc-case-card__type { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); margin-top: var(--fc-space-1); }
.fc-case-card__alert { font-size: var(--fc-font-size-xs); margin-top: var(--fc-space-3); display: flex; align-items: flex-start; gap: var(--fc-space-2); }
.fc-case-card--danger  .fc-case-card__alert { color: var(--fc-color-danger-500); }
.fc-case-card--warning .fc-case-card__alert { color: var(--fc-color-warning-700); }
.fc-case-card--info    .fc-case-card__alert { color: var(--fc-color-info-500); }
.fc-case-card--success .fc-case-card__alert { color: var(--fc-color-success-500); }
.fc-case-card--more {
  background: var(--fc-surface-canvas);
  border: 1px dashed var(--fc-border-default);
  border-left: 1px dashed var(--fc-border-default);
  text-align: center;
  font-size: var(--fc-font-size-xs);
  color: var(--fc-text-muted);
}
.fc-case-card--more:hover { background: var(--fc-color-neutral-100); }

/* --- Stat grid (4-col) --- */
.fc-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--fc-space-4); margin-bottom: var(--fc-space-6); }
@media (max-width: 767px) { .fc-stat-grid { grid-template-columns: 1fr 1fr; } }
.fc-stat-card {
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5) var(--fc-space-5);
  box-shadow: var(--fc-shadow-sm);
}
.fc-stat-card__label { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); }
.fc-stat-card__value { font-size: var(--fc-font-size-xl); font-weight: var(--fc-font-weight-semibold); margin-top: var(--fc-space-2); color: var(--fc-text-strong); }
.fc-stat-card__value--danger  { color: var(--fc-color-danger-500); }
.fc-stat-card__value--warning { color: var(--fc-color-warning-700); }
.fc-stat-card__sub { font-size: 11px; margin-top: var(--fc-space-1); }
.fc-stat-card__sub--up      { color: var(--fc-color-success-500); }
.fc-stat-card__sub--down    { color: var(--fc-color-danger-500); }
.fc-stat-card__sub--warn    { color: var(--fc-color-warning-700); }
.fc-stat-card__sub--neutral { color: var(--fc-text-muted); }

/* --- Revenue grid (2-col) --- */
.fc-revenue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--fc-space-5);
  margin-bottom: var(--fc-space-6);
}
.fc-revenue-card {
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5) var(--fc-space-6);
  box-shadow: var(--fc-shadow-sm);
}
@media (max-width: 767px) { .fc-revenue-grid { grid-template-columns: 1fr; } }
.fc-revenue-card__header { font-size: var(--fc-font-size-sm); font-weight: var(--fc-font-weight-semibold); margin-bottom: var(--fc-space-5); display: flex; align-items: center; gap: var(--fc-space-2); }
.fc-revenue-row { padding: var(--fc-space-4) 0; border-bottom: 1px solid var(--fc-border-subtle); }
.fc-revenue-row:last-child { border-bottom: none; }
.fc-revenue-row__top { display: flex; justify-content: space-between; align-items: baseline; }
.fc-revenue-row__name { font-size: var(--fc-font-size-sm); color: var(--fc-text-strong); }
.fc-revenue-row__amount { font-size: var(--fc-font-size-sm); font-weight: var(--fc-font-weight-semibold); }
.fc-revenue-row__detail { font-size: var(--fc-font-size-xs); margin-top: var(--fc-space-1); }
.fc-revenue-row--danger .fc-revenue-row__amount { color: var(--fc-color-danger-500); }
.fc-revenue-row--danger .fc-revenue-row__detail { color: var(--fc-color-danger-500); }
.fc-revenue-row--warn .fc-revenue-row__amount { color: var(--fc-color-warning-700); }
.fc-revenue-row--warn .fc-revenue-row__detail { color: var(--fc-color-warning-700); }
.fc-revenue-row__sub { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); }
.fc-revenue-actions { margin-top: var(--fc-space-5); padding-top: var(--fc-space-4); border-top: 1px solid var(--fc-border-subtle); text-align: right; }

/* --- AI nudge bar --- */
.fc-ai-nudge {
  background: var(--fc-surface-canvas);
  border-radius: var(--fc-radius-md);
  padding: var(--fc-space-4) var(--fc-space-6);
  display: flex;
  align-items: center;
  gap: var(--fc-space-4);
  margin-bottom: var(--fc-space-8);
}
.fc-ai-nudge__text { font-size: var(--fc-font-size-xs); color: var(--fc-text-muted); flex: 1; }
.fc-ai-nudge__text strong { color: var(--fc-text-strong); }

/* --- Heatmap strip (5-col) --- */
.fc-heatmap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--fc-space-3);
  margin-bottom: var(--fc-space-6);
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5);
  box-shadow: var(--fc-shadow-sm);
}
@media (max-width: 767px) { .fc-heatmap { grid-template-columns: repeat(3, 1fr); } }
.fc-heat-day {
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5) var(--fc-space-4);
  text-align: center;
}
.fc-heat-day__label  { font-size: var(--fc-font-size-xs); font-weight: var(--fc-font-weight-semibold); }
.fc-heat-day__count  { font-size: var(--fc-font-size-xl); font-weight: var(--fc-font-weight-bold); margin: var(--fc-space-2) 0; }
.fc-heat-day__unit   { font-size: 11px; }
.fc-heat-day__bar    { margin-top: var(--fc-space-3); height: 4px; border-radius: var(--fc-radius-pill); overflow: hidden; }
.fc-heat-day__bar-fill { height: 100%; border-radius: var(--fc-radius-pill); }
.fc-heat-day__status { font-size: 10px; margin-top: var(--fc-space-2); font-weight: var(--fc-font-weight-medium); }

.fc-heat-day--overloaded { background: var(--fc-color-danger-50); }
.fc-heat-day--overloaded .fc-heat-day__label,
.fc-heat-day--overloaded .fc-heat-day__count,
.fc-heat-day--overloaded .fc-heat-day__unit,
.fc-heat-day--overloaded .fc-heat-day__status { color: var(--fc-color-danger-500); }
.fc-heat-day--overloaded .fc-heat-day__bar { background: rgba(214, 52, 42, 0.15); }
.fc-heat-day--overloaded .fc-heat-day__bar-fill { background: var(--fc-color-danger-500); }

.fc-heat-day--tight { background: var(--fc-color-warning-50); }
.fc-heat-day--tight .fc-heat-day__label,
.fc-heat-day--tight .fc-heat-day__count,
.fc-heat-day--tight .fc-heat-day__unit,
.fc-heat-day--tight .fc-heat-day__status { color: var(--fc-color-warning-700); }
.fc-heat-day--tight .fc-heat-day__bar { background: rgba(201, 122, 12, 0.15); }
.fc-heat-day--tight .fc-heat-day__bar-fill { background: var(--fc-color-warning-500); }

.fc-heat-day--light,
.fc-heat-day--open { background: var(--fc-surface-canvas); }
.fc-heat-day--light .fc-heat-day__label,
.fc-heat-day--light .fc-heat-day__unit,
.fc-heat-day--light .fc-heat-day__status,
.fc-heat-day--open .fc-heat-day__label,
.fc-heat-day--open .fc-heat-day__unit,
.fc-heat-day--open .fc-heat-day__status { color: var(--fc-text-muted); }
.fc-heat-day--light .fc-heat-day__count,
.fc-heat-day--open .fc-heat-day__count { color: var(--fc-text-strong); }
.fc-heat-day--light .fc-heat-day__bar,
.fc-heat-day--open .fc-heat-day__bar { background: var(--fc-color-neutral-150); }
.fc-heat-day--light .fc-heat-day__bar-fill,
.fc-heat-day--open .fc-heat-day__bar-fill { background: var(--fc-color-success-500); }

/* --- Day detail grid --- */
.fc-day-detail {
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  padding: var(--fc-space-5) var(--fc-space-6);
  margin-bottom: var(--fc-space-6);
  box-shadow: var(--fc-shadow-sm);
}
.fc-day-detail__header { font-size: var(--fc-font-size-sm); font-weight: var(--fc-font-weight-semibold); margin-bottom: var(--fc-space-5); display: flex; align-items: center; gap: var(--fc-space-2); }
.fc-day-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--fc-space-2) var(--fc-space-5);
  font-size: var(--fc-font-size-xs);
  align-items: center;
}
.fc-day-grid__time { color: var(--fc-text-muted); }
.fc-day-grid__time--urgent { color: var(--fc-color-danger-500); font-weight: var(--fc-font-weight-medium); }
.fc-day-grid__desc { color: var(--fc-text-strong); }
.fc-day-grid__desc--urgent { color: var(--fc-color-danger-500); font-weight: var(--fc-font-weight-medium); }
.fc-day-grid__tag {
  font-size: 11px;
  padding: var(--fc-space-1) var(--fc-space-3);
  border-radius: var(--fc-radius-md);
  font-weight: var(--fc-font-weight-medium);
  text-align: center;
}
.fc-day-grid__tag--hearing  { background: var(--fc-color-info-50);    color: var(--fc-color-info-700); }
.fc-day-grid__tag--meeting  { background: #f3e8ff; color: #7c3aed; }
.fc-day-grid__tag--deadline { background: var(--fc-color-danger-50);  color: var(--fc-color-danger-700); }
.fc-day-grid__tag--overdue  { background: var(--fc-color-warning-50); color: var(--fc-color-warning-700); }
.fc-day-grid__tag--billing  { background: var(--fc-surface-canvas);   color: var(--fc-text-muted); }
.fc-day-grid__tag--review   { background: var(--fc-surface-canvas);   color: var(--fc-text-muted); }

/* --- Sage suggestion --- */
.fc-sage-suggestion {
  background: var(--fc-color-warning-50);
  border: 1px solid rgba(201, 122, 12, 0.3);
  border-radius: var(--fc-radius-md);
  padding: var(--fc-space-5) var(--fc-space-6);
  margin-bottom: var(--fc-space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--fc-space-4);
}
.fc-sage-suggestion__icon { color: var(--fc-color-warning-500); flex-shrink: 0; margin-top: var(--fc-space-1); }
.fc-sage-suggestion__text { font-size: var(--fc-font-size-xs); color: var(--fc-color-warning-700); line-height: var(--fc-line-height-md); }
.fc-sage-suggestion__text strong { color: #451a03; }

/* --- Dashboard CTA --- */
.fc-dash-cta { display: flex; justify-content: flex-end; padding: var(--fc-space-6) 0 var(--fc-space-8); }

/* --- Bottom stats (3-col) --- */
.fc-dash-bottom-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--fc-space-4); margin-bottom: var(--fc-space-9); }
@media (max-width: 767px) { .fc-dash-bottom-stats { grid-template-columns: 1fr; } }

/* ==================================================================
 * 7. WORKSPACE — Operating view shell (v5.2 redesign)
 *    Used by CRM, Clients, Intake, Calendar, Tasks, Messages,
 *    Questionnaires, Discovery, Deadlines, Billing, Trust, Reports,
 *    Automations, Notifications, AI Review, Admin views.
 * ================================================================== */

.fc-workspace { padding: var(--fc-space-7) 0; }

.fc-workspace__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--fc-space-5);
  margin-bottom: var(--fc-space-7);
}

.fc-workspace__kicker {
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--fc-letter-spacing-wide);
  color: var(--fc-color-brand-500);
  margin-bottom: var(--fc-space-2);
}

.fc-workspace__title {
  font-size: var(--fc-font-size-xl);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  letter-spacing: var(--fc-letter-spacing-tight);
  margin: 0 0 var(--fc-space-2);
}

.fc-workspace__desc {
  font-size: var(--fc-font-size-sm);
  color: var(--fc-text-muted);
  line-height: var(--fc-line-height-md);
  margin: 0;
  max-width: 640px;
}

.fc-workspace__sections {
  display: flex;
  flex-direction: column;
  gap: var(--fc-space-6);
  margin-top: var(--fc-space-7);
}

.fc-stat-grid--auto { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.fc-phase2-note {
  margin-top: var(--fc-space-7);
  padding: var(--fc-space-4) var(--fc-space-6);
  background: var(--fc-surface-canvas);
  border-radius: var(--fc-radius-md);
  font-size: var(--fc-font-size-xs);
  color: var(--fc-text-muted);
  line-height: var(--fc-line-height-md);
  border: 1px dashed var(--fc-border-default);
}
.fc-phase2-note strong {
  color: var(--fc-text-default);
  margin-right: var(--fc-space-3);
}

/* --- List item (replaces operating-record) --- */
.fc-list-item {
  padding: var(--fc-space-4) var(--fc-space-5);
  border-bottom: 1px solid var(--fc-border-subtle);
  transition: background var(--fc-motion-duration-fast) var(--fc-motion-ease-standard);
}
.fc-list-item:last-child { border-bottom: none; }
.fc-list-item:hover { background: var(--fc-surface-canvas); }

.fc-list-item__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--fc-space-4);
}

.fc-list-item__title {
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-medium);
  color: var(--fc-text-strong);
}

.fc-list-item__meta {
  font-size: var(--fc-font-size-xs);
  color: var(--fc-text-muted);
  margin-top: var(--fc-space-1);
}

.fc-list-item__body {
  font-size: var(--fc-font-size-xs);
  color: var(--fc-text-default);
  margin-top: var(--fc-space-2);
  line-height: var(--fc-line-height-sm);
}

.fc-card__body--list { padding: 0; }
.fc-card__body--list .fc-list-item:first-child { border-top: none; }

/* ==================================================================
 * 8. MATTERS VIEW — redesigned master-detail (v5.2)
 * ================================================================== */

.fc-matters-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  min-height: calc(100vh - 120px);
}
@media (max-width: 900px) { .fc-matters-grid { grid-template-columns: 1fr; } }

.fc-matters-sidebar {
  border-right: 1px solid var(--fc-border-subtle);
  overflow-y: auto;
  background: var(--fc-surface-raised);
}

.fc-matters-sidebar__header {
  padding: var(--fc-space-5) var(--fc-space-6);
  border-bottom: 1px solid var(--fc-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-3);
  position: sticky;
  top: 0;
  background: var(--fc-surface-raised);
  z-index: var(--fc-z-raised);
}

.fc-matters-sidebar__title {
  font-size: var(--fc-font-size-md);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  margin: 0;
}

.fc-matter-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--fc-space-4) var(--fc-space-6);
  border: none;
  border-bottom: 1px solid var(--fc-border-subtle);
  border-left: 3px solid transparent;
  background: var(--fc-surface-raised);
  cursor: pointer;
  transition: background var(--fc-motion-duration-fast) var(--fc-motion-ease-standard),
              border-color var(--fc-motion-duration-fast) var(--fc-motion-ease-standard);
  font-family: var(--fc-font-sans);
}
.fc-matter-item:hover { background: var(--fc-surface-canvas); }
.fc-matter-item.selected {
  background: var(--fc-color-brand-50);
  border-left-color: var(--fc-color-brand-500);
}

.fc-matter-item__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--fc-space-3);
}

.fc-matter-item__name {
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-medium);
  color: var(--fc-text-strong);
}

.fc-matter-item__meta {
  font-size: var(--fc-font-size-xs);
  color: var(--fc-text-muted);
  margin-top: var(--fc-space-1);
  line-height: var(--fc-line-height-sm);
}

.fc-matters-detail {
  overflow-y: auto;
  padding: var(--fc-space-7);
  background: var(--fc-surface-canvas);
}

.fc-matters-detail__header {
  font-size: var(--fc-font-size-xl);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  margin: 0 0 var(--fc-space-6);
}

/* --- Intake leads panel (sub-panel of matters sidebar) --- */
.fc-intake-header {
  padding: var(--fc-space-4) var(--fc-space-6);
  border-bottom: 1px solid var(--fc-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-3);
}

.fc-intake-header__title {
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
}

/* ==================================================================
 * 9. BILLING VIEW — redesigned two-column (v5.2)
 * ================================================================== */

.fc-billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--fc-space-6);
  padding: var(--fc-space-7) 0;
}
@media (max-width: 900px) { .fc-billing-grid { grid-template-columns: 1fr; } }

.fc-billing-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-3);
  margin-bottom: var(--fc-space-4);
}

.fc-billing-section__title {
  font-size: var(--fc-font-size-md);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  margin: 0;
}

/* ==================================================================
 * 10. EVIDENCE VIEW — redesigned (v5.2)
 * ================================================================== */

.fc-evidence-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-5);
  padding: var(--fc-space-5) 0;
  margin-bottom: var(--fc-space-5);
}

.fc-evidence-header__title {
  font-size: var(--fc-font-size-xl);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  margin: 0;
}

.fc-segmented {
  display: inline-flex;
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-md);
  overflow: hidden;
}

.fc-segment {
  padding: var(--fc-space-2) var(--fc-space-5);
  font-size: var(--fc-font-size-xs);
  font-weight: var(--fc-font-weight-medium);
  color: var(--fc-text-muted);
  background: var(--fc-surface-raised);
  border: none;
  border-right: 1px solid var(--fc-border-default);
  cursor: pointer;
  transition: background var(--fc-motion-duration-fast) var(--fc-motion-ease-standard),
              color var(--fc-motion-duration-fast) var(--fc-motion-ease-standard);
  font-family: var(--fc-font-sans);
}
.fc-segment:last-child { border-right: none; }
.fc-segment:hover { background: var(--fc-surface-canvas); color: var(--fc-text-default); }
.fc-segment.active {
  background: var(--fc-color-brand-500);
  color: var(--fc-text-inverse);
}

.fc-evidence-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--fc-space-4);
  padding: var(--fc-space-5);
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-subtle);
  border-radius: var(--fc-radius-lg);
  margin-bottom: var(--fc-space-5);
}

.fc-evidence-form label {
  font-size: var(--fc-font-size-sm);
  font-weight: var(--fc-font-weight-medium);
  color: var(--fc-text-default);
  display: flex;
  flex-direction: column;
  gap: var(--fc-space-2);
}

.fc-evidence-form select,
.fc-evidence-form input,
.fc-evidence-form textarea {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 var(--fc-space-4);
  font-family: var(--fc-font-sans);
  font-size: var(--fc-font-size-sm);
  color: var(--fc-text-strong);
  background: var(--fc-surface-raised);
  border: 1px solid var(--fc-border-default);
  border-radius: var(--fc-radius-md);
}

/* ==================================================================
 * 11. BOARD VIEW — Advisor Board (v5.2)
 * ================================================================== */

.fc-board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--fc-space-6);
  padding: var(--fc-space-7) 0;
}
@media (max-width: 900px) { .fc-board-grid { grid-template-columns: 1fr; } }

/* ==================================================================
 * 12. GLOBAL VIEW — page header used by all views (v5.2)
 * ================================================================== */

.fc-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-5);
  padding: var(--fc-space-5) 0 var(--fc-space-6);
  border-bottom: 1px solid var(--fc-border-subtle);
  margin-bottom: var(--fc-space-6);
}

.fc-page-header__title {
  font-size: var(--fc-font-size-xl);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  letter-spacing: var(--fc-letter-spacing-tight);
  margin: 0;
}

.fc-page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--fc-space-3);
}

/* --- Empty state --- */
.fc-empty-state {
  text-align: center;
  padding: var(--fc-space-11) var(--fc-space-7);
  color: var(--fc-text-muted);
}
.fc-empty-state__icon { font-size: 40px; margin-bottom: var(--fc-space-4); opacity: 0.4; }
.fc-empty-state__title { font-size: var(--fc-font-size-md); font-weight: var(--fc-font-weight-medium); color: var(--fc-text-default); margin-bottom: var(--fc-space-2); }
.fc-empty-state__body { font-size: var(--fc-font-size-sm); max-width: 360px; margin: 0 auto; line-height: var(--fc-line-height-md); }

/* --- Section divider --- */
.fc-section-divider {
  height: 1px;
  background: var(--fc-border-subtle);
  margin: var(--fc-space-6) 0;
}

/* --- Detail sections (matter detail, etc.) --- */
.fc-detail-section {
  margin-bottom: var(--fc-space-6);
}

.fc-detail-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fc-space-4);
  margin-bottom: var(--fc-space-4);
}

.fc-detail-section__title {
  font-size: var(--fc-font-size-md);
  font-weight: var(--fc-font-weight-semibold);
  color: var(--fc-text-strong);
  margin: 0;
}

.fc-detail-section__actions {
  display: flex;
  align-items: center;
  gap: var(--fc-space-3);
}
