/* ==========================================================================
   SIAMAQ INGENIERÍA · ADMIN & CRUD MASTER STYLESHEET
   UI/UX Excellence · Ultra-Premium SaaS Design System
   ========================================================================== */

@view-transition { navigation: none; }

/* Small text uses dedicated contrast-safe colors; logo assets retain brand colors. */
.main .page-pretitle { color: #0369a1; }
.main .page-description { color: var(--text-muted); }
[data-theme="dark"] .main .page-pretitle { color: #38bdf8; }

:root {
  /* Typography System (unificado con portada/catálogo) */
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans: var(--font-body);
  --font: var(--font-body);
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Monaco, Consolas, monospace;

  /* Industrial Engineering Palette */
  --sq-navy-950: #061224;
  --sq-navy-900: #0b1e38;
  --sq-navy-850: #0f274a;
  --sq-navy-800: #133360;
  --sq-navy-700: #1a427b;
  --sq-blue-600: #1d4ed8;
  --sq-blue-500: #2563eb;
  --sq-blue-400: #3b82f6;
  --sq-cyan-600: #0284c7;
  --sq-cyan-500: #0ea5e9;
  --sq-cyan-400: #38bdf8;
  --sq-orange-600: #b53e09;
  --sq-orange-500: #f26419;
  --sq-orange-400: #fb923c;
  --sq-emerald-600: #059669;
  --sq-emerald-500: #10b981;
  --sq-red-600: #dc2626;
  --sq-red-500: #ef4444;

  /* Neutral Slate Tones */
  --sq-slate-900: #0f172a;
  --sq-slate-800: #1e293b;
  --sq-slate-700: #334155;
  --sq-slate-600: #475569;
  --sq-slate-500: #64748b;
  --sq-slate-400: #94a3b8;
  --sq-slate-300: #cbd5e1;
  --sq-slate-200: #e2e8f0;
  --sq-slate-100: #f1f5f9;
  --sq-slate-50:  #f8fafc;

  /* Semantic UI Tokens */
  --body-bg: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f8fafc;
  --bg-surface-tertiary: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #edf2f7;
  --border-color: #e2e8f0;
  --border-translucent: rgba(15, 23, 42, 0.06);

  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #58677e;
  --text-disabled: #94a3b8;

  --primary: #0f274a;
  --primary-hover: #1a427b;
  --primary-lt: rgba(15, 39, 74, 0.08);
  --primary-dk: #061224;
  --accent: #f26419;
  --accent-lt: rgba(242, 100, 25, 0.1);

  --card-bg: var(--bg-surface);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  --primary-svg-color: #f26419;
}

[data-theme="dark"] {
  --body-bg: #090f1d;
  --bg-surface: #0f1a2e;
  --bg-surface-secondary: #14223a;
  --bg-surface-tertiary: #192b49;
  --border: #1e3252;
  --border-light: #16263e;
  --border-color: #1e3252;
  --border-translucent: rgba(255, 255, 255, 0.08);

  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #8ba0bd;
  --text-disabled: #4e6584;

  --primary: #2563eb;
  --primary-hover: #3b82f6;
  --primary-lt: rgba(37, 99, 235, 0.16);
  --primary-dk: #1d4ed8;
  --accent: #fb923c;
  --accent-lt: rgba(251, 146, 60, 0.15);

  --card-bg: var(--bg-surface);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--border);
  --shadow-card-hover: 0 12px 30px -5px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(37, 99, 235, 0.3);
  --primary-svg-color: #fb923c;
}

/* Base Reset & Typography Setup */
body,
button,
input,
select,
textarea,
dialog {
  font-family: var(--font-body);
}

body {
  color: var(--text);
  background-color: var(--body-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.main h1, .main h2, .main h3, .main h4, .main h5, .main h6,
.page-title, .card-title, .welcome-title, .auth-title {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--text);
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
}

/* ==========================================================================
   SIDEBAR & BRANDING MASTER SECTION (SIAMAQ)
   ========================================================================== */
.sidebar {
  background: var(--sidebar-bg, #1a2332);
  border-right: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
  display: flex !important;
  flex-direction: column !important;
}

/* Brand Header */
.sidebar-brand {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  height: auto !important;
  min-height: 76px;
  padding: 14px 16px 10px !important;
  text-decoration: none !important;
  gap: 6px;
  border-bottom: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
}

.sidebar-brand-badge {
  background: transparent;
  border-radius: 0;
  padding: 4px 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  box-shadow: none;
  max-width: 100%;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand:hover .sidebar-brand-badge {
  transform: translateY(-1px);
}

.sidebar-logo {
  width: auto;
  max-width: 154px;
  height: auto;
  max-height: 40px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.sidebar-brand .brand-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fdba74;
  background: rgba(242, 100, 25, 0.12);
  border: 1px solid rgba(242, 100, 25, 0.28);
  padding: 2.5px 8px;
  border-radius: 4px;
  margin-top: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Sidebar Navigation Sections */
.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}

.cms-nav-section {
  margin: 0;
  padding: 0;
}

.cms-nav-section + .cms-nav-section {
  border-top: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
  margin-top: 14px;
  padding-top: 10px;
}

.cms-nav-section h2.nav-section-label {
  font-family: var(--font-display) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  padding: 12px 14px 6px !important;
  color: var(--sidebar-text, #7b8fa3) !important;
  opacity: 0.9 !important;
}

.cms-nav-section .nav-link {
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text, #7b8fa3);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.cms-nav-section .nav-link:hover {
  color: var(--sidebar-text-hover, #ffffff);
  background: var(--sidebar-hover, rgba(255, 255, 255, 0.06));
  text-decoration: none;
}

.cms-nav-section .nav-link.active {
  color: #ffffff;
  background: var(--sidebar-active, rgba(26, 187, 156, 0.14));
  font-weight: 600;
}

[data-theme="dark"] .cms-nav-section .nav-link.active {
  background: rgba(37, 99, 235, 0.22);
}

.nav-counter {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.12));
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-hover, #ffffff);
}

/* Sidebar Collapsible Subsections */
.cms-nav-sub {
  margin: 4px 0;
  border-radius: var(--radius-sm);
}

.cms-nav-sub-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text, #9fb3c8);
  font-size: 12.5px;
  font-weight: 600;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.cms-nav-sub-summary::-webkit-details-marker {
  display: none;
}

.cms-nav-sub-summary:hover,
.cms-nav-sub[open] > .cms-nav-sub-summary {
  color: var(--sidebar-text-hover, #ffffff);
  background: var(--sidebar-hover, rgba(255, 255, 255, 0.06));
}

.cms-sub-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cms-sub-chevron {
  font-size: 11px;
  opacity: 0.75;
  transition: transform 0.16s ease;
}

.cms-nav-sub[open] > .cms-nav-sub-summary .cms-sub-chevron {
  transform: rotate(90deg);
}

.cms-nav-sub-links {
  margin: 2px 0 4px 12px;
  padding-left: 10px;
  border-left: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.1));
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cms-nav-sub-links .nav-link {
  font-size: 12.5px;
  padding: 6px 10px;
  gap: 9px;
}

/* Sidebar Footer & User Info */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border, rgba(255, 255, 255, 0.08));
  padding: 10px 12px;
  flex-shrink: 0;
  background: var(--sidebar-bg, #1a2332);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s ease;
}

.sidebar-user:hover {
  background: var(--sidebar-hover, rgba(255, 255, 255, 0.06));
  text-decoration: none;
}

.sidebar-user .avatar {
  background: linear-gradient(135deg, var(--sq-blue-500), var(--sq-navy-850));
  color: #ffffff;
  font-weight: 700;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-user-info span {
  display: block;
}

.sidebar-user-info .name {
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-user-info .role {
  font-size: 11px !important;
  color: var(--sidebar-text, #7b8fa3) !important;
  margin-top: 2px;
  line-height: 1.2;
}

/* ==========================================================================
   TOPBAR & SHELL POLISH
   ========================================================================== */
.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  padding: 0 28px;
  transition: none !important;
}

.main, .sidebar {
  transition: none !important;
}

[data-theme="dark"] .topbar {
  background: rgba(15, 26, 46, 0.92);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb a:hover {
  color: var(--sq-blue-500);
}

.breadcrumb span:last-child {
  color: var(--text);
  font-weight: 600;
}

/* Page Header */
.page-header {
  margin-bottom: 24px;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-pretitle {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sq-cyan-600);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-pretitle::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sq-orange-500);
}

.page-title {
  font-size: 26px;
  line-height: 1.25;
  margin: 0;
}

.page-description {
  color: var(--text-muted);
  font-size: 14px;
  margin: 6px 0 0;
  max-width: 680px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-lg {
  height: 44px;
  padding: 0 20px;
  font-size: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--sq-navy-900), var(--sq-navy-800));
  color: #ffffff !important;
  border: 1px solid var(--sq-navy-700);
  box-shadow: 0 2px 6px rgba(11, 30, 56, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--sq-navy-850), var(--sq-navy-700));
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(11, 30, 56, 0.3);
  text-decoration: none;
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, var(--sq-blue-600), var(--sq-blue-500));
  border-color: var(--sq-blue-400);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, var(--sq-blue-500), var(--sq-blue-400));
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-outline:hover {
  background: var(--bg-surface-secondary);
  color: var(--text);
  border-color: var(--sq-slate-400);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff !important;
  border: 1px solid #991b1b;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
  text-decoration: none;
}

.btn-amber {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff !important;
  border: 1px solid #92400e;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.btn-amber:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.35);
  text-decoration: none;
}

/* ==========================================================================
   CARDS & SURFACES
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  min-width: 0;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  margin-top: 3px;
}

.card-body {
  padding: 24px;
  min-width: 0;
}

.tox-tinymce {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* ==========================================================================
   HERO / WELCOME BANNER (DASHBOARD)
   ========================================================================== */
.welcome-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px 40px;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #09172e 0%, #102a52 60%, #15396e 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 36px -6px rgba(9, 23, 46, 0.35);
  color: #ffffff;
  overflow: hidden;
}

.welcome-card::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 100, 25, 0.22) 0%, rgba(242, 100, 25, 0) 70%);
  pointer-events: none;
}

.welcome-card::after {
  content: "";
  position: absolute;
  bottom: -80px;
  left: 20%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0) 70%);
  pointer-events: none;
}

.welcome-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sq-orange-400);
  background: rgba(242, 100, 25, 0.14);
  border: 1px solid rgba(242, 100, 25, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 14px;
}

.welcome-card .welcome-title, h2.welcome-title {
  color: #ffffff !important;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 12px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.welcome-text {
  color: #cbd5e1;
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.welcome-actions .btn-primary {
  background: linear-gradient(135deg, var(--sq-orange-500), var(--sq-orange-600));
  border-color: var(--sq-orange-400);
  box-shadow: 0 4px 14px rgba(242, 100, 25, 0.35);
}

.welcome-actions .btn-primary:hover {
  background: linear-gradient(135deg, var(--sq-orange-400), var(--sq-orange-500));
  box-shadow: 0 6px 20px rgba(242, 100, 25, 0.45);
}

.welcome-actions .btn-outline {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.welcome-actions .btn-outline:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.welcome-graphic {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 24px;
}

.welcome-illustration {
  width: 250px;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.35));
  animation: floatIllustration 5s ease-in-out infinite alternate;
}

@keyframes floatIllustration {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

/* ==========================================================================
   METRIC CARDS / STATS GRID
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--sq-blue-400);
}

.stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon-wrapper {
  transform: scale(1.08);
}

.stat-icon-navy {
  background: rgba(15, 39, 74, 0.08);
  color: var(--sq-navy-850);
}

[data-theme="dark"] .stat-icon-navy {
  background: rgba(59, 130, 246, 0.15);
  color: var(--sq-blue-400);
}

.stat-icon-cyan {
  background: rgba(2, 132, 199, 0.1);
  color: var(--sq-cyan-600);
}

[data-theme="dark"] .stat-icon-cyan {
  background: rgba(56, 189, 248, 0.15);
  color: var(--sq-cyan-400);
}

.stat-icon-amber {
  background: rgba(242, 100, 25, 0.1);
  color: var(--sq-orange-500);
}

[data-theme="dark"] .stat-icon-amber {
  background: rgba(251, 146, 60, 0.15);
  color: var(--sq-orange-400);
}

.stat-icon-emerald {
  background: rgba(5, 150, 105, 0.1);
  color: var(--sq-emerald-600);
}

[data-theme="dark"] .stat-icon-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--sq-emerald-500);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  margin-bottom: 6px;
}

.stat-subtext {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-tertiary);
  color: var(--text-secondary);
}

/* Pending Quote Alert */
.quote-dashboard-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin-bottom: 24px;
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-left: 4px solid var(--sq-orange-500);
  border-radius: var(--radius-md);
  color: #92400e;
  text-decoration: none;
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

[data-theme="dark"] .quote-dashboard-alert {
  background: linear-gradient(90deg, #2b1f0d 0%, #36240d 100%);
  border-color: #78350f;
  color: #fde68a;
}

.quote-dashboard-alert:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.beacon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sq-orange-500);
  display: inline-block;
  margin-right: 8px;
  animation: beaconPulse 1.8s infinite;
}

@keyframes beaconPulse {
  0% { box-shadow: 0 0 0 0 rgba(242, 100, 25, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(242, 100, 25, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 100, 25, 0); }
}

/* ==========================================================================
   CRUD TOOLBAR & FILTERS
   ========================================================================== */
.users-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.users-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.role-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.role-pill-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.role-pill-btn:hover {
  background: var(--bg-surface-tertiary);
  color: var(--text);
  border-color: var(--sq-slate-400);
  text-decoration: none;
}

.role-pill-btn.active {
  background: var(--sq-navy-900);
  color: #ffffff;
  border-color: var(--sq-navy-900);
  font-weight: 600;
}

[data-theme="dark"] .role-pill-btn.active {
  background: var(--sq-blue-600);
  border-color: var(--sq-blue-500);
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.search-control {
  font-family: var(--font-body);
  font-size: 13px;
  height: 36px;
  width: 290px;
  padding: 0 34px 0 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.15s ease;
}

.search-control:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--sq-blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.search-clear-btn:hover {
  color: var(--text);
}

/* ==========================================================================
   CRUD DATA TABLE
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

table.table th {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-surface-secondary);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
  background: var(--bg-surface);
  transition: background-color 0.12s ease;
}

table.table tbody tr:hover td {
  background-color: var(--bg-surface-secondary);
}

table.table tbody tr:last-child td {
  border-bottom: none;
}

/* User cell representation */
.user-cell {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}

.user-cell:hover {
  text-decoration: none;
}

.user-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  border: 2px solid var(--bg-surface);
}

.user-avatar.initials {
  background: linear-gradient(135deg, var(--sq-navy-850), var(--sq-navy-700));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}

[data-theme="dark"] .user-avatar.initials {
  background: linear-gradient(135deg, var(--sq-blue-600), var(--sq-cyan-600));
}

.user-names {
  display: flex;
  flex-direction: column;
}

.user-handle {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-full-name {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.you-badge {
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-lt);
  color: var(--sq-orange-500);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(242, 100, 25, 0.25);
}

/* Roles Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.role-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.role-badge.role-admin {
  background: rgba(15, 39, 74, 0.08);
  border-color: rgba(15, 39, 74, 0.15);
  color: var(--sq-navy-850);
}

.role-badge.role-admin::before {
  background: var(--sq-navy-800);
}

[data-theme="dark"] .role-badge.role-admin {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--sq-blue-400);
}

[data-theme="dark"] .role-badge.role-admin::before {
  background: var(--sq-blue-400);
}

.role-badge.role-editor {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.2);
  color: var(--sq-cyan-600);
}

.role-badge.role-editor::before {
  background: var(--sq-cyan-500);
}

.role-badge.role-client {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.2);
  color: var(--sq-emerald-600);
}

.role-badge.role-client::before {
  background: var(--sq-emerald-500);
}

.role-badge.role-visitor {
  background: var(--bg-surface-tertiary);
  border-color: var(--border);
  color: var(--text-muted);
}

.role-badge.role-visitor::before {
  background: var(--text-disabled);
}

/* Row Actions */
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--bg-surface-secondary);
  color: var(--text);
  border-color: var(--sq-slate-400);
  text-decoration: none;
}

.action-btn.danger-btn {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.04);
}

.action-btn.danger-btn:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* ==========================================================================
   EMPTY STATE WITH UNDRAW
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.empty-illustration {
  width: 220px;
  height: auto;
  max-height: 150px;
  margin: 0 auto 20px;
  display: block;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 440px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.page-current-pill {
  font-weight: 700;
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
}

/* ==========================================================================
   EDITOR GRID & FORM STYLING (CREATE / EDIT)
   ========================================================================== */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.editor-grid > * {
  min-width: 0;
  max-width: 100%;
}

.form-fieldset {
  margin-bottom: 28px;
}

.form-fieldset:last-child {
  margin-bottom: 0;
}

.fieldset-legend {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.full-width {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.req-dot {
  color: var(--sq-orange-500);
}

.form-control {
  font-family: var(--font-body);
  font-size: 14px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--sq-blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-group small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.4;
}

/* Password wrapper */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap .form-control {
  width: 100%;
  padding-right: 90px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.password-toggle:hover {
  background: var(--bg-surface-tertiary);
  color: var(--text);
}

/* Photo Upload Dropzone */
.photo-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 10px 0;
}

.profile-photo-wrap {
  position: relative;
}

.profile-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  background: var(--bg-surface-secondary);
}

.photo-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.photo-upload-btn {
  cursor: pointer;
  width: 100%;
}

.remove-photo-check {
  font-size: 13px;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.security-tip-card {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.security-tip-card strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* ==========================================================================
   PROFILE SHOW VIEW (EXECUTIVE)
   ========================================================================== */
.profile-card {
  overflow: hidden;
}

.profile-cover {
  height: 140px;
  background: linear-gradient(135deg, var(--sq-navy-950), var(--sq-navy-800));
  position: relative;
  overflow: hidden;
}

.profile-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(242, 100, 25, 0.25), transparent 60%);
}

.profile-heading {
  padding: 0 32px 28px;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-top: -60px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.profile-heading .profile-photo {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border: 4px solid var(--bg-surface);
}

.profile-heading-info {
  flex: 1;
  padding-bottom: 6px;
}

.profile-heading-info h2 {
  font-size: 24px;
  margin: 6px 0 4px;
}

.profile-heading-info p {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}

.profile-body {
  padding: 32px;
}

.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}

.profile-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-meta-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.profile-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.biography-title {
  font-size: 16px;
  margin-bottom: 14px;
}

.biography-content {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 800px;
}

.profile-card-pro .profile-cover {
  height: 164px;
  padding: 20px 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.profile-cover-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.profile-cover-top {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-cover-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.profile-self-pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
  font-size: 11.5px;
  font-weight: 700;
}

.profile-avatar-frame {
  position: relative;
  flex-shrink: 0;
}

.profile-card-pro .profile-heading .profile-photo {
  width: 124px;
  height: 124px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--bg-surface);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.profile-card-pro .profile-heading-info {
  padding-top: 68px;
}

.profile-card-pro .profile-actions-bar {
  padding-top: 68px;
}

.profile-status-dot {
  position: absolute;
  right: -3px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #94a3b8;
  border: 3px solid var(--bg-surface);
}

.profile-status-dot.is-online {
  background: #10b981;
}

.profile-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-id-chip {
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.profile-handle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-handle-pill {
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.profile-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-danger-outline {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.32);
}

.btn-danger-outline:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: #dc2626;
}

[data-theme="dark"] .btn-danger-outline {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.profile-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.profile-kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
}

.profile-kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-kpi-icon.is-navy {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}

[data-theme="dark"] .profile-kpi-icon.is-navy {
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}

.profile-kpi-icon.is-emerald {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

[data-theme="dark"] .profile-kpi-icon.is-emerald {
  color: #6ee7b7;
}

.profile-kpi-icon.is-amber {
  background: rgba(242, 100, 25, 0.14);
  color: #c2410c;
}

[data-theme="dark"] .profile-kpi-icon.is-amber {
  color: #fdba74;
}

.profile-kpi-icon.is-cyan {
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
}

[data-theme="dark"] .profile-kpi-icon.is-cyan {
  color: #7dd3fc;
}

.profile-kpi-card .profile-meta-value {
  display: block;
  margin: 2px 0;
}

.profile-kpi-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.profile-pro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.profile-panel-box {
  padding: 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.profile-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.profile-panel-head .biography-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.profile-inline-edit-link {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sq-orange-600, #cd4e00);
  text-decoration: none;
}

[data-theme="dark"] .profile-inline-edit-link {
  color: #fdba74;
}

.profile-inline-edit-link:hover {
  text-decoration: underline;
}

.profile-empty-bio {
  padding: 18px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg-surface-secondary);
}

.profile-empty-bio p {
  margin: 0 0 12px;
  color: var(--text-muted);
}

.profile-aside-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-perm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-light);
  color: var(--text);
}

.profile-perm-item.is-denied {
  color: var(--text-muted);
}

.profile-perm-mark {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

[data-theme="dark"] .profile-perm-mark {
  color: #6ee7b7;
}

.profile-perm-item.is-denied .profile-perm-mark {
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
}

.profile-security-box {
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid #f26419;
}

.profile-security-box strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 6px;
  color: var(--text);
}

.profile-security-box p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

@media (max-width: 1120px) {
  .profile-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-pro-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .profile-card-pro .profile-heading-info,
  .profile-card-pro .profile-actions-bar {
    padding-top: 0;
  }
}

@media (max-width: 600px) {
  .profile-card-pro .profile-cover {
    height: 132px;
    padding: 16px 18px;
  }
  .profile-card-pro .profile-body {
    padding: 20px 16px;
  }
  .profile-kpi-grid {
    grid-template-columns: 1fr;
  }
  .profile-handle-line,
  .profile-badge-row,
  .profile-actions-bar {
    justify-content: center;
  }
}

/* ==========================================================================
   DELETE / DANGER CONFIRMATION
   ========================================================================== */
.delete-card {
  max-width: 620px;
  margin: 20px auto 40px;
  text-align: center;
}

.delete-illustration {
  width: 180px;
  height: auto;
  max-height: 140px;
  margin: 10px auto 20px;
  display: block;
}

.delete-title {
  font-size: 22px;
  margin-bottom: 12px;
}

.delete-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.delete-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}

/* ==========================================================================
   NOTICES & ALERTS
   ========================================================================== */
.notice {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid;
  animation: sqFadeUp 0.25s ease-out;
}

.notice-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

[data-theme="dark"] .notice-success {
  background: rgba(6, 95, 70, 0.2);
  color: #6ee7b7;
  border-color: rgba(6, 95, 70, 0.4);
}

.notice-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

[data-theme="dark"] .notice-error {
  background: rgba(153, 27, 27, 0.2);
  color: #fca5a5;
  border-color: rgba(153, 27, 27, 0.4);
}

@keyframes sqFadeUp {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN (1440, 1024, 768, 390, 320)
   ========================================================================== */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar:not(.mobile-open) {
    transform: translateX(-100%);
  }
  .main {
    margin-left: 0 !important;
    margin-inline-start: 0 !important;
  }
  .topbar {
    left: 0 !important;
    inset-inline-start: 0 !important;
    padding: 0 16px !important;
  }
  .breadcrumb {
    display: none !important;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .editor-grid aside {
    order: -1;
  }
  .photo-panel {
    flex-direction: row;
    text-align: left;
  }
  .welcome-card {
    padding: 30px;
  }
  .welcome-illustration {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .welcome-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    gap: 20px;
  }
  .welcome-graphic {
    padding-left: 0;
    align-self: center;
  }
  .welcome-illustration {
    width: 170px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .profile-heading {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 20px 20px;
  }
  .profile-meta-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-control {
    width: 100%;
  }
  .search-input-wrap {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .page-wrapper {
    padding: 18px 14px !important;
  }
  .page-header-row {
    gap: 16px;
    align-items: flex-start;
    flex-direction: column;
  }
  .topbar-right {
    gap: 6px;
  }
  .topbar-right .btn {
    font-size: 11px;
    padding: 4px 8px;
    height: 30px;
  }
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .welcome-card {
    padding: 24px;
  }
  .welcome-graphic {
    display: none;
  }
  .full-width {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .page-wrapper {
    padding: 16px 12px !important;
  }
  .card-header {
    padding: 14px 16px;
  }
  .card-body {
    padding: 16px;
  }
  .form-footer {
    padding: 14px 16px;
  }
  .welcome-title {
    font-size: 22px;
  }
  .stat-value {
    font-size: 28px;
  }
  .list-footer {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}


/* ==========================================================================
   LOGIN / ACCESO ADMINISTRATIVO ULTRA PREMIUM
   Experiencia corporativa Pro, alta seguridad y elegancia industrial
   ========================================================================== */

.login-page {
  min-height: 100vh;
  background: var(--sq-slate-50);
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  font-family: var(--font-body);
}

.auth-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(460px, 540px) 1fr;
  min-height: 100vh;
  width: 100%;
  flex: 1;
}

.auth-page {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: #ffffff;
  position: relative;
  z-index: 2;
  box-shadow: 10px 0 35px -10px rgba(15, 23, 42, 0.06);
}

.auth-card {
  min-width: 0;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.auth-logo {
  width: auto;
  max-width: 155px;
  height: auto;
  max-height: 42px;
  object-fit: contain;
}

.version-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--sq-orange-600);
  background: rgba(242, 100, 25, 0.1);
  border: 1px solid rgba(242, 100, 25, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.08em;
  display: inline-block;
}

.auth-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.06em;
}

.security-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 6px #0284c7;
}

.auth-intro {
  margin-bottom: 28px;
}

.auth-intro .page-pretitle {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--sq-orange-500);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--sq-slate-900);
  margin: 0 0 8px;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--sq-slate-500);
  margin: 0;
}

.auth-alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  margin-bottom: 22px;
  font-size: 13px;
  animation: auth-alert-slide 0.3s ease;
}

@keyframes auth-alert-slide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-alert-icon {
  color: #dc2626;
  flex-shrink: 0;
  margin-top: 2px;
}

.auth-alert-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-alert-text strong {
  font-size: 13px;
  font-weight: 700;
  color: #991b1b;
}

.auth-alert-text span {
  font-size: 12px;
  color: #b91c1c;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.security-hint {
  font-size: 11px;
  color: #58677e;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sq-slate-400);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.input-with-icon:focus-within .field-icon {
  color: var(--sq-orange-500);
}

.input-with-icon .auth-input,
.input-with-icon .form-control,
.auth-input {
  height: 48px;
  padding: 10px 14px 10px 44px;
  border-radius: 10px;
  border: 1px solid var(--sq-slate-300);
  font-size: 14px;
  line-height: 1.4;
  color: var(--sq-slate-900);
  background: #ffffff;
  width: 100%;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.input-with-icon .auth-input:focus,
.input-with-icon .form-control:focus,
.auth-input:focus {
  background: #ffffff;
  border-color: var(--sq-orange-500);
  box-shadow: 0 0 0 4px rgba(242, 100, 25, 0.18);
  outline: none;
}

.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px #ffffff inset;
  -webkit-text-fill-color: var(--sq-slate-900);
  caret-color: var(--sq-slate-900);
  transition: background-color 5000s ease-in-out 0s;
}

.password-wrap.input-with-icon .auth-input,
.password-wrap.input-with-icon .form-control {
  padding-left: 44px;
  padding-right: 86px;
}

.password-wrap .password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sq-slate-600);
  background: var(--sq-slate-100);
  border: 1px solid var(--sq-slate-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.password-wrap .password-toggle:hover {
  background: var(--sq-slate-200);
  color: var(--sq-slate-900);
}

.login-submit {
  width: 100%;
  min-height: 50px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--sq-orange-500) 0%, var(--sq-orange-600) 100%);
  border: 1px solid var(--sq-orange-600);
  color: #ffffff;
  box-shadow: 0 8px 20px -4px rgba(242, 100, 25, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
}

.login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -4px rgba(242, 100, 25, 0.52);
  background: var(--sq-orange-600);
  color: #ffffff;
}

.login-btn-arrow {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.login-submit:hover .login-btn-arrow {
  transform: translateX(3px);
}

.auth-footer {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--sq-slate-200);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-security-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--sq-slate-500);
}

.auth-security-notice svg {
  color: var(--sq-emerald-600);
  flex-shrink: 0;
  margin-top: 2px;
}

.auth-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.auth-link {
  color: var(--sq-slate-500);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.auth-link:hover {
  color: var(--sq-orange-500);
  text-decoration: underline;
}

/* Panel Visual Derecho */
.auth-panel-visual {
  background: linear-gradient(135deg, #061224 0%, #0b1e38 55%, #133360 100%);
  color: #ffffff;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-visual-grid-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
}

.auth-visual-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.18;
}

.auth-visual-glow.glow-1 {
  top: -100px;
  right: -100px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #f26419 0%, transparent 70%);
}

.auth-visual-glow.glow-2 {
  bottom: -100px;
  left: -100px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
}

.auth-visual-content {
  position: relative;
  z-index: 1;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.visual-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #fdba74;
  background: rgba(242, 100, 25, 0.14);
  border: 1px solid rgba(253, 186, 116, 0.25);
  padding: 5px 12px;
  border-radius: 999px;
  width: fit-content;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f26419;
  box-shadow: 0 0 0 3px rgba(242, 100, 25, 0.3);
}

.visual-illustration-container {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 32px 24px;
  display: flex;
  justify-content: center;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.4);
}

.visual-svg {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.35));
}

.visual-quote h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  margin: 0 0 10px;
  letter-spacing: -0.025em;
}

.visual-quote p {
  font-size: 13.5px;
  line-height: 1.7;
  color: #94a3b8;
  margin: 0;
}

.visual-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.visual-metric-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  backdrop-filter: blur(8px);
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: #38bdf8;
}

.metric-lbl {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.visual-footer-bar {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #64748b;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.login-footer {
  padding: 16px 24px;
  text-align: center;
  font-size: 11.5px;
  color: var(--sq-slate-400);
  background: #ffffff;
  border-top: 1px solid var(--sq-slate-200);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.login-footer-sep {
  opacity: 0.4;
}

.login-footer-dev {
  color: var(--sq-slate-500);
}

.login-footer-dev a {
  color: var(--sq-slate-700);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.login-footer-dev a:hover {
  color: var(--sq-primary);
}

/* Soporte Tema Oscuro */
[data-theme="dark"] .login-page {
  background: var(--sq-navy-950);
}

[data-theme="dark"] .auth-page {
  background: var(--sq-navy-900);
  box-shadow: 10px 0 35px -10px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .auth-title {
  color: #ffffff;
}

[data-theme="dark"] .auth-subtitle {
  color: #94a3b8;
}

[data-theme="dark"] .form-label {
  color: #cbd5e1;
}

[data-theme="dark"] .input-with-icon .auth-input,
[data-theme="dark"] .input-with-icon .form-control,
[data-theme="dark"] .auth-input {
  background: var(--sq-navy-950);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

[data-theme="dark"] .input-with-icon .auth-input:focus,
[data-theme="dark"] .input-with-icon .form-control:focus,
[data-theme="dark"] .auth-input:focus {
  background: var(--sq-navy-950);
  border-color: var(--sq-orange-500);
}

[data-theme="dark"] .auth-input:-webkit-autofill,
[data-theme="dark"] .auth-input:-webkit-autofill:hover,
[data-theme="dark"] .auth-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--sq-navy-950) inset;
  -webkit-text-fill-color: #ffffff;
  caret-color: #ffffff;
}

[data-theme="dark"] .password-wrap .password-toggle {
  background: var(--sq-navy-800);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

[data-theme="dark"] .auth-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .auth-security-notice {
  color: #94a3b8;
}

[data-theme="dark"] .auth-link {
  color: #94a3b8;
}

[data-theme="dark"] .login-footer {
  background: var(--sq-navy-950);
  border-top-color: rgba(255, 255, 255, 0.08);
  color: #64748b;
}

[data-theme="dark"] .login-footer-dev {
  color: #64748b;
}

[data-theme="dark"] .login-footer-dev a {
  color: #94a3b8;
}

[data-theme="dark"] .login-footer-dev a:hover {
  color: #38bdf8;
}

/* Adaptación Responsiva */
@media (max-width: 960px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-panel-visual {
    display: none;
  }
  .auth-page {
    min-height: calc(100vh - 54px);
    padding: 36px 20px;
    box-shadow: none;
  }
}

@media (max-width: 480px) {
  .auth-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .auth-title {
    font-size: 24px;
  }
  .auth-footer-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.auth-intro .page-pretitle, .req-dot { color:#b53e09; }
