/* Jornada — Layout & App Shell */

/* ─── Login ─── */
.login-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .login-page {
    grid-template-columns: 1.1fr 1fr;
  }
}

.login-brand {
  display: none;
  background: var(--color-primary-gradient);
  padding: var(--space-12) var(--space-10);
  color: #fff;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

@media (min-width: 900px) {
  .login-brand { display: flex; }
}

.login-brand::before,
.login-brand::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.login-brand::before {
  width: 520px; height: 520px;
  background: rgba(255, 255, 255, 0.07);
  top: -180px; right: -120px;
  animation: floatOrb 20s ease-in-out infinite;
}

.login-brand::after {
  width: 320px; height: 320px;
  background: rgba(255, 255, 255, 0.05);
  bottom: -80px; left: -60px;
  animation: floatOrb 16s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -15px) scale(1.05); }
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.login-brand-logo {
  width: 112px; height: 112px;
  margin-bottom: var(--space-8);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

.login-brand h1 {
  color: #fff;
  font-size: clamp(2.25rem, 4vw, 3rem);
  margin-bottom: var(--space-4);
  font-weight: 800;
}

.login-brand-tagline {
  font-size: var(--font-size-lg);
  opacity: 0.92;
  line-height: 1.7;
  margin-bottom: var(--space-10);
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-feature {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  opacity: 0.9;
}

.login-feature-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  backdrop-filter: blur(8px);
}

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  background: var(--surface-app);
  background-image: var(--surface-app-pattern);
}

.login-card {
  width: 100%;
  max-width: 420px;
  animation: fadeInScale var(--duration-slow) var(--ease-out);
}

.login-card-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-10) var(--space-8);
  box-shadow: var(--shadow-xl);
}

.login-card .logo-mobile {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  margin-bottom: var(--space-6);
}

@media (min-width: 900px) {
  .login-card .logo-mobile { display: none; }
}

.login-card h2 {
  margin-bottom: var(--space-2);
  font-size: var(--font-size-2xl);
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-8);
}

.login-version {
  margin-top: var(--space-6);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  letter-spacing: var(--letter-wide);
  text-transform: uppercase;
}

/* ─── App Shell ─── */
body[data-app-shell="true"] {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-total-height) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.app-sidebar {
  grid-area: sidebar;
  background: var(--surface-sidebar);
  color: var(--text-on-sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: var(--z-sticky);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-brand img {
  width: 40px; height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(13, 148, 136, 0.45));
}

.app-sidebar-brand span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--font-size-xl);
  color: #fff;
  letter-spacing: var(--letter-tight);
}

.app-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.app-nav-section {
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.app-nav-section:first-child {
  padding-top: 0;
}

.app-nav-section:not(:first-child) {
  margin-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: #94a3b8;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast);
  margin-bottom: 2px;
  position: relative;
}

.app-nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  text-decoration: none;
  transform: translateX(2px);
}

.app-nav-item.active,
.app-nav-item.active:hover {
  background: rgba(13, 148, 136, 0.28);
  color: #5eead4;
  box-shadow: inset 3px 0 0 var(--brand-400);
  transform: none;
}

.app-nav-item svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  stroke-width: 2;
  opacity: 0.9;
}

.app-nav-item.active svg { opacity: 1; }

.nav-pendency-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-warning-bg, #fef3c7);
  color: var(--color-warning-text, #92400e);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  line-height: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.app-nav-item.active .nav-pendency-badge {
  background: rgba(94, 234, 212, 0.25);
  color: #5eead4;
}

.app-bottom-nav-item {
  position: relative;
}

.app-bottom-nav-item .nav-pendency-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  margin-left: 0;
  min-width: 1rem;
  height: 1rem;
  line-height: 1rem;
  font-size: 10px;
  padding: 0 4px;
}

.app-bottom-more-link {
  position: relative;
}

.app-bottom-more-link .nav-pendency-badge {
  margin-left: auto;
}

.push-optin-banner {
  position: fixed;
  bottom: calc(var(--safe-bottom, 0px) + var(--bottom-nav-height, 56px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 690;
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  max-width: min(92vw, 480px);
}

@media (min-width: 900px) {
  .push-optin-banner {
    bottom: 24px;
  }
}

.app-sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

a.app-sidebar-user:hover,
a.app-sidebar-user.active {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  color: inherit;
}

.app-sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: #fff;
  flex-shrink: 0;
}

.app-sidebar-user-info {
  min-width: 0;
  flex: 1;
}

.app-sidebar-user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-user-role {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 calc(var(--space-6) + var(--safe-right)) 0 calc(var(--space-6) + var(--safe-left));
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding-top: var(--safe-top);
  min-height: var(--topbar-total-height);
}

.app-topbar-title {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-tight);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.app-topbar-company {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.app-topbar-company-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.app-topbar-company-select {
  min-width: 10rem;
  max-width: 16rem;
  width: auto;
  padding-block: var(--space-2);
  font-size: var(--font-size-sm);
}

.app-topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-muted);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.app-topbar-avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  color: #fff;
}

/* Desktop: Sair fica na sidebar; no PWA/mobile aparece no topbar */
.app-topbar-logout {
  display: none;
}

.app-main {
  grid-area: main;
  min-height: 0;
  padding: var(--space-6) var(--space-8);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-bottom) + var(--space-8));
  max-width: calc(var(--content-max-width) + var(--sidebar-width));
}

.app-bottom-nav {
  display: none;
}

/* Sheet "Mais" — fora do media query (hidden no desktop via display none no pai) */
.app-bottom-more {
  display: none;
}

/* ─── Page header ─── */
.page-header {
  margin-bottom: var(--space-8);
  animation: fadeIn var(--duration-slow) var(--ease-out);
}

.page-header h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-2);
}

.page-header p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  max-width: 560px;
}

/* ─── Mobile ─── */
@media (max-width: 1023px) {
  body[data-app-shell="true"] {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-total-height) 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }

  .app-topbar {
    padding-left: calc(var(--space-4) + var(--safe-left));
    padding-right: calc(var(--space-4) + var(--safe-right));
  }

  .app-topbar-title {
    font-size: var(--font-size-lg);
  }

  .app-sidebar { display: none; }

  .app-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    height: var(--bottom-nav-height);
    padding: 6px var(--space-2) calc(6px + var(--safe-bottom));
    background: var(--surface-glass);
    backdrop-filter: blur(24px) saturate(1.35);
    -webkit-backdrop-filter: blur(24px) saturate(1.35);
    border-top: 1px solid var(--border-subtle);
    z-index: var(--z-sticky);
    box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04), 0 -8px 32px rgba(15, 23, 42, 0.08);
  }

  .app-bottom-nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 4px 2px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color var(--duration-fast) var(--ease-out);
  }

  .app-bottom-nav-item:hover,
  .app-bottom-nav-item:focus-visible {
    color: var(--text-secondary);
    text-decoration: none;
    outline: none;
  }

  .app-bottom-nav-item:focus-visible .app-bottom-nav-icon {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  .app-bottom-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 32px;
    border-radius: var(--radius-full);
    transition:
      background var(--duration-normal) var(--ease-out),
      transform var(--duration-fast) var(--ease-out),
      color var(--duration-fast) var(--ease-out);
  }

  .app-bottom-nav-item:active .app-bottom-nav-icon {
    transform: scale(0.92);
  }

  .app-bottom-nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.85;
    flex-shrink: 0;
  }

  .app-bottom-nav-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
  }

  .app-bottom-nav-item.active {
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
  }

  .app-bottom-nav-item.active .app-bottom-nav-icon {
    background: var(--color-primary-subtle);
    color: var(--color-primary);
  }

  .app-bottom-nav-item.active svg {
    stroke-width: 2.25;
  }

  .app-bottom-more {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-sticky) + 10);
    pointer-events: none;
    visibility: hidden;
  }

  .app-bottom-more.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  .app-bottom-more-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    padding: 0;
    margin: 0;
    background: var(--surface-overlay);
    opacity: 0;
    cursor: pointer;
    transition: opacity var(--duration-normal) var(--ease-out);
  }

  .app-bottom-more.is-open .app-bottom-more-backdrop {
    opacity: 1;
  }

  .app-bottom-more-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(80dvh, 640px);
    padding: var(--space-3) var(--space-4) calc(var(--space-6) + var(--safe-bottom));
    background: var(--surface-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-xl);
    transform: translateY(100%);
    transition: transform var(--duration-normal) var(--ease-out);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-bottom-more.is-open .app-bottom-more-sheet {
    transform: translateY(0);
  }

  .app-bottom-more-handle {
    width: 36px;
    height: 4px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-full);
    background: var(--border-strong);
  }

  .app-bottom-more-title {
    margin: 0 0 var(--space-4);
    font-family: var(--font-display);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-tight);
    color: var(--text-primary);
  }

  .app-bottom-more-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .app-bottom-more-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .app-bottom-more-section-title {
    margin: 0 0 var(--space-1);
    padding: 0 var(--space-4);
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
  }

  .app-bottom-more-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: background var(--duration-fast);
  }

  .app-bottom-more-link:hover,
  .app-bottom-more-link:focus-visible {
    background: var(--surface-muted);
    text-decoration: none;
    outline: none;
  }

  .app-bottom-more-link.active {
    background: var(--color-primary-subtle);
    color: var(--color-primary);
  }

  .app-bottom-more-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    color: var(--text-secondary);
    flex-shrink: 0;
  }

  .app-bottom-more-link.active .app-bottom-more-icon {
    background: rgba(20, 184, 166, 0.2);
    color: var(--color-primary);
  }

  .app-bottom-more-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
  }

  body.app-bottom-more-open {
    overflow: hidden;
  }

  .app-main {
    padding: var(--space-4) var(--space-5);
    /* Reserva espaço do menu fixo para o conteúdo não ficar inacessível */
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-6));
  }

  body[data-app-shell="true"] .toast-container {
    bottom: calc(var(--bottom-nav-height) + var(--space-4));
  }

  .app-topbar-user span:not(.app-topbar-avatar) { display: none; }

  .app-topbar-company-label { display: none; }

  .app-topbar-company-select {
    min-width: 8rem;
    max-width: 11rem;
  }

  .app-topbar-logout {
    display: inline-flex;
  }
}

@media (max-width: 1023px) and (prefers-reduced-motion: reduce) {
  .app-bottom-nav-icon,
  .app-bottom-more-backdrop,
  .app-bottom-more-sheet {
    transition: none;
  }

  .app-bottom-nav-item:active .app-bottom-nav-icon {
    transform: none;
  }
}

/* ─── Dashboard ─── */
.dashboard-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .dashboard-grid {
    gap: var(--space-5);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.dashboard-section { margin-top: var(--space-10); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.section-header h2,
.section-header h3 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

/* Dashboard mobile / PWA / Android WebView */
@media (max-width: 639px) {
  .dashboard-section {
    margin-top: var(--space-6);
  }

  .dashboard-section .card:has(.dashboard-team-table) {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  .dashboard-section .card:has(.dashboard-team-table):hover {
    box-shadow: none;
  }

  .dashboard-section .card > .table-wrap {
    overflow: visible;
  }

  .dashboard-team-table thead {
    display: none;
  }

  .dashboard-team-table,
  .dashboard-team-table tbody {
    display: block;
    width: 100%;
  }

  .dashboard-team-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name name"
      "matricula saldo"
      "pendencies interval";
    gap: var(--space-2) var(--space-3);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
  }

  .dashboard-team-table tr:last-child {
    margin-bottom: 0;
  }

  .dashboard-team-table td {
    padding: 0;
    border: none;
    font-size: var(--font-size-sm);
  }

  .dashboard-team-table td:nth-child(1) { grid-area: name; }
  .dashboard-team-table td:nth-child(2) { grid-area: matricula; color: var(--text-muted); }
  .dashboard-team-table td:nth-child(3) { grid-area: saldo; text-align: right; font-weight: var(--font-weight-semibold); }
  .dashboard-team-table td:nth-child(4) {
    grid-area: pendencies;
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
  .dashboard-team-table td:nth-child(5) {
    grid-area: interval;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
  }

  .dashboard-team-table td[data-label]::before {
    content: attr(data-label);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--letter-wide);
  }

  .dashboard-team-table td:nth-child(3)::before {
    content: none;
  }

  .dashboard-team-table .table-row-clickable:hover {
    background: var(--surface-hover, rgba(13, 148, 136, 0.06));
  }
}

.login-legal {
  margin-top: var(--space-4);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.login-legal a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-legal a:hover {
  color: var(--color-primary);
}

/* ─── Páginas legais (privacidade / exclusão) ─── */
.legal-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-6);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
}

.legal-brand img {
  height: 40px;
  width: auto;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
}

.legal-nav a[aria-current="page"] {
  color: var(--color-primary-dark);
  font-weight: var(--font-weight-semibold);
}

.legal-main {
  flex: 1;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

.legal-doc h1 {
  margin-bottom: var(--space-3);
}

.legal-doc h2 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  font-size: var(--font-size-xl);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.legal-doc h3 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  font-size: var(--font-size-lg);
}

.legal-doc p,
.legal-doc li {
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.legal-doc ul,
.legal-doc ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-4);
}

.legal-doc code {
  font-size: 0.9em;
  background: var(--surface-muted);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

.legal-eyebrow {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-wide);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.legal-meta {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.legal-toc {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin: var(--space-6) 0;
}

.legal-toc h2 {
  margin-top: 0;
  border-bottom: none;
  font-size: var(--font-size-base);
}

.legal-toc ol {
  margin-bottom: 0;
}

.legal-table-wrap {
  overflow-x: auto;
  margin: var(--space-4) 0;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.legal-table th,
.legal-table td {
  text-align: left;
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  vertical-align: top;
}

.legal-table th {
  background: var(--surface-muted);
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.legal-steps {
  counter-reset: legal-step;
  list-style: none;
  padding-left: 0;
}

.legal-steps li {
  counter-increment: legal-step;
  position: relative;
  padding-left: var(--space-8);
  margin-bottom: var(--space-4);
}

.legal-steps li::before {
  content: counter(legal-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--text-on-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.legal-note {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.legal-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-default);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.legal-footer a {
  color: var(--text-secondary);
}
