/* ============================================================
 * Promanage Design System v1.0 — applied to GBP Phone Ticketing
 * Token source: webapp/doc/ProManage-Tokens.json
 * Spec:         webapp/doc/ProManage-Design-System.md
 * ============================================================ */

:root {
  /* ---- Colors ---------------------------------------------- */
  --pm-primary: #2563EB;
  --pm-primary-hover: #1D4ED8;
  --pm-primary-pressed: #1E40AF;
  --pm-primary-light: #DBEAFE;
  --pm-primary-subtle: #EFF6FF;

  --pm-background: #FFFFFF;
  --pm-surface: #FAFAFA;
  --pm-surface-card: #F8FAFC;
  --pm-surface-hover: #F1F5F9;
  --pm-surface-disabled: #E8EDF3;
  --pm-surface-selected: #EFF6FF;

  --pm-text: #0F172A;
  --pm-text-secondary: #334155;
  --pm-text-muted: #64748B;
  --pm-text-disabled: #94A3B8;
  --pm-text-inverse: #FFFFFF;
  --pm-text-link: #2563EB;

  --pm-border: #E2E8F0;
  --pm-border-strong: #CBD5E1;
  --pm-border-focus: #2563EB;
  --pm-border-error: #DC2626;

  --pm-success: #16A34A;
  --pm-success-dark: #15803D;
  --pm-success-light: #DCFCE7;
  --pm-success-subtle: #F0FDF4;

  --pm-warning: #D97706;
  --pm-warning-dark: #B45309;
  --pm-warning-light: #FEF3C7;
  --pm-warning-subtle: #FFFBEB;

  --pm-danger: #DC2626;
  --pm-danger-dark: #B91C1C;
  --pm-danger-light: #FEE2E2;
  --pm-danger-subtle: #FFF1F2;

  --pm-info: #2563EB;
  --pm-info-dark: #1D4ED8;
  --pm-info-light: #DBEAFE;
  --pm-info-subtle: #EFF6FF;

  --pm-disabled: #CBD5E1;
  --pm-placeholder: #94A3B8;
  --pm-overlay: rgba(0, 0, 0, 0.48);

  /* ---- Spacing -------------------------------------------- */
  --pm-space-xs: 4px;
  --pm-space-sm: 8px;
  --pm-space-compact: 10px;
  --pm-space-base: 12px;
  --pm-space-lg: 16px;
  --pm-space-xl: 20px;
  --pm-space-2xl: 24px;
  --pm-space-3xl: 32px;
  --pm-space-4xl: 40px;
  --pm-space-5xl: 48px;
  --pm-space-6xl: 64px;
  --pm-topbar-height: 64px;

  /* ---- Sizing --------------------------------------------- */
  --pm-icon-sm: 16px;
  --pm-icon: 20px;
  --pm-icon-lg: 24px;
  --pm-icon-xl: 32px;

  /* ---- Border radius -------------------------------------- */
  --pm-radius-none: 0;
  --pm-radius-xs: 2px;
  --pm-radius-sm: 4px;
  --pm-radius-base: 6px;
  --pm-radius-lg: 8px;
  --pm-radius-xl: 12px;
  --pm-radius-2xl: 16px;
  --pm-radius-pill: 999px;

  /* ---- Font sizes ----------------------------------------- */
  --pm-font-xxs: 10px;
  --pm-font-micro: 11px;
  --pm-font-xs: 12px;
  --pm-font-sm: 14px;
  --pm-font-base: 16px;
  --pm-font-lg: 18px;
  --pm-font-xl: 20px;
  --pm-font-2xl: 22px;
  --pm-font-3xl: 24px;
  --pm-font-4xl: 28px;

  /* ---- Component tokens ----------------------------------- */
  --pm-card-padding-v: 20px;
  --pm-card-padding-h: 24px;
  --pm-card-header-pt: 20px;
  --pm-card-header-pb: 16px;
  --pm-card-gap: 16px;
  --pm-card-inner-gap: 12px;
  --pm-card-radius: 8px;
  --pm-card-border: 1px;

  --pm-badge-padding-h: 8px;
  --pm-badge-padding-v: 2px;
  --pm-badge-radius: 999px;
  --pm-badge-font-size: 12px;

  --pm-avatar-sm: 24px;
  --pm-avatar-md: 32px;
  --pm-avatar-lg: 40px;
  --pm-avatar-xl: 56px;

  --pm-btn-height: 40px;
  --pm-btn-height-sm: 32px;
  --pm-btn-height-lg: 48px;

  --pm-input-height: 40px;

  --pm-table-cell-padding-h: 16px;
  --pm-table-cell-padding-v: 12px;
  --pm-table-row-height: 48px;

  /* ---- Shadows -------------------------------------------- */
  --pm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --pm-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --pm-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --pm-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.14);

  /* ---- Opacity -------------------------------------------- */
  --pm-opacity-disabled: 0.4;
  --pm-opacity-hover: 0.8;

  /* ---- Transitions ---------------------------------------- */
  --pm-transition-fast: 150ms ease-out;
  --pm-transition-base: 200ms ease-out;
  --pm-transition-slow: 300ms ease-out;

  /* ---- z-index -------------------------------------------- */
  --pm-z-sticky: 200;
  --pm-z-dropdown: 300;
  --pm-z-panel: 400;
  --pm-z-modal: 500;
  --pm-z-toast: 600;

  /* ---- Typography font stacks ----------------------------- */
  --pm-font-sans: 'Inter', -apple-system, BlinkMacSystemFont,
                  'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --pm-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular,
                  Menlo, Consolas, monospace;
}

/* ============================================================
 * Base
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--pm-font-sans);
  font-size: var(--pm-font-sm);
  line-height: 20px;
  color: var(--pm-text);
  background: var(--pm-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

a {
  color: var(--pm-text-link);
  text-decoration: none;
  transition: color var(--pm-transition-fast);
}
a:hover { text-decoration: underline; }

code, kbd, pre, samp {
  font-family: var(--pm-font-mono);
  font-size: 0.92em;
}
code {
  background: var(--pm-surface-hover);
  padding: 0.1rem 0.4rem;
  border-radius: var(--pm-radius-sm);
  color: var(--pm-text-secondary);
}

/* ---- Typography utility (per spec §3.4) ------------------- */
.pm-text-h1         { font-size: var(--pm-font-3xl); font-weight: 600; line-height: 32px; letter-spacing: -0.01em; color: var(--pm-text); margin: 0; }
.pm-text-h2         { font-size: var(--pm-font-xl);  font-weight: 600; line-height: 28px; color: var(--pm-text); margin: 0; }
.pm-text-h3         { font-size: var(--pm-font-base); font-weight: 600; line-height: 24px; color: var(--pm-text); margin: 0; }
.pm-text-h4         { font-size: var(--pm-font-sm);  font-weight: 600; line-height: 20px; color: var(--pm-text); margin: 0; }
.pm-text-body       { font-size: var(--pm-font-sm);  font-weight: 400; line-height: 20px; color: var(--pm-text); }
.pm-text-body-medium{ font-size: var(--pm-font-sm);  font-weight: 500; line-height: 20px; color: var(--pm-text); }
.pm-text-label      { font-size: var(--pm-font-sm);  font-weight: 500; line-height: 20px; color: var(--pm-text-secondary); }
.pm-text-small      { font-size: var(--pm-font-xs);  font-weight: 400; line-height: 16px; color: var(--pm-text-muted); }
.pm-text-caption    { font-size: var(--pm-font-xs);  font-weight: 400; line-height: 16px; color: var(--pm-text-muted); }
.pm-text-micro      { font-size: var(--pm-font-micro); font-weight: 500; line-height: 14px; letter-spacing: 0.04em; color: var(--pm-text-muted); text-transform: uppercase; }
.pm-text-mono       { font-family: var(--pm-font-mono); font-size: var(--pm-font-sm); line-height: 20px; }

.muted { color: var(--pm-text-muted); font-size: var(--pm-font-xs); line-height: 16px; }
.ok    { color: var(--pm-success); font-weight: 500; }
.warn  { color: var(--pm-warning-dark); }
.err   { color: var(--pm-danger); }

/* ============================================================
 * Layout — Topbar + page content
 * ============================================================ */

/* ============================================================
 * App shell — sidebar + main, signed-in pages
 * ============================================================ */
.app-shell { min-height: 100vh; }

.sidebar {
  /* Royal-blue theme tokens — scoped to the sidebar only */
  --sb-bg:           #3D54EA;
  --sb-bg-hover:     #2D43D6;
  --sb-bg-active:    #1F32C0;
  --sb-border:       #2D43D6;
  --sb-text:         #EEF2FF;
  --sb-text-muted:   #C7D2FE;
  --sb-text-active:  #FFFFFF;

  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  z-index: var(--pm-z-sticky);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--pm-space-base);
  padding: var(--pm-space-lg) var(--pm-space-xl);
  border-bottom: 1px solid var(--sb-border);
  color: var(--sb-text);
  text-decoration: none;
  min-height: var(--pm-topbar-height);
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img {
  display: block;
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
}
.sidebar-brand-product {
  font-size: var(--pm-font-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.10);
  color: var(--sb-text-active);
  border-radius: var(--pm-radius-sm);
}

.sidebar-nav {
  flex: 1;
  padding: var(--pm-space-lg) var(--pm-space-base);
  overflow-y: auto;
}
.sidebar-section { margin-bottom: var(--pm-space-xl); }
.sidebar-section-label {
  display: block;
  font-size: var(--pm-font-micro);
  font-weight: 600;
  color: var(--sb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 var(--pm-space-base);
  margin-bottom: var(--pm-space-xs);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--pm-space-base);
  padding: var(--pm-space-sm) var(--pm-space-base);
  margin: 2px 0;
  border-radius: var(--pm-radius-base);
  color: var(--sb-text);
  font-size: var(--pm-font-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--pm-transition-fast),
              color var(--pm-transition-fast);
}
.sidebar-item:hover {
  background: var(--sb-bg-hover);
  color: var(--sb-text-active);
  text-decoration: none;
}
.sidebar-item.is-active {
  background: var(--sb-bg-active);
  color: var(--sb-text-active);
  font-weight: 600;
}
.sidebar-item svg {
  flex-shrink: 0;
  color: inherit;
  opacity: 0.85;
}
.sidebar-item.is-active svg { opacity: 1; }

/* Pending / disabled / rejected users see the full sidebar so they
   understand what they'll get once approved, but the feature links
   become non-interactive — the route handlers also enforce this, the
   visual treatment is just so the UI doesn't lie. */
.sidebar-item.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
}
.sidebar-item.is-disabled:hover {
  background: transparent;
  color: var(--sb-text);
}

/* Small status banner shown in the sidebar above the nav for
   non-approved users so the reason for the disabled nav is obvious. */
.sidebar-access-banner {
  margin: var(--pm-space-base) var(--pm-space-base) var(--pm-space-lg);
  padding: var(--pm-space-sm) var(--pm-space-base);
  border-radius: var(--pm-radius-base);
  background: rgba(245, 158, 11, 0.12);
  border-left: 3px solid #F59E0B;
  color: var(--sb-text-active);
  font-size: var(--pm-font-xs);
  line-height: 1.4;
}
.sidebar-access-banner strong {
  display: block;
  margin-bottom: 2px;
  font-size: var(--pm-font-sm);
  color: #F59E0B;
}
.sidebar-access-banner.is-rejected,
.sidebar-access-banner.is-disabled-status {
  background: rgba(220, 38, 38, 0.12);
  border-left-color: #DC2626;
}
.sidebar-access-banner.is-rejected strong,
.sidebar-access-banner.is-disabled-status strong {
  color: #DC2626;
}

.sidebar-footer {
  padding: var(--pm-space-lg) var(--pm-space-xl);
  border-top: 1px solid var(--sb-border);
  background: var(--sb-bg);
}
.sidebar-footer .user-chip {
  display: flex;
  align-items: center;
  gap: var(--pm-space-sm);
  margin: 0 0 var(--pm-space-sm);
}
.sidebar-footer .user-chip img {
  width: var(--pm-avatar-md);
  height: var(--pm-avatar-md);
  border-radius: var(--pm-radius-pill);
  border: 1px solid var(--sb-border);
  object-fit: cover;
}
.user-avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--pm-avatar-md);
  height: var(--pm-avatar-md);
  border-radius: var(--pm-radius-pill);
  background: linear-gradient(135deg, #6366F1 0%, #3B82F6 100%);
  color: #FFFFFF;
  font-weight: 600;
  font-size: var(--pm-font-base);
  flex-shrink: 0;
  text-transform: uppercase;
  border: 1px solid var(--sb-border);
}
.user-chip-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-chip-name {
  font-size: var(--pm-font-sm);
  font-weight: 500;
  color: var(--sb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-email {
  font-size: var(--pm-font-xs);
  color: var(--sb-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  display: block;
  color: var(--sb-text-muted);
  font-size: var(--pm-font-xs);
  font-weight: 500;
}
.sidebar-logout:hover { color: #FCA5A5; text-decoration: none; }

/* ---- Main content area shift ---- */
.app-main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; --pm-sidebar-half: 120px; }
.app-main.is-public { margin-left: 0; --pm-sidebar-half: 0px; }
.app-main > main { flex: 1; }

/* ---- Footer ---- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pm-space-lg) var(--pm-space-2xl);
  margin-top: var(--pm-space-2xl);
  text-align: center;
  font-size: var(--pm-font-xs);
  color: var(--pm-text-muted);
  border-top: 1px solid var(--pm-border);
  background: var(--pm-surface);
}

/* ---- Access status pages (pending / denied / disabled) ---- */
.access-card {
  max-width: 32rem;
  margin: var(--pm-space-6xl) auto;
  background: #fff;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-lg, 12px);
  padding: var(--pm-space-3xl) var(--pm-space-3xl);
  text-align: center;
  box-shadow: var(--pm-shadow-sm);
}
.access-card h1 {
  margin: var(--pm-space-lg) 0 var(--pm-space-sm);
  font-size: var(--pm-font-3xl);
  font-weight: 600;
  color: var(--pm-text);
}
.access-card p { margin: var(--pm-space-sm) 0; color: var(--pm-text-secondary); }
.access-card .muted { color: var(--pm-text-muted); }
.access-icon { display: flex; justify-content: center; }
.access-actions { margin-top: var(--pm-space-2xl); }

/* ---- Row action button group (admin user list) ---- */
.row-actions { display: flex; gap: var(--pm-space-xs); flex-wrap: wrap; }
.btn-xs { height: 26px; padding: 0 10px; font-size: var(--pm-font-xs); border-radius: 4px; }
.btn.danger {
  background: #DC2626; border-color: #DC2626; color: #fff;
}
.btn.danger:hover { background: #B91C1C; border-color: #B91C1C; }

/* ---- Admin dashboard: KPI cards, online dot, event badges ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--pm-space-lg);
  margin-bottom: var(--pm-space-2xl);
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-lg, 10px);
  padding: var(--pm-space-lg) var(--pm-space-xl);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label {
  font-size: var(--pm-font-micro);
  font-weight: 600;
  color: var(--pm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-value {
  font-size: var(--pm-font-3xl);
  font-weight: 700;
  color: var(--pm-text);
  display: flex;
  align-items: center;
  gap: var(--pm-space-sm);
  line-height: 1.1;
}
.kpi-hint {
  font-size: var(--pm-font-xs);
  color: var(--pm-text-muted);
}
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
  animation: online-pulse 2s ease-in-out infinite;
}
@keyframes online-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
  50%       { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.06); }
}
.event-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--pm-radius-sm, 4px);
  background: #EEF2FF;
  color: #4338CA;
  font-family: var(--pm-font-mono);
  font-size: var(--pm-font-xs);
  font-weight: 500;
}

/* ---- History page: filter bar, sortable headers, pager ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--pm-space-base);
  margin-bottom: var(--pm-space-lg);
  padding-bottom: var(--pm-space-base);
  border-bottom: 1px solid var(--pm-border);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { color: var(--pm-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.filter-group select,
.filter-group input[type="date"] {
  height: 32px;
  padding: 0 var(--pm-space-sm);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-base, 6px);
  background: #fff;
  font-size: var(--pm-font-sm);
  color: var(--pm-text);
  min-width: 140px;
}
.filter-group select:focus,
.filter-group input[type="date"]:focus {
  outline: none;
  border-color: var(--pm-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.filter-actions { display: flex; gap: var(--pm-space-sm); margin-left: auto; }

.data.sortable th { padding: 0; }
.sort-th {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pm-space-xs);
  padding: var(--pm-space-base) var(--pm-table-cell-padding-h, 12px);
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
}
.sort-th:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.18); }
.sort-th.is-active { color: #FFFFFF; }
.sort-icon { font-size: var(--pm-font-xs); color: #E0F7FB; }
.sort-th.is-active .sort-icon { color: #FFFFFF; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pm-space-base);
  flex-wrap: wrap;
  margin-top: var(--pm-space-lg);
  padding-top: var(--pm-space-base);
  border-top: 1px solid var(--pm-border);
}
.pager-info { color: var(--pm-text-secondary); }
.pager-size { display: flex; align-items: center; gap: var(--pm-space-sm); }
.pager-size select {
  height: 30px;
  padding: 0 var(--pm-space-sm);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-base, 6px);
  background: #fff;
  font-size: var(--pm-font-sm);
}
.inline-form { display: inline; margin: 0; }
.pager-nav { display: flex; align-items: center; gap: var(--pm-space-xs); }
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--pm-space-sm);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-base, 6px);
  background: #fff;
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-base);
  line-height: 1;
  text-decoration: none;
}
.pager-btn:hover { background: var(--pm-surface-hover); color: var(--pm-text); text-decoration: none; }
.pager-btn.is-disabled { color: var(--pm-text-disabled); background: var(--pm-surface-disabled); cursor: not-allowed; }
.pager-page { padding: 0 var(--pm-space-sm); color: var(--pm-text-secondary); font-size: var(--pm-font-sm); }

/* ---- Public topbar (signed-out pages) ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--pm-space-2xl);
  height: var(--pm-topbar-height);
  padding: 0 var(--pm-space-3xl);
  background: var(--pm-background);
  border-bottom: 1px solid var(--pm-border);
  position: sticky;
  top: 0;
  z-index: var(--pm-z-sticky);
}
.topbar.topbar-public { background: var(--pm-background); }
.topbar .public-nav { margin-left: auto; display: flex; align-items: center; gap: var(--pm-space-lg); }
.topbar .public-nav a { color: var(--pm-text-secondary); font-size: var(--pm-font-sm); font-weight: 500; }
.topbar .public-nav a:hover { color: var(--pm-text); text-decoration: none; }

.brand {
  display: flex;
  align-items: center;
  gap: var(--pm-space-base);
  color: var(--pm-text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 36px; width: auto; }
.brand-divider {
  display: inline-block;
  width: 1px;
  height: var(--pm-space-2xl);
  background: var(--pm-border);
}
.brand-product {
  font-size: var(--pm-font-sm);
  font-weight: 600;
  color: var(--pm-text);
  letter-spacing: -0.005em;
}

/* ---- Main content area --------------------------------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--pm-space-2xl) var(--pm-space-3xl);
}

/* ---- Page header (§5.2) -------------------------------- */
.page-header {
  margin-bottom: var(--pm-space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-xs);
}
.page-header h1 { margin: 0; }
.page-subtitle { margin: 0; color: var(--pm-text-muted); }

/* ---- Job detail — stat row ----------------------------- */
.job-stat-row {
  display: flex;
  gap: var(--pm-space-4xl);
  align-items: center;
  margin-bottom: var(--pm-space-base);
}
.job-stat {
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-xs);
}
.job-stat .pm-text-micro { color: var(--pm-text-muted); }

/* ---- Inline status line with icon --------------------- */
.status-line {
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-sm);
  margin: var(--pm-space-base) 0;
  font-size: var(--pm-font-sm);
  font-weight: 500;
}
.status-line svg { flex-shrink: 0; }

/* ============================================================
 * Card (§4.1 — canonical pattern)
 * ============================================================ */

.card {
  background: var(--pm-surface-card);
  border: var(--pm-card-border) solid var(--pm-border);
  border-radius: var(--pm-card-radius);
  box-shadow: var(--pm-shadow-sm);
  padding: var(--pm-card-padding-v) var(--pm-card-padding-h);
  margin-bottom: var(--pm-card-gap);
}
.card > h2 { font-size: var(--pm-font-xl); font-weight: 600; line-height: 28px; margin: 0 0 var(--pm-space-sm); color: var(--pm-text); letter-spacing: -0.005em; }
.card > h3 { font-size: var(--pm-font-base); font-weight: 600; line-height: 24px; margin: 0 0 var(--pm-space-sm); color: var(--pm-text); }
.card > h3 + p,
.card > h2 + p { margin-top: 0; }
.card p { margin: var(--pm-space-sm) 0; line-height: 20px; }
.card > .actions { margin-top: var(--pm-space-base); }

/* ============================================================
 * Buttons (§4.4 - §4.7)
 * ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pm-space-sm);
  height: var(--pm-btn-height);
  padding: 0 var(--pm-space-lg);
  font-family: inherit;
  font-size: var(--pm-font-sm);
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-base);
  background: var(--pm-background);
  color: var(--pm-primary);
  cursor: pointer;
  transition: background var(--pm-transition-base),
              border-color var(--pm-transition-base),
              color var(--pm-transition-base);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  background: var(--pm-primary-subtle);
  border-color: var(--pm-primary);
  text-decoration: none;
}
.btn:active { background: var(--pm-primary-light); }
.btn:focus-visible {
  outline: 2px solid var(--pm-border-focus);
  outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] {
  opacity: var(--pm-opacity-disabled);
  pointer-events: none;
}

.btn.primary {
  background: var(--pm-primary);
  border-color: var(--pm-primary);
  color: var(--pm-text-inverse);
}
.btn.primary:hover  { background: var(--pm-primary-hover);  border-color: var(--pm-primary-hover); }
.btn.primary:active { background: var(--pm-primary-pressed); border-color: var(--pm-primary-pressed); }

.btn.danger,
.btn.destructive {
  background: var(--pm-danger);
  border-color: var(--pm-danger);
  color: var(--pm-text-inverse);
}
.btn.danger:hover { background: var(--pm-danger-dark); border-color: var(--pm-danger-dark); }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--pm-text-secondary);
}
.btn.ghost:hover {
  background: var(--pm-surface-hover);
  color: var(--pm-text);
}

.actions { display: flex; gap: var(--pm-space-sm); flex-wrap: wrap; align-items: center; }

/* ============================================================
 * Badge (§4.3)
 * ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--pm-badge-padding-v) var(--pm-badge-padding-h);
  border-radius: var(--pm-badge-radius);
  font-size: var(--pm-badge-font-size);
  font-weight: 600;
  line-height: 16px;
  background: var(--pm-info-light);
  color: var(--pm-info-dark);
  white-space: nowrap;
}
.badge.st-pending,
.badge.st-created       { background: var(--pm-surface-hover);   color: var(--pm-text-secondary); }
.badge.st-running,
.badge.st-paused        { background: var(--pm-warning-light);   color: var(--pm-warning-dark); }
.badge.st-submitted,
.badge.st-done          { background: var(--pm-success-light);   color: var(--pm-success-dark); }
.badge.st-failed,
.badge.st-cancelled     { background: var(--pm-danger-light);    color: var(--pm-danger-dark); }

/* ============================================================
 * Inputs (§4.8)
 * ============================================================ */

input[type="text"],
input[type="email"],
input[type="file"],
input:not([type]),
textarea,
select {
  height: var(--pm-input-height);
  padding: var(--pm-space-sm) var(--pm-space-base);
  background: var(--pm-background);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-base);
  font-family: inherit;
  font-size: var(--pm-font-sm);
  color: var(--pm-text);
  transition: border-color var(--pm-transition-base);
}
input[type="file"] {
  height: auto;
  padding: var(--pm-space-sm);
}
input:hover, textarea:hover, select:hover { border-color: var(--pm-border-strong); }
input:focus, textarea:focus, select:focus {
  border: 2px solid var(--pm-border-focus);
  outline: none;
  padding: calc(var(--pm-space-sm) - 1px) calc(var(--pm-space-base) - 1px);
}
input::placeholder, textarea::placeholder { color: var(--pm-placeholder); }
input:disabled, textarea:disabled, select:disabled {
  background: var(--pm-surface-disabled);
  color: var(--pm-text-disabled);
}

.upload-form { display: flex; gap: var(--pm-space-base); align-items: center; flex-wrap: wrap; }

/* ============================================================
 * Table (§4.9 — flat, no shadow)
 * ============================================================ */

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--pm-background);
  margin: 0;
}
table.data thead th {
  background: #4FC3DD;
  font-size: var(--pm-font-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFFFFF;
  padding: var(--pm-table-cell-padding-v) var(--pm-table-cell-padding-h);
  border-bottom: 1px solid #38ABC7;
  text-align: left;
  white-space: nowrap;
}
table.data tbody td {
  padding: var(--pm-table-cell-padding-v) var(--pm-table-cell-padding-h);
  border-bottom: 1px solid var(--pm-border);
  font-size: var(--pm-font-sm);
  color: var(--pm-text);
  vertical-align: top;
  line-height: 20px;
}
table.data tbody tr { transition: background-color var(--pm-transition-fast); }
table.data tbody tr:hover { background: var(--pm-surface-hover); }
table.data tbody td .muted { display: block; margin-top: 2px; }

/* ============================================================
 * Landing — hero + how-it-works
 * ============================================================ */

.hero {
  text-align: center;
  padding: var(--pm-space-6xl) var(--pm-space-lg) var(--pm-space-4xl);
}
.hero-logo {
  display: block;
  margin: 0 auto var(--pm-space-xl);
  height: 56px;
  width: auto;
}
.hero h1 {
  font-size: var(--pm-font-4xl);
  font-weight: 700;
  line-height: 36px;
  margin: 0 0 var(--pm-space-base);
  color: var(--pm-text);
  letter-spacing: -0.02em;
}
.hero .lead {
  font-size: var(--pm-font-base);
  line-height: 24px;
  color: var(--pm-text-muted);
  max-width: 36rem;
  margin: 0 auto var(--pm-space-2xl);
}
.hero .btn.primary {
  height: var(--pm-btn-height-lg);
  padding: 0 var(--pm-space-xl);
  font-size: var(--pm-font-base);
}

.overview {
  max-width: 56rem;
  margin: 0 auto var(--pm-space-4xl);
  background: var(--pm-surface-card);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-card-radius);
  box-shadow: var(--pm-shadow-sm);
  padding: var(--pm-space-3xl) var(--pm-space-4xl);
}
.overview h2 {
  text-align: center;
  margin: 0 0 var(--pm-space-2xl);
  font-size: var(--pm-font-xl);
  font-weight: 600;
  line-height: 28px;
  color: var(--pm-text);
  letter-spacing: -0.005em;
}
.overview-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--pm-card-inner-gap);
}
.overview-steps > li {
  padding: var(--pm-space-lg) var(--pm-space-xl);
  border-left: 3px solid var(--pm-primary);
  background: var(--pm-primary-subtle);
  border-radius: 0 var(--pm-radius-base) var(--pm-radius-base) 0;
}
.overview-steps h3 {
  margin: 0 0 var(--pm-space-xs);
  font-size: var(--pm-font-sm);
  font-weight: 600;
  color: var(--pm-text);
}
.overview-steps p {
  margin: 0;
  font-size: var(--pm-font-sm);
  color: var(--pm-text-secondary);
  line-height: 20px;
}
.overview-footer { text-align: center; margin-top: var(--pm-space-2xl); }

/* ============================================================
 * User manual page
 * ============================================================ */

.manual {
  max-width: 52rem;
  margin: 0 auto;
  background: var(--pm-surface-card);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-card-radius);
  box-shadow: var(--pm-shadow-sm);
  padding: var(--pm-space-4xl) var(--pm-space-5xl);
}
.manual-header {
  margin-bottom: var(--pm-space-3xl);
  padding-bottom: var(--pm-space-xl);
  border-bottom: 1px solid var(--pm-border);
}
.manual-header h1 {
  margin: 0 0 var(--pm-space-xs);
  font-size: var(--pm-font-3xl);
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.01em;
}
.manual section {
  margin-bottom: var(--pm-space-3xl);
  scroll-margin-top: calc(var(--pm-topbar-height) + var(--pm-space-base));
}
.manual h2 {
  font-size: var(--pm-font-xl);
  font-weight: 600;
  line-height: 28px;
  margin: 0 0 var(--pm-space-base);
  color: var(--pm-text);
  letter-spacing: -0.005em;
}
.manual h3 {
  font-size: var(--pm-font-base);
  font-weight: 600;
  line-height: 24px;
  margin: var(--pm-space-xl) 0 var(--pm-space-xs);
  color: var(--pm-text);
}
.manual p {
  margin: var(--pm-space-sm) 0;
  font-size: var(--pm-font-sm);
  line-height: 22px;
  color: var(--pm-text-secondary);
}
.manual ul, .manual ol {
  margin: var(--pm-space-sm) 0;
  padding-left: var(--pm-space-xl);
  color: var(--pm-text-secondary);
}
.manual ul li, .manual ol li {
  margin: var(--pm-space-xs) 0;
  line-height: 22px;
}
.manual code {
  background: var(--pm-surface-hover);
  padding: 0.1rem var(--pm-space-xs);
  border-radius: var(--pm-radius-sm);
  font-size: 0.88em;
  color: var(--pm-text-secondary);
}
.manual-steps { padding-left: var(--pm-space-xl); }
.manual-steps > li { margin: var(--pm-space-base) 0; line-height: 22px; }

.manual-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--pm-space-base) 0;
  font-size: var(--pm-font-sm);
  background: var(--pm-background);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-base);
  overflow: hidden;
}
.manual-table th, .manual-table td {
  text-align: left;
  padding: var(--pm-space-base) var(--pm-table-cell-padding-h);
  border-bottom: 1px solid var(--pm-border);
  vertical-align: top;
}
.manual-table thead th {
  background: var(--pm-surface);
  color: var(--pm-text-secondary);
  font-weight: 600;
  font-size: var(--pm-font-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.manual-table tbody tr:last-child td { border-bottom: none; }
.manual-table.small { font-size: var(--pm-font-xs); }
.manual-table.small td:first-child {
  width: 2.5rem;
  color: var(--pm-text-muted);
  font-weight: 600;
}

/* Callout (§4.13 alert pattern) ------------------------------ */
.callout {
  margin: var(--pm-space-lg) 0;
  padding: var(--pm-space-lg);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-info-subtle);
  border-left: 4px solid var(--pm-info);
  font-size: var(--pm-font-sm);
  line-height: 20px;
  color: var(--pm-text-secondary);
}
.callout strong { color: var(--pm-text); }
.callout.warn {
  background: var(--pm-warning-subtle);
  border-left-color: var(--pm-warning);
}
.callout.danger {
  background: var(--pm-danger-subtle);
  border-left-color: var(--pm-danger);
}

.manual-footer {
  margin-top: var(--pm-space-2xl);
  padding-top: var(--pm-space-xl);
  border-top: 1px solid var(--pm-border);
  font-size: var(--pm-font-xs);
  color: var(--pm-text-muted);
  line-height: 18px;
}

/* Sticky TOC -------------------------------------------------- */
.toc {
  position: fixed;
  right: max(var(--pm-space-lg), calc((100vw - 52rem)/2 - 12rem - var(--pm-space-lg) - var(--pm-sidebar-half, 0px)));
  top: calc(var(--pm-topbar-height) + var(--pm-space-xl));
  width: 12rem;
}
.toc h4 {
  margin: 0 0 var(--pm-space-sm);
  font-size: var(--pm-font-micro);
  color: var(--pm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.toc ol {
  padding-left: var(--pm-space-base);
  margin: 0;
  list-style: decimal;
}
.toc ol li { margin: var(--pm-space-xs) 0; line-height: 18px; font-size: var(--pm-font-xs); }
.toc a { color: var(--pm-text-muted); }
.toc a:hover { color: var(--pm-primary); text-decoration: none; }
@media (max-width: 1520px) {
  .toc { display: none; }
}

/* ============================================================
 * Job detail — live progress log
 * ============================================================ */

#live-log {
  list-style: none;
  padding: var(--pm-space-base) var(--pm-space-lg);
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--pm-text);
  color: var(--pm-text-inverse);
  border-radius: var(--pm-radius-lg);
  font-family: var(--pm-font-mono);
  font-size: var(--pm-font-xs);
  line-height: 18px;
}
#live-log li { padding: 0.1rem 0; }

#live-empty { font-style: italic; }

/* ============================================================
 * Misc / utilities
 * ============================================================ */

.welcome h2 { margin: 0 0 var(--pm-space-xs); }

/* Step labels in job-detail row table */
table.data .step { font-family: var(--pm-font-mono); font-size: var(--pm-font-xs); }
table.data .ticket { font-family: var(--pm-font-mono); font-size: var(--pm-font-xs); color: var(--pm-success-dark); }

/* ============================================================
 * Multi-tool platform UI — launcher cards, breadcrumbs, filter chips
 * ============================================================ */

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--pm-space-xs);
  margin-bottom: var(--pm-space-base);
  color: var(--pm-text-muted);
  font-size: var(--pm-font-xs);
}
.breadcrumbs a {
  color: var(--pm-text-muted);
  font-weight: 500;
}
.breadcrumbs a:hover { color: var(--pm-primary); text-decoration: none; }
.breadcrumbs .sep {
  color: var(--pm-border-strong);
  font-weight: 400;
}
.breadcrumbs .current {
  color: var(--pm-text);
  font-weight: 600;
}

/* ---- Sub-tab strip (per design system §4.15) ----------- */
.subtab-strip {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--pm-border);
  margin-bottom: var(--pm-space-xl);
  overflow-x: auto;
}
.subtab {
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-sm);
  padding: var(--pm-space-base) var(--pm-space-xl);
  font-size: var(--pm-font-sm);
  font-weight: 500;
  color: var(--pm-text-secondary);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-top-left-radius: var(--pm-radius-sm);
  border-top-right-radius: var(--pm-radius-sm);
  transition: color var(--pm-transition-fast),
              background-color var(--pm-transition-fast),
              border-color var(--pm-transition-fast),
              font-weight var(--pm-transition-fast);
  white-space: nowrap;
  text-decoration: none;
}
.subtab:hover {
  color: var(--pm-text);
  background: var(--pm-surface-hover);
  text-decoration: none;
}
.subtab.is-active {
  color: var(--pm-primary);
  border-bottom-color: var(--pm-primary);
  font-weight: 700;
  background: var(--pm-primary-subtle);
}
.subtab.is-active:hover { background: var(--pm-primary-subtle); }

.tool-grid-section { margin-bottom: var(--pm-space-3xl); }
.section-heading { margin: 0 0 var(--pm-space-lg); color: var(--pm-text); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--pm-card-gap);
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-base);
  background: var(--pm-surface-card);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-card-radius);
  box-shadow: var(--pm-shadow-sm);
  padding: var(--pm-card-padding-v) var(--pm-card-padding-h);
  color: var(--pm-text);
  text-decoration: none;
  transition: box-shadow var(--pm-transition-base),
              border-color var(--pm-transition-base),
              transform var(--pm-transition-base);
  min-height: 200px;
}
.tool-card:hover {
  box-shadow: var(--pm-shadow-md);
  border-color: var(--pm-primary);
  text-decoration: none;
  transform: translateY(-1px);
}
.tool-card:active { transform: translateY(0); }

.tool-card-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--pm-primary-subtle);
  color: var(--pm-primary);
  border-radius: var(--pm-radius-lg);
}
.tool-card-icon svg { display: block; }

.tool-card-body { flex: 1; }
.tool-card-body h3 { margin: 0 0 var(--pm-space-xs); }
.tool-card-body p {
  margin: 0;
  color: var(--pm-text-muted);
  font-size: var(--pm-font-sm);
  line-height: 20px;
}

.tool-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--pm-space-base);
  border-top: 1px solid var(--pm-border);
}
.tool-card-meta .pm-text-micro {
  color: var(--pm-text-muted);
  letter-spacing: 0.08em;
}
.tool-card-cta {
  color: var(--pm-primary);
  font-weight: 500;
  font-size: var(--pm-font-sm);
}

/* History tool filter -------------------------------------- */
.filter-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--pm-space-sm);
  margin-bottom: var(--pm-space-lg);
}
.filter-row .pm-text-micro {
  color: var(--pm-text-muted);
  margin-right: var(--pm-space-xs);
}
.filter-chip {
  display: inline-flex;
  padding: var(--pm-space-xs) var(--pm-space-base);
  border-radius: var(--pm-radius-pill);
  background: var(--pm-surface);
  border: 1px solid var(--pm-border);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-xs);
  font-weight: 500;
  transition: background var(--pm-transition-fast), color var(--pm-transition-fast);
}
.filter-chip:hover {
  background: var(--pm-surface-hover);
  text-decoration: none;
  color: var(--pm-text);
}
.filter-chip.is-active {
  background: var(--pm-primary-subtle);
  border-color: var(--pm-primary);
  color: var(--pm-primary);
}

/* ============================================================
 * Animations — kept short and subtle. Pages, badges, and the
 * mobile drawer all share the same easing curve for cohesion.
 * Respects prefers-reduced-motion at the bottom of this file.
 * ============================================================ */

@keyframes pm-fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pm-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pm-slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes pm-pulse-soft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}
@keyframes pm-pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}
@keyframes pm-spinner {
  to { transform: rotate(360deg); }
}
@keyframes pm-shimmer {
  0%   { background-position: -480px 0; }
  100% { background-position: 480px 0; }
}
@keyframes pm-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* Subtle entry animation on every page change — feels snappy without
   getting in the way. Only on the main column so the sidebar/topbar
   don't re-flash on each navigation. */
.app-main > main { animation: pm-fade-in-up 320ms ease-out both; }

/* "Running" job badges get a soft pulsing ring to draw the eye to
   active rows in tables and on the dashboard. */
.badge.st-running { animation: pm-pulse-soft 1.8s ease-in-out infinite; }

/* Status-line OK gets a one-shot fade so a successful action is felt,
   not just seen. */
.status-line.ok { animation: pm-fade-in 280ms ease-out both; }

/* Reusable inline spinner — drop into buttons or status lines. */
.pm-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pm-spinner 700ms linear infinite;
  vertical-align: -3px;
}
.pm-spinner.lg { width: 28px; height: 28px; border-width: 3px; }
.btn .pm-spinner { margin-right: 8px; }

/* Skeleton block for loading placeholders. */
.pm-skeleton {
  background: linear-gradient(
    90deg,
    var(--pm-surface-hover) 0%,
    var(--pm-surface) 50%,
    var(--pm-surface-hover) 100%
  );
  background-size: 960px 100%;
  animation: pm-shimmer 1.4s linear infinite;
  border-radius: var(--pm-radius-sm);
  min-height: 14px;
}

/* Soft focus ring for primary buttons + CTAs that doesn't compete
   with the design but is clearly visible for keyboard users. */
.btn.primary:focus-visible,
.tool-card:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

/* ============================================================
 * Mobile topbar — visible only when the sidebar is collapsed.
 * Sticky so the hamburger is always reachable on long pages.
 * ============================================================ */

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: var(--pm-z-sticky);
  height: 56px;
  padding: 0 var(--pm-space-base);
  background: #fff;
  border-bottom: 1px solid var(--pm-border);
  align-items: center;
  gap: var(--pm-space-base);
  box-shadow: var(--pm-shadow-sm);
}
.mobile-topbar .hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--pm-radius-base);
  background: transparent;
  border: none;
  color: var(--pm-text-secondary);
  cursor: pointer;
  transition: background var(--pm-transition-fast),
              color var(--pm-transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.mobile-topbar .hamburger:hover,
.mobile-topbar .hamburger:focus-visible {
  background: var(--pm-surface-hover);
  color: var(--pm-text);
}
.mobile-topbar .brand {
  display: flex;
  align-items: center;
  gap: var(--pm-space-sm);
  text-decoration: none;
  color: var(--pm-text);
}
.mobile-topbar .brand img { height: 24px; width: auto; display: block; }
.mobile-topbar .brand-product {
  font-size: var(--pm-font-xxs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 5px;
  background: var(--pm-primary-subtle);
  color: var(--pm-primary);
  border-radius: var(--pm-radius-sm);
}
.mobile-topbar .spacer { margin-left: auto; }
.mobile-topbar .mobile-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--pm-primary-subtle);
  color: var(--pm-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: var(--pm-font-sm);
  flex-shrink: 0;
  overflow: hidden;
}
.mobile-topbar .mobile-avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Backdrop behind the drawer when it's open. */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: calc(var(--pm-z-sticky) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease-out;
  backdrop-filter: blur(2px);
}

/* ============================================================
 * Hero polish on landing page (signed-out users only)
 * — soft radial gradient + a couple of floating blur orbs
 *   give the public face a more product-marketing feel without
 *   adding any image assets to the repo.
 * ============================================================ */

.app-main.is-public {
  position: relative;
  overflow-x: hidden;
}
.app-main.is-public::before,
.app-main.is-public::after {
  content: '';
  position: absolute;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
  animation: pm-float 9s ease-in-out infinite;
}
.app-main.is-public::before {
  background: radial-gradient(circle, #DBEAFE 0%, rgba(219, 234, 254, 0) 70%);
  top: -120px;
  left: -180px;
}
.app-main.is-public::after {
  background: radial-gradient(circle, #EEF2FF 0%, rgba(238, 242, 255, 0) 70%);
  top: 200px;
  right: -200px;
  animation-delay: 3s;
}
.app-main.is-public > * { position: relative; z-index: 1; }

/* The landing hero card itself — give it presence */
.hero {
  text-align: center;
  padding: var(--pm-space-6xl) var(--pm-space-2xl) var(--pm-space-4xl);
  max-width: 720px;
  margin: 0 auto;
}
.hero .hero-logo {
  height: 48px;
  width: auto;
  margin-bottom: var(--pm-space-xl);
  animation: pm-fade-in 600ms ease-out both;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--pm-space-base);
  background: linear-gradient(135deg, #0F172A 0%, #2563EB 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pm-fade-in-up 600ms ease-out 80ms both;
}
.hero .lead {
  font-size: var(--pm-font-lg);
  color: var(--pm-text-secondary);
  line-height: 1.55;
  max-width: 560px;
  margin: 0 auto var(--pm-space-2xl);
  animation: pm-fade-in-up 600ms ease-out 160ms both;
}
.hero .btn.primary {
  height: 48px;
  padding: 0 var(--pm-space-2xl);
  font-size: var(--pm-font-base);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
  animation: pm-fade-in-up 600ms ease-out 240ms both,
             pm-pulse-soft 2.4s ease-in-out 1.2s infinite;
}
.hero .btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.32);
}

/* Landing "How it works" steps — entrance + hover lift */
.overview {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--pm-space-4xl) var(--pm-space-2xl);
}
.overview h2 {
  text-align: center;
  font-size: var(--pm-font-3xl);
  margin-bottom: var(--pm-space-3xl);
}
.overview-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--pm-space-lg);
}
.overview-steps li {
  background: #fff;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-lg);
  padding: var(--pm-space-xl);
  box-shadow: var(--pm-shadow-sm);
  transition: transform var(--pm-transition-base),
              box-shadow var(--pm-transition-base),
              border-color var(--pm-transition-base);
  animation: pm-fade-in-up 520ms ease-out both;
}
.overview-steps li:nth-child(1) { animation-delay: 320ms; }
.overview-steps li:nth-child(2) { animation-delay: 400ms; }
.overview-steps li:nth-child(3) { animation-delay: 480ms; }
.overview-steps li:nth-child(4) { animation-delay: 560ms; }
.overview-steps li:nth-child(5) { animation-delay: 640ms; }
.overview-steps li:hover {
  transform: translateY(-2px);
  box-shadow: var(--pm-shadow-md);
  border-color: var(--pm-primary-light);
}
.overview-steps h3 {
  margin: 0 0 var(--pm-space-sm);
  color: var(--pm-primary);
  font-size: var(--pm-font-lg);
}
.overview-steps p {
  margin: 0;
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-sm);
  line-height: 1.55;
}
.overview-footer {
  text-align: center;
  margin-top: var(--pm-space-2xl);
}

/* ============================================================
 * Responsive — tablet (≤1024) and mobile (≤768).
 * Strategy: at ≤768 the fixed sidebar becomes an off-canvas drawer
 * (transform:translateX) toggled by body.has-drawer. Tables become
 * horizontally scrollable, grids collapse to one column, action
 * rows wrap, headings step down a size.
 * ============================================================ */

@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .app-main { margin-left: 220px; }
  main { padding-left: var(--pm-space-xl); padding-right: var(--pm-space-xl); }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas drawer. */
  .sidebar {
    width: min(88vw, 320px);
    transform: translateX(-100%);
    transition: transform 260ms ease-out;
    box-shadow: var(--pm-shadow-xl);
    overscroll-behavior: contain;
  }
  body.has-drawer .sidebar { transform: translateX(0); }
  body.has-drawer .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.has-drawer { overflow: hidden; }
  .sidebar-backdrop { display: block; }

  /* Main column takes the full width and gets a mobile topbar. */
  .app-main { margin-left: 0; }
  .mobile-topbar { display: flex; }

  /* Tighter main padding so content gets the screen. */
  main { padding: var(--pm-space-base); }

  /* Smaller display headings so they don't dominate small screens. */
  .pm-text-h1 { font-size: var(--pm-font-2xl); line-height: 28px; }
  .pm-text-h2 { font-size: var(--pm-font-lg);  line-height: 24px; }
  .page-header { margin-bottom: var(--pm-space-base); }

  /* Forms / action rows — buttons go full-width and stack. */
  .actions, .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--pm-space-sm);
  }
  .actions .btn, .form-row .btn { width: 100%; justify-content: center; }
  /* Bump touch targets above 40px for thumbs. */
  .btn { min-height: 44px; }

  /* Tables overflow horizontally instead of breaking the layout. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { display: block; overflow-x: auto; white-space: nowrap; font-size: var(--pm-font-xs); }
  table.data thead, table.data tbody, table.data tr { display: table; width: 100%; }

  /* Grids collapse to single column. */
  .tool-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: var(--pm-space-base); }

  /* Cards: tighter padding so a phone screen has more room. */
  .card { padding: var(--pm-space-lg) var(--pm-space-base); }

  /* Filter rows wrap so chips don't overflow. */
  .filter-row { flex-direction: column; align-items: stretch; gap: var(--pm-space-sm); }

  /* Subtab strip becomes scrollable instead of wrapping. */
  .subtab-strip { padding-bottom: 2px; }
  .subtab { padding: var(--pm-space-base) var(--pm-space-base); flex-shrink: 0; }

  /* Hero typography on small screens — keep balance. */
  .hero { padding: var(--pm-space-4xl) var(--pm-space-base) var(--pm-space-2xl); }
  .hero h1 { font-size: clamp(1.75rem, 8vw, 2.25rem); }
  .hero .lead { font-size: var(--pm-font-base); }

  /* Access status card: snap edges, more breathing room. */
  .access-card {
    margin: var(--pm-space-2xl) var(--pm-space-base);
    padding: var(--pm-space-2xl) var(--pm-space-lg);
  }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .breadcrumbs { font-size: var(--pm-font-xxs); }
  .tool-card { min-height: auto; padding: var(--pm-space-lg) var(--pm-space-base); }
  /* Live log: shorter on phones so it doesn't dominate the row table. */
  #live-log { max-height: 200px; }
}

/* Honor users who've opted out of motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .app-main.is-public::before,
  .app-main.is-public::after { animation: none; }
}
