/* FlowDesk — Ultra Modern Design System */
/* Fonts: Syne (display) + DM Sans (body) + DM Mono (code) */

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

:root {
  /* Base palette - dark theme */
  --bg-app: #0c0c0f;
  --bg-surface: #111116;
  --bg-elevated: #18181f;
  --bg-hover: #1f1f28;
  --bg-active: #25252f;
  --bg-input: #16161e;

  --border: rgba(255,255,255,0.07);
  --border-focus: rgba(139,92,246,0.5);
  --border-strong: rgba(255,255,255,0.14);

  --text-primary: #f1f0f5;
  --text-secondary: #8b8a9a;
  --text-muted: #565566;
  --text-inverse: #0c0c0f;

  --accent: #7c5cfc;
  --accent-light: rgba(124,92,252,0.15);
  --accent-glow: rgba(124,92,252,0.3);
  --accent-hover: #9171fd;

  --success: #22d3a0;
  --success-bg: rgba(34,211,160,0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --danger: #f43f5e;
  --danger-bg: rgba(244,63,94,0.1);
  --info: #60a5fa;
  --info-bg: rgba(96,165,250,0.1);

  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);

  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
  --bg-app: #f4f3f8;
  --bg-surface: #ffffff;
  --bg-elevated: #f9f8fc;
  --bg-hover: #f0eefb;
  --bg-active: #e8e5f7;
  --bg-input: #f7f6fc;
  --border: rgba(0,0,0,0.08);
  --border-focus: rgba(124,92,252,0.4);
  --border-strong: rgba(0,0,0,0.14);
  --text-primary: #1a1825;
  --text-secondary: #6b6880;
  --text-muted: #a09db8;
  --text-inverse: #ffffff;
  --accent-light: rgba(124,92,252,0.08);
  --accent-glow: rgba(124,92,252,0.2);
  --success-bg: rgba(34,211,160,0.08);
  --warning-bg: rgba(245,158,11,0.08);
  --danger-bg: rgba(244,63,94,0.08);
  --info-bg: rgba(96,165,250,0.08);
  --shadow: 0 2px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
}

html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── AMBIENT BACKGROUND ──────────────────────────────── */
.ambient-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.ambient-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.04;
  animation: orbFloat 20s ease-in-out infinite alternate;
}
[data-theme="light"] .ambient-orb { opacity: 0.06; }
.orb-1 { width: 600px; height: 600px; background: #7c5cfc; top: -200px; left: -200px; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; background: #22d3a0; bottom: -150px; right: -150px; animation-delay: -7s; }
.orb-3 { width: 400px; height: 400px; background: #f43f5e; top: 40%; left: 40%; animation-delay: -14s; }
@keyframes orbFloat { 0%{transform:translate(0,0) scale(1)} 100%{transform:translate(30px,40px) scale(1.05)} }

/* ─── LAYOUT ──────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
  backdrop-filter: blur(20px);
}
.sidebar.collapsed { width: 64px; }
.main-layout {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--transition);
  position: relative; z-index: 1;
}
.sidebar.collapsed ~ .main-layout { margin-left: 64px; }

/* ─── SIDEBAR LOGO ────────────────────────────────────── */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.logo-text {
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 700;
  letter-spacing: -0.02em;
  transition: opacity var(--transition);
}
.sidebar-toggle {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-toggle,
.sidebar.collapsed .sidebar-section-label { display: none; }

/* ─── SIDEBAR NAV ─────────────────────────────────────── */
.sidebar-section-label {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 16px 16px 6px;
}
.sidebar-nav { list-style: none; padding: 0 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition);
  position: relative; white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; font-size: 0.7rem; font-weight: 600;
  background: var(--bg-elevated); color: var(--text-secondary);
  padding: 2px 7px; border-radius: var(--radius-full);
}
.nav-badge.urgent { background: var(--danger-bg); color: var(--danger); }
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

/* ─── SIDEBAR FOOTER ──────────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px 10px;
}
.user-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: var(--radius);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }
.logout-btn {
  color: var(--text-muted); padding: 4px;
  border-radius: var(--radius-sm); display: flex;
  transition: color var(--transition);
}
.logout-btn:hover { color: var(--danger); }
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-btn { display: none; }

/* ─── TOPBAR ──────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(20px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.breadcrumb-item {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.mobile-menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 6px; border-radius: var(--radius-sm);
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-full); padding: 7px 14px;
  color: var(--text-muted);
}
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-body);
  font-size: 0.85rem; width: 200px;
}
.search-box input::placeholder { color: var(--text-muted); }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg-surface);
}

/* ─── PAGE CONTENT ────────────────────────────────────── */
.page-content { padding: 28px; max-width: 1400px; }

/* ─── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-strong); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 600; letter-spacing: -0.01em;
}
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); }

/* ─── STAT CARDS ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--stat-color, var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.03em; margin-bottom: 10px; }
.stat-value {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary);
  line-height: 1;
}
.stat-delta { font-size: 0.78rem; margin-top: 8px; color: var(--text-muted); }
.stat-icon {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--stat-bg, var(--accent-light));
  color: var(--stat-color, var(--accent));
  display: flex; align-items: center; justify-content: center;
}

/* ─── TABLES ──────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem; color: var(--text-secondary);
  transition: background var(--transition);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }
.data-table .td-primary { color: var(--text-primary); font-weight: 500; }
.data-table .td-mono { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }

/* ─── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-neutral { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-accent  { background: var(--accent-light); color: var(--accent); }

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 2px 12px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-success { background: var(--success); color: #0a0a0a; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-ghost { background: none; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; border-radius: var(--radius-lg); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ─── FORM ELEMENTS ───────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 7px;
}
.form-label .required { color: var(--danger); margin-left: 3px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-family: var(--font-body); font-size: 0.9rem;
  transition: all var(--transition); outline: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124,92,252,0.1);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%238b8a9a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px; cursor: pointer;
}
.form-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 0.76rem; color: var(--danger); margin-top: 5px; display: none; }
.form-input.error, .form-select.error { border-color: var(--danger); }
.input-prefix-wrap { position: relative; }
.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.88rem; pointer-events: none;
}
.input-prefix-wrap .form-input { padding-left: 28px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

/* ─── AI PANEL ────────────────────────────────────────── */
.ai-panel {
  background: linear-gradient(135deg, rgba(124,92,252,0.08) 0%, rgba(34,211,160,0.05) 100%);
  border: 1px solid rgba(124,92,252,0.2);
  border-radius: var(--radius-lg); padding: 20px; margin-top: 20px;
}
.ai-panel-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.ai-icon {
  width: 28px; height: 28px; border-radius: var(--radius);
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.ai-panel-title { font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.ai-panel-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.ai-summary { font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary); margin-bottom: 14px; }
.ai-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ai-flag { background: var(--warning-bg); color: var(--warning); padding: 4px 10px; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 500; }
.risk-meter { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.risk-bar { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: var(--radius-full); overflow: hidden; }
.risk-fill { height: 100%; border-radius: var(--radius-full); transition: width 1s ease; }

/* ─── WORKFLOW STEPPER ────────────────────────────────── */
.workflow-steps { display: flex; flex-direction: column; gap: 0; }
.workflow-step {
  display: flex; gap: 14px; padding-bottom: 20px; position: relative;
}
.workflow-step:last-child { padding-bottom: 0; }
.step-line {
  display: flex; flex-direction: column; align-items: center;
}
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--bg-surface);
  color: var(--text-muted);
}
.step-dot.done { background: var(--success); border-color: var(--success); color: #0a0a0a; }
.step-dot.active { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 0 0 4px var(--accent-light); }
.step-dot.rejected { background: var(--danger); border-color: var(--danger); color: white; }
.step-connector {
  width: 2px; flex: 1; background: var(--border);
  margin: 4px 0; min-height: 20px;
}
.step-connector.done { background: var(--success); }
.step-body { flex: 1; padding-top: 4px; }
.step-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.step-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.step-comment {
  margin-top: 8px; padding: 10px 12px;
  background: var(--bg-elevated); border-radius: var(--radius);
  font-size: 0.82rem; color: var(--text-secondary);
  border-left: 2px solid var(--border);
}

/* ─── APPROVE PAGE ────────────────────────────────────── */
.approve-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-app); padding: 24px;
}
.approve-card {
  width: 100%; max-width: 560px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 40px; box-shadow: var(--shadow-lg);
}
.approve-card .brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 32px;
}
.approve-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }

/* ─── BADGES / TAGS ───────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 500; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary);
}

/* ─── PROGRESS BAR ────────────────────────────────────── */
.progress { height: 4px; background: var(--bg-elevated); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: var(--accent); transition: width 0.6s ease; }

/* ─── FLASH MESSAGES ──────────────────────────────────── */
.flash-msg {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px;
  font-size: 0.9rem; font-weight: 500;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown { from {opacity:0;transform:translateY(-8px)} to {opacity:1;transform:translateY(0)} }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,211,160,0.2); }
.flash-error   { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(244,63,94,0.2); }
.flash-info    { background: var(--info-bg); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }
.flash-close { background: none; border: none; cursor: pointer; color: inherit; font-size: 1.1rem; opacity: 0.6; padding: 0; }

/* ─── TOASTS ──────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 16px;
  font-size: 0.85rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s var(--spring);
  max-width: 300px;
}
@keyframes toastIn { from {opacity:0;transform:translateX(30px)} to {opacity:1;transform:translateX(0)} }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }

/* ─── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* ─── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from {opacity:0} to {opacity:1} }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px;
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s var(--spring);
}
@keyframes modalIn { from {opacity:0;transform:scale(0.94) translateY(20px)} to {opacity:1;transform:scale(1) translateY(0)} }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); }
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ─── SEARCH OVERLAY ──────────────────────────────────── */
.search-results-overlay {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  width: 500px; max-width: calc(100vw - 48px);
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  z-index: 300; padding: 8px 0;
  animation: fadeIn 0.15s ease;
}
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-hover); }

/* ─── PAGINATION ──────────────────────────────────────── */
.fd-pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.fd-page-btn {
  min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: 0.82rem; font-weight: 500;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none; transition: all var(--transition);
}
.fd-page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.fd-page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ─── FILTER BAR ──────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.filter-chip {
  padding: 6px 14px; border-radius: var(--radius-full);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 500; cursor: pointer; color: var(--text-secondary);
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ─── CODE / API DOCS ─────────────────────────────────── */
.code-block {
  background: #0a0a10; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  font-family: var(--font-mono); font-size: 0.8rem;
  line-height: 1.6; color: #c9c5e0; overflow-x: auto;
}
.code-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-layout { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .search-box input { width: 140px; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── ANIMATIONS ──────────────────────────────────────── */
.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-up { animation: slideUp 0.4s var(--spring) forwards; }
@keyframes slideUp { from {opacity:0;transform:translateY(16px)} to {opacity:1;transform:translateY(0)} }

/* stagger children */
.stagger > * { opacity: 0; animation: slideUp 0.4s var(--spring) forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* ─── UTILITIES ───────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.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; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.74rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
@media(max-width:900px) { .grid-2,.grid-3 { grid-template-columns: 1fr; } }

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