/*
 * VirtualLawOffice Material 3 theme using the original React color palette
 * Self-contained: no CSS framework, Node build, or external font dependency.
 */
:root {
  color-scheme: light;
  --md-sys-color-primary: #c9942b;
  --md-sys-color-on-primary: #11100a;
  --md-sys-color-primary-container: #fff1bd;
  --md-sys-color-on-primary-container: #704900;
  --md-sys-color-secondary: #6b6253;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #eee3ca;
  --md-sys-color-on-secondary-container: #201a10;
  --md-sys-color-tertiary: #7b5005;
  --md-sys-color-tertiary-container: #f1dfaa;
  --md-sys-color-error: #8a1538;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #fef3c7;
  --md-sys-color-on-error-container: #7c2d12;
  --md-sys-color-surface: #f5f1e6;
  --md-sys-color-surface-dim: #e0d2ad;
  --md-sys-color-surface-bright: #fffdf8;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #fffaf0;
  --md-sys-color-surface-container: #f5f1e6;
  --md-sys-color-surface-container-high: #eee3ca;
  --md-sys-color-surface-container-highest: #e4d6b6;
  --md-sys-color-on-surface: #1b170f;
  --md-sys-color-on-surface-variant: #6b6253;
  --md-sys-color-outline: #d9c895;
  --md-sys-color-outline-variant: #e4d6b6;
  --md-sys-color-inverse-surface: #070606;
  --md-sys-color-inverse-on-surface: #fff9e8;
  --md-sys-color-success: #15803d;
  --md-sys-color-success-container: #dcfce7;
  --md-sys-color-warning: #92400e;
  --md-sys-color-warning-container: #fef3c7;
  --md-ref-typeface: Roboto, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --md-shape-xs: 4px;
  --md-shape-sm: 8px;
  --md-shape-md: 12px;
  --md-shape-lg: 16px;
  --md-shape-xl: 28px;
  --md-elevation-1: 0 1px 2px rgba(0, 0, 0, .16), 0 1px 3px 1px rgba(0, 0, 0, .08);
  --md-elevation-2: 0 1px 2px rgba(0, 0, 0, .18), 0 2px 6px 2px rgba(0, 0, 0, .08);
  --md-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .16);
  font-family: var(--md-ref-typeface);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .38; }
::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Material navigation drawer and top app bar */
.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 200ms cubic-bezier(.2, 0, 0, 1);
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  padding: 20px 12px;
  overflow-y: auto;
  color: var(--md-sys-color-on-secondary-container);
  background: var(--md-sys-color-secondary-container);
  border-radius: 0 var(--md-shape-xl) var(--md-shape-xl) 0;
  transition: width 200ms cubic-bezier(.2, 0, 0, 1), transform 220ms cubic-bezier(.2, 0, 0, 1);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 12px 24px;
  color: var(--md-sys-color-on-secondary-container);
}
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand > span { display: grid; gap: 1px; min-width: 0; }
.brand strong { font-size: 15px; font-weight: 700; letter-spacing: .1px; }
.brand small { color: var(--md-sys-color-on-surface-variant); font-size: 11px; font-weight: 500; letter-spacing: .5px; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  overflow: hidden;
  border-radius: 24px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .1px;
  transition: background 150ms ease, color 150ms ease;
}
.sidebar nav a::after, .button::after, .icon-button::after, .menu-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: currentColor;
  opacity: 0;
  transition: opacity 150ms ease;
}
.sidebar nav a:hover::after, .button:hover::after, .icon-button:hover::after, .menu-toggle:hover::after { opacity: .08; }
.sidebar nav a:active::after, .button:active::after, .icon-button:active::after, .menu-toggle:active::after { opacity: .12; }
.sidebar nav a > span { position: relative; z-index: 1; width: 24px; text-align: center; font-size: 20px; font-weight: 400; }
.sidebar nav a.active { color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 88px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--md-sys-color-surface) 94%, transparent);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  backdrop-filter: blur(14px);
}
.topbar-heading { min-width: 0; margin-right: auto; }
.topbar h1 { margin: 0 0 3px; font-size: 24px; font-weight: 500; line-height: 1.25; letter-spacing: 0; }
.topbar p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: 13px; line-height: 1.35; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.user-chip {
  display: grid;
  gap: 1px;
  min-height: 48px;
  padding: 7px 16px;
  border-radius: 24px;
  background: var(--md-sys-color-surface-container);
}
.user-chip strong { font-size: 13px; font-weight: 600; }
.user-chip small { color: var(--md-sys-color-on-surface-variant); font-size: 11px; text-transform: capitalize; }
.page-content { display: grid; gap: 24px; padding: 28px 32px 48px; }

/* Material buttons and controls */
.button, .icon-button, .menu-toggle {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: .1px;
  transition: box-shadow 150ms ease, background 150ms ease, transform 100ms ease;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 20px;
  border-radius: 20px;
  font-size: 14px;
}
.button.primary { color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); box-shadow: var(--md-elevation-1); }
.button.primary:hover { box-shadow: var(--md-elevation-2); }
.button.subtle { color: var(--md-sys-color-primary); background: transparent; outline: 1px solid var(--md-sys-color-outline); outline-offset: -1px; }
.button.danger { color: var(--md-sys-color-on-error); background: var(--md-sys-color-error); box-shadow: var(--md-elevation-1); }
.button.wide { width: 100%; }
.icon-button, .menu-toggle {
  display: inline-grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--md-sys-color-on-surface-variant);
  background: transparent;
  font-size: 20px;
  line-height: 1;
}
.icon-button:hover, .menu-toggle:hover { background: var(--md-sys-color-surface-container-high); }
.button:focus-visible, .icon-button:focus-visible, .menu-toggle:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--md-sys-color-primary) 32%, transparent);
  outline-offset: 2px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Material cards, surfaces, and status chips */
.panel, .hero, .kpi {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-lg);
}
.panel { padding: 24px; }
.panel:hover, .kpi:hover { box-shadow: var(--md-elevation-1); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-header h2 { margin: 0 0 4px; font-size: 18px; font-weight: 500; line-height: 1.35; }
.panel-header p { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: 13px; line-height: 1.45; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-high);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: capitalize;
}
.pill.ready, .pill.done { color: #003921; background: var(--md-sys-color-success-container); }
.pill.live { color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); }
.pill.signing { color: #201535; background: var(--md-sys-color-tertiary-container); }
.pill.hold, .pill.failed { color: #241a00; background: var(--md-sys-color-warning-container); }
.hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  padding: 32px;
  color: var(--md-sys-color-on-primary-container);
  background: var(--md-sys-color-primary-container);
  border: 0;
  border-radius: var(--md-shape-xl);
}
.hero h2 { margin: 14px 0 6px; font-size: 30px; font-weight: 500; line-height: 1.2; }
.hero p { margin: 0 0 20px; color: color-mix(in srgb, var(--md-sys-color-on-primary-container) 75%, transparent); }
.hero aside { display: grid; align-content: center; gap: 8px; padding-left: 28px; border-left: 1px solid color-mix(in srgb, var(--md-sys-color-on-primary-container) 20%, transparent); }
.hero aside span, .hero aside p { margin: 0; color: color-mix(in srgb, var(--md-sys-color-on-primary-container) 72%, transparent); font-size: 12px; }
.hero aside strong { font-size: 18px; font-weight: 600; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { display: grid; gap: 7px; padding: 22px; background: var(--md-sys-color-surface-container-low); }
.kpi span, .kpi small { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.kpi strong { color: var(--md-sys-color-primary); font-size: 28px; font-weight: 500; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.steps div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 14px;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-shape-md);
}
.steps b { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: var(--md-sys-color-surface-container-highest); font-size: 11px; }
.steps .done { color: #003921; background: var(--md-sys-color-success-container); }
.steps .done b { color: #fff; background: var(--md-sys-color-success); }

/* Layout */
.content-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; }
.content-grid.wide-main { grid-template-columns: minmax(0, 2.4fr) minmax(320px, 1fr); }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.stack { display: grid; align-content: start; gap: 24px; }
.sticky-panel { position: sticky; top: 116px; max-height: calc(100vh - 140px); overflow: auto; }
.field-row { max-width: 440px; }

/* Material fields */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--md-sys-color-on-surface-variant); font-size: 12px; font-weight: 600; letter-spacing: .2px; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
  border: 0;
  border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-shape-xs) var(--md-shape-xs) 0 0;
  outline: 0;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { background: var(--md-sys-color-surface-container-highest); }
input:focus, select:focus, textarea:focus { border-bottom: 2px solid var(--md-sys-color-primary); box-shadow: inset 0 -1px var(--md-sys-color-primary); }
.search-input { max-width: 240px; border: 0; border-radius: 24px; background: var(--md-sys-color-surface-container); }
.file-drop { padding: 22px; text-align: center; background: var(--md-sys-color-surface-container-low); border: 1px dashed var(--md-sys-color-outline); border-radius: var(--md-shape-md); }
.file-drop input { min-height: auto; padding: 0; background: transparent; border: 0; }
.file-drop span { color: var(--md-sys-color-on-surface-variant); font-weight: 400; }
.form-message { padding: 12px 16px; border-radius: var(--md-shape-md); font-size: 13px; }
.form-message.error { display: block; color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); }
.form-message.success { display: block; color: #003921; background: var(--md-sys-color-success-container); }

/* Material data tables and lists */
.table-wrap { overflow: auto; margin: 0 -8px; }
table { width: 100%; min-width: 740px; border-collapse: collapse; }
th { padding: 12px 14px; text-align: left; color: var(--md-sys-color-on-surface-variant); border-bottom: 1px solid var(--md-sys-color-outline-variant); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
td { height: 52px; padding: 12px 14px; vertical-align: middle; border-bottom: 1px solid var(--md-sys-color-outline-variant); font-size: 12px; }
td strong { display: block; font-size: 12px; font-weight: 600; }
td small { display: block; margin-top: 3px; color: var(--md-sys-color-on-surface-variant); }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 5%, transparent); }
.clickable-row { cursor: pointer; }
.clickable-row.selected { background: var(--md-sys-color-primary-container); }
.metric-list, .card-list { display: grid; gap: 8px; }
.metric-list > div, .list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 12px 16px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-shape-md);
}
.list-card { align-items: flex-start; transition: background 150ms ease, box-shadow 150ms ease; }
a.list-card:hover { background: var(--md-sys-color-surface-container); box-shadow: var(--md-elevation-1); }
.list-card > div { display: grid; gap: 4px; }
.list-card span, .list-card small, .metric-list span { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.detail-grid { display: grid; gap: 10px; margin-bottom: 18px; }
.detail-grid div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.detail-grid span { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.detail-grid strong { text-align: right; font-size: 12px; font-weight: 600; }
.empty-state { padding: 32px; text-align: center; color: var(--md-sys-color-on-surface-variant); font-size: 13px; }
.hash { display: block; max-width: 160px; overflow: hidden; color: var(--md-sys-color-on-surface-variant); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; }
.spinner { display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: middle; border: 2px solid var(--md-sys-color-primary-container); border-top-color: var(--md-sys-color-primary); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat, dialog, snackbar */
.chat-panel { min-height: 560px; display: grid; grid-template-rows: auto 1fr auto; }
.chat-messages { display: flex; flex-direction: column; gap: 10px; height: 390px; padding: 16px; overflow: auto; background: var(--md-sys-color-surface-container-low); border-radius: var(--md-shape-lg); }
.chat-message { max-width: 72%; padding: 12px 14px; background: var(--md-sys-color-surface-container-lowest); border-radius: var(--md-shape-lg) var(--md-shape-lg) var(--md-shape-lg) var(--md-shape-xs); box-shadow: var(--md-elevation-1); }
.chat-message.mine { align-self: flex-end; color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); border-radius: var(--md-shape-lg) var(--md-shape-lg) var(--md-shape-xs) var(--md-shape-lg); }
.chat-message header { display: flex; justify-content: space-between; gap: 10px; color: var(--md-sys-color-on-surface-variant); font-size: 10px; }
.chat-message p { margin: 6px 0 0; font-size: 13px; white-space: pre-wrap; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.video-dialog { width: min(1100px, calc(100vw - 32px)); padding: 0; color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-low); border: 0; border-radius: var(--md-shape-xl); box-shadow: var(--md-elevation-3); }
.video-dialog::backdrop { background: rgba(0, 0, 0, .52); backdrop-filter: blur(3px); }
.video-console { padding: 24px; }
.video-console > header, .video-console > footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.video-console h2 { margin: 8px 0 3px; font-size: 24px; font-weight: 500; }
.video-console p { margin: 0; color: var(--md-sys-color-on-surface-variant); }
.video-console > footer { justify-content: center; margin-top: 16px; }
.video-console > footer > span { flex: 1; color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.video-card { position: relative; display: grid; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; color: #fff; background: #101418; border-radius: var(--md-shape-lg); }
.video-card video { width: 100%; height: 100%; object-fit: cover; }
.video-card > span:last-child { position: absolute; bottom: 10px; left: 10px; padding: 5px 10px; background: rgba(0, 0, 0, .68); border-radius: 8px; font-size: 11px; }
.large-icon { color: #bdc7d0; font-size: 40px; }
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 260px; padding: 14px 16px; color: var(--md-sys-color-inverse-on-surface); background: var(--md-sys-color-inverse-surface); border-radius: var(--md-shape-xs); box-shadow: var(--md-elevation-3); font-size: 14px; }
.toast.error { color: var(--md-sys-color-on-error-container); background: var(--md-sys-color-error-container); }

/* Authentication */
.auth-page { display: grid; min-height: 100vh; padding: 32px; place-items: center; background: var(--md-sys-color-surface); }
.auth-shell { width: min(980px, 100%); }
.auth-brand { margin-bottom: 16px; }
.auth-brand .brand { width: max-content; padding: 0; color: var(--md-sys-color-on-surface); }
.auth-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; padding: 48px; background: var(--md-sys-color-surface-container-lowest); border-radius: var(--md-shape-xl); box-shadow: var(--md-elevation-2); }
.auth-copy h1 { margin: 20px 0 12px; font-size: 40px; font-weight: 500; line-height: 1.15; }
.auth-copy h1 span { display: block; color: var(--md-sys-color-primary); }
.auth-copy p { color: var(--md-sys-color-on-surface-variant); line-height: 1.6; }
.auth-form { display: grid; gap: 16px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--md-sys-color-secondary-container); border-radius: 24px; }
.tabs a { padding: 10px 16px; text-align: center; border-radius: 20px; color: var(--md-sys-color-on-secondary-container); font-size: 13px; font-weight: 700; }
.tabs a.active { color: var(--md-sys-color-on-primary); background: var(--md-sys-color-primary); box-shadow: var(--md-elevation-1); }

/* Collapsible navigation rail */
@media (min-width: 761px) {
  body.nav-collapsed .app-shell { grid-template-columns: 88px minmax(0, 1fr); }
  body.nav-collapsed .sidebar { padding-right: 10px; padding-left: 10px; }
  body.nav-collapsed .sidebar .brand { justify-content: center; padding-right: 0; padding-left: 0; }
  body.nav-collapsed .sidebar .brand > span { display: none; }
  body.nav-collapsed .sidebar nav a { justify-content: center; gap: 0; padding: 0; font-size: 0; }
  body.nav-collapsed .sidebar nav a > span { font-size: 20px; }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; }
  .content-grid, .content-grid.wide-main { grid-template-columns: 1fr; }
  .sticky-panel { position: static; max-height: none; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: block;
    width: min(320px, calc(100vw - 56px));
    height: 100vh;
    padding: 20px 12px;
    border-radius: 0 var(--md-shape-xl) var(--md-shape-xl) 0;
    box-shadow: var(--md-elevation-3);
    transform: translateX(-105%);
  }
  .sidebar .brand { padding-bottom: 24px; }
  .sidebar nav { display: grid; overflow: visible; }
  .sidebar nav a { white-space: normal; }
  body.nav-open { overflow: hidden; }
  body.nav-open::before { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .42); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .menu-toggle { position: fixed; top: 16px; left: min(332px, calc(100vw - 48px)); z-index: 60; color: var(--md-sys-color-on-surface); background: var(--md-sys-color-surface-container-high); box-shadow: var(--md-elevation-2); }
  .topbar { position: sticky; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; min-height: 76px; padding: 12px 16px; }
  .topbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .topbar-actions .button { padding: 0 14px; }
  .user-chip { display: none; }
  .page-content { padding: 16px 16px 40px; }
  .panel { padding: 20px; }
  .split-grid, .kpi-grid, .hero, .auth-panel { grid-template-columns: 1fr; }
  .hero { padding: 24px; border-radius: var(--md-shape-lg); }
  .hero aside { padding: 20px 0 0; border-top: 1px solid color-mix(in srgb, var(--md-sys-color-on-primary-container) 20%, transparent); border-left: 0; }
  .steps { grid-template-columns: repeat(5, minmax(96px, 1fr)); overflow: auto; padding-bottom: 4px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .auth-page { padding: 20px; }
  .auth-panel { gap: 28px; padding: 28px 24px; }
  .auth-copy h1 { font-size: 32px; }
  .video-grid { grid-template-columns: 1fr; }
  .toast-region { right: 16px; bottom: 16px; left: 16px; }
  .toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Original React palette applied to Material 3 components. */
/* Client drawer follows the light React portal palette. */
.sidebar {
  color: #4f4738;
  background: #ffffff;
  border-right: 1px solid #e4d6b6;
  border-radius: 0 var(--md-shape-xl) var(--md-shape-xl) 0;
}
.sidebar .brand { color: #1b170f; }
.sidebar .brand small { color: #6b6253; }
.sidebar nav a { color: #4f4738; }
.sidebar nav a.active { color: #7b5005; background: #fff4cc; }

/* Admin drawer follows the black-and-gold React console palette. */
body[data-page^="admin-"] .sidebar {
  color: #fff9e8;
  background: #070606;
  border-right-color: #211a0e;
}
body[data-page^="admin-"] .sidebar .brand { color: #fff9e8; }
body[data-page^="admin-"] .sidebar .brand small { color: #d6bd72; }
body[data-page^="admin-"] .sidebar nav a { color: #efe1b0; }
body[data-page^="admin-"] .sidebar nav a.active { color: #ffffff; background: #211a0e; }

.topbar { background: color-mix(in srgb, #f5f1e6 94%, transparent); }
.button.primary { color: #11100a; background: #c9942b; }
.button.subtle { color: #211a0e; background: #fffdf8; }
.icon-button, .menu-toggle { color: #211a0e; }
.kpi strong { color: #7b5005; }
.pill.ready { color: #704900; background: #fff1bd; }
.pill.done { color: #15803d; background: #f0fdf4; }
.pill.live { color: #166534; background: #dcfce7; }
.pill.signing { color: #5a3f00; background: #f5e5ae; }
.pill.hold, .pill.failed { color: #92400e; background: #fef3c7; }
.clickable-row.selected { background: #fff7d6; }
.tabs a.active { color: #11100a; background: #c9942b; }

.hero {
  color: #1b170f;
  background: linear-gradient(135deg, #ffffff 0%, #f6fbfa 56%, #fff4d2 100%);
  border: 1px solid #e4d6b6;
}
.hero p { color: #6b6253; }
.hero aside {
  padding: 20px;
  color: #ffffff;
  background: #070606;
  border: 0;
  border-radius: var(--md-shape-md);
}
.hero aside span, .hero aside p { color: #e4d199; }
.auth-page { background: #f5f1e6; }
.auth-form { padding: 20px; background: #fffaf0; border-radius: var(--md-shape-lg); }

@media (max-width: 760px) {
  .hero aside { padding: 20px; border: 0; }
  body[data-page^="admin-"] .sidebar { background: #070606; }
  body.nav-open .menu-toggle { color: #211a0e; background: #fffdf8; }
}

[data-captcha] { display: grid; gap: 8px; }
[data-captcha][hidden] { display: none; }
[data-captcha-image] { max-width: 100%; }
[data-captcha-refresh] { justify-self: start; }

.auth-methods, .social-auth { display: grid; gap: 16px; min-width: 0; }
.social-auth p { margin: 0; text-align: center; }
.auth-form .errorlist { color: var(--md-sys-color-error, #b3261e); }

.social-auth form { margin: 0; }
.social-auth-button { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; }
.social-auth-icon { display: block; width: 20px; height: 20px; flex: 0 0 20px; }
