/* ═══════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces — warm charcoal family */
  --surface-0: #121214;
  --surface-1: #19191d;
  --surface-2: #1f1f24;
  --surface-3: #28282f;
  --surface-4: #32323b;

  /* Primary accent — teal */
  --accent: #0AD4AA;
  --accent-hover: #0BEDC0;
  --accent-soft: rgba(10,212,170,0.10);
  --accent-muted: rgba(10,212,170,0.06);

  /* CTA — burnt orange */
  --cta: #E8663D;
  --cta-hover: #F07A55;
  --cta-soft: rgba(232,102,61,0.10);

  /* Semantic */
  --success: #36D986;
  --success-soft: rgba(54,217,134,0.10);
  --danger: #E85D6F;
  --danger-soft: rgba(232,93,111,0.10);
  --warning: #F0A830;
  --warning-soft: rgba(240,168,48,0.10);
  --info: #38BDF8;
  --info-soft: rgba(56,189,248,0.10);

  /* Text — warm grays */
  --text-primary: #EDEDEF;
  --text-secondary: #9D9DA5;
  --text-tertiary: #6C6C75;
  --text-disabled: #4A4A52;

  /* Borders */
  --border: #2A2A32;
  --border-subtle: #222228;
  --border-focus: var(--accent);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 28px;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
  --sp-9: 48px; --sp-10: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.25);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-focus: 0 0 0 3px rgba(10,212,170,0.25);

  /* Motion */
  --ease-out: cubic-bezier(0.16,1,0.3,1);
  --ease-in-out: cubic-bezier(0.4,0,0.2,1);
  --duration-fast: 0.15s;
  --duration-normal: 0.2s;
  --duration-slow: 0.3s;

  /* Layout */
  --sidebar-w: 256px;
  --mobile-bar-h: 56px;
  --content-max: 1180px;
}

/* ═══════════════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════════════ */
html { height: 100%; }
body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.025em; line-height: 1.25; }
h2 { font-size: var(--text-xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.3; }
h3 { font-size: var(--text-base); font-weight: 600; letter-spacing: -0.005em; line-height: 1.4; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-disabled); }

/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
button, .btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 9px 18px;
  transition: all var(--duration-fast) var(--ease-in-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  white-space: nowrap;
}
button:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-cta {
  background: var(--cta);
  color: #fff;
  box-shadow: 0 1px 3px rgba(232,102,61,0.25);
}
.btn-cta:hover { background: var(--cta-hover); box-shadow: 0 2px 6px rgba(232,102,61,0.3); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(232,102,61,0.15); }

.btn-accent {
  background: var(--accent);
  color: #0a0a0b;
  box-shadow: 0 1px 4px rgba(10,212,170,0.25);
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 4px rgba(232,93,111,0.25);
}
.btn-danger:hover { background: #d44e5f; }

.btn-sm { font-size: var(--text-sm); padding: 6px 14px; font-weight: 500; }
.btn-icon { padding: 8px; border-radius: var(--radius-md); background: transparent; color: var(--text-tertiary); border: none; }
.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }

/* ═══════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════ */
input, select, textarea {
  background: var(--surface-0);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--text-sm);
  width: 100%;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-in-out), box-shadow var(--duration-fast) var(--ease-in-out);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.4; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-disabled); }
select { cursor: pointer; }

/* ── Custom Select ── */
.cs-wrapper {
  position: relative;
  width: 100%;
}
.cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  background: var(--surface-0);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-in-out), box-shadow var(--duration-fast) var(--ease-in-out);
  text-align: left;
  line-height: 1.4;
}
.cs-trigger:focus,
.cs-wrapper.cs-open .cs-trigger {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}
.cs-trigger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cs-arrow {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.15s var(--ease-out);
  display: flex;
}
.cs-wrapper.cs-open .cs-arrow {
  transform: rotate(180deg);
}
.cs-list {
  display: none;
  position: absolute;
  left: 0;
  min-width: 100%;
  top: 100%;
  margin-top: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 600;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-4) transparent;
}
.cs-wrapper.cs-open .cs-list {
  display: block;
  animation: dropIn 0.15s var(--ease-out);
}
.cs-option {
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  line-height: 1.4;
  white-space: nowrap;
}
.cs-option:hover,
.cs-option.cs-focused {
  background: var(--surface-3);
  color: var(--text-primary);
}
.cs-option.cs-selected {
  color: var(--accent);
  font-weight: 600;
}
.cs-option.cs-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Compact variant (sidebar tenant selector) */
.cs-compact .cs-trigger {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  font-size: var(--text-sm);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.field-hint { color: var(--text-tertiary); font-size: var(--text-xs); margin-top: 4px; line-height: 1.4; }
.field-error { color: var(--danger); font-size: var(--text-xs); margin-top: 4px; }

/* ═══════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-xs);
}

/* ═══════════════════════════════════════════════════
   TAGS / BADGES
   ═══════════════════════════════════════════════════ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.6;
}
.tag-green { background: var(--success-soft); color: var(--success); }
.tag-red { background: var(--danger-soft); color: var(--danger); }
.tag-teal { background: var(--accent-soft); color: var(--accent); }
.tag-orange { background: var(--cta-soft); color: var(--cta); }
.tag-amber { background: var(--warning-soft); color: var(--warning); }
.tag-blue { background: var(--info-soft); color: var(--info); }
.tag-ghost { background: var(--surface-3); color: var(--text-secondary); }
.tag-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ═══════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════ */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  white-space: nowrap;
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text-secondary); }
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: var(--text-base);
}
tr:last-child td { border-bottom: none; }
tr { transition: background var(--duration-fast) var(--ease-in-out); }
tbody tr:hover td { background: var(--surface-3); }

/* ═══════════════════════════════════════════════════
   TOGGLE
   ═══════════════════════════════════════════════════ */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--surface-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-in-out);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 2px; top: 2px;
  background: var(--text-tertiary);
  border-radius: 50%;
  transition: all var(--duration-normal) var(--ease-in-out);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }

/* ═══════════════════════════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-4) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 14px; width: 60%; }
.skeleton-title { height: 24px; width: 180px; }
.skeleton-stat { height: 36px; width: 90px; }
.skeleton-card { height: 120px; width: 100%; border-radius: var(--radius-lg); }

/* ═══════════════════════════════════════════════════
   ALERTS / TOAST
   ═══════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  pointer-events: auto;
  transform: translateX(120%);
  animation: toastIn 0.35s var(--ease-out) forwards;
  max-width: 380px;
}
.toast.removing { animation: toastOut 0.25s var(--ease-in-out) forwards; }
.toast-success { border-left: 3px solid var(--success); color: var(--success); }
.toast-error { border-left: 3px solid var(--danger); color: var(--danger); }
.toast-info { border-left: 3px solid var(--accent); color: var(--accent); }
.toast-warning { border-left: 3px solid var(--warning); color: var(--warning); }
@keyframes toastIn { to { transform: translateX(0); } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }

/* ═══════════════════════════════════════════════════
   MODAL / CONFIRM
   ═══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-in-out);
}
.modal-overlay.open { display: flex; opacity: 1; }
.modal-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-7);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--duration-normal) var(--ease-out);
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-title { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--sp-2); }
.modal-body { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--sp-6); line-height: 1.6; }
.modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ═══════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: var(--sp-9) var(--sp-6); }
.empty-state-icon { font-size: 40px; margin-bottom: var(--sp-4); opacity: 0.2; filter: grayscale(1); }
.empty-state-text { font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--sp-1); }
.empty-state-hint { font-size: var(--text-sm); color: var(--text-tertiary); line-height: 1.5; }

/* ═══════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════ */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 30% 60%, rgba(10,212,170,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 30%, rgba(232,102,61,0.03) 0%, transparent 50%),
    var(--surface-0);
}
.login-card {
  width: 400px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-9) var(--sp-8);
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-8);
}
.login-logo svg { flex-shrink: 0; }
.login-logo-text { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); }
.login-heading { font-size: var(--text-lg); font-weight: 600; color: var(--text-primary); margin-bottom: var(--sp-1); }
.login-sub { color: var(--text-tertiary); font-size: var(--text-sm); margin-bottom: var(--sp-6); }
.login-error {
  background: var(--danger-soft);
  border: 1px solid rgba(232,93,111,0.2);
  color: var(--danger);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  display: none;
}

/* ═══════════════════════════════════════════════════
   APP LAYOUT — SIDEBAR
   ═══════════════════════════════════════════════════ */
.app-layout {
  display: none;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--duration-slow) var(--ease-out);
}
.sidebar-header {
  padding: var(--sp-5) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.sidebar-logo-text { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.03em; }
.sidebar-nav { flex: 1; padding: var(--sp-2) var(--sp-3); overflow-y: auto; }
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-4);
  margin: 1px 0;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-in-out);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  line-height: 1;
}
.sidebar-nav-item:hover { background: var(--surface-3); color: var(--text-secondary); transform: none; box-shadow: none; }
.sidebar-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  position: relative;
}
.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar-nav-item svg { flex-shrink: 0; opacity: 0.55; }
.sidebar-nav-item:hover svg { opacity: 0.75; }
.sidebar-nav-item.active svg { opacity: 1; }
.sidebar-tenant-selector {
  padding: 0 var(--sp-4);
  margin-bottom: var(--sp-2);
}
.sidebar-tenant-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-disabled);
  margin-bottom: 4px;
}
.sidebar-tenant-select {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
}
.sidebar-section-label {
  padding: var(--sp-5) var(--sp-4) var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-disabled);
}
.sidebar-footer {
  padding: var(--sp-4) var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: var(--text-xs); color: var(--text-tertiary); }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  display: none;
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-in-out);
}
.sidebar-overlay.visible { display: block; opacity: 1; }

/* ═══════════════════════════════════════════════════
   APP LAYOUT — MAIN CONTENT
   ═══════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-header {
  padding: var(--sp-4) var(--sp-7);
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  min-height: 44px;
}
.main-header .bc-sep { margin: 0 var(--sp-1); }
.main-header .bc-link { color: var(--text-tertiary); cursor: pointer; transition: color var(--duration-fast); }
.main-header .bc-link:hover { color: var(--text-secondary); text-decoration: none; }
.main-header .bc-current { color: var(--text-secondary); }

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 150;
  height: 52px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--sp-4);
  align-items: center;
}
.mobile-topbar .hamburger { background: none; border: none; padding: 8px; color: var(--text-secondary); }
.mobile-topbar .hamburger:hover { transform: none; box-shadow: none; }
.mobile-topbar-logo { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.03em; margin-left: var(--sp-3); }

.mobile-bottombar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mobile-bar-h);
  background: var(--surface-1);
  border-top: 1px solid var(--border-subtle);
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bottombar-inner {
  display: flex;
  height: 100%;
}
.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-disabled);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  transition: color var(--duration-fast);
  padding: 0;
}
.mobile-tab:hover { transform: none; box-shadow: none; }
.mobile-tab svg { width: 22px; height: 22px; }
.mobile-tab.active { color: var(--accent); }

/* ═══════════════════════════════════════════════════
   PAGE CONTAINER
   ═══════════════════════════════════════════════════ */
.page-container {
  flex: 1;
  padding: 0 var(--sp-7) var(--sp-8);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}
.page { display: none; }
.page.active { display: block; animation: pageIn 0.25s var(--ease-out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-title-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--sp-6); flex-wrap: wrap; gap: var(--sp-3); }
.page-title { margin-bottom: 2px; }
.page-subtitle { color: var(--text-tertiary); font-size: var(--text-sm); margin-top: 2px; }

/* ═══════════════════════════════════════════════════
   DASHBOARD — BENTO GRID
   ═══════════════════════════════════════════════════ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-7);
}
.bento-grid .stat-card:first-child { grid-column: span 2; }
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  position: relative;
  transition: border-color var(--duration-fast);
}
.stat-card:hover { border-color: var(--border); }
.stat-card-header { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.stat-card-icon { color: var(--accent); flex-shrink: 0; }
.stat-card-label { font-size: var(--text-sm); color: var(--text-secondary); font-weight: 500; }
.stat-card-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-bottom: var(--sp-2); }
.stat-card:first-child .stat-card-value { font-size: 32px; }
.stat-card-footer { display: flex; align-items: center; justify-content: space-between; }
.stat-card-trend { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 600; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.stat-card-sparkline { display: block; }

/* ═══════════════════════════════════════════════════
   CAMPAIGNS LIST
   ═══════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-disabled); pointer-events: none; }
.search-input-wrap input { padding-left: 38px; }
.filter-bar select {
  width: auto;
  min-width: 140px;
  padding: 10px 14px;
}
.filter-bar .cs-wrapper {
  width: auto;
  min-width: 140px;
}
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.view-toggle button {
  padding: 8px 12px;
  border-radius: 0;
  background: var(--surface-3);
  color: var(--text-tertiary);
  border: none;
  border-right: 1px solid var(--border);
}
.view-toggle button:last-child { border-right: none; }
.view-toggle button:hover { transform: none; box-shadow: none; }
.view-toggle button.active { background: var(--accent-soft); color: var(--accent); }

.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-4);
}
.campaign-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-in-out);
}
.campaign-card:hover { border-color: var(--border); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.campaign-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.campaign-card-title { font-weight: 600; font-size: var(--text-base); }
.campaign-card-slug { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: var(--sp-3); }
.campaign-card-meta { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); font-size: var(--text-sm); color: var(--text-tertiary); }
.campaign-card-reward { color: var(--accent); font-weight: 700; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-5);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.pagination-buttons { display: flex; gap: var(--sp-2); }
.pagination-buttons button { min-width: 36px; }

/* ═══════════════════════════════════════════════════
   DROPDOWN MENU
   ═══════════════════════════════════════════════════ */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  right: 0; top: 100%;
  margin-top: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 500;
  display: none;
  overflow: hidden;
}
.dropdown-menu.open { display: block; animation: dropIn 0.15s var(--ease-out); }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  line-height: 1;
  border-radius: 0;
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text-primary); transform: none; box-shadow: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }

/* ═══════════════════════════════════════════════════
   CAMPAIGN FORM — TABS
   ═══════════════════════════════════════════════════ */
.form-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.form-tab {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--duration-fast);
  white-space: nowrap;
  font-family: inherit;
  border-radius: 0;
}
.form-tab:hover { color: var(--text-secondary); transform: none; box-shadow: none; }
.form-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.form-tab-panel { display: none; }
.form-tab-panel.active { display: block; animation: pageIn 0.2s var(--ease-out); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }

.form-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-6);
  margin: var(--sp-7) calc(-1 * var(--sp-6)) calc(-1 * var(--sp-6));
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  backdrop-filter: blur(12px);
}
.form-save-bar .unsaved-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  display: none;
}

/* Upload row */
.upload-row { display: flex; gap: 8px; align-items: center; }
.upload-row input[type="text"] { flex: 1; }
.upload-row label.btn-ghost { cursor: pointer; white-space: nowrap; font-size: var(--text-sm); padding: 8px 14px; }
.upload-row input[type="file"] { display: none; }
.popup-img-preview {
  width: 100%; max-height: 200px; object-fit: contain;
  border-radius: var(--radius-md);
  margin-top: var(--sp-3);
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  padding: var(--sp-3);
  display: none;
}
.popup-img-preview.visible { display: block; }

/* ═══════════════════════════════════════════════════
   CHART
   ═══════════════════════════════════════════════════ */
.chart-wrap { position: relative; margin: var(--sp-4) 0 var(--sp-2); }
.chart-wrap canvas { display: block; width: 100%; }
.chart-tooltip {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-xs);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
  display: none;
  z-index: 10;
}
.chart-tooltip.visible { display: block; }
.chart-tooltip-date { color: var(--text-secondary); font-weight: 600; margin-bottom: 2px; }
.chart-tooltip-val { color: var(--accent); font-weight: 700; }

/* ═══════════════════════════════════════════════════
   BACK LINK
   ═══════════════════════════════════════════════════ */
.back-link {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  margin-bottom: var(--sp-4);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  transition: color var(--duration-fast);
}
.back-link:hover { color: var(--text-secondary); text-decoration: none; }

/* ═══════════════════════════════════════════════════
   API KEYS
   ═══════════════════════════════════════════════════ */
.key-reveal-box {
  background: var(--surface-0);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.key-reveal-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  word-break: break-all;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
  .bento-grid .stat-card:first-child { grid-column: span 2; }
  .stat-card:first-child .stat-card-value { font-size: 36px; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom)); }
  .main-header { display: none; }
  .mobile-topbar { display: flex; }
  .mobile-bottombar { display: block; }
  .page-container { padding: 0 var(--sp-4) var(--sp-6); }
  .bento-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .bento-grid .stat-card:first-child { grid-column: span 2; }
  .stat-card-value { font-size: 24px !important; }
  .stat-card { padding: var(--sp-4); }
  .form-grid { grid-template-columns: 1fr; }
  .page-title-row { flex-direction: column; align-items: flex-start; }
  .filter-bar { flex-direction: column; }
  .search-input-wrap { width: 100%; min-width: unset; }
  .filter-bar select { width: 100%; }
  .filter-bar .cs-wrapper { width: 100%; }
  .campaigns-grid { grid-template-columns: 1fr; }
  .view-toggle { display: none; }

  .toast-container { top: 60px; right: var(--sp-3); left: var(--sp-3); }
  .toast { max-width: 100%; }

  .modal-box { border-radius: var(--radius-xl) var(--radius-xl) 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; width: 100%; }

  .form-save-bar { margin-left: calc(-1 * var(--sp-4)); margin-right: calc(-1 * var(--sp-4)); padding: var(--sp-3) var(--sp-4); }

  .login-card { width: 92%; padding: var(--sp-7) var(--sp-6); }

  table { font-size: var(--text-sm); }
  th, td { padding: 10px var(--sp-3); }
}

@media (max-width: 480px) {
  .bento-grid { grid-template-columns: 1fr; }
  .bento-grid .stat-card:first-child { grid-column: span 1; }
}

/* ═══════════════════════════════════════════════════
   ANALYTICS STAT CARDS (grid of 4)
   ═══════════════════════════════════════════════════ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}
.stat-cards .stat-card {
  padding: var(--sp-5) var(--sp-6);
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: var(--sp-2);
}
.stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
}

/* ── Portal / Users helpers ── */
.detail-row { display: flex; justify-content: space-between; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.detail-row:last-child { border-bottom: none; }
/* empty-state base styles defined above */
.tag-default { background: var(--surface-3); color: var(--text-secondary); }
.tag-success { background: rgba(54,217,134,0.1); color: var(--success); }
.tag-danger { background: rgba(232,93,111,0.1); color: var(--danger); }

/* ═══════════════════════════════════════════════════
   INTEGRATION PAGE
   ═══════════════════════════════════════════════════ */

/* ── Hero / orientation ── */
.ig-hero {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-4);
}
.ig-hero-content {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
}
.ig-hero-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ig-hero-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.ig-hero-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.ig-hero-desc strong { color: var(--text-primary); font-weight: 600; }
.ig-hero-steps {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}
.ig-hero-chip {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ── Collapsible credentials ── */
.ig-details {
  margin-bottom: var(--sp-5);
}
.ig-details-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--sp-2) 0;
  list-style: none;
  user-select: none;
}
.ig-details-summary::-webkit-details-marker { display: none; }
.ig-details-summary svg {
  transition: transform 0.2s var(--ease-out);
  flex-shrink: 0;
}
.ig-details[open] > .ig-details-summary svg {
  transform: rotate(180deg);
}
.ig-details-hint {
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: auto;
  font-size: var(--text-xs);
}
.ig-details .ig-credentials {
  margin-top: var(--sp-3);
}

/* ── Credentials panel ── */
.ig-credentials { margin-bottom: var(--sp-4); }
.ig-cred-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}
.ig-cred-row {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ig-cred-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
}
.ig-cred-value-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.ig-cred-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.ig-cred-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ig-cred-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Quick actions bar ── */
.ig-actions {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.ig-actions .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }
.ig-actions svg { flex-shrink: 0; }

/* ── Timeline ── */
.ig-timeline { position: relative; }

.ig-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
}
.ig-step--last { padding-bottom: 0; }

.ig-step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ig-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface-0);
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.ig-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.ig-step-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.ig-step-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin-top: var(--sp-2);
}

/* ── Step content ── */
.ig-step-content {
  min-width: 0;
  padding-bottom: var(--sp-2);
}
.ig-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.ig-step-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 28px;
}
.ig-step-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 2px 0 0;
  line-height: 1.5;
}
.ig-step-desc code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}

/* ── Copy agent prompt button ── */
.ig-copy-prompt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ig-copy-prompt:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Code block ── */
.ig-code-wrap {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ig-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
.ig-lang {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 600;
}
.ig-code-copy {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.15s;
}
.ig-code-copy:hover { color: var(--accent); }
.ig-code {
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.65;
  color: var(--text-primary);
  overflow-x: auto;
  background: transparent;
}
.ig-code code {
  font-family: inherit;
  font-size: inherit;
}

/* ── Verification note ── */
.ig-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--accent-muted);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.ig-note svg {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Footer actions ── */
.ig-footer {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}
.ig-footer-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}

/* ── Error state ── */
.ig-error {
  text-align: center;
  padding: var(--sp-8);
  color: var(--danger);
  font-size: var(--text-sm);
}

/* ── Loading skeleton ── */
.ig-loading { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .ig-hero { padding: var(--sp-4); }
  .ig-hero-steps { flex-wrap: wrap; }
  .ig-cred-grid { grid-template-columns: 1fr 1fr; }
  .ig-step { grid-template-columns: 24px 1fr; gap: var(--sp-3); }
  .ig-step-num, .ig-step-dot { width: 24px; height: 24px; font-size: var(--text-xs); }
  .ig-step-header { flex-direction: column; gap: var(--sp-2); }
  .ig-actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .ig-cred-grid { grid-template-columns: 1fr; }
  .ig-hero-content { flex-direction: column; gap: var(--sp-3); }
}

/* ═══════════════════════════════════════════════════════════
   AI Agent page — bespoke styling, not SaaS-generic.
   Uses teal accent (--accent) for CTA, amber/red for action badges.
   ═══════════════════════════════════════════════════════════ */

.ag-summary {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-wrap;
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--accent);
  background: var(--accent-muted);
  border-radius: 4px;
}
.ag-summary-empty { color: var(--text-disabled); font-style: italic; border-left-color: var(--border-subtle); background: transparent; }

.ag-warn {
  margin-top: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--warning);
  background: var(--warning-soft);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 4px;
}

.ag-muted { color: var(--text-disabled); font-size: var(--text-sm); text-align: center; }

.ag-rec { display: flex; flex-direction: column; gap: var(--sp-3); }
.ag-rec-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.ag-rec-title { margin: 0; font-size: var(--text-lg); flex: 1; }

.ag-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ag-badge-create { background: var(--success-soft); color: var(--success); }
.ag-badge-update { background: var(--warning-soft); color: var(--warning); }
.ag-badge-disable { background: var(--danger-soft); color: var(--danger); }
.ag-badge-neutral { background: var(--surface-3); color: var(--text-secondary); }

.ag-pri { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 10px; }
.ag-pri-high { background: var(--danger-soft); color: var(--danger); }
.ag-pri-medium { background: var(--accent-soft); color: var(--accent); }
.ag-pri-low { background: var(--surface-3); color: var(--text-tertiary); }

.ag-rec-details { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.ag-kv { display: inline-flex; flex-direction: column; gap: 2px; }
.ag-k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); font-weight: 600; }
.ag-v { font-size: var(--text-sm); color: var(--text-primary); font-weight: 500; }

.ag-desc { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
.ag-reasoning { font-size: var(--text-sm); line-height: 1.5; color: var(--text-secondary); }
.ag-reasoning .ag-k { display: block; margin-bottom: 2px; }

.ag-exposure {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-3);
  border-radius: 4px;
  align-self: flex-start;
  cursor: help;
}
.ag-exposure .ag-v { font-weight: 700; color: var(--accent); }

.ag-status { font-size: var(--text-xs); padding: var(--sp-2) var(--sp-3); border-radius: 4px; }
.ag-status-approved { background: var(--success-soft); color: var(--success); }
.ag-status-rejected { background: var(--danger-soft); color: var(--danger); }
.ag-status-expired { background: var(--surface-3); color: var(--text-tertiary); }

.ag-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }

.ag-form {
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}
.ag-form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.ag-label { display: block; font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

.ag-hist-row {
  display: grid;
  grid-template-columns: 180px 1fr auto auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}
.ag-hist-row:last-child { border-bottom: none; }
.ag-hist-date { color: var(--text-tertiary); }
.ag-hist-recs { color: var(--text-secondary); }
.ag-hist-outcome { color: var(--text-tertiary); font-size: var(--text-xs); }

@media (max-width: 768px) {
  .ag-form-grid { grid-template-columns: 1fr; }
  .ag-hist-row { grid-template-columns: 1fr; gap: var(--sp-1); }
  .ag-rec-details { gap: var(--sp-3); }
}
