/* ==========================================================================
   Drive-Guard v4 Enterprise — Apple-Grade Design System & CSS Tokens
   Fully Fluid & Responsive: 14" MacBook → 28" DualUp → 32" Monitor → Mobile
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
  /* Color Palette (macOS Dark Mode) */
  --bg-app: #090a0f;
  --bg-surface: #12141c;
  --bg-surface-elevated: #1a1d28;
  --bg-surface-hover: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(18, 20, 28, 0.8);
  --bg-glass-header: rgba(9, 10, 15, 0.92);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-accent: rgba(10, 132, 255, 0.5);

  --text-primary: #f5f6f8;
  --text-secondary: #9ea3b0;
  --text-tertiary: #646a78;

  --accent-blue: #0a84ff;
  --accent-blue-hover: #0070e0;
  --accent-blue-glow: rgba(10, 132, 255, 0.25);
  
  --alert-red: #ff453a;
  --alert-red-bg: rgba(255, 69, 58, 0.12);
  --alert-red-border: rgba(255, 69, 58, 0.3);
  
  --success-green: #32d74b;
  --success-green-bg: rgba(50, 215, 75, 0.12);
  --success-green-border: rgba(50, 215, 75, 0.3);
  
  --warning-orange: #ff9f0a;
  --warning-orange-bg: rgba(255, 159, 10, 0.12);
  --warning-orange-border: rgba(255, 159, 10, 0.3);
  
  --shield-purple: #bf5af2;
  --shield-purple-bg: rgba(191, 90, 242, 0.12);
  --shield-purple-border: rgba(191, 90, 242, 0.3);

  --ttl-cyan: #64d2ff;
  --ttl-cyan-bg: rgba(100, 210, 255, 0.12);
  --ttl-cyan-border: rgba(100, 210, 255, 0.3);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  --blur-glass: blur(12px);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 300ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Fluid spacing tokens — scale with viewport */
  --page-padding: clamp(1rem, 2.5vw, 3rem);
  --section-gap: clamp(1.25rem, 2vw, 2.5rem);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  /* 
    True 'Zoom Out' scaling:
    Roots all rem values to the viewport width.
    At 1800px+ -> 16px (100% scale)
    At 1400px -> 12.6px (78% scale)
    At 1200px -> 10.8px (67% scale)
    This guarantees the dense table fits perfectly on 14-inch screens without scrolling.
  */
  font-size: clamp(9px, 0.9vw, 16px); 
}

html {
  height: 100%;
  scroll-behavior: smooth;
  overflow-y: scroll;
}

html, body {
  width: 100%;
}

body {
  min-height: 100%;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(13px, 1.1vw, 15px);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-blue-hover); }

/* ==========================================================================
   HEADER — Full-width sticky glass bar, 3-zone flex layout
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--bg-glass-header);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--page-padding);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transform: translateZ(0);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent-blue), #5e5ce6);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.35);
  flex-shrink: 0;
}

.logo-text {
  font-size: clamp(1rem, 1.4vw, 1.3rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.logo-badge {
  font-size: 0.64rem;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(255, 69, 58, 0.2), rgba(191, 90, 242, 0.2));
  color: #ff6b6b;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  border: 1px solid rgba(255, 69, 58, 0.3);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* CENTER — Security Tools Pill Bar */
.nav-tools-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.nav-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: clamp(0.74rem, 0.85vw, 0.84rem);
  font-weight: 500;
  cursor: pointer;
  /* Only transition the properties that actually change on hover — not 'all' */
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.nav-pill-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }
.nav-pill-btn.highlight-shield { color: var(--shield-purple); }
.nav-pill-btn.highlight-shield:hover { background: var(--shield-purple-bg); }

/* LANDING PAGE NAV */
/* Landing page nav links — GPU-composited hover only
 * CRITICAL: color/background on :hover = CPU repaint = backing-store re-promotion flash
 * under GPU memory pressure (triggered by heavy tabs, video, etc.)
 * opacity on :hover = pure GPU alpha multiply = zero CPU, zero repaint, zero flicker */
.landing-nav-link {
  color: white;
  text-decoration: none;
  opacity: 0.65;
  /* will-change: opacity pre-allocates compositor slot so no promotion cost on hover */
  will-change: opacity;
}
.landing-nav-link:hover {
  opacity: 1;
}

.landing-nav-btn {
  padding: 10px 24px;
  background: rgba(10, 132, 255, 0.1);
  border: 1px solid rgba(10, 132, 255, 0.3);
  border-radius: 20px;
  color: var(--accent-blue);
  text-decoration: none;
  box-shadow: 0 0 15px rgba(10, 132, 255, 0.15);
  opacity: 0.8;
  will-change: opacity;
}
.landing-nav-btn:hover {
  opacity: 1;
}

.landing-action-button {
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  will-change: opacity;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.landing-action-button:hover {
  opacity: 0.88;
  transform: translateY(-2px);
}
/* No :hover override — let btn-primary:hover run normally within the isolated layer */

/* RIGHT — Mode + Connect */
.header-right-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.mode-toggle-container {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  display: flex;
  gap: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: clamp(0.72rem, 0.82vw, 0.82rem);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.mode-btn.active { background: var(--accent-blue); color: white; box-shadow: 0 2px 8px rgba(10, 132, 255, 0.4); }
.mode-btn:hover:not(.active) { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }

/* Mobile Hamburger (hidden on desktop) */
.hamburger-btn {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.hamburger-btn:hover { background: rgba(255,255,255,0.1); }
.hamburger-line {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-smooth);
}

/* Mobile Nav Dropdown (hidden on desktop) */
.mobile-nav-dropdown {
  display: flex;
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem var(--page-padding);
  z-index: 99;
  gap: 0.5rem;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  
  /* Smooth Animation */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s;
}
.mobile-nav-dropdown.open { 
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.mobile-nav-dropdown .nav-pill-btn {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  font-size: 0.92rem;
  justify-content: flex-start;
  min-height: 48px;
}
.mobile-nav-dropdown .mode-toggle-container {
  width: 100%;
  justify-content: center;
  padding: 4px;
}
.mobile-nav-dropdown .mode-btn {
  flex: 1;
  justify-content: center;
  padding: 10px;
  font-size: 0.9rem;
}

/* ==========================================================================
   MAIN CONTENT — Fully fluid, no max-width cap
   ========================================================================== */
.main-content {
  width: 100%;
  padding: var(--section-gap) var(--page-padding);
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(20, 22, 31, 0.4) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 2.5vw, 2.5rem) clamp(1.5rem, 3vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-sm);
}

.hero-text { flex: 1; min-width: 0; }
.hero-title {
  font-size: clamp(1.35rem, 2.2vw, 2.2rem);
  margin-bottom: 0.6rem;
  background: linear-gradient(135deg, #ffffff 0%, #a0a6b5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}
.hero-desc { color: var(--text-secondary); font-size: clamp(0.85rem, 1vw, 1rem); line-height: 1.6; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: clamp(0.78rem, 0.85vw, 0.88rem);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  outline: none;
  white-space: nowrap;
  min-height: 36px;
  position: relative;
}
.btn-primary { background: var(--accent-blue); color: white; box-shadow: 0 4px 14px rgba(10, 132, 255, 0.35); }
.btn-primary:not(.landing-action-button):hover { background: var(--accent-blue-hover); box-shadow: 0 6px 20px rgba(10, 132, 255, 0.5); filter: brightness(1.1); }
.btn-danger { background: var(--alert-red); color: white; box-shadow: 0 4px 14px rgba(255, 69, 58, 0.3); }
.btn-danger:hover { background: #e0382e; box-shadow: 0 6px 20px rgba(255, 69, 58, 0.5); filter: brightness(1.1); }
.btn-danger:disabled { background: var(--bg-surface-elevated); color: var(--text-tertiary); cursor: not-allowed; box-shadow: none; border: 1px solid var(--border-subtle); }
.btn-secondary { background: var(--bg-surface-elevated); color: var(--text-primary); border: 1px solid var(--border-subtle); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--border-hover); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.btn-shield { background: var(--shield-purple-bg); color: var(--shield-purple); border: 1px solid var(--shield-purple-border); }
.btn-shield:hover { background: rgba(191, 90, 242, 0.25); box-shadow: 0 4px 12px rgba(191, 90, 242, 0.2); filter: brightness(1.1); }
.btn-override-safe { background: var(--success-green-bg); color: var(--success-green); border: 1px solid var(--success-green-border); padding: 5px 10px; font-size: 0.78rem; font-weight: 600; border-radius: 6px; position: relative; }
.btn-override-safe:hover { background: rgba(50, 215, 75, 0.25); filter: brightness(1.1); }
.btn-restrict-domain { background: rgba(10, 132, 255, 0.12); color: #64d2ff; border: 1px solid rgba(10, 132, 255, 0.35); padding: 5px 10px; font-size: 0.76rem; font-weight: 600; border-radius: 6px; position: relative; }
.btn-restrict-domain:hover { background: rgba(10, 132, 255, 0.25); filter: brightness(1.1); }
.btn-transfer-owner { background: linear-gradient(135deg, rgba(255, 159, 10, 0.15), rgba(191, 90, 242, 0.15)); color: #ffd60a; border: 1px solid rgba(255, 159, 10, 0.35); padding: 5px 10px; font-size: 0.76rem; font-weight: 600; border-radius: 6px; position: relative; }
.btn-transfer-owner:hover { background: rgba(255, 159, 10, 0.3); filter: brightness(1.1); }
.btn-icon { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary); width: 32px; height: 32px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition-fast); }
.btn-icon:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }

.role-changer-select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.role-changer-select:hover { border-color: var(--accent-blue); }
.role-changer-select:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 2px var(--accent-blue-glow); }
.role-changer-select option { background: var(--bg-surface-elevated); }

/* ==========================================================================
   KPI STATS GRID — Fluid columns, fills available width
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 1.5vw, 1.5rem);
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(1.25rem, 2vw, 1.75rem);
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; color: var(--text-secondary); font-size: clamp(0.78rem, 0.9vw, 0.9rem); font-weight: 500; }
.stat-value { font-size: clamp(2rem, 3vw, 3rem); font-weight: 700; color: var(--text-primary); font-family: 'Outfit', sans-serif; }
.stat-subtext { font-size: clamp(0.72rem, 0.8vw, 0.8rem); color: var(--text-tertiary); margin-top: 0.5rem; }
.stat-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.icon-blue { background: rgba(10, 132, 255, 0.15); color: var(--accent-blue); }
.icon-red { background: var(--alert-red-bg); color: var(--alert-red); }
.icon-green { background: var(--success-green-bg); color: var(--success-green); }

/* ==========================================================================
   TABLE SECTION — Fluid, fills screen width
   ========================================================================== */
.table-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-toolbar {
  padding: clamp(1rem, 1.5vw, 1.5rem) clamp(1rem, 2vw, 2rem);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  background: rgba(255, 255, 255, 0.01);
}
.toolbar-left { 
  display: flex; 
  align-items: center; 
  gap: 0.85rem; 
  flex-wrap: wrap; 
  max-width: 100%;
}

.view-toggle-box {
  display: flex;
  background: var(--bg-app);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.view-btn { flex-shrink: 0; background: transparent; border: none; color: var(--text-secondary); padding: 0.35rem 0.75rem; border-radius: 6px; font-size: clamp(0.76rem, 0.82vw, 0.84rem); font-weight: 500; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; }
.view-btn.active { background: var(--bg-surface-elevated); color: var(--text-primary); font-weight: 600; box-shadow: var(--shadow-sm); border: 1px solid rgba(255, 255, 255, 0.1); }

.dept-select-box { display: flex; align-items: center; background: var(--bg-app); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0 0.6rem; height: 2.1rem; flex-shrink: 0; }
.dept-select { background: transparent; border: none; color: var(--text-primary); font-size: clamp(0.76rem, 0.82vw, 0.84rem); font-weight: 600; outline: none; cursor: pointer; }
.dept-select option { background: var(--bg-surface-elevated); color: var(--text-primary); }

.filter-tabs { display: flex; gap: 0.5rem; background: var(--bg-app); padding: 0.35rem; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); flex-shrink: 0; flex-wrap: wrap; }
.tab-btn { flex-shrink: 0; background: transparent; border: none; color: var(--text-secondary); padding: 0.45rem 1rem; border-radius: var(--radius-pill); font-size: clamp(0.76rem, 0.82vw, 0.84rem); font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tab-btn:hover:not(.active) { color: var(--text-primary); }
.tab-btn.active { background: var(--bg-surface-elevated); color: var(--text-primary); font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.08); }
.tab-count { font-size: 0.72rem; padding: 0.15rem 0.45rem; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
.tab-btn.active .tab-count { background: var(--accent-blue); color: white; }
#tab-breach.active .tab-count { background: var(--alert-red); color: white; }

.search-box { position: relative; width: clamp(260px, 30vw, 450px); flex-grow: 1; max-width: 450px; }
.search-input { width: 100%; background: var(--bg-app); border: 1px solid var(--border-subtle); border-radius: var(--radius-pill); padding: 0.6rem 1rem 0.6rem 2.5rem; color: var(--text-primary); font-size: clamp(14px, 1vw, 16px); outline: none; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.search-input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.15); }
.search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; width: 1rem; height: 1rem; }

/* DESKTOP TABLE */
.table-container { overflow-x: auto; }
.desktop-table-wrap { display: block; }
.guest-table { width: 100%; border-collapse: collapse; text-align: left; table-layout: auto; }
.guest-table th { position: sticky; top: 0; background: var(--bg-surface-elevated); color: var(--text-secondary); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--border-subtle); z-index: 10; white-space: nowrap; }
.guest-table td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; font-size: 0.82rem; color: var(--text-primary); }
.guest-table tr:last-child td { border-bottom: none; }
.guest-table tr:hover td { background-color: var(--bg-surface-hover); }

/* Hide less critical columns on smaller screens to prevent horizontal scroll */
@media (max-width: 1400px) {
  .col-dept, .th-dept { display: none; }
}
@media (max-width: 1280px) {
  .col-last-activity, .th-last-activity { display: none; }
  .col-files, .th-files { display: none; }
}
/* Give the user column enough breathing room instead of a hard clip */
#th-user-col { min-width: 260px; }

.custom-checkbox { width: 1rem; height: 1rem; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.3); appearance: none; background: var(--bg-app); cursor: pointer; position: relative; flex-shrink: 0; }
.custom-checkbox:checked { background: var(--accent-blue); border-color: var(--accent-blue); }
.custom-checkbox:checked::after { content: '✓'; position: absolute; color: white; font-size: 0.65rem; font-weight: 700; top: 50%; left: 50%; transform: translate(-50%, -50%); }

.user-info { display: flex; align-items: center; gap: 0.85rem; cursor: pointer; }
.user-info:hover .user-name { color: var(--accent-blue); text-decoration: underline; }
.user-avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-subtle); background: var(--bg-surface-elevated); flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; color: var(--text-primary); transition: color var(--transition-fast); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.badge-stale { background: var(--alert-red-bg); color: var(--alert-red); border: 1px solid var(--alert-red-border); }
.badge-active { background: var(--success-green-bg); color: var(--success-green); border: 1px solid var(--success-green-border); }
.badge-moderate { background: var(--warning-orange-bg); color: var(--warning-orange); border: 1px solid var(--warning-orange-border); }
.badge-shield { background: var(--shield-purple-bg); color: var(--shield-purple); border: 1px solid var(--shield-purple-border); }
.badge-ttl { background: var(--ttl-cyan-bg); color: var(--ttl-cyan); border: 1px solid var(--ttl-cyan-border); }
.badge-dept { background: rgba(255, 255, 255, 0.07); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
@keyframes breachPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(255, 69, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0); } }
.badge-breach { background: rgba(255, 69, 58, 0.18); color: #ff6b6b; border: 1px solid #ff453a; animation: breachPulse 2s ease-in-out infinite; }
.badge-role-editor { background: rgba(255, 69, 58, 0.15); color: #ff453a; padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 600; border: 1px solid rgba(255, 69, 58, 0.3); }
.badge-role-commenter { background: rgba(255, 159, 10, 0.15); color: #ff9f0a; padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 600; border: 1px solid rgba(255, 159, 10, 0.3); }
.badge-role-viewer { background: rgba(50, 215, 75, 0.12); color: #32d74b; padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 600; border: 1px solid rgba(50, 215, 75, 0.3); }

/* breachPulse uses opacity only — GPU composited, zero repaint cost vs box-shadow */
@keyframes breachPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* Mobile card list — hidden on desktop */
.mobile-card-list { display: none; }

/* ==========================================================================
   DRAWER — Slide from right (desktop), slide from bottom (mobile)
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: clamp(680px, 60vw, 920px);
  background: var(--bg-surface-elevated);
  border-left: 1px solid var(--border-hover);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  overflow: hidden;
}
.drawer-overlay.active .drawer-panel { transform: translateX(0); }

.drawer-header { padding: 1.25rem 1.75rem; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; background: var(--bg-glass-header); flex-shrink: 0; }
.drawer-title { font-size: clamp(1rem, 1.2vw, 1.25rem); font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.drawer-body { padding: 1.75rem; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.drawer-section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.06em; margin-bottom: 1rem; margin-top: 1.5rem; }
.drawer-section-title:first-child { margin-top: 0; }

.file-card { background: linear-gradient(135deg, var(--bg-surface-elevated) 0%, rgba(20,24,35,0.9) 100%); border: 1px solid var(--border-subtle); border-left: 3px solid var(--accent-blue); border-radius: var(--radius-md); padding: 1rem; margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.65rem; transition: border-color 0.2s, box-shadow 0.2s; }
.file-card:hover { border-color: rgba(10,132,255,0.5); box-shadow: 0 4px 20px rgba(10,132,255,0.1); }
.file-card:has(.drawer-file-checkbox:checked) { border-left-color: #30d158; background: linear-gradient(135deg, rgba(48,209,88,0.06) 0%, var(--bg-surface-elevated) 100%); }
.file-card-title { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.owner-meta-box { background: rgba(255, 255, 255, 0.03); border: 1px dashed var(--border-subtle); padding: 6px 10px; border-radius: 6px; font-size: 0.76rem; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.owner-offboarded { border-color: rgba(255, 159, 10, 0.5); background: rgba(255, 159, 10, 0.08); color: #ffb340; }

.history-filter-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 1rem; }
.act-pill { background: var(--bg-app); border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; }
.act-pill:hover { color: var(--text-primary); border-color: var(--border-hover); }
.act-pill.active { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-left 0.2s ease;
  cursor: pointer;
  user-select: none;
  border-left: 3px solid transparent;
}
.activity-item:active {
  cursor: grabbing;
}
.activity-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--accent-blue);
}
.activity-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateX(10px);
}
.activity-item:hover .activity-actions,
.activity-item.swiped .activity-actions {
  opacity: 1;
  transform: translateX(0);
}
.notif-action-btn {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.notif-action-btn.resolve {
  background: rgba(48, 209, 88, 0.15);
  color: #30d158;
  border-color: rgba(48, 209, 88, 0.3);
}
.notif-action-btn.resolve:hover {
  background: rgba(48, 209, 88, 0.25);
}
.notif-action-btn.dismiss {
  background: rgba(255, 69, 58, 0.15);
  color: #ff453a;
  border-color: rgba(255, 69, 58, 0.3);
}
.notif-action-btn.dismiss:hover {
  background: rgba(255, 69, 58, 0.25);
}
.notif-action-btn.restore {
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent-blue);
  border-color: rgba(10, 132, 255, 0.3);
}
.notif-action-btn.restore:hover {
  background: rgba(10, 132, 255, 0.25);
}
.activity-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.act-high { background: var(--alert-red-bg); color: var(--alert-red); border: 1px solid var(--alert-red-border); }
.act-med { background: var(--warning-orange-bg); color: var(--warning-orange); }
.act-low { background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); }

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; pointer-events: none; transition: opacity var(--transition-smooth); padding: 1rem; will-change: opacity; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--bg-surface-elevated); border: 1px solid var(--border-hover); border-radius: var(--radius-lg); width: 100%; max-width: 580px; padding: clamp(1.25rem, 3vw, 2.25rem); box-shadow: var(--shadow-lg); transform: scale(0.95); transition: transform var(--transition-smooth); max-height: 90vh; overflow-y: auto; will-change: transform; }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: clamp(1rem, 1.3vw, 1.3rem); color: var(--text-primary); font-weight: 700; }
.close-btn { background: transparent; border: none; color: var(--text-tertiary); font-size: 1.5rem; cursor: pointer; line-height: 1; min-width: 32px; min-height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; will-change: opacity; opacity: 0.6; transition: opacity 0.2s ease; }
.close-btn:hover { opacity: 1; }
.modal-body { margin-bottom: 1.25rem; color: var(--text-secondary); font-size: 0.94rem; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }

.progress-bar-container { width: 100%; height: 8px; background: var(--bg-app); border-radius: var(--radius-pill); overflow: hidden; margin: 1.25rem 0; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-blue), #5e5ce6); width: 0%; transition: width 0.3s ease; }

.admin-list-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-app); padding: 0.85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); margin-bottom: 0.6rem; }

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 3rem); }
.toast { background: var(--bg-surface-elevated); border: 1px solid var(--border-hover); border-left: 4px solid var(--accent-blue); padding: 0.95rem 1.25rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 0.75rem; color: var(--text-primary); font-size: 0.88rem; font-weight: 500; min-width: min(300px, calc(100vw - 3rem)); transform: translateX(120%); transition: transform var(--transition-smooth); }
.toast.show { transform: translateX(0); }
.toast-success { border-left-color: var(--success-green); }
.toast-error { border-left-color: var(--alert-red); }


/* ==========================================================================
   ADMIN PANEL — Large Full-Screen Delegation Console (~75% viewport)
   ========================================================================== */

/* Override the overlay to always center-align (not bottom-sheet) */
.modal-overlay-center {
  align-items: center !important;
}

/* The panel itself */
.admin-panel {
  width: min(75vw, 1400px);
  height: min(80vh, 960px);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform var(--transition-smooth);
}
.modal-overlay.active .admin-panel { transform: scale(1); }

/* Panel Header */
.admin-panel-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.06), rgba(191, 90, 242, 0.06));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 1rem;
}
.admin-panel-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.admin-panel-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(191, 90, 242, 0.2), rgba(10, 132, 255, 0.15));
  border: 1px solid rgba(191, 90, 242, 0.3);
  border-radius: var(--radius-md);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-panel-title {
  font-size: clamp(1.2rem, 1.6vw, 1.6rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.admin-panel-subtitle {
  font-size: clamp(0.8rem, 0.9vw, 0.9rem);
  color: var(--text-secondary);
}
.admin-panel-close {
  font-size: 1.75rem;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/* Panel Two-Column Body */
.admin-panel-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

/* Left Column — Admin List */
.admin-panel-left {
  padding: 1.75rem 1.75rem 1.75rem 2rem;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Right Column — Hierarchy + Form */
.admin-panel-right {
  padding: 1.75rem 2rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.01);
}

/* Section titles inside panel */
.admin-panel-section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Admin count badge */
.admin-count-badge {
  background: var(--accent-blue);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* Tier Labels */
.admin-tier-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Admin list within each tier */
.admin-tier-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 48px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-app);
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition-fast);
}
.admin-list-item:hover { border-color: var(--border-hover); }

.admin-list-item-email {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-list-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

/* Role Hierarchy Cards (right column) */
.role-hierarchy-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.role-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
.role-card:hover { border-color: var(--border-hover); }
.role-card-icon {
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.role-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.role-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.role-card-super { background: linear-gradient(135deg, rgba(191, 90, 242, 0.1), rgba(10, 132, 255, 0.06)); border-color: rgba(191, 90, 242, 0.2) !important; }
.role-card-super .role-card-icon { background: var(--shield-purple-bg); }
.role-card-super .role-card-name { color: var(--shield-purple); }

.role-card-multi { background: rgba(10, 132, 255, 0.06); }
.role-card-multi .role-card-icon { background: rgba(10, 132, 255, 0.15); }
.role-card-multi .role-card-name { color: var(--accent-blue); }

.role-card-dept { background: rgba(255, 159, 10, 0.06); }
.role-card-dept .role-card-icon { background: var(--warning-orange-bg); }
.role-card-dept .role-card-name { color: var(--warning-orange); }

.role-card-user { background: rgba(50, 215, 75, 0.05); }
.role-card-user .role-card-icon { background: var(--success-green-bg); }
.role-card-user .role-card-name { color: var(--success-green); }

/* Authorization Form Card */
.admin-form-card {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.admin-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.admin-form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
}
.admin-form-select {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.admin-form-select:hover, .admin-form-select:focus { border-color: var(--accent-blue); }
.admin-form-select option { background: var(--bg-surface-elevated); }
.admin-form-note {
  background: var(--warning-orange-bg);
  border: 1px solid var(--warning-orange-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--warning-orange);
  line-height: 1.5;
}
.admin-form-submit {
  width: 100%;
  padding: 0.85rem;
  font-size: 0.95rem;
  justify-content: center;
}

/* Panel Footer */
.admin-panel-footer {
  padding: 1.1rem 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-glass-header);
  flex-shrink: 0;
}
.admin-panel-footer-note {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* Admin Panel on Tablet ≤1024px: stack columns */
@media (max-width: 1024px) {
  .admin-panel {
    width: min(92vw, 800px);
    height: min(90vh, 900px);
  }
  .admin-panel-body {
    grid-template-columns: 1fr;
  }
  .admin-panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: 320px;
  }
}

/* Admin Panel on Mobile ≤768px: full screen */
@media (max-width: 768px) {
  .modal-overlay-center { align-items: center !important; }
  .admin-panel {
    width: 100%;
    height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .admin-panel-header { padding: 1.1rem 1.25rem; }
  .admin-panel-icon { width: 40px; height: 40px; font-size: 1.2rem; }
  .admin-panel-body { grid-template-columns: 1fr; }
  .admin-panel-left { border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: 280px; padding: 1.25rem; }
  .admin-panel-right { padding: 1.25rem; }
  .admin-panel-footer { padding: 1rem 1.25rem; flex-direction: column; align-items: stretch; }
  .admin-form-submit { padding: 0.95rem; }
}

/* ==========================================================================

   ========================================================================== */

/* ── 14-inch laptop (≤1280px) — Compact layout to prevent black void ── */
@media (max-width: 1280px) {
  /* Collapse the tall hero banner into a slim 1-line strip */
  .hero-banner {
    padding: 0.6rem clamp(1rem, 2vw, 1.5rem);
    gap: 1rem;
  }
  .hero-title { font-size: clamp(0.85rem, 1.1vw, 1rem); }
  .hero-desc { display: none; }

  /* Compact stat cards */
  .stat-card { padding: 0.85rem 1rem; }
  .stat-value { font-size: clamp(1.6rem, 2.5vw, 2rem); }
  .stat-subtext { display: none; }
  .stat-header { margin-bottom: 0.4rem; font-size: 0.78rem; }

  /* Reduce section gap so content is tighter */
  .main-content { gap: 0.75rem; padding-top: 0.75rem; padding-bottom: 0.75rem; overflow-x: hidden; }

  /* Wrap toolbar so it doesn't overflow horizontally */
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left { flex-wrap: wrap; gap: 0.5rem; }
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .filter-tabs::-webkit-scrollbar { display: none; }

  /* Hide less critical view buttons text on small laptops */
  .view-toggle-box { flex-wrap: wrap; }
}

/* ── Large screens (2560px+, 32" / 4K) ── */
@media (min-width: 2560px) {
  :root { --page-padding: clamp(2.5rem, 3vw, 5rem); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
  .guest-table th, .guest-table td { padding: 1.25rem 2rem; }
  .hero-banner { padding: 3rem 4rem; }
}

/* ── XL screens (1920px+ / 28" DualUp / 32") ── */
@media (min-width: 1920px) {
  .hero-title { font-size: clamp(2rem, 2.5vw, 2.8rem); }
  .stat-value { font-size: clamp(2.5rem, 3.5vw, 3.5rem); }
}

/* ── Tablet / iPad (≤1024px) — Collapse nav into hamburger ── */
@media (max-width: 1024px) {
  .nav-tools-bar { display: none !important; }
  .hamburger-btn { display: flex; }
  .app-header { height: auto; padding: 0.85rem var(--page-padding); flex-wrap: nowrap; }
  .header-right-controls { gap: 0.6rem; }
  .mode-btn { padding: 4px 8px; font-size: 0.76rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .toolbar-left { gap: 0.6rem; }
  .search-box { width: 100%; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .drawer-panel { width: min(760px, 95vw); }
}

/* ── Mobile (≤768px / smartphones, foldables in portrait) ── */
@media (max-width: 768px) {
  :root { --page-padding: 0.85rem; --section-gap: 1rem; }

  .app-header { height: auto; padding: 0.75rem var(--page-padding); }
  .logo-badge { display: none; }
  .mode-toggle-container { display: none; }
  #btn-connect-workspace { display: none; }

  /* Hero → compact */
  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem;
    gap: 1rem;
  }
  .hero-title { font-size: clamp(1.1rem, 5vw, 1.4rem); }
  .hero-desc { display: none; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  /* Stats → 2 columns */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stat-value { font-size: clamp(1.75rem, 7vw, 2.2rem); }
  .stat-card { padding: 1rem; }
  .stat-subtext { display: none; }

  /* Table section → switch to cards */
  .desktop-table-wrap { display: none; }
  .mobile-card-list { display: block; padding: 0.75rem; }

  /* Toolbar on mobile */
  .view-toggle-box { width: 100%; }
  .view-btn { flex: 1; text-align: center; justify-content: center; }
  .dept-select-box { width: 100%; }
  .dept-select { width: 100%; }
  .filter-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }

  /* Drawer → bottom sheet on mobile */
  .drawer-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 92vh;
    border-left: none;
    border-top: 1px solid var(--border-hover);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }
  .drawer-overlay.active .drawer-panel { transform: translateY(0); }

  /* Pull handle for bottom sheet */
  .drawer-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0.75rem auto -0.25rem;
  }
  .drawer-header { padding: 0.85rem 1.25rem; }
  .drawer-body { padding: 1.25rem; }
  .file-card-actions { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .file-card-actions .btn,
  .file-card-actions .role-changer-select,
  .file-card-actions .btn-restrict-domain,
  .file-card-actions .btn-transfer-owner { width: 100%; justify-content: center; font-size: 0.85rem; padding: 10px; min-height: 44px; }

  /* Modals → Centered on mobile */
  .modal-content { 
    max-width: 95%; 
    width: 100%;
    border-radius: var(--radius-lg); 
    margin: 0;
    max-height: 85vh;
    overflow-y: auto;
  }
  .modal-overlay { align-items: center; justify-content: center; padding: 1rem; }

  /* Toast → bottom left on mobile */
  .toast-container { bottom: 1rem; left: 1rem; right: 1rem; }
  .toast { min-width: unset; width: 100%; }
}

/* ── Very small phones (≤390px) ── */
@media (max-width: 390px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .logo-text { font-size: 1rem; }
  .stat-header span { font-size: 0.72rem; }
}

/* ==========================================================================
   MOBILE CARD COMPONENTS (rendered by JS on small screens)
   ========================================================================== */
.m-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color var(--transition-fast);
}
.m-card:active { border-color: var(--border-hover); }

.m-card-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}
.m-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.m-card-avatar-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(10,132,255,0.15);
  color: var(--accent-blue);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m-card-name { font-weight: 700; font-size: 0.96rem; color: var(--text-primary); }
.m-card-email { font-size: 0.78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.m-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}
.m-card-status { width: 100%; }
.m-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.m-card-actions .btn,
.m-card-actions button {
  min-height: 44px;
  justify-content: center;
  font-size: 0.84rem;
  width: 100%;
}
.m-card-actions .btn-breach {
  grid-column: 1 / -1;
}
.m-card-breach-banner {
  background: var(--alert-red-bg);
  border: 1px solid var(--alert-red-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: #ff6b6b;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Drive-Guard v5 — Header Auth, Notifications, Footer & Panel Styles
   ========================================================================== */

/* Header Bell & Badge */
.header-bell {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
}
.header-bell:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
  box-shadow: 0 0 16px rgba(10, 132, 255, 0.2);
}
.notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--alert-red);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-app);
}

/* Notification Dropdown Menu (v5 Ultrawide / Desktop Enhancement) */
.notif-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}
.notif-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 580px;
  max-width: 94vw;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), 0 0 30px rgba(10, 132, 255, 0.15);
  z-index: 2500;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  text-align: left;
}
.notif-dropdown-menu.active {
  display: flex;
  animation: dropdownSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dropdownSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Segmented Filter Control Bar (Full-Width, Uncluttered) */
.notif-segmented-control {
  display: flex;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}
.notif-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}
.notif-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}
.notif-tab.active {
  background: var(--bg-surface-elevated);
  color: white;
  border-color: var(--border-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
@media (max-width: 768px) {
  .notif-dropdown-menu {
    position: fixed;
    top: 64px;
    left: 5vw;
    right: 5vw;
    width: 90vw;
    max-height: 80vh;
    border-radius: var(--radius-md);
  }
}

/* User Profile Pill & Dropdown */
.auth-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px 4px 5px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}
.user-profile-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}
.user-profile-pill img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.profile-arrow {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-left: 2px;
}

.profile-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
  z-index: 1000;
  padding: 0.5rem 0;
  flex-direction: column;
}
.profile-dropdown-menu.active {
  display: flex;
}
.profile-dropdown-header {
  padding: 0.6rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.profile-dropdown-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-dropdown-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu-item {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition-fast);
}
.profile-menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.profile-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.35rem 0;
}

/* Settings & Help Sidebar Tabs */
.settings-sidebar {
  width: 220px;
  background: var(--bg-app);
  border-right: 1px solid var(--border-subtle);
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.settings-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}
.settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}
.settings-tab-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.settings-content-area {
  flex: 1;
  padding: 1.75rem 2.25rem;
  overflow-y: auto;
}
.settings-tab-content {
  display: none;
}
.settings-tab-content.active {
  display: block;
}
.help-section {
  display: none;
}
.help-section.active {
  display: block;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(18, 20, 28, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-hover);
  padding: 1rem var(--page-padding);
  z-index: 2500;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
}
.cookie-banner-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Footer Section */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem var(--page-padding);
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--text-tertiary);
  font-size: 0.8rem;
}
.footer-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.footer-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}
.footer-link:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .cookie-banner-content {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-banner-actions {
    width: 100%;
    justify-content: stretch;
  }
  .cookie-banner-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .app-footer {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .footer-right {
    justify-content: center;
  }
  .settings-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    overflow-x: auto;
    padding: 0.75rem;
  }
  .settings-tab-btn {
    white-space: nowrap;
  }
  .settings-content-area {
    padding: 1.25rem;
  }
}

/* ==========================================================================
   Drive-Guard v5.3 — Tag Classifier & Folder Hierarchy View Styles
   ========================================================================== */
.tag-preset-btn {
  transition: transform 0.15s ease, opacity 0.15s ease;
  border: 1px solid transparent;
}
.tag-preset-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
  border-color: var(--text-primary);
}
.folder-header-row {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-blue);
}
.folder-sub-row {
  padding-left: 2rem !important;
  background: rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   Phase 2: Ticketing & Omnichannel Simulations
   ========================================================================== */

/* Omnichannel Overlay Container */
.omnichannel-sim-overlay {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 2500;
  pointer-events: none;
}

/* Individual Sim Popups */
.omni-sim-container {
  width: 320px;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0,0,0,0.6);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
  overflow: hidden;
}

.omni-sim-container.active {
  transform: translateX(0);
  opacity: 1;
}

.omni-header {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(0,0,0,0.1);
}

.omni-body {
  padding: 12px 16px;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}
.spin-animation {
  animation: spin 1s linear infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background 0.2s, border-color 0.2s;
}

.ticket-row:hover {
  background: rgba(10, 132, 255, 0.06);
  border-color: rgba(10, 132, 255, 0.3);
}

.ticket-row-id {
  font-weight: 700;
  font-family: monospace;
  color: var(--text-primary);
}

.ticket-row-target {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ticket-badge {
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
}

.ticket-badge-open {
  background: rgba(255, 179, 64, 0.15);
  color: #ffb340;
  border: 1px solid rgba(255, 179, 64, 0.3);
}

.ticket-badge-resolved {
  background: rgba(48, 209, 88, 0.15);
  color: #30d158;
  border: 1px solid rgba(48, 209, 88, 0.3);
}

/* CC Autocomplete Pills */
.cc-pill {
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(10, 132, 255, 0.3);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cc-pill-remove {
  cursor: pointer;
  opacity: 0.7;
}
.cc-pill-remove:hover { opacity: 1; }
.autocomplete-item {
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.autocomplete-item:hover {
  background: rgba(255,255,255,0.05);
}

/* Onboarding Wizard Styles - Rebuilt for scale and stability */
.wizard-step {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}
.wizard-step.active {
  display: flex !important;
  flex-direction: column;
  gap: clamp(1.2rem, 3vw, 2rem);
  width: 100%;
}
.wizard-dot {
  width: clamp(24px, 4vw, 40px);
  height: 5px;
  border-radius: 3px;
  background: var(--border-subtle);
  transition: 0.3s ease;
}
.wizard-dot.active-dot {
  background: var(--accent-blue);
}

/* Grids */
.wizard-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  width: 100%;
}
.wizard-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  width: 100%;
}

/* Pricing Cards */
.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: clamp(1rem, 2vw, 1.25rem);
  display: flex;
  flex-direction: column;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  position: relative;
}
.pricing-card.text-left {
  text-align: left;
}
/* Feature Comparison Table */
.pricing-table-container {
  width: 100%;
  margin-top: 2rem;
  margin-bottom: 2rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.95rem;
}
.pricing-table th {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border-hover);
  position: sticky;
  top: 0;
  background: rgba(26, 29, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}
.pricing-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.pricing-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}
.pricing-table .table-section-header td {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(10, 132, 255, 0.05);
  padding: 1.5rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-accent);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.pricing-table td:first-child {
  text-align: left;
  color: var(--text-primary);
  font-weight: 500;
}
.pricing-table .check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent-blue);
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 0 8px rgba(10, 132, 255, 0.2);
}
.pricing-table .dash {
  color: var(--text-tertiary);
  font-weight: 600;
}
/* Hover Glow Effects */
.pricing-card.glow-silver:hover {
  box-shadow: 0 0 0 1px var(--border-subtle), 0 8px 24px rgba(255,255,255,0.05);
  border-color: var(--border-subtle);
  z-index: 10;
}
.pricing-card.glow-green:hover {
  box-shadow: 0 0 0 1px #10b981, 0 8px 24px rgba(16,185,129,0.15);
  border-color: #10b981;
  z-index: 10;
}
.pricing-card.glow-blue:hover {
  box-shadow: 0 0 0 1px var(--accent-blue), 0 8px 24px rgba(10,132,255,0.15);
  border-color: var(--accent-blue);
  z-index: 10;
}
.pricing-card.glow-purple:hover {
  box-shadow: 0 0 0 1px #8b5cf6, 0 8px 24px rgba(139,92,246,0.15);
  border-color: #8b5cf6;
  z-index: 10;
}
.premium-card {
  background: rgba(10,132,255,0.08);
  border: 2px solid var(--accent-blue);
}
.premium-card.pop-out {
  transform: scale(1.03);
  box-shadow: 0 4px 20px rgba(10,132,255,0.25);
}
.premium-card.pop-out:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 1px var(--accent-blue), 0 8px 24px rgba(10,132,255,0.25);
}

/* Card Internals */
.pricing-icon {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 0.75rem;
  text-align: center;
}
.pricing-title {
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.pricing-desc {
  font-size: clamp(0.8rem, 1.1vw, 0.9rem);
  color: var(--text-secondary);
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.5;
}
.pricing-price {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  margin: clamp(0.75rem, 1.5vw, 1rem) 0;
}
.pricing-price span {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  font-weight: 400;
}
.pricing-features {
  font-size: clamp(0.75rem, 1vw, 0.85rem);
  color: var(--text-secondary);
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  padding-left: 1.2rem;
  line-height: 1.6;
}
.pricing-disclaimer {
  font-size: clamp(0.65rem, 0.9vw, 0.75rem);
  color: var(--text-tertiary);
  margin-top: 0.75rem;
  text-align: center;
}
.most-popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-blue);
  color: #fff;
  font-size: clamp(0.65rem, 0.9vw, 0.75rem);
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(10,132,255,0.5);
  white-space: nowrap;
}

/* Utilities */
.btn-full {
  width: 100%;
  margin-top: auto;
}
.flex-1 {
  flex: 1;
}

/* Scan Animation */
.scan-radar-ring {
  width: clamp(80px, 15vw, 120px);
  height: clamp(80px, 15vw, 120px);
  border-radius: 50%;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--accent-blue);
  animation: spin 1.5s linear infinite;
  margin: 0 auto clamp(1rem, 2vw, 1.5rem);
}
.scan-progress-container {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: clamp(1rem, 2vw, 1.5rem);
  margin: 0 auto;
}
.scan-progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: clamp(0.75rem, 1.1vw, 0.85rem);
}
.scan-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-app);
  border-radius: 4px;
  overflow: hidden;
}
.scan-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--alert-orange);
  transition: width 0.1s linear;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Phase 5: Billing & Subscription Dashboard
   ========================================================================== */
.billing-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
.billing-table th {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  font-weight: 600;
  color: var(--text-secondary);
}
.billing-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}
.billing-table tr:last-child td {
  border-bottom: none;
}
.billing-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.role-toggle-btn.active {
  background: var(--bg-surface-elevated) !important;
  border-color: var(--border-hover) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Phase 7: Landing Page (Long-form Structure & Pacing)
   ========================================================================== */

.landing-section {
  padding: 6rem 1rem;
  width: 100%;
}

.bg-gradient-dark {
  background: linear-gradient(135deg, rgba(14, 14, 25, 1) 0%, rgba(20, 20, 35, 1) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.bg-surface {
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Marquee Animation for Social Proof */
.marquee-container {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  width: 100%;
  padding: 2rem 0;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-content {
  display: inline-block;
  animation: marquee 30s linear infinite;
}

.marquee-content img {
  height: 30px;
  margin: 0 3rem;
  opacity: 0.5;
  filter: grayscale(100%);
  transition: opacity 0.3s;
}

.marquee-content img:hover {
  opacity: 1;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* CSS Mockup Dashboard */
.css-dashboard-mockup {
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  max-width: 900px;
  margin: 0 auto;
  backdrop-filter: blur(10px);
}

.mockup-header {
  display: flex;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.mockup-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.mockup-dot.red { background: #ff5f56; }
.mockup-dot.yellow { background: #ffbd2e; }
.mockup-dot.green { background: #27c93f; }

.mockup-bar {
  height: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin-bottom: 12px;
}

/* Stardust Effect */
/* ===== STARDUST — GPU-SAFE RULES =====
 * dots: opacity animation only (twinkle). NO transform/drift per-dot.
 * container: NO will-change. Dots are 1.5–3px — WebKit handles tiny opacity
 * animations cheaply without backing store. Full page height is safe now that
 * the nav hover flicker root cause (CPU color repaint) is permanently fixed.
 * ===================================== */
.stardust-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.stardust {
  position: absolute;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.4);
  /* twinkle uses opacity — composited at container level, not per-dot */
  /* NO transform on individual dots — that would create per-dot GPU layers */
  animation: twinkle 4s ease-in-out infinite;
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.8; }
}

/* ============================================================
 * ⚠️  DO NOT TOUCH: GOOGLE DRIVE TEXT ANIMATION
 * ============================================================
 * Root cause of the nightmare: CSS `color` animation on 11 
 * individual letter spans is CPU-side painting. On a 14-inch 
 * MacBook Retina (2× DPI), at full window width (1512px CSS = 
 * 3024px physical), the font-size is ~181px physical per letter. 
 * 11 letters × ~39,000px² × 60fps = 25.9M pixels/sec of CPU 
 * paint → frame drops → text vanishes on scroll.
 *
 * THE FIX: Static colors on letters + single `filter: hue-rotate()`
 * on the parent. The GPU applies one color-matrix per frame 
 * for the ENTIRE word regardless of screen size. Zero CPU cost.
 *
 * ❌ NEVER do any of these again:
 *   - Animate `color` on individual .google-letter spans
 *   - Add `filter: blur()` to ::before or ::after pseudo-elements
 *   - Add `transform: translateZ(0)` or `will-change` to children
 *   - Add `z-index: -1` to any pseudo-element inside this section
 *   - Add `isolation: isolate` or `backface-visibility` here
 *   - Use `background-clip: text` with animated gradients
 *
 * ✅ SAFE to change:
 *   - The hue-rotate animation duration (gpuHueWave)
 *   - The static base colors per letter (nth-child rules)
 *   - text-shadow values on .google-letter
 *   - font-weight, cursor on .google-word-wrap
 * ============================================================ */

/* GPU-compositor hue rotation — one GPU matrix op per frame for the whole word */
@keyframes gpuHueWave {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(360deg); }
}

.letter-wrap {
  display: inline-block;
  padding: 0 2px;
  cursor: default;
}

.google-word-wrap {
  display: inline-block;
  font-weight: 800;
  cursor: default;
  /* Single GPU-composited animation replaces 11 individual CPU paint jobs */
  animation: gpuHueWave 6s linear infinite;
}

/* Static base colors per letter — never repainted, just hue-shifted by the GPU */
.google-word-wrap > .letter-wrap:nth-child(1) .google-letter { color: #4285F4; } /* G - Blue   */
.google-word-wrap > .letter-wrap:nth-child(2) .google-letter { color: #EA4335; } /* o - Red    */
.google-word-wrap > .letter-wrap:nth-child(3) .google-letter { color: #FBBC05; } /* o - Yellow */
.google-word-wrap > .letter-wrap:nth-child(4) .google-letter { color: #34A853; } /* g - Green  */
.google-word-wrap > .letter-wrap:nth-child(5) .google-letter { color: #4285F4; } /* l - Blue   */
.google-word-wrap > .letter-wrap:nth-child(6) .google-letter { color: #EA4335; } /* e - Red    */
/* nth-child(7) is the spacer span — no letter */
.google-word-wrap > .letter-wrap:nth-child(8)  .google-letter { color: #FBBC05; } /* D - Yellow */
.google-word-wrap > .letter-wrap:nth-child(9)  .google-letter { color: #34A853; } /* r - Green  */
.google-word-wrap > .letter-wrap:nth-child(10) .google-letter { color: #4285F4; } /* i - Blue   */
.google-word-wrap > .letter-wrap:nth-child(11) .google-letter { color: #EA4335; } /* v - Red    */
.google-word-wrap > .letter-wrap:nth-child(12) .google-letter { color: #FBBC05; } /* e - Yellow */

.google-letter {
  display: inline-block;
  /* No animation — color is static, parent handles everything on GPU.
   * text-shadow uses currentColor so it hue-rotates with the letter for free. */
  text-shadow:
    0 0 35px currentColor,
    0 0 70px currentColor;
}

/* Different sizes and animation delays for variety */
.stardust:nth-child(3n) { width: 2px; height: 2px; animation-duration: 3s, 25s; }
.stardust:nth-child(3n+1) { width: 3px; height: 3px; animation-duration: 5s, 15s; }
.stardust:nth-child(3n+2) { width: 1.5px; height: 1.5px; animation-duration: 4s, 30s; }

.stardust:nth-child(1) { top: 15%; left: 20%; animation-delay: 0s, 0s; }
.stardust:nth-child(2) { top: 30%; left: 80%; animation-delay: 1s, 0s; }
.stardust:nth-child(3) { top: 60%; left: 15%; animation-delay: 2s, 0s; }
.stardust:nth-child(4) { top: 80%; left: 70%; animation-delay: 0.5s, 0s; }
.stardust:nth-child(5) { top: 45%; left: 50%; animation-delay: 1.5s, 0s; }
.stardust:nth-child(6) { top: 10%; left: 60%; animation-delay: 2.5s, 0s; }
.stardust:nth-child(7) { top: 75%; left: 35%; animation-delay: 0.2s, 0s; }
.stardust:nth-child(8) { top: 25%; left: 10%; animation-delay: 1.2s, 0s; }
.stardust:nth-child(9) { top: 55%; left: 85%; animation-delay: 0.8s, 0s; }
.stardust:nth-child(10) { top: 85%; left: 90%; animation-delay: 2.2s, 0s; }
.stardust:nth-child(11) { top: 5%; left: 40%; animation-delay: 0.3s, 0s; }
.stardust:nth-child(12) { top: 40%; left: 30%; animation-delay: 1.8s, 0s; }
.stardust:nth-child(13) { top: 65%; left: 65%; animation-delay: 0.6s, 0s; }
.stardust:nth-child(14) { top: 90%; left: 20%; animation-delay: 2.8s, 0s; }
.stardust:nth-child(15) { top: 20%; left: 95%; animation-delay: 1.4s, 0s; }

/* Radar Layout (Desktop Default) */
.radar-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "badge radar"
    "title radar"
    "desc radar"
    "bullets radar";
  gap: 0 4rem;
  align-items: center;
  text-align: left;
}
.rl-badge { grid-area: badge; justify-self: start; }
.rl-title { grid-area: title; margin: 0 0 1.5rem 0 !important; }
.rl-desc { grid-area: desc; margin-bottom: 2rem !important; }
.rl-bullets { grid-area: bullets; }
.rl-radar { grid-area: radar; display: flex; justify-content: center; }

/* Responsive Media Queries */
@media (max-width: 900px) {
  .flex-responsive {
    flex-direction: column !important;
    gap: 3rem !important;
    text-align: center;
  }
  
  .flex-responsive-reverse {
    flex-direction: column !important;
  }

  .flex-responsive > div {
    width: 100% !important;
    flex: none !important;
  }

  /* Radar CSS Grid overrides for mobile */
  .radar-layout {
    grid-template-columns: 1fr auto !important; /* Bullets take all remaining space, radar is fixed size */
    grid-template-areas:
      "badge badge"
      "title title"
      "desc desc"
      "bullets radar" !important;
    gap: 1.5rem 1rem !important;
    align-items: center;
  }
  
  .rl-desc {
    margin-bottom: 0.5rem !important; /* Remove the massive desktop margin on mobile */
  }

  /* Resize the actual layout box instead of using transform, which caused the massive empty space */
  .rl-radar .radar-container {
    width: 130px !important;
    height: 130px !important;
    margin: 0; /* Keep it tight to the right edge */
  }

  /* Bullets have plenty of room now, inherit the original 1.05rem font size */
  .rl-bullets {
    font-size: 1.05rem !important;
  }

  .mobile-nav {
    display: none !important; /* Hide secondary links on narrow screens to prevent overlapping */
  }

  /* Shrink hero gaps and padding for mobile */
  .landing-section {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  #landing-features {
    gap: 4rem !important;
  }
}

/* Settings Modal Sidebar Buttons */
.settings-tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.settings-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-blue);
  color: white;
  font-weight: 700;
}

/* ==========================================================================
   CRM Dashboard Specific Styles
   ========================================================================== */
.crm-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.crm-search-filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.crm-input {
  width: 320px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.crm-select {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.crm-action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 900px) {
  .crm-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .crm-search-filters {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  
  .crm-input, .crm-select, .custom-dropdown {
    width: 100% !important;
    font-size: 16px; /* Must be 16px on mobile to prevent iOS/mobile zoom bugs */
  }
  
  .crm-action-buttons {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .crm-action-buttons .btn {
    flex: 1 1 calc(50% - 4px);
    margin-left: 0 !important; /* Override inline styles */
    text-align: center;
    justify-content: center;
  }
}
