/* portal-redesign-v1
   Unified light silver/white portal UX for Admin � Staff � Client � Careers.
   Scoped to portal shells so public marketing pages stay untouched.
   Loads last in the cascade. */

:root {
  --portal-bg: #f3f3f3;
  --portal-bg-soft: #ebebeb;
  --portal-surface: #ffffff;
  --portal-ink: #1a1a1a;
  --portal-ink-soft: #2e2e2e;
  --portal-mute: #5c5c5c;
  --portal-faint: #6b6b6b;
  --portal-border: rgba(0, 0, 0, 0.09);
  --portal-border-md: rgba(0, 0, 0, 0.14);
  --portal-border-strong: rgba(0, 0, 0, 0.2);
  --portal-chrome: #141414;
  --portal-chrome-text: #d8d8d8;
  --portal-chrome-mute: #a8a8a8;
  --portal-accent: #2a2a2a;
  --portal-success: #047857;
  --portal-success-bg: rgba(4, 120, 87, 0.1);
  --portal-warning: #b45309;
  --portal-warning-bg: rgba(180, 83, 9, 0.1);
  --portal-danger: #b91c1c;
  --portal-danger-bg: rgba(185, 28, 28, 0.1);
  --portal-info-bg: rgba(0, 0, 0, 0.04);
  --portal-radius: 12px;
  --portal-radius-sm: 8px;
  --portal-radius-lg: 16px;
  --portal-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --portal-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07);
  --portal-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.1);
  --portal-focus: 0 0 0 3px rgba(0, 0, 0, 0.18);
  --portal-touch: 44px;
  --portal-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ========== Shell tokens ========== */
.admin,
.hub-page,
.hub-shell,
.hub-gateway,
.portal,
.portal-main,
.client-shell,
.dash-page,
.unified-login,
.admin-login,
body.employee-portal {
  --color-black: var(--portal-bg);
  --color-surface: var(--portal-surface);
  --color-surface-elevated: #fafafa;
  --color-border: var(--portal-border);
  --color-border-strong: var(--portal-border-md);
  --color-grey-900: var(--portal-ink);
  --color-grey-800: var(--portal-ink-soft);
  --color-grey-500: var(--portal-mute);
  --color-grey-400: var(--portal-faint);
  color-scheme: light;
}

.admin,
.hub-page,
.hub-shell,
.hub-gateway,
.portal,
.client-shell,
.dash-page,
.unified-login,
body.employee-portal {
  background:
    radial-gradient(ellipse 70% 45% at 85% 0%, rgba(0, 0, 0, 0.03), transparent 55%),
    radial-gradient(ellipse 50% 40% at 5% 100%, rgba(0, 0, 0, 0.025), transparent 55%),
    var(--portal-bg) !important;
  color: var(--portal-ink-soft) !important;
}

/* ========== Admin shell ========== */
.admin {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

.admin-sidebar {
  background: var(--portal-chrome) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 4px 0 28px rgba(0, 0, 0, 0.14) !important;
  color: var(--portal-chrome-text) !important;
  padding: 1rem 0.85rem 1.5rem !important;
}

.admin-sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  margin-bottom: 0.75rem !important;
  padding: 0.65rem 0.65rem 1rem !important;
}

.admin-nav-section-title {
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
  color: #b8b8b8 !important;
  margin: 1rem 0.65rem 0.4rem !important;
}

.admin-nav a,
.hub-nav a,
.hub-sidebar a {
  display: flex !important;
  align-items: center !important;
  min-height: var(--portal-touch) !important;
  padding: 0.55rem 0.75rem !important;
  border-radius: var(--portal-radius-sm) !important;
  color: var(--portal-chrome-mute) !important;
  font-weight: 500 !important;
  border: 1px solid transparent !important;
  transition: background 0.2s var(--portal-ease), color 0.2s var(--portal-ease), transform 0.2s var(--portal-ease) !important;
}

.admin-nav a:hover,
.hub-nav a:hover,
.hub-sidebar a:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #f0f0f0 !important;
  transform: translateX(3px);
}

.admin-nav a.active,
.hub-nav a.active,
.hub-sidebar a.active {
  background: linear-gradient(90deg, rgba(200, 200, 200, 0.14), transparent) !important;
  color: #f2f2f2 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  border-left: 3px solid #c8c8c8 !important;
  font-weight: 700 !important;
}

.admin-nav a:focus-visible,
.hub-nav a:focus-visible,
.admin-mobile-toggle:focus-visible,
.admin .btn:focus-visible,
.admin button:focus-visible,
.dash-page .btn:focus-visible,
.dash-page button:focus-visible,
.hub-page .btn:focus-visible,
.hub-page button:focus-visible,
.portal .btn:focus-visible,
.portal button:focus-visible,
.client-shell .btn:focus-visible,
.client-shell button:focus-visible,
.unified-login .btn:focus-visible,
.unified-login button:focus-visible,
.admin input:focus-visible,
.admin select:focus-visible,
.admin textarea:focus-visible,
.dash-page input:focus-visible,
.dash-page select:focus-visible,
.dash-page textarea:focus-visible,
.client-shell input:focus-visible,
.client-shell select:focus-visible,
.client-shell textarea:focus-visible,
.hub-page input:focus-visible,
.hub-page select:focus-visible,
.hub-page textarea:focus-visible,
body.employee-portal input:focus-visible,
body.employee-portal button:focus-visible,
body.employee-portal a.btn:focus-visible {
  outline: none !important;
  box-shadow: var(--portal-focus) !important;
}

.admin-main,
.admin-page,
.admin-content {
  background: transparent !important;
}

.admin-page,
.dash-page {
  padding: clamp(1rem, 3vw, 1.75rem) clamp(0.85rem, 2.5vw, 1.5rem) clamp(1.5rem, 4vw, 2.5rem) !important;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.admin-header,
.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  border-bottom: 1px solid var(--portal-border-md) !important;
  padding-bottom: 1rem !important;
  margin-bottom: 1.25rem !important;
}

.admin-header h1,
.dash-header h1,
.hub-gateway-intro h1,
.portal-main h1,
.client-page-header h1,
body.employee-portal h1 {
  color: var(--portal-ink) !important;
  -webkit-text-fill-color: var(--portal-ink) !important;
  background: none !important;
  letter-spacing: -0.02em !important;
  line-height: 1.2 !important;
  font-size: clamp(1.35rem, 3vw, 1.75rem) !important;
}

.dash-lead,
.hub-lead,
.client-page-lead,
.admin-header p,
.site-control-hint {
  color: var(--portal-mute) !important;
  line-height: 1.5 !important;
}

.admin-mobile-toggle {
  min-width: var(--portal-touch) !important;
  min-height: var(--portal-touch) !important;
  border-radius: var(--portal-radius-sm) !important;
  border: 1px solid var(--portal-border-md) !important;
  background: var(--portal-surface) !important;
  color: var(--portal-ink) !important;
  box-shadow: var(--portal-shadow-sm) !important;
}

.admin-mobile-bar {
  position: sticky !important;
  top: 0 !important;
  z-index: 40 !important;
  background: rgba(243, 243, 243, 0.92) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid var(--portal-border) !important;
  padding: 0.55rem 0.75rem !important;
  padding-top: max(0.55rem, env(safe-area-inset-top)) !important;
}

/* ========== Cards / metrics ========== */
.admin .card,
.dash-page .card,
.hub-page .card,
.portal .card,
.client-shell .card,
.site-control-status-card,
.dash-metric,
.dash-quick-link,
.dash-quick-card,
.dash-help-card,
.dash-record-card,
.hub-role-card,
.stat-card,
.metric-card,
.insight-card,
.marketing-feature-card,
body.employee-portal .card {
  background: var(--portal-surface) !important;
  border: 1px solid var(--portal-border) !important;
  border-radius: var(--portal-radius) !important;
  box-shadow: var(--portal-shadow-sm) !important;
  color: var(--portal-ink-soft) !important;
  backdrop-filter: none !important;
}

.stat-card,
.dash-metric,
.admin-stats > *,
.metric-grid > *,
.grid-metrics > .card {
  transition: transform 0.2s var(--portal-ease), box-shadow 0.2s var(--portal-ease), border-color 0.2s var(--portal-ease);
}

@media (hover: hover) and (pointer: fine) {
  .stat-card:hover,
  .dash-metric:hover,
  .dash-quick-link:hover,
  .dash-quick-card:hover,
  .hub-role-card:hover,
  .marketing-feature-card:hover {
    transform: translateY(-3px);
    border-color: var(--portal-border-strong) !important;
    box-shadow: var(--portal-shadow-md) !important;
  }
}

.stat-card .label,
.dash-metric-label,
.admin .label,
body.employee-portal .label {
  color: var(--portal-mute) !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

.stat-card .value,
.dash-metric-value,
body.employee-portal .metric {
  color: var(--portal-ink) !important;
  -webkit-text-fill-color: var(--portal-ink) !important;
  background: none !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
}

.admin-stats,
.dash-metric-grid,
.metric-grid,
.grid-metrics,
.dash-quick-grid,
.site-control-status-grid,
.marketing-feature-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)) !important;
  gap: clamp(0.65rem, 2vw, 1rem) !important;
}

/* ========== Buttons ========== */
.admin .btn,
.dash-page .btn,
.hub-page .btn,
.portal .btn,
.client-shell .btn,
.unified-login .btn,
body.employee-portal .btn,
body.employee-portal a.btn,
body.employee-portal button.btn {
  min-height: var(--portal-touch);
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
  padding: 0.55rem 1rem !important;
  border-radius: var(--portal-radius-sm) !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  line-height: 1.2 !important;
  transition: background 0.18s var(--portal-ease), color 0.18s var(--portal-ease), border-color 0.18s var(--portal-ease), box-shadow 0.18s var(--portal-ease) !important;
  text-decoration: none !important;
  cursor: pointer;
}

.admin .btn-primary,
.dash-page .btn-primary,
.hub-page .btn-primary,
.portal .btn-primary,
.client-shell .btn-primary,
.unified-login .btn-primary,
body.employee-portal .btn.primary,
body.employee-portal button.btn.primary {
  background: var(--portal-chrome) !important;
  color: #f0f0f0 !important;
  border: 1px solid var(--portal-chrome) !important;
}

.admin .btn-primary:hover,
.dash-page .btn-primary:hover,
.hub-page .btn-primary:hover,
.portal .btn-primary:hover,
.client-shell .btn-primary:hover,
body.employee-portal .btn.primary:hover {
  background: #000 !important;
  color: #fff !important;
}

.admin .btn-outline,
.admin .btn-silver,
.dash-page .btn-outline,
.dash-page .btn-silver,
.hub-page .btn-outline,
.client-shell .btn-outline,
body.employee-portal .btn:not(.primary):not(.urgent) {
  background: var(--portal-surface) !important;
  color: var(--portal-ink) !important;
  border: 1px solid var(--portal-border-md) !important;
}

.admin .btn-outline:hover,
.admin .btn-silver:hover,
.dash-page .btn-outline:hover,
.client-shell .btn-outline:hover,
body.employee-portal .btn:not(.primary):not(.urgent):hover {
  background: var(--portal-bg-soft) !important;
}

.admin .btn:disabled,
.dash-page .btn:disabled,
.client-shell .btn:disabled,
body.employee-portal .btn:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* ========== Forms ========== */
.admin .form-group,
.dash-page .form-group,
.hub-page .form-group,
.portal .form-group,
.client-shell .form-group,
body.employee-portal .profile-form {
  margin-bottom: 0.95rem;
}

.admin label,
.dash-page label,
.hub-page label,
.portal label,
.client-shell label,
.unified-login label,
body.employee-portal label {
  display: block;
  color: var(--portal-ink) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.35rem !important;
}

.admin input:not([type='checkbox']):not([type='radio']):not([type='file']),
.admin select,
.admin textarea,
.dash-page input:not([type='checkbox']):not([type='radio']):not([type='file']),
.dash-page select,
.dash-page textarea,
.hub-page input:not([type='checkbox']):not([type='radio']):not([type='file']),
.hub-page select,
.hub-page textarea,
.portal input:not([type='checkbox']):not([type='radio']):not([type='file']),
.portal select,
.portal textarea,
.client-shell input:not([type='checkbox']):not([type='radio']):not([type='file']),
.client-shell select,
.client-shell textarea,
.unified-login input:not([type='checkbox']):not([type='radio']),
body.employee-portal input,
body.employee-portal select,
body.employee-portal textarea {
  width: 100%;
  min-height: var(--portal-touch);
  background: var(--portal-surface) !important;
  color: var(--portal-ink) !important;
  border: 1px solid var(--portal-border-md) !important;
  border-radius: var(--portal-radius-sm) !important;
  padding: 0.6rem 0.8rem !important;
  font-size: 1rem !important;
  line-height: 1.4 !important;
  box-shadow: none !important;
}

.admin textarea,
.dash-page textarea,
.client-shell textarea,
.portal textarea,
body.employee-portal textarea {
  min-height: 110px;
  resize: vertical;
}

/* ========== Tables ========== */
.admin .table-wrap,
.dash-page .table-wrap,
.client-shell .table-wrap,
body.employee-portal .table-wrap {
  background: var(--portal-surface) !important;
  border: 1px solid var(--portal-border) !important;
  border-radius: var(--portal-radius) !important;
  box-shadow: var(--portal-shadow-sm) !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.admin-table,
.dash-table,
.admin .data-table,
.dash-page .data-table,
.portal .data-table,
body.employee-portal .data-table,
.client-shell table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

.admin-table th,
.dash-table th,
.admin .data-table th,
.dash-page .data-table th,
.portal .data-table th,
body.employee-portal .data-table th,
.client-shell th {
  text-align: left;
  color: var(--portal-mute) !important;
  font-size: 0.7rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 0.8rem 0.9rem !important;
  border-bottom: 1px solid var(--portal-border-md) !important;
  background: #fafafa !important;
  white-space: nowrap;
}

.admin-table td,
.dash-table td,
.admin .data-table td,
.dash-page .data-table td,
.portal .data-table td,
body.employee-portal .data-table td,
.client-shell td {
  color: var(--portal-ink-soft) !important;
  padding: 0.85rem 0.9rem !important;
  border-bottom: 1px solid var(--portal-border) !important;
  vertical-align: top;
}

.admin-table tbody tr:hover td,
.dash-table tbody tr:hover td,
.admin .data-table tbody tr:hover td,
.dash-page .data-table tbody tr:hover td,
.portal .data-table tbody tr:hover td,
body.employee-portal .data-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.025) !important;
}

/* ========== Status badges ========== */
.admin .status,
.dash-page .status,
.client-shell .client-status,
.dash-status-pill,
.admin .status-pill,
.dash-page .status-pill,
.portal .status-pill,
.client-shell .status-pill,
body.employee-portal .status,
body.employee-portal .badge {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 1.5rem;
  padding: 0.15rem 0.55rem !important;
  border-radius: 999px !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
  border: 1px solid transparent;
  text-transform: capitalize;
}

.admin .status-new,
.dash-page .status-new,
.portal .status-new,
body.employee-portal .status-new,
.client-shell .client-status-new,
.dash-status-pill--new,
body.employee-portal .badge-new {
  background: var(--portal-success-bg) !important;
  color: var(--portal-success) !important;
  border-color: rgba(4, 120, 87, 0.25) !important;
}

.admin .status-contacted,
.admin .status-reviewing,
.dash-page .status-contacted,
.dash-page .status-reviewing,
.portal .status-contacted,
.portal .status-reviewing,
body.employee-portal .status-contacted,
body.employee-portal .status-reviewing,
.client-shell .client-status-open,
.dash-status-pill--open {
  background: var(--portal-info-bg) !important;
  color: var(--portal-ink-soft) !important;
  border-color: var(--portal-border-md) !important;
}

.admin .status-interview,
.admin .status-pending,
.dash-page .status-interview,
.dash-page .status-pending,
.portal .status-interview,
.portal .status-pending,
body.employee-portal .status-interview,
body.employee-portal .status-pending,
.dash-status-pill--pending,
.client-shell .client-status-pending {
  background: var(--portal-warning-bg) !important;
  color: var(--portal-warning) !important;
  border-color: rgba(180, 83, 9, 0.25) !important;
}

.admin .status-closed,
.admin .status-rejected,
.dash-page .status-closed,
.dash-page .status-rejected,
.portal .status-closed,
.portal .status-rejected,
body.employee-portal .status-closed,
body.employee-portal .status-rejected,
.client-shell .client-status-closed,
.dash-status-pill--danger {
  background: var(--portal-danger-bg) !important;
  color: var(--portal-danger) !important;
  border-color: rgba(185, 28, 28, 0.25) !important;
}

/* ========== Alerts / empty / loading ========== */
.admin .banner,
.dash-page .banner,
.hub-page .hub-guest-banner,
.hub-page .hub-switch-banner,
.dash-page .dash-session-strip,
.admin .admin-banner,
.admin .site-control-msg,
body.employee-portal .banner,
body.employee-portal .emp-session-strip {
  background: var(--portal-surface) !important;
  border: 1px solid var(--portal-border-md) !important;
  color: var(--portal-ink-soft) !important;
  border-radius: var(--portal-radius-sm) !important;
  box-shadow: var(--portal-shadow-sm) !important;
}

.admin .banner-warn,
.dash-page .banner-warn,
.portal .banner-warn,
.client-shell .banner-warn,
body.employee-portal .banner-warn {
  background: var(--portal-warning-bg) !important;
  border-color: rgba(180, 83, 9, 0.3) !important;
  color: #92400e !important;
}

.admin .banner-danger,
.admin .error,
.dash-page .banner-danger,
.dash-page .error,
.portal .banner-danger,
.portal .error,
.client-shell .banner-danger,
.client-shell .error,
body.employee-portal .banner-danger,
body.employee-portal .error {
  background: var(--portal-danger-bg) !important;
  border-color: rgba(185, 28, 28, 0.3) !important;
  color: #991b1b !important;
}

.dash-page .dash-empty,
.admin .empty,
body.employee-portal .empty,
body.employee-portal .loading {
  color: var(--portal-mute) !important;
  background: rgba(0, 0, 0, 0.02) !important;
  border: 1px dashed var(--portal-border-md);
  border-radius: var(--portal-radius);
  padding: 1.25rem !important;
  text-align: center;
}

/* ========== Hub gateway ========== */
.hub-gateway {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.5rem) !important;
}

.hub-role-card {
  padding: 1.15rem 1.2rem !important;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hub-role-card h2,
.hub-role-card h3 {
  color: var(--portal-ink) !important;
  margin: 0 !important;
}

.hub-trust-row li {
  background: var(--portal-bg-soft) !important;
  border: 1px solid var(--portal-border) !important;
  color: var(--portal-mute) !important;
  border-radius: 999px !important;
}

/* ========== Client portal ========== */
.client-shell {
  min-height: 100dvh !important;
}

.client-shell .portal-header,
.client-shell .client-header,
.portal-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid var(--portal-border) !important;
  color: var(--portal-ink-soft) !important;
}

.client-header-inner,
.portal-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem clamp(0.85rem, 3vw, 1.25rem) !important;
  min-height: var(--portal-touch);
}

.client-greeting,
.portal-greeting {
  color: var(--portal-mute) !important;
  white-space: normal !important;
}

.client-page,
.portal-main {
  max-width: 960px !important;
  margin: 0 auto !important;
  padding: clamp(1.1rem, 4vw, 2rem) clamp(0.85rem, 3vw, 1.25rem) 3rem !important;
}

.client-page-header {
  gap: 0.75rem !important;
  margin-bottom: 0.85rem !important;
}

.client-header-actions,
.portal-header-actions,
.dash-header-actions,
.admin-header-actions,
body.employee-portal .actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
  align-items: center !important;
}

/* ========== System Hub / Site Control ========== */
.sys-tabs {
  display: flex !important;
  gap: 0.4rem !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.35rem !important;
  margin-bottom: 1rem !important;
  mask-image: linear-gradient(90deg, #000 85%, transparent);
}

.sys-tabs button,
.sys-tabs a,
.sys-tab {
  flex: 0 0 auto !important;
  min-height: var(--portal-touch) !important;
  padding: 0.55rem 0.95rem !important;
  border-radius: 999px !important;
  border: 1px solid var(--portal-border-md) !important;
  background: var(--portal-surface) !important;
  color: var(--portal-ink-soft) !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.sys-tabs button.active,
.sys-tabs a.active,
.sys-tab.active {
  background: var(--portal-chrome) !important;
  color: #f0f0f0 !important;
  border-color: var(--portal-chrome) !important;
}

.site-control-section {
  margin-bottom: 1.5rem !important;
}

.site-control-section .card {
  padding: clamp(0.95rem, 2.5vw, 1.25rem) !important;
}

.dash-section-title {
  color: var(--portal-ink) !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  margin: 0 0 0.75rem !important;
}

.site-control-checklist li.ok {
  color: var(--portal-success) !important;
}

.site-control-checklist li.warn {
  color: var(--portal-warning) !important;
}

/* ========== Employee portal (static page) ========== */
body.employee-portal {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif !important;
  line-height: 1.55;
}

body.employee-portal .wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.15rem clamp(0.85rem, 3vw, 1.5rem) 2.5rem;
  padding-top: max(1.15rem, env(safe-area-inset-top));
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

body.employee-portal .workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--portal-border-md);
}

body.employee-portal .brand-mark {
  background: linear-gradient(135deg, #2a2a2a, #111) !important;
  color: #f0f0f0 !important;
}

body.employee-portal .sub,
body.employee-portal .team-role {
  color: var(--portal-mute) !important;
}

body.employee-portal .btn.urgent {
  border-color: rgba(185, 28, 28, 0.4) !important;
  color: var(--portal-danger) !important;
  background: var(--portal-danger-bg) !important;
}

body.employee-portal .team-card,
body.employee-portal .team-photo-placeholder {
  background: #f7f7f7 !important;
  border: 1px solid var(--portal-border) !important;
  color: var(--portal-ink-soft) !important;
}

body.employee-portal .emp-session-strip {
  background: #fff !important;
  border: 1px solid var(--portal-border-md) !important;
  color: var(--portal-ink-soft) !important;
}

body.employee-portal .emp-role-badge {
  background: #f3f3f3 !important;
  color: var(--portal-ink) !important;
  border: 1px solid var(--portal-border-md) !important;
}

body.employee-portal .profile-form .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

body.employee-portal .msg.ok {
  color: var(--portal-success) !important;
}

body.employee-portal .msg.err {
  color: var(--portal-danger) !important;
}

/* ========== Action bars / filters ========== */
.admin .filters,
.admin .toolbar,
.dash-page .filters,
.dash-page .toolbar,
.admin-actions,
.crud-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .admin-page,
  .dash-page {
    padding-left: clamp(0.75rem, 2vw, 1rem) !important;
    padding-right: clamp(0.75rem, 2vw, 1rem) !important;
  }

  .admin-stats,
  .dash-metric-grid,
  .site-control-status-grid,
  .marketing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .admin-stats,
  .dash-metric-grid,
  .metric-grid,
  .grid-metrics,
  .dash-quick-grid,
  .site-control-status-grid,
  .marketing-feature-grid,
  .hub-gateway .hub-roles,
  .layout-2 {
    grid-template-columns: 1fr !important;
  }

  .admin-header,
  .dash-header,
  .client-page-header,
  body.employee-portal .workspace-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .admin-header-actions,
  .dash-header-actions,
  .client-header-actions,
  .portal-header-actions,
  body.employee-portal .actions {
    width: 100%;
  }

  .admin-header-actions .btn,
  .dash-header-actions .btn,
  .client-header-actions .btn,
  .portal-header-actions .btn,
  body.employee-portal .actions .btn {
    flex: 1 1 auto;
  }

  .client-header-inner,
  .portal-header-inner {
    flex-wrap: wrap !important;
  }

  body.employee-portal .profile-form .row,
  .admin .form-row,
  .dash-page .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Tables: scroll wrapper, never force page-wide overflow */
  .admin .table-wrap,
  .dash-page .table-wrap,
  .client-shell .table-wrap,
  .portal .table-wrap,
  body.employee-portal .table-wrap,
  .admin .admin-table-wrap,
  .hub-page .table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table,
  .dash-table,
  .data-table,
  .admin table,
  .dash-page table,
  .client-shell table,
  .hub-page table {
    min-width: max(100%, 20rem);
  }

  .sys-tabs,
  .hub-page .mfa-tabs,
  .admin .mfa-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    mask-image: linear-gradient(90deg, #000 78%, transparent);
  }

  .hub-page .unified-login,
  .hub-page .admin-login,
  .hub-gateway,
  .client-shell,
  .portal-shell {
    padding-left: max(0.85rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.85rem, env(safe-area-inset-right, 0px));
  }

  .hub-page input,
  .hub-page select,
  .hub-page textarea,
  .client-shell input,
  .client-shell select,
  .client-shell textarea,
  .portal-shell input,
  .portal-shell select,
  .portal-shell textarea {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .hub-page .btn,
  .client-shell .btn,
  .portal-shell .btn,
  body.employee-portal .btn {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .admin-stats,
  .dash-metric-grid {
    gap: 0.55rem !important;
  }

  .admin .btn,
  .dash-page .btn,
  .client-shell .btn,
  body.employee-portal .btn {
    width: 100%;
  }

  .admin-header-actions,
  .dash-header-actions,
  .client-header-actions,
  body.employee-portal .actions {
    flex-direction: column;
    align-items: stretch !important;
  }

  .admin-table,
  .dash-table,
  .data-table {
    min-width: max(100%, 18rem);
    font-size: 0.84rem;
  }
}

/* ========== Accessibility ========== */
@media (prefers-reduced-motion: reduce) {
  .admin *,
  .hub-page *,
  .hub-shell *,
  .portal *,
  .client-shell *,
  .dash-page *,
  body.employee-portal * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .stat-card:hover,
  .dash-metric:hover,
  .dash-quick-link:hover,
  .hub-role-card:hover,
  .admin-nav a:hover {
    transform: none !important;
  }
}

/* Decorative emoji/icons not announced */
.dash-quick-icon,
.marketing-feature-icon,
.hub-role-card [aria-hidden='true'] {
  speak: never;
}

/* Contrast fixes for faint text on paper */
.admin .site-control-hint,
.dash-page .site-control-hint,
.client-shell .muted,
.portal .muted {
  color: var(--portal-mute) !important;
}

/* ========== Security / MFA ========== */
.mfa-qr-image {
  display: block;
  margin: 0.85rem auto 1rem;
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: var(--portal-radius-sm);
  border: 1px solid var(--portal-border-md);
  background: #fff;
  padding: 0.5rem;
  box-shadow: var(--portal-shadow-sm);
}

.mfa-secret {
  display: block;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  padding: 0.65rem 0.75rem;
  margin-top: 0.5rem;
  background: #f7f7f7;
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-sm);
  color: var(--portal-ink);
}

/* Careers portal shell */
.portal .portal-header,
.portal .client-header {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid var(--portal-border) !important;
}

.portal .portal-main,
.portal .client-page {
  max-width: 960px;
  margin: 0 auto;
}

/* Sticky filter/action rows on CRUD pages */
.admin .crud-toolbar,
.admin .filters,
.dash-page .filters {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(243, 243, 243, 0.92);
  backdrop-filter: blur(8px);
  padding: 0.55rem 0;
  margin-top: -0.25rem;
}

@media (max-width: 1023px) {
  .admin .crud-toolbar,
  .admin .filters,
  .dash-page .filters {
    top: 3.25rem;
  }
}

/* Modal / overlay polish inside portals */
.admin .modal,
.dash-page .modal,
.client-shell .modal,
.portal .modal {
  background: rgba(0, 0, 0, 0.45) !important;
}

.admin .modal-content,
.admin .modal-panel,
.dash-page .modal-content,
.client-shell .modal-content {
  background: #fff !important;
  color: var(--portal-ink-soft) !important;
  border: 1px solid var(--portal-border-md) !important;
  border-radius: var(--portal-radius-lg) !important;
  box-shadow: var(--portal-shadow-lg) !important;
  max-width: min(640px, calc(100vw - 1.5rem));
  max-height: min(85dvh, 720px);
  overflow: auto;
}

/* Page header shared component */
.admin .page-header,
.dash-page .page-header,
.portal .page-header,
.client-shell .page-header {
  margin-bottom: 1.15rem !important;
}

.admin .page-header h1,
.dash-page .page-header h1,
.portal .page-header h1,
.client-shell .page-header h1 {
  color: var(--portal-ink) !important;
  -webkit-text-fill-color: var(--portal-ink) !important;
}

/* portal-redesign-type-v3 - match site display/body fonts */
.admin,
.hub-page,
.client-shell,
.portal-shell,
.employee-shell {
  font-family: "Source Sans 3", "Segoe UI", sans-serif !important;
}
.admin h1,
.admin h2,
.hub-page h1,
.client-shell h1,
.portal-shell h1,
.admin .page-title,
.admin .dash-header h1 {
  font-family: Archivo, "Arial Narrow", sans-serif !important;
  letter-spacing: -0.03em;
}

/* Hub / employee phone harden — phase 6 */
@media (max-width: 768px) {
  .hub-gateway .hub-roles,
  .hub-page .hub-roles {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .hub-role-card,
  .hub-role-card:hover {
    transform: none !important;
  }

  .hub-gateway-intro,
  .hub-gateway .hub-lead {
    text-align: center;
  }

  .unified-login,
  .unified-login-form,
  .hub-page .admin-login-form,
  .hub-page .unified-login-form {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body.employee-portal .workspace-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.employee-portal .profile-form .row {
    grid-template-columns: 1fr !important;
  }

  .admin-table th,
  .dash-table th,
  .admin .data-table th,
  .dash-page .data-table th {
    white-space: normal;
  }
}
