/* ==========================================================================
   Okta App Manager — Design System
   Inspired by Apple iCloud web UI: clean, frosted glass, generous space.
   Theme: Violet/Purple accent on white.
   ========================================================================== */

/* ── Fonts & Base Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Background */
  --bg:            #ffffff;       /* Pure white */
  --surface:       #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.85);
  --surface-hover: #f5f3ff;       /* Violet-50 */
  --border:        rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);

  /* Brand purple */
  --accent:        #7c3aed;       /* Violet-600 */
  --accent-hover:  #6d28d9;       /* Violet-700 */
  --accent-light:  rgba(124, 58, 237, 0.09);
  --accent-ring:   rgba(124, 58, 237, 0.28);
  --accent-dark:   #4c1d95;       /* Violet-900 */

  /* Semantic colors */
  --green:         #10b981;
  --green-light:   rgba(16, 185, 129, 0.12);
  --red:           #ef4444;
  --red-light:     rgba(239, 68, 68, 0.10);
  --orange:        #f59e0b;
  --orange-light:  rgba(245, 158, 11, 0.12);
  --indigo:        #6366f1;
  --gray-accent:   #64748b;

  /* Typography */
  --text:   #0f172a;       /* slate-900 */
  --text-2: #334155;       /* slate-700 */
  --text-3: #64748b;       /* slate-500 */
  --text-4: #94a3b8;       /* slate-400 */

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.05);

  /* Radii */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;

  /* Sidebar */
  --sidebar-w:  248px;
  --sidebar-bg: rgba(245, 243, 255, 0.95);   /* Violet-50 tinted */

  /* Transition */
  --t: 0.18s ease;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid rgba(124,58,237,0.12);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.main-content {
  margin-left: var(--sidebar-w);
  padding: 36px 40px 60px;
  min-height: 100vh;
  max-width: 1200px;
}
.main-content.content-wide { max-width: 1600px; }

/* ── Sidebar Header ───────────────────────────────────────────────────────── */
.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(109,40,217,0.30);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-logo-text { font-size: 0.9rem; font-weight: 700; color: var(--accent-dark); line-height: 1.2; }
.sidebar-logo-sub  { font-size: 0.72rem; color: var(--text-3); font-weight: 400; }

/* ── Sidebar Nav ──────────────────────────────────────────────────────────── */
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 10px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t), color var(--t);
  cursor: pointer;
}
.nav-item:hover { background: var(--accent-light); color: var(--accent); text-decoration: none; }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-item-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

/* ── Sidebar Footer ───────────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 0.7rem; color: var(--text-3); }
.logout-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.logout-btn:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }

/* ── Mock data banner ─────────────────────────────────────────────────────── */
.mock-banner {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border-bottom: 1px solid #fcd34d;
  padding: 6px 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #92400e;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 200;
  margin-left: var(--sidebar-w);
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.page-title { font-size: 1.75rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.page-subtitle { font-size: 0.9rem; color: var(--text-3); margin-top: 4px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.card-body { padding: 20px 22px; }

/* ── App cards grid (app list page) ──────────────────────────────────────── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.app-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
  position: relative;
}
.app-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent-ring);
  text-decoration: none;
}
.app-card-icon {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent-light) 0%, rgba(139,92,246,0.12) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 14px;
}
.app-card-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.app-card-desc { font-size: 0.82rem; color: var(--text-3); line-height: 1.4; }
.app-card-badge {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.badge-owner  { background: var(--accent-light); color: var(--accent-dark); }
.badge-viewer { background: rgba(100,116,139,0.12); color: var(--gray-accent); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Form controls ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-hint { font-size: 0.76rem; color: var(--text-3); margin-top: 4px; }

/* ── Search bar ───────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap .search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-4);
  pointer-events: none;
  font-size: 0.9rem;
}
.search-wrap .form-control { padding-left: 34px; }
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.search-dropdown.open { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--t);
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--accent-light); }
.search-result-item .user-initials {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  flex-shrink: 0;
}
.search-result-name  { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.search-result-email { font-size: 0.76rem; color: var(--text-3); }

/* ── User table ───────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-hover); }
.data-table .user-col {
  display: flex; align-items: center; gap: 10px;
}
.data-table .initials-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0;
}

/* ── Status pills ─────────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.status-active   { background: var(--green-light);  color: #065f46; }
.status-inactive { background: rgba(100,116,139,0.12); color: var(--gray-accent); }
.status-pending  { background: var(--orange-light); color: #92400e; }

/* ── Change queue panel ───────────────────────────────────────────────────── */
.queue-panel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.queue-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.queue-panel-title {
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.queue-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}
.queue-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px 4px;
}
.queue-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.queue-item:last-child { border-bottom: none; }
.queue-item-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.queue-item-name  { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.queue-item-email { font-size: 0.72rem; color: var(--text-3); }
.queue-add-dot    { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.queue-remove-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.queue-actions { padding: 14px 16px; display: flex; gap: 8px; }
.queue-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-4);
  font-size: 0.84rem;
}

/* ── Confirmation modal ───────────────────────────────────────────────────── */
dialog {
  border: none;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 0;
  width: 480px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
dialog::backdrop {
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(4px);
}
.dialog-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.dialog-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.dialog-body  { padding: 18px 24px; font-size: 0.875rem; color: var(--text-2); line-height: 1.6; }
.dialog-footer { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.dialog-summary { margin-top: 12px; }
.dialog-summary-row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}
.dialog-summary-row:last-child { border-bottom: none; }
.summary-add    { color: var(--green); font-weight: 700; }
.summary-remove { color: var(--red);   font-weight: 700; }

/* ── Toast notifications ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 360px;
  font-size: 0.84rem;
  color: var(--text-2);
  display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.22s ease;
  pointer-events: all;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red);   }
.toast-info    { border-left: 3px solid var(--accent); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash-list { list-style: none; margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.flash-msg {
  padding: 11px 16px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
}
.flash-success { background: var(--green-light); color: #065f46; border: 1px solid rgba(16,185,129,0.2); }
.flash-error   { background: var(--red-light);   color: #991b1b; border: 1px solid rgba(239,68,68,0.2); }
.flash-info    { background: var(--accent-light); color: var(--accent-dark); border: 1px solid var(--accent-ring); }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 40%, #e8e4fb 100%);
}
.login-card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  padding: 42px 40px 36px;
  width: 360px;
  max-width: calc(100vw - 32px);
}
.login-logo {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 10px; margin-bottom: 28px;
}
.login-logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(109,40,217,0.35);
  overflow: hidden;
}
.login-logo-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.login-logo-sub   { font-size: 0.78rem; color: var(--text-3); margin-top: -4px; }

/* ── Tables (audit log) ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.audit-table { font-size: 0.8rem; }
.audit-table td, .audit-table th { padding: 8px 12px; }
.action-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-family: ui-monospace, 'SF Mono', monospace;
}
.action-tag.add    { background: var(--green-light);  color: #065f46; }
.action-tag.remove { background: var(--red-light);    color: #991b1b; }
.action-tag.login  { background: var(--orange-light); color: #92400e; }

/* ── Stat chips (app detail header) ──────────────────────────────────────── */
.stat-chips { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 18px;
  display: flex; flex-direction: column;
  gap: 2px;
  min-width: 120px;
}
.stat-chip-value { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.stat-chip-label { font-size: 0.72rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab-btn {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.empty-desc  { font-size: 0.875rem; color: var(--text-3); }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; }
.page-link {
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  font-size: 0.82rem;
  color: var(--text-2);
  text-decoration: none;
  transition: background var(--t);
}
.page-link:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent-ring); text-decoration: none; }
.page-link.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-info { font-size: 0.8rem; color: var(--text-3); margin-left: 8px; }

/* ── Info page cards (home) ───────────────────────────────────────────────── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
}
.info-card-icon { font-size: 1.8rem; margin-bottom: 12px; }
.info-card-title { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.info-card-body  { font-size: 0.84rem; color: var(--text-3); line-height: 1.55; }

/* ── Spinner / loading ────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-3); }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.78rem; }
.font-bold  { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Dev user switcher (mock mode only) ──────────────────────────────────── */
.dev-switcher {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
}
.dev-persona-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background var(--t), border-color var(--t);
}
.dev-persona-btn:hover {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.2);
}
.dev-persona-active {
  background: rgba(245,158,11,0.12) !important;
  border-color: rgba(245,158,11,0.35) !important;
}
.dev-persona-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dev-persona-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.dev-persona-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dev-persona-title {
  font-size: 0.68rem;
  color: var(--text-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Simulation banner ────────────────────────────────────────────────────── */
.sim-banner {
  background: linear-gradient(90deg, #fef9c3, #fef3c7);
  border-bottom: 2px solid #f59e0b;
  padding: 7px 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #78350f;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 200;
  margin-left: var(--sidebar-w);
}
.sim-exit-btn {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t);
}
.sim-exit-btn:hover { background: #d97706; }

/* ── Filter bar (app detail page) ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #faf9ff;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.filter-bar select,
.filter-bar input[type="text"] {
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  height: 32px;
}
.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.filter-bar .filter-clear {
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  font-weight: 600;
  transition: background var(--t);
  height: 32px;
}
.filter-bar .filter-clear:hover { background: var(--accent-light); }
.filter-count {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-left: auto;
}

/* ── Bulk select mode ─────────────────────────────────────────────────────── */
.bulk-checkbox {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.bulk-select-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-dark);
}

/* ── Group search picker (admin form) ────────────────────────────────────── */
.group-picker-wrap {
  position: relative;
}
.group-picker-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: text;
  min-height: 40px;
}
.group-picker-display:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.group-picker-input {
  border: none;
  outline: none;
  font-size: 0.875rem;
  color: var(--text);
  background: transparent;
  flex: 1;
  min-width: 120px;
  font-family: inherit;
}
.group-picker-selected {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 20px;
  padding: 2px 10px 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.group-picker-selected .remove-tag {
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--accent);
  margin-left: 2px;
}
.group-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.group-picker-dropdown.open { display: block; }
.group-picker-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.855rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--t);
}
.group-picker-item:last-child { border-bottom: none; }
.group-picker-item:hover { background: var(--accent-light); color: var(--accent-dark); }
.group-picker-item .group-id { font-size: 0.7rem; color: var(--text-4); font-family: ui-monospace, monospace; }
.group-picker-empty {
  padding: 12px 14px;
  font-size: 0.84rem;
  color: var(--text-4);
  text-align: center;
}

/* ── Bulk add dialog ──────────────────────────────────────────────────────── */
/* NOTE: Do NOT apply display:flex to #bulkAddModal directly — it would      */
/* override the browser's built-in display:none for closed <dialog> elements */
/* and cause the modal to render on page load. Scope flex layout to [open].  */
#bulkAddModal {
  width: 700px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 60px);
}
#bulkAddModal[open] {
  display: flex;
  flex-direction: column;
}
#bulkAddModal .dialog-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
/* ── Bulk remove dialog ─────────────────────────────────────────────────────── */
#bulkRemoveModal {
  width: 700px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 60px);
}
#bulkRemoveModal[open] {
  display: flex;
  flex-direction: column;
}
#bulkRemoveModal .dialog-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.bulk-modal-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #faf9ff;
  flex-shrink: 0;
}
.bulk-modal-filters select {
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  color: var(--text-2);
  background: var(--surface);
  outline: none;
  height: 32px;
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.bulk-modal-filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.bulk-modal-table-wrap {
  overflow-y: auto;
  flex: 1;
}
.bulk-modal-footer-count {
  font-size: 0.82rem;
  color: var(--text-3);
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

/* ── Policy / IT notice banners ──────────────────────────────────────────── */
.policy-banner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: rgba(124, 58, 237, 0.045);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin-bottom: 26px;
}
.policy-banner-icon { flex-shrink: 0; color: var(--accent); margin-top: 2px; }
.policy-banner-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--accent-dark);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.policy-banner-list {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: 0.815rem;
  color: var(--text-2);
  line-height: 1.8;
}
.policy-banner-list li { margin-bottom: 1px; }
.policy-banner-list strong { color: var(--text); }

/* Compact inline notice — used inside cards (e.g. Add Users card on detail page) */
.it-notice {
  background: rgba(124, 58, 237, 0.04);
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-left: 3px solid rgba(124, 58, 237, 0.4);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 0.795rem;
  color: var(--text-2);
  line-height: 1.7;
  margin: 12px 22px 4px;
}
.it-notice strong { color: var(--accent-dark); }
.it-notice + .tabs { margin-top: 12px; }

/* ── Assignment group tags ────────────────────────────────────────────────── */
.assign-group-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--green-light);
  color: #065f46;
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.assign-group-tag-readonly {
  background: var(--surface-hover);
  color: var(--text-3);
  border-color: var(--border);
}

/* ── Cooldown timer banner ────────────────────────────────────────────────── */
.cooldown-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--orange-light);
  border: 1px solid rgba(245,158,11,0.25);
  border-left: 4px solid var(--orange);
  border-radius: var(--r-md);
  padding: 12px 18px;
  margin-bottom: 14px;
  font-size: 0.84rem;
  color: #92400e;
  font-weight: 500;
}
.cooldown-timer {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--orange);
  min-width: 44px;
  text-align: center;
}

/* ── Group picker dialog (per-user group selection) ───────────────────────── */
.group-check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}
.group-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.group-check-item:hover { background: var(--surface-hover); border-color: var(--accent-ring); }
.group-check-item input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink:0; }
.group-check-label { font-size: 0.875rem; font-weight: 600; color: var(--text-2); }
.group-check-id { font-size: 0.7rem; color: var(--text-4); font-family: ui-monospace, monospace; margin-top:1px; }

/* ── User row assignment group badges ────────────────────────────────────── */
.user-group-badge {
  display: inline-block;
  background: var(--green-light);
  color: #065f46;
  border-radius: 4px;
  padding: 1px 7px;
  margin: 1px 2px 1px 0;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px 16px 60px; }
  .mock-banner  { margin-left: 0; }
}
