﻿/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   BIMAKART IAM â€” Enterprise SaaS Design System
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Tokens â”€â”€ */
:root {
  --bg:            #F8FAFC;
  --surface:       #FFFFFF;
  --surface-hover: #F8FAFC;
  --border:        #E2E8F0;
  --border-light:  #F1F5F9;
  --divider:       #F1F5F9;
  --accent:        #EE724E;
  --accent-hover:  #DB6848;
  --accent-light:  #FDF0EC;
  --accent-glow:   rgba(238, 114, 78, .14);
  --accent-glow-strong: rgba(238, 114, 78, .28);
  --text:          #0F172A;
  --text-secondary:#475569;
  --text-muted:    #94A3B8;
  --success:       #22C55E;
  --success-bg:    #F0FDF4;
  --warning:       #F59E0B;
  --warning-bg:    #FFFBEB;
  --danger:        #EF4444;
  --danger-bg:     #FEF2F2;
  --black:         #0F172A;
  --white:         #FFFFFF;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --radius-card:   16px;
  --radius-sidebar:16px;
  --radius-btn:    10px;
  --radius-input:  10px;
  --radius:        var(--radius-card);
  --radius-sm:     12px;
  --radius-xs:     8px;
  --radius-pill:   9999px;
  --shadow-xs:     0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm:     0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow:        0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .04);
  --shadow-md:     0 4px 12px -1px rgba(15, 23, 42, .08), 0 2px 6px -2px rgba(15, 23, 42, .04);
  --shadow-lg:     0 10px 24px -3px rgba(15, 23, 42, .1), 0 4px 8px -4px rgba(15, 23, 42, .04);
  --shadow-xl:     0 20px 40px -5px rgba(15, 23, 42, .12), 0 8px 16px -6px rgba(15, 23, 42, .04);
  --shadow-float:  var(--shadow);
  --shadow-float-hover: var(--shadow-lg);
  --shadow-accent: 0 6px 18px rgba(238, 114, 78, .22);
  --accent-rgb: 238, 114, 78;
  --accent-gradient-end: #F4A08A;
  --accent-soft: #F08A6C;
  --accent-border-muted: rgba(238, 114, 78, .18);
  --transition:    all 180ms cubic-bezier(.4, 0, .2, 1);
  --ease-spring:   cubic-bezier(.4, 0, .2, 1);
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-7: 64px;
  --topbar-height: 56px;
  --sidebar-width: 256px;
  --sidebar-collapsed-width: 68px;
  --sidebar-transition: width 280ms cubic-bezier(.4, 0, .2, 1), margin 280ms cubic-bezier(.4, 0, .2, 1);
}

/* â”€â”€ Reset â”€â”€ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--html-font-size, 80%);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .sidebar-nav-scroll,
  .main-content,
  .page-body {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font);
  font-size: 1rem; /* follows --html-font-size / type scale */
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.has-premium-topbar .page-header { display: none; }
.has-premium-topbar .iam-breadcrumb { display: none; }

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

::selection { background: var(--accent-light); color: var(--accent); }

/* â”€â”€ Lucide / SVG icons â”€â”€ */
[data-lucide],
svg.lucide {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  display: inline-block;
  vertical-align: middle;
  color: inherit;
}

.sidebar-link svg.lucide,
.sidebar-collapse-btn svg.lucide,
.sidebar-section-toggle svg.lucide {
  width: 16px;
  height: 16px;
}

.topbar-menu-btn svg.lucide,
.topbar-icon-btn svg.lucide,
.premium-topbar-search > svg.lucide {
  width: 18px;
  height: 18px;
}

.btn svg.lucide,
.alert svg.lucide {
  width: 15px;
  height: 15px;
}

.btn-xs svg.lucide,
.btn-sm svg.lucide {
  width: 14px;
  height: 14px;
}

/* â”€â”€ Typography â”€â”€ */
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }

/* â”€â”€ Typography scale â”€â”€ */
.page-title-type { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.section-title-type { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.card-title-type { font-size: 15px; font-weight: 600; }
.body-type { font-size: 14px; font-weight: 400; }
.small-type { font-size: 12px; font-weight: 500; }

/* â”€â”€ Layout Shell â”€â”€ */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding: var(--space-2);
  gap: var(--space-2);
  --sidebar-current-width: var(--sidebar-width);
}

.app-shell.sidebar-is-collapsed {
  --sidebar-current-width: var(--sidebar-collapsed-width);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  z-index: 90;
  backdrop-filter: blur(2px);
}

body.iam-mobile-nav-open { overflow: hidden; }

/* â”€â”€ Floating Sidebar â”€â”€ */
.sidebar {
  width: var(--sidebar-current-width);
  min-height: calc(100vh - 32px);
  background: var(--surface);
  border-radius: var(--radius-sidebar);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  bottom: var(--space-2);
  z-index: 100;
  overflow: hidden;
  transition: var(--sidebar-transition);
  will-change: width;
}

.app-shell.sidebar-is-collapsed .sidebar-link-label,
.app-shell.sidebar-is-collapsed .sidebar-section-toggle-label,
.app-shell.sidebar-is-collapsed .sidebar-badge-soon,
.app-shell.sidebar-is-collapsed .sidebar-badge-new {
  display: none;
}

.app-shell.sidebar-is-collapsed .sidebar-link {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.app-shell.sidebar-is-collapsed .sidebar-active-indicator {
  left: 4px;
}

.sidebar-brand {
  padding: 16px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-brand.is-collapsed {
  flex-direction: column;
  padding: 12px 8px;
  gap: 8px;
}

.sidebar-brand.is-collapsed .sidebar-collapse-btn {
  margin-left: 0;
}

.sidebar-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gradient-end) 100%);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.sidebar-logo-mark.has-logo {
  background: #000;
  color: transparent;
  width: auto;
  min-width: 36px;
  max-width: 120px;
  height: 36px;
  padding: 4px 6px;
  box-sizing: border-box;
  overflow: hidden;
}

.sidebar-logo-mark.has-logo .sidebar-logo-img {
  height: 28px;
  max-width: 120px;
  width: auto;
  object-fit: contain;
  object-position: center;
  display: block;
}

.sidebar-brand.is-collapsed .sidebar-logo-mark.has-logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  padding: 0;
  border-radius: 10px;
}

.sidebar-brand.is-collapsed .sidebar-logo-mark.has-logo .sidebar-logo-img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

.sidebar-collapse-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse-btn i { width: 16px; height: 16px; }
.sidebar-collapse-btn:hover { background: var(--accent-light); color: var(--accent); }

.sidebar-brand h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.sidebar-brand small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  letter-spacing: .06em;
  font-weight: 500;
}

.sidebar-nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  padding: 8px 10px 10px;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.sidebar-nav-scroll:hover::-webkit-scrollbar-thumb {
  background: var(--text-muted);
}

.sidebar-nav {
  padding: 0;
}

.sidebar-section { margin-bottom: 2px; }

.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  padding: 6px 10px;
  margin-top: 6px;
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: var(--font);
  transition: background 180ms ease, color 180ms ease;
}

.sidebar-section-toggle:hover {
  background: var(--bg);
}

.sidebar-section-toggle-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
}

.sidebar-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 280ms cubic-bezier(.4, 0, .2, 1);
}

.sidebar-chevron.is-open {
  transform: rotate(180deg);
}

.sidebar-section-panel,
.sidebar-group-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 280ms cubic-bezier(.4, 0, .2, 1), opacity 200ms ease;
  opacity: 0;
}

.sidebar-section-panel.is-open,
.sidebar-group-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.sidebar-section-inner,
.sidebar-group-inner {
  overflow: hidden;
  min-height: 0;
}

.sidebar-group-inner {
  padding-left: calc(8px + (var(--nav-depth, 0) * 10px));
  border-left: 1px solid var(--border-light);
  margin-left: 18px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.sidebar-group-toggle {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
}

.sidebar-group-toggle.is-branch-active {
  color: var(--text);
  font-weight: 600;
}

.sidebar-group-toggle .sidebar-chevron {
  margin-left: auto;
}

.sidebar-link-leaf {
  padding-left: calc(10px + (var(--nav-depth, 0) * 4px));
}

.app-shell.sidebar-is-collapsed .sidebar-section-toggle,
.app-shell.sidebar-is-collapsed .sidebar-group-toggle,
.app-shell.sidebar-is-collapsed .sidebar-group-toggle .sidebar-chevron,
.app-shell.sidebar-is-collapsed .sidebar-section-toggle-label {
  display: none;
}

.app-shell.sidebar-is-collapsed .sidebar-section-panel {
  grid-template-rows: 1fr;
  opacity: 1;
}

.app-shell.sidebar-is-collapsed .sidebar-group-panel {
  display: none !important;
}

.app-shell.sidebar-is-collapsed .sidebar-group-inner {
  padding-left: 0;
  margin-left: 0;
  border-left: none;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 10px 10px 4px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  transition: background 180ms ease, color 180ms ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 1px;
}

.sidebar-link:hover {
  background: var(--accent-light);
  color: var(--text);
  text-decoration: none;
  transform: none;
}

.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  box-shadow: none;
}

.sidebar-link.active i,
.sidebar-link.active svg.lucide {
  color: var(--accent);
  stroke: currentColor;
}

.sidebar-active-indicator {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-logout {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text-muted);
}

.sidebar-link i,
.sidebar-link svg.lucide {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-link-soon {
  opacity: .85;
}

.sidebar-badge-soon {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-badge-new {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.app-shell.sidebar-is-collapsed .sidebar-badge-new {
  display: none;
}

.iam-breadcrumb-sep {
  margin: 0 6px;
  opacity: .6;
}

.access-subnav .btn-xs {
  font-size: 12px;
  padding: 4px 10px;
}

.sidebar-footer {
  padding: 12px 10px 14px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-help-card {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
}

.sidebar-help-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.sidebar-help-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* â”€â”€ Main Content â”€â”€ */
.main-content {
  flex: 1;
  margin-left: calc(var(--sidebar-current-width) + var(--space-2));
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  transition: margin-left 280ms cubic-bezier(.4, 0, .2, 1);
  min-width: 0;
}

/* â”€â”€ Premium Topbar â”€â”€ */
.premium-topbar {
  position: relative;
  z-index: 60;
  margin-bottom: var(--space-2);
}

.premium-topbar-inner {
  min-height: var(--topbar-height);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: auto 1fr minmax(160px, 320px) auto;
  align-items: center;
  gap: 12px 16px;
  padding: 8px 16px;
  transition: var(--transition);
  overflow: visible;
}

.topbar-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.topbar-menu-btn i { width: 18px; height: 18px; }
.topbar-menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.premium-topbar-left { min-width: 0; }

.premium-topbar-crumb {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.premium-topbar-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: var(--text);
}

.premium-topbar-desc {
  display: none !important;
}

.premium-topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0 12px;
  height: 38px;
  transition: var(--transition);
}

.premium-topbar-search.is-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  transform: none;
}

.premium-topbar-search i,
.premium-topbar-search > svg.lucide {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.premium-topbar-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 0 8px;
  outline: none;
  color: var(--text);
}

.premium-kbd {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
}

.premium-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  position: relative;
  z-index: 70;
}

/* â”€â”€ Notification bell panel (global) â”€â”€ */
.notif-bell-wrap {
  position: relative;
  z-index: 80;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  overflow: hidden;
}

.notif-panel-header,
.notif-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}

.notif-panel-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border-light);
}

.notif-panel-body {
  max-height: 360px;
  overflow: auto;
}

.notif-empty {
  padding: 18px 14px;
  font-size: 13px;
}

.notif-item,
.notif-row {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.notif-item:hover,
.notif-row:hover {
  background: var(--bg);
}

.notif-item.is-unread,
.notif-row.is-unread {
  background: var(--accent-light);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item-icon svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.notif-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
}

.notif-item-meta {
  font-size: 11px;
}

.notif-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.notif-modal {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.notif-modal-header,
.notif-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.notif-modal-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border-light);
}

.notif-modal-body {
  padding: 16px;
}

.notif-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px 18px;
}

.notif-settings-item {
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.topbar-icon-btn:hover {
  background: var(--bg);
  border-color: var(--border-light);
  color: var(--text);
}

.topbar-bell:hover { animation: bellBounce .5s ease; }

@keyframes bellBounce {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.topbar-badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.topbar-create {
  font-size: 13px;
  font-weight: 600;
  height: 36px;
  padding-inline: 14px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  box-shadow: var(--shadow-accent);
  gap: 6px;
}

.topbar-create:hover {
  background: var(--accent-hover);
}

.topbar-create svg.lucide {
  width: 14px;
  height: 14px;
}

.topbar-profile {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 4px;
}

.topbar-profile:hover .topbar-avatar {
  box-shadow: 0 0 0 2px var(--accent-light);
}

.topbar-avatar {
  transition: box-shadow 160ms ease;
}

.topbar-profile-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: var(--success);
  border: 2px solid #fff;
  border-radius: 50%;
  z-index: 1;
}

.topbar-avatar { border-radius: 50% !important; }

.premium-topbar-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-body { flex: 1; padding-bottom: var(--space-3); }

.app-main-footer {
  margin-top: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.app-main-footer-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-main-footer-left span:first-child {
  font-weight: 600;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .app-main-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

.table-pagination-footer {
  padding: 0 var(--space-3) var(--space-3);
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
  padding-top: 12px;
}

/* â”€â”€ Stats Grid â”€â”€ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-card-icon i { width: 20px; height: 20px; color: var(--accent); }

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card .stat-trend {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.stat-trend.up { background: var(--success-bg); color: var(--success); }
.stat-trend.down { background: var(--danger-bg); color: var(--danger); }
.stat-trend.neutral { background: var(--bg); color: var(--text-muted); }
.stat-trend.warn { background: var(--accent-light); color: var(--accent); }

/* â”€â”€ Cards â”€â”€ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
}
.card-header {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: var(--space-3); }

/* â”€â”€ Page Header (legacy pages) â”€â”€ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-top: var(--space-1);
}

.page-header-left h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-header-left p {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* â”€â”€ Search & Filters â”€â”€ */
.search-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 0 0 320px;
}

.search-input-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 40px;
}

/* â”€â”€ Table â”€â”€ */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}

tbody tr { transition: background 160ms ease; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }

tbody td .btn-xs {
  height: 28px;
  padding-inline: 8px;
  border-radius: 6px;
}

tbody td .inline {
  display: inline-flex;
  vertical-align: middle;
}

/* â”€â”€ Badges â”€â”€ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}

.badge-active   { background: var(--success-bg); color: #16A34A; }
.badge-inactive { background: var(--bg); color: var(--text-muted); }
.badge-blocked  { background: var(--danger-bg); color: var(--danger); }
.badge-role     { background: var(--accent-light); color: var(--accent); }
.badge-success  { background: var(--success-bg); color: #16A34A; }
.badge-failed   { background: var(--danger-bg); color: var(--danger); }
.badge-pending  { background: var(--warning-bg); color: #D97706; }
.badge-pending-ops { background: #ede9fe; color: #6d28d9; }

/* â”€â”€ Avatar â”€â”€ */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--black);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: var(--radius-xs); }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; border-radius: var(--radius); }
.avatar.xl { width: 72px; height: 72px; font-size: 1.25rem; border-radius: var(--radius); }

/* â”€â”€ Buttons â”€â”€ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 var(--space-3);
  min-height: 28px;
  height: var(--btn-height, 38px);
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), .3);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--white);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover { background: #DC2626; text-decoration: none; color: var(--white); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-xs { height: 28px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 28px; min-width: 28px; height: 28px; padding: 0; }
.btn-icon i[data-lucide],
.btn-icon svg { width: 14px; height: 14px; flex-shrink: 0; }

/* â”€â”€ Forms â”€â”€ */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: var(--control-height, 48px);
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input, var(--radius-btn));
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea { height: auto; min-height: 80px; padding: 12px 16px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 3.5L11.5 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* â”€â”€ Alert (legacy + designed) â”€â”€ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.alert > svg.lucide,
.alert > i[data-lucide] + svg,
.alert svg.lucide:first-child {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-success { background: var(--success-bg); color: #166534; border: 1px solid rgba(34,197,94,.22); }
.alert-danger  { background: var(--danger-bg); color: #991B1B; border: 1px solid rgba(239,68,68,.22); }
.alert-warn    { background: var(--warning-bg); color: #92400E; border: 1px solid rgba(245,158,11,.22); }
.alert-info    { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-border-muted); }

.iam-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: iamAlertIn .35s var(--ease-spring);
}

.iam-alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: currentColor;
  opacity: .55;
}

.iam-alert__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,.55);
}

.iam-alert__icon svg {
  width: 18px;
  height: 18px;
}

.iam-alert__body { flex: 1; min-width: 0; }
.iam-alert__title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.iam-alert__content {
  font-size: 13px;
  line-height: 1.5;
  opacity: .92;
}
.iam-alert__content p { margin: 0; }
.iam-alert__content p + p { margin-top: 6px; }
.iam-alert__list {
  margin: 4px 0 0;
  padding-left: 1.1rem;
}
.iam-alert__list li + li { margin-top: 2px; }

.iam-alert__close {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .45;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  line-height: 0;
  transition: opacity .15s ease, background .15s ease;
}
.iam-alert__close:hover { opacity: 1; background: rgba(0,0,0,.06); }
.iam-alert__close svg { width: 14px; height: 14px; }

.iam-alert--success { background: linear-gradient(135deg, #ECFDF5, #F0FDF4); color: #166534; border-color: rgba(34,197,94,.2); }
.iam-alert--error   { background: linear-gradient(135deg, #FEF2F2, #FFF1F2); color: #991B1B; border-color: rgba(239,68,68,.2); }
.iam-alert--warning { background: linear-gradient(135deg, #FFFBEB, #FFF7ED); color: #92400E; border-color: rgba(245,158,11,.25); }
.iam-alert--info    { background: linear-gradient(135deg, var(--accent-light), #EFF6FF); color: #1E3A8A; border-color: rgba(59,130,246,.18); }

.iam-alert-enter { transition: opacity .25s ease, transform .25s var(--ease-spring); }
.iam-alert-enter-start { opacity: 0; transform: translateY(-6px); }
.iam-alert-enter-end { opacity: 1; transform: translateY(0); }
.iam-alert-leave { transition: opacity .2s ease, transform .2s ease; }
.iam-alert-leave-start { opacity: 1; transform: translateY(0); }
.iam-alert-leave-end { opacity: 0; transform: translateY(-4px); }

@keyframes iamAlertIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.iam-callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.5;
}
.iam-callout__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,.55);
}
.iam-callout__icon svg { width: 16px; height: 16px; }
.iam-callout__body { flex: 1; min-width: 0; }
.iam-callout__body p { margin: 0; }
.iam-callout__body p + p { margin-top: 6px; }
.iam-callout code {
  background: rgba(0,0,0,.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.iam-callout--info { background: #EFF6FF; color: #1E40AF; border-color: rgba(59,130,246,.2); }
.iam-callout--warning { background: var(--warning-bg); color: #92400E; border-color: rgba(245,158,11,.22); }
.iam-callout--danger { background: var(--danger-bg); color: #991B1B; border-color: rgba(239,68,68,.22); }
.iam-callout--success { background: var(--success-bg); color: #166534; border-color: rgba(34,197,94,.22); }

/* â”€â”€ Modal â”€â”€ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 { font-size: 15px; font-weight: 600; }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* â”€â”€ Pagination â”€â”€ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
  justify-content: center;
  align-items: center;
}

.pagination a,
.pagination span,
.pagination .pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  max-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
  text-decoration: none;
  box-sizing: border-box;
}

.pagination a:hover,
.pagination .pagination-btn:hover:not(.disabled):not(.active) {
  background: var(--bg);
  border-color: var(--border);
  text-decoration: none;
  color: var(--text);
}

.pagination .active,
.pagination .pagination-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

/* Prevent Laravel Tailwind default SVG chevrons from exploding when Tailwind is absent */
.pagination svg,
.table-pagination-footer svg,
nav[role="navigation"] svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

/* â”€â”€ Empty State â”€â”€ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.empty-state-icon i { width: 28px; height: 28px; color: var(--accent); }

.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* â”€â”€ Toast â”€â”€ */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0F172A;
  color: #F8FAFC;
  padding: 14px 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .28);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  animation: toastIn .32s var(--ease-spring);
}

.toast--success { background: linear-gradient(145deg, #14532D, #166534); }
.toast--error { background: linear-gradient(145deg, #7F1D1D, #991B1B); }
.toast--warning { background: linear-gradient(145deg, #92400E, #B45309); }
.toast--info {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}
.toast--info .toast-icon { background: var(--accent-light); color: var(--accent); }
.toast-icon svg { width: 16px; height: 16px; }

.toast-body { flex: 1; min-width: 0; padding-top: 3px; }
.toast-message { margin: 0; line-height: 1.45; font-weight: 500; }

.toast-action {
  background: rgba(255,255,255,.16);
  color: inherit;
  border: 0;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s ease;
  white-space: nowrap;
}
.toast-action:hover { background: rgba(255,255,255,.28); }
.toast--info .toast-action {
  background: var(--accent);
  color: #fff;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  margin-left: 2px;
  opacity: .55;
  transition: opacity .15s ease;
  padding: 2px;
  line-height: 0;
}
.toast-close:hover { opacity: 1; }
.toast-close svg { width: 14px; height: 14px; }

.toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255,255,255,.35);
  transform-origin: left center;
  animation-name: toastProgress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
.toast--info .toast-progress { background: var(--accent); opacity: .55; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) translateX(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.toast-enter { transition: opacity .28s ease, transform .28s var(--ease-spring); }
.toast-enter-start { opacity: 0; transform: translateX(16px); }
.toast-enter-end { opacity: 1; transform: translateX(0); }
.toast-leave { transition: opacity .2s ease, transform .2s ease; }
.toast-leave-start { opacity: 1; transform: translateX(0); }
.toast-leave-end { opacity: 0; transform: translateX(12px); }

/* Page load progress */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  background: transparent;
}
.page-progress.is-active {
  opacity: 1;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-gradient-end, var(--accent)));
  animation: pageProgress 1.1s ease-in-out infinite;
  transform-origin: left center;
}
.page-progress.is-done {
  animation: none;
  width: 100%;
  opacity: 0;
  transition: opacity .28s ease;
}
@keyframes pageProgress {
  0% { transform: scaleX(.08); opacity: .4; }
  50% { transform: scaleX(.65); opacity: 1; }
  100% { transform: scaleX(.95); opacity: .7; }
}

.fade-page {
  animation: fadePage .28s ease;
}
@keyframes fadePage {
  from { opacity: .01; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fade-up, .fade-page, .iam-alert, .toast, .page-progress.is-active {
    animation: none !important;
  }
  .fade-up { opacity: 1; transform: none; }
}

/* â”€â”€ Skeleton â”€â”€ */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

.skeleton-bar {
  height: 14px;
  width: 100%;
  max-width: 100%;
}

.table-skeleton td {
  padding: 14px 16px;
}

body.iam-confirm-open { overflow: hidden; }

.iam-confirm-modal { max-width: 420px; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* â”€â”€ FadeUp Animation â”€â”€ */
.fade-up {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp .5s var(--ease-spring) forwards;
}

.fade-up:nth-child(1) { animation-delay: 0ms; }
.fade-up:nth-child(2) { animation-delay: 60ms; }
.fade-up:nth-child(3) { animation-delay: 120ms; }
.fade-up:nth-child(4) { animation-delay: 180ms; }
.fade-up:nth-child(5) { animation-delay: 240ms; }
.fade-up:nth-child(6) { animation-delay: 300ms; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* â”€â”€ Connection Banner â”€â”€ */
.connection-banner {
  background: var(--accent-light);
  color: var(--accent);
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid rgba(var(--accent-rgb), .15);
}

/* â”€â”€ Tools Belt â”€â”€ */
.tools-belt {
  background: var(--surface);
  color: var(--text);
  padding: var(--space-4);
  border-radius: var(--radius);
  font-family: var(--font);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.tools-belt .form-input,
.tools-belt textarea {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  height: 40px;
}

.tools-belt h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* â”€â”€ Hierarchy â”€â”€ */
.hierarchy-stage {
  width: 100%;
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 168px);
  min-height: 560px;
}

.hierarchy-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hierarchy-toolbar-spacer { flex: 1; min-width: 8px; }

.hierarchy-view-modes {
  display: inline-flex;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
}

.hierarchy-mode-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hierarchy-mode-btn i,
.hierarchy-mode-btn svg { width: 14px; height: 14px; pointer-events: none; }

.hierarchy-mode-btn:hover { color: var(--text); }
.hierarchy-mode-btn.is-active {
  background: var(--accent-light);
  color: var(--accent);
}

.hierarchy-stage .canvas-container {
  width: 100%;
  flex: 1 1 auto;
  min-height: 360px;
  height: auto;
  background: linear-gradient(180deg, #FBFBFC 0%, var(--bg) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-float);
}

.hierarchy-bottom-dock,
.hierarchy-top-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: static;
  z-index: 30;
}

.hierarchy-top-dock {
  flex-direction: column;
  align-items: stretch;
}

.hierarchy-bottom-tools,
.hierarchy-top-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.hierarchy-status-inline {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
  white-space: nowrap;
}

.hierarchy-match-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hierarchy-depth-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.hierarchy-depth-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  height: 32px;
}

.hierarchy-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  width: 100%;
  min-width: 0;
}

.hierarchy-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.hierarchy-filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  cursor: pointer;
  transition: var(--transition);
}

.hierarchy-filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.hierarchy-filter-chip.is-active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.hierarchy-footer-stat.is-clickable {
  appearance: none;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-light);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.hierarchy-footer-stat.is-clickable:hover,
.hierarchy-footer-stat.is-clickable.is-active {
  background: rgba(var(--accent-rgb), 0.06);
}

.hierarchy-footer-stat.is-clickable.is-active strong {
  color: var(--accent);
}

@media (max-width: 900px) {
  .hierarchy-top-dock .hierarchy-footer-stats {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}

.hierarchy-stage[data-view="tree"] .hierarchy-canvas-only { display: none !important; }
.hierarchy-stage[data-view="tree"] .minimap { display: none !important; }

.hierarchy-bottom-dock .hierarchy-footer-stats,
.hierarchy-top-dock .hierarchy-footer-stats {
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  gap: 0;
}

.hierarchy-bottom-dock .hierarchy-footer-stat,
.hierarchy-top-dock .hierarchy-footer-stat {
  min-width: 64px;
  padding: 2px 10px;
}

/* â”€â”€ Hierarchy tree view â”€â”€ */
.hierarchy-tree-view {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: auto;
  padding: 20px 22px 28px;
  background:
    radial-gradient(ellipse at top left, rgba(var(--accent-rgb), 0.05), transparent 42%),
    linear-gradient(180deg, #FBFBFC 0%, var(--bg) 100%);
}

.hierarchy-tree-view[hidden] { display: none !important; }

.htree-shell { max-width: 920px; margin: 0 auto; }

.htree-legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.htree-legend > span:first-child {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.htree-legend-hint {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.htree-list { display: flex; flex-direction: column; gap: 8px; }

.htree-node {
  position: relative;
}

.htree-node:not(.is-root) > .htree-rail {
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  width: 16px;
  pointer-events: none;
}

.htree-node:not(.is-root) > .htree-rail::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 50%;
  width: 1px;
  background: #E5E7EB;
}

.htree-node:not(.is-root) > .htree-rail::after {
  content: "";
  position: absolute;
  left: 0;
  top: 28px;
  width: 14px;
  height: 1px;
  background: #E5E7EB;
}

.htree-node.is-last > .htree-rail::before { bottom: calc(100% - 29px); }

.htree-children {
  position: relative;
  margin-top: 8px;
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.htree-card {
  position: relative;
  display: grid;
  grid-template-columns: 28px 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid #ECECEC;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
  font-family: inherit;
  color: inherit;
}

.htree-card:hover {
  border-color: rgba(var(--accent-rgb), .3);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.06);
  transform: translateY(-1px);
}

.htree-card:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.35);
  outline-offset: 2px;
}

.htree-card.is-selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-light) 0%, #FFFFFF 100%);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 8px 22px var(--accent-glow);
}

.htree-card.is-wiring {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow-strong);
}

.htree-card.is-wiring::before,
.htree-card.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.htree-node.is-dimmed {
  opacity: 0.38;
}

.htree-node.is-dimmed .htree-card:hover {
  opacity: 1;
}

.htree-node.is-wiring:not(.is-selected) > .htree-rail::before,
.htree-node.is-wiring:not(.is-selected) > .htree-rail::after,
.htree-node.is-selected > .htree-rail::before,
.htree-node.is-selected > .htree-rail::after {
  background: var(--accent);
  width: 2px;
}

.htree-node.is-wiring:not(.is-selected) > .htree-rail::after,
.htree-node.is-selected > .htree-rail::after {
  height: 2px;
}

.htree-node.is-ghost .htree-card {
  border-style: dashed;
  background: #FAFAFA;
  opacity: .85;
}

.htree-node.is-match .htree-name {
  color: var(--accent);
}

.htree-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid #ECECEC;
  border-radius: var(--radius-xs);
  background: #F7F8FA;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.htree-toggle i { width: 14px; height: 14px; transition: transform .15s ease; }
.htree-toggle.is-open i,
.htree-toggle.is-open svg {
  transform: none;
}
.htree-toggle:hover { background: var(--accent-light); color: var(--accent); border-color: rgba(var(--accent-rgb), .2); }

.htree-toggle-leaf {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  position: relative;
}

.htree-toggle-leaf::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: #D1D5DB;
}

.htree-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.htree-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.htree-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.htree-name {
  font-size: 14px;
  font-weight: 700;
  color: #161616;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htree-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px #fff;
}

.htree-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.htree-role {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  color: var(--role, var(--accent));
  background: var(--accent-glow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htree-id,
.htree-level {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.htree-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.htree-metric {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #F7F8FA;
  border-radius: var(--radius-pill);
  padding: 3px 8px;
  white-space: nowrap;
}

.htree-metric em {
  font-style: normal;
  font-weight: 700;
  color: #161616;
  margin-right: 2px;
}

.htree-metric-muted {
  color: var(--accent);
  background: var(--accent-glow);
}

.htree-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .htree-card {
    grid-template-columns: 28px 36px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .htree-metrics {
    grid-column: 2 / -1;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .htree-legend { flex-direction: column; gap: 4px; }
}

.hierarchy-dock-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  background: var(--bg);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  min-width: 180px;
  max-width: 280px;
  flex: 1;
}

.hierarchy-dock-search i { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.hierarchy-dock-input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  outline: none;
  color: var(--text);
}

.hierarchy-dock-divider {
  width: 1px;
  height: 24px;
  background: var(--divider);
  flex-shrink: 0;
}

.hierarchy-dock-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.hierarchy-dock-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), .2);
}

.hierarchy-dock-btn:active {
  transform: scale(0.96);
}

.hierarchy-dock-btn i,
.hierarchy-dock-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.hierarchy-dock-zoom {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: center;
}

.hierarchy-float-controls {
  position: absolute;
  left: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hierarchy-popover-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: var(--text);
}

.hierarchy-loading {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(247, 248, 250, .75);
  backdrop-filter: blur(4px);
}

.hierarchy-loading.is-active { display: flex; }

.hierarchy-loading-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hierarchy-status-chip {
  position: absolute;
  bottom: calc(var(--space-2) + 8px);
  right: var(--space-2);
  z-index: 10;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  max-width: min(360px, 70%);
}

.hierarchy-inspector {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  bottom: var(--space-2);
  width: min(340px, calc(100% - var(--space-4)));
  z-index: 14;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--font);
}

.hierarchy-inspector[hidden] { display: none !important; }

.hierarchy-inspector-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-btn);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}

.hierarchy-inspector-close i,
.hierarchy-inspector-close svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.hierarchy-inspector-close:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), .2);
}

.hierarchy-inspector-header {
  display: flex;
  gap: 12px;
  padding-right: 36px;
  align-items: flex-start;
}

.hierarchy-inspector-avatar {
  border-radius: 50% !important;
  background: #111 !important;
  color: #fff !important;
  flex-shrink: 0;
}

.hierarchy-inspector-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.hierarchy-inspector-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hierarchy-inspector-meta {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.hierarchy-inspector-meta dt {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.hierarchy-inspector-meta dd { margin: 2px 0 0; color: var(--text); font-weight: 600; }

.hierarchy-inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.hierarchy-inspector-hint { margin-top: 0; }

.hierarchy-link-btn {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  margin-right: 6px;
}

.hierarchy-link-btn:hover { text-decoration: underline; }

.hierarchy-shortcuts {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 18;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 220px;
}

.hierarchy-shortcuts[hidden] { display: none !important; }

.hierarchy-shortcuts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
}

.hierarchy-footer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 4px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hierarchy-footer-stat {
  flex: 1;
  min-width: 88px;
  padding: 4px 10px;
  border-right: 1px solid var(--border-light);
}

.hierarchy-footer-stat:last-child { border-right: none; }

.hierarchy-footer-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.hierarchy-footer-stat strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.minimap {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 20;
  width: 168px;
  height: 118px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .96);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

.minimap::after {
  content: 'Overview';
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
}

.hierarchy-focus-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--accent-border-muted, rgba(238, 114, 78, 0.25));
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  max-width: min(420px, calc(100% - 24px));
}

.hierarchy-focus-chip[hidden] { display: none !important; }

.hierarchy-focus-clear {
  border: 0;
  background: var(--accent-light);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.hierarchy-focus-clear:hover {
  background: var(--accent);
  color: #fff;
}

.hierarchy-shortcuts-list li { margin-bottom: 6px; }

.hierarchy-shortcuts-list kbd {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.canvas-hover-card {
  position: absolute;
  z-index: 20;
  min-width: 200px;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transition: opacity 200ms ease, transform 200ms ease;
}

.canvas-hover-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.canvas-hover-card-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.canvas-hover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

.canvas-hover-link {
  color: var(--accent);
  text-decoration: none;
}

.canvas-hover-link:hover { text-decoration: underline; }

/* â”€â”€ Charts â”€â”€ */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

#hierarchyCanvas { width: 100%; height: 100%; cursor: grab; }
#hierarchyCanvas:active { cursor: grabbing; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.chart-card:hover {
  box-shadow: var(--shadow-md);
}

.chart-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
  width: 100%;
  overflow: hidden;
}

.chart-canvas-wrap canvas {
  display: block;
  max-height: 100%;
}

/* â”€â”€ Heatmap â”€â”€ */
.heatmap-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.heatmap-table td,
.heatmap-table th {
  border: 1px solid var(--border-light);
  padding: 8px 10px;
  text-align: center;
}
.heatmap-cell-warn { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* â”€â”€ Flex Utilities â”€â”€ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.relative { position: relative; }

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .hierarchy-inspector { width: min(280px, 100% - 24px); }
}

@media (max-width: 1100px) {
  .premium-topbar-inner {
    grid-template-columns: auto 1fr minmax(140px, 240px) auto;
  }
  .topbar-icon-muted { display: none; }
  .premium-topbar-desc { display: none; }
}

@media (max-width: 768px) {
  .app-shell { padding: 0; gap: 0; }
  .topbar-menu-btn { display: inline-flex; }

  .sidebar {
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 0 var(--radius-sidebar) var(--radius-sidebar) 0;
    width: min(280px, 86vw) !important;
    transform: translateX(calc(-100% - 8px));
    transition: transform 280ms cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--shadow-lg);
  }

  .app-shell.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.mobile-nav-open .sidebar-backdrop {
    display: block;
  }

  .main-content {
    margin-left: 0 !important;
    min-height: 100vh;
  }

  .sidebar-collapse-btn { display: none; }

  .premium-topbar {
    top: 0;
    margin-bottom: 12px;
  }

  .premium-topbar-inner {
    grid-template-columns: auto 1fr auto;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .premium-topbar-search { display: none; }

  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 12px; }
  .search-area { flex-direction: column; align-items: stretch; }
  .search-input-wrap { flex: 1 1 100%; }
}

/* â”€â”€ Auth / Login (guest) â”€â”€ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.auth-page .auth-card,
.auth-page .auth-methods-panel,
.auth-page .form-input,
.auth-page .btn {
  font-family: var(--font);
}

body.auth-modal-open { overflow: hidden; }

[x-cloak] { display: none !important; }

.auth-page-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.auth-page-bg::before,
.auth-page-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.65;
}

.auth-page-bg::before {
  width: min(520px, 90vw);
  height: min(520px, 90vw);
  background: radial-gradient(circle, #FFD4B8 0%, transparent 70%);
  top: -15%;
  left: -10%;
}

.auth-page-bg::after {
  width: min(600px, 95vw);
  height: min(600px, 95vw);
  background: radial-gradient(circle, #FFF0E6 0%, transparent 65%);
  bottom: -25%;
  right: -15%;
}

.auth-page-wave {
  position: absolute;
  width: 140%;
  left: -20%;
  opacity: 0.35;
}

.auth-page-wave--top {
  top: 8%;
  color: #FFB380;
}

.auth-page-wave--bottom {
  bottom: 5%;
  color: #FFCDB2;
  transform: rotate(180deg);
}

.auth-page-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 32px;
  position: relative;
  overflow: visible;
}

.auth-brand {
  margin-bottom: var(--space-4);
}

.auth-brand-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 6px;
}

.auth-brand-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gradient-end) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(255, 107, 0, .25);
}

.auth-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1.2;
}

.auth-brand-tagline {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 60px;
}

.auth-form .form-group { margin-bottom: var(--space-2); }

.auth-form .form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-form .form-input {
  height: 48px;
  font-size: 14px;
  border-radius: var(--radius-btn);
  border-color: var(--border);
}

.auth-form .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.auth-form .form-input-icon .form-input {
  padding-left: 44px;
  padding-right: 44px;
}

.auth-form .form-input-icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-form .form-input-icon-right {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.auth-form .form-input-icon-right:hover {
  color: var(--text);
  background: var(--bg);
}

.auth-form .form-input-icon { position: relative; }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.auth-remember input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  border-radius: 4px;
}

.auth-forgot {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.auth-forgot:hover { text-decoration: underline; }

.auth-submit {
  width: 100%;
  height: 48px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-btn);
  background: var(--accent);
  box-shadow: var(--shadow-accent);
}

.auth-submit:hover {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--accent-hover) 100%);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.auth-divider-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.auth-alt-btn {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.auth-alt-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.auth-alt-btn .auth-alt-chevron {
  margin-left: auto;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.auth-secured {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-secured i { width: 16px; height: 16px; }

/* Other methods modal */
.auth-methods-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}

.auth-methods-overlay.is-open {
  display: flex;
}

.auth-methods-panel {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  padding: var(--space-3);
  max-height: 90vh;
  overflow-y: auto;
}

.auth-methods-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.auth-methods-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.auth-methods-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.auth-methods-close:hover { background: var(--accent-light); color: var(--accent); }

.auth-method-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.auth-method-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border-radius: var(--radius-btn);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.auth-method-tab i { width: 18px; height: 18px; }

.auth-method-tab.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.auth-callout {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  border: 1px solid rgba(var(--accent-rgb), .12);
}

.auth-callout-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-callout-icon i { width: 20px; height: 20px; }

.auth-callout p {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.auth-success-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--space-2);
  background: var(--success-bg);
  border: 1px solid rgba(34, 197, 94, .25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: #15803d;
  margin-top: var(--space-2);
}

.auth-success-banner i { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.auth-jwt-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: var(--transition);
}

.auth-jwt-card:hover {
  border-color: var(--accent);
  background: var(--bg);
}

.auth-jwt-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-btn);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-jwt-card-icon i { width: 20px; height: 20px; }

.auth-jwt-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.auth-jwt-card-desc {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-jwt-card .auth-alt-chevron {
  margin-left: auto;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.auth-methods-panel textarea.form-input {
  min-height: 120px;
  height: auto;
  padding: 12px 16px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

/* â”€â”€ Auth split (compact edgeone-style) â”€â”€ */
.auth-split-body {
  --auth-input-h: 44px;
  --auth-cta-h: 44px;
  --auth-title: 22px;
  --auth-subtitle: 13px;
  --auth-label: 11px;
  --auth-dark: #0F172A;
  --auth-muted: #64748B;
  font-family: var(--font);
  margin: 0;
  min-height: 100vh;
  background: var(--white);
  color: var(--auth-dark);
  -webkit-font-smoothing: antialiased;
}

.auth-split {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.auth-split-visual {
  width: 45%;
  background: linear-gradient(135deg, #FFF7ED 0%, #F0FDF4 60%, #F0FDFA 100%);
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-split-visual::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 60%;
  height: 50%;
  background-image: radial-gradient(circle, rgba(var(--accent-rgb), 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.auth-split-visual-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 400px;
}

.auth-split-hero-img {
  max-width: min(320px, 100%);
  height: auto;
  object-fit: contain;
  margin: 0 auto 24px;
  display: block;
}

.auth-split-tagline-pre {
  font-size: 14px;
  font-weight: 700;
  color: var(--auth-dark);
  margin-bottom: 4px;
}

.auth-split-tagline-main {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent);
  margin-bottom: 8px;
}

.auth-split-tagline-sub {
  font-size: var(--auth-subtitle);
  color: var(--auth-muted);
  line-height: 1.5;
}

.auth-split-form {
  width: 55%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 48px;
  position: relative;
}

.auth-split-form-inner {
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-split-secured {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--auth-muted);
  padding-top: 16px;
  margin-top: auto;
}

.auth-split-secured-icon {
  width: 16px;
  height: 16px;
}

.auth-split-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.auth-split-header-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gradient-end) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.auth-split-kicker {
  font-size: var(--auth-label);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.auth-split-title {
  font-size: var(--auth-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 6px;
}

.auth-split-subtitle {
  font-size: var(--auth-subtitle);
  color: var(--auth-muted);
  line-height: 1.45;
  margin: 0;
}

.auth-split-alert {
  margin-bottom: 16px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field-label {
  display: block;
  font-size: var(--auth-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--auth-dark);
  margin-bottom: 8px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--auth-input-h);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--white);
  transition: var(--transition);
}

.auth-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--auth-muted);
  pointer-events: none;
}

.auth-input-wrap input {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--auth-dark);
  padding: 0 44px 0 44px;
}

.auth-input-wrap input::placeholder {
  color: #b0b8c9;
}

.auth-toggle-pw {
  position: absolute;
  right: 10px;
  border: none;
  background: none;
  padding: 6px;
  cursor: pointer;
  color: var(--auth-muted);
  display: flex;
  align-items: center;
}

.auth-toggle-pw:hover { color: var(--auth-dark); }

.auth-toggle-pw svg { width: 18px; height: 18px; }

.auth-field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 6px;
}

.auth-split-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.auth-split-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--auth-muted);
  cursor: pointer;
}

.auth-split-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auth-split-row-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.auth-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.auth-link:hover { text-decoration: underline; }

.auth-link-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.auth-cta {
  width: 100%;
  height: var(--auth-cta-h);
  border: none;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-accent);
}

.auth-cta:hover {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--accent-hover) 100%);
  transform: translateY(-1px);
}

.auth-cta:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.auth-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  resize: vertical;
  outline: none;
}

.auth-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-svg-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-methods-panel--compact {
  max-width: 400px;
  padding: 20px;
  border-radius: var(--radius);
}

.auth-methods-panel--compact .auth-methods-header h2 {
  font-size: 18px;
}

.auth-callout--compact {
  padding: 12px;
  margin-bottom: 16px;
}

.auth-callout--compact p {
  font-size: 12px;
}

.auth-split-body .auth-method-tab svg {
  width: 16px;
  height: 16px;
}

.auth-split-body .auth-methods-close svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .auth-split { flex-direction: column; }
  .auth-split-visual { display: none; }
  .auth-split-form {
    width: 100%;
    padding: 24px 20px;
    min-height: 100vh;
  }
}

/* â”€â”€ Premium dashboard â”€â”€ */
.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  margin-bottom: 20px;
}

.dash-toolbar-spacer { flex: 1; }

.dash-range {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs);
}

.dash-range-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.dash-range-btn:hover { color: var(--text); background: var(--bg); }
.dash-range-btn.is-active {
  background: var(--accent-light);
  color: var(--accent);
}

.dash-range-caption { width: 100%; text-align: right; margin: 0; }

.dash-kpi .dash-kpi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.dash-kpi .stat-card-icon { margin-bottom: 12px; }

.dash-chart-row {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.dash-chart-wide .dash-chart-tall { height: 280px; }

.dash-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--space-2);
}

.dash-card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }

.dash-donut-wrap { height: 200px; position: relative; }

.dash-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.dash-donut-total {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.dash-legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.dash-legend li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.dash-lower-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dash-role-list { display: flex; flex-direction: column; gap: 14px; }

.dash-role-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
}

.dash-role-name {
  font-size: 13px;
  font-weight: 500;
  text-transform: capitalize;
  grid-column: 1;
}

.dash-role-count {
  font-size: 13px;
  font-weight: 700;
  grid-column: 2;
  grid-row: 1;
}

.dash-role-bar-track {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.dash-role-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff9240);
  border-radius: 999px;
  min-width: 4px;
  transition: width .4s ease;
}

.dash-security-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-security-list li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-security-list strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.dash-security-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-security-icon i { width: 18px; height: 18px; }
.dash-security-icon-warn { background: #FEF3C7; color: #D97706; }
.dash-security-icon-danger { background: var(--danger-bg); color: var(--danger); }
.dash-security-icon-ok { background: var(--success-bg); color: var(--success); }

.dash-health-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

.dash-health-main {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.dash-health-check { width: 22px; height: 22px; color: var(--success); flex-shrink: 0; }

.dash-health-components {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 13px;
}

.dash-health-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.dash-health-dot.is-ok { background: var(--success); }
.dash-health-dot.is-bad { background: var(--danger); }

.dash-health-meta { margin-left: auto; }

.dash-health-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 1200px) {
  .dash-lower-grid { grid-template-columns: 1fr 1fr; }
  .dash-security-card { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-chart-row { grid-template-columns: 1fr; }
  .dash-lower-grid { grid-template-columns: 1fr; }
  .dash-health-meta { margin-left: 0; width: 100%; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* â”€â”€ User edit â”€â”€ */
.user-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.user-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.user-edit-impact {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  border: 1px solid rgba(var(--accent-rgb), .15);
  color: var(--text);
  font-size: 13px;
}

.user-edit-payout {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-edit-perms {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
  scroll-behavior: smooth;
}

.user-edit-perm-app > summary,
.user-edit-perm-module > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 0;
}

.user-edit-perm-module {
  margin-left: 12px;
  margin-bottom: 6px;
}

.user-edit-perm-module .perm-row {
  margin: 4px 0 4px 10px;
}

.user-perm-quick {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-perm-quick .form-select {
  flex: 1;
  min-width: 0;
}

.user-perm-matrix-wrap {
  margin-top: 4px;
}

.user-perm-matrix {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.user-perm-matrix .data-table {
  margin: 0;
}

.user-perm-matrix .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.user-perm-module-row td {
  background: var(--bg);
  font-size: 13px;
}

.user-perm-module-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.iam-access-modules {
  display: grid;
  gap: 8px;
}

.iam-access-module {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.iam-access-module-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
}

.iam-access-module-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.iam-access-module-title {
  font-size: 13px;
  font-weight: 600;
}

.iam-access-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.iam-access-module.is-open .iam-access-chevron {
  transform: rotate(90deg);
}

details.iam-access-module > summary {
  list-style: none;
  cursor: pointer;
}

details.iam-access-module > summary::-webkit-details-marker {
  display: none;
}

details.iam-access-module[open] .iam-access-chevron {
  transform: rotate(90deg);
}

details.iam-access-module .iam-access-module-body {
  border-top: 1px solid var(--border-light);
}

.iam-access-module-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.iam-access-module-body {
  display: grid;
  gap: 2px;
  padding: 6px 8px 8px;
  border-top: 1px solid var(--border-light);
}

.iam-access-perm {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  margin: 0;
}

.iam-access-perm:hover {
  background: var(--bg);
}

.iam-access-perm.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.iam-access-perm input {
  margin-top: 2px;
  flex-shrink: 0;
}

.iam-access-perm-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.iam-access-perm-label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.iam-access-perm-code {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  word-break: break-all;
}

.app-perm-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.app-perm-import {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.app-perm-import .form-input {
  min-width: 200px;
}

.app-perm-modules {
  display: grid;
  gap: 8px;
}

.app-perm-module {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.app-perm-module-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
}

.app-perm-module-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.app-perm-module-title {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-perm-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.app-perm-module.is-open .app-perm-chevron {
  transform: rotate(90deg);
}

.app-perm-module-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-light);
  display: grid;
  gap: 10px;
}

.app-perm-rows {
  display: grid;
  gap: 6px;
}

.app-perm-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1.4fr) auto;
  gap: 6px;
  align-items: center;
}

@media (max-width: 900px) {
  .app-perm-row {
    grid-template-columns: 1fr;
  }
}

.app-perm-module-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-perm-coverage > .card-header,
.app-perm-coverage-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-perm-coverage-summary::-webkit-details-marker {
  display: none;
}

.app-perm-coverage[open] .app-perm-coverage-summary {
  border-bottom: 1px solid var(--border-light);
}

.user-edit-diff {
  font-size: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.user-edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.user-edit-sticky {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

.user-edit-meta {
  display: grid;
  gap: 10px;
  font-size: 13px;
}

.user-edit-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.user-edit-meta > div:last-child { border-bottom: none; padding-bottom: 0; }

.text-success { color: var(--success); }

@media (max-width: 960px) {
  .user-edit-layout { grid-template-columns: 1fr; }
  .user-edit-sticky { position: static; }
  .user-edit-grid { grid-template-columns: 1fr; }
}

.user-edit { margin-bottom: 48px; position: relative; }

.user-edit-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

.user-edit-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.user-edit-input-badge {
  position: relative;
}

.user-edit-input-badge .badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.user-edit-input-badge .form-input {
  padding-right: 88px;
}

.user-edit-info-list {
  display: grid;
  gap: 12px;
}

.user-edit-info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.user-edit-info-list > div:last-child { border-bottom: none; padding-bottom: 0; }

.user-edit-activity-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.user-edit-activity-row:last-child { border-bottom: none; }

.user-edit-activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.user-edit-unsaved {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .28);
}

.user-edit-unsaved-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FBBF24;
  animation: pulseDot 1.2s ease infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.85); }
}

.user-detail-quick-item:disabled {
  opacity: .45;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .user-edit-stats { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 900px) {
  .user-edit-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .user-edit-stats { grid-template-columns: 1fr 1fr !important; }
  .user-edit-unsaved { left: 16px; right: 16px; justify-content: center; }
}

/* â”€â”€ Users list + preview drawer â”€â”€ */
.users-page {
  position: relative;
}

.users-table tbody tr.users-row {
  cursor: pointer;
  transition: background 160ms ease;
}

.users-table tbody tr.users-row-pending {
  background: #f5f3ff;
}

.users-table tbody tr.users-row-pending:hover {
  background: #ede9fe;
}

.users-table tbody tr.users-row:hover {
  background: var(--accent-light);
}

.users-table tbody tr.users-row.is-selected {
  background: var(--accent-light);
  box-shadow: inset 3px 0 0 var(--accent);
}

.users-pagination .pagination {
  margin-top: 0;
  justify-content: flex-end;
}

.pagination .disabled,
.pagination .pagination-btn.disabled {
  opacity: .45;
  pointer-events: none;
  cursor: default;
  background: var(--surface-2, var(--bg));
}

.user-preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .28);
  z-index: 120;
  backdrop-filter: blur(2px);
}

.user-preview-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border-light);
  box-shadow: var(--shadow-xl);
  z-index: 130;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(.4, 0, .2, 1);
  overflow-y: auto;
}

.user-preview-drawer.is-open {
  transform: translateX(0);
}

.user-preview-inner {
  padding: 18px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
}

.user-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-preview-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-preview-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50% !important;
  background: var(--black);
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 700;
}

.user-preview-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  line-height: 1.25;
}

.user-preview-meta {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.user-preview-meta > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.user-preview-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.user-preview-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.user-preview-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.user-preview-actions .btn {
  justify-content: center;
}

body.user-preview-open {
  overflow: hidden;
}

/* â”€â”€ User detail (view) â”€â”€ */
.user-detail { margin-bottom: 24px; }

.user-detail-actions {
  position: relative;
  display: inline-flex;
}

.user-detail-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 40;
}

.user-detail-actions-menu a,
.user-detail-actions-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
}

.user-detail-actions-menu a:hover,
.user-detail-actions-menu button:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.user-detail-actions-menu i { width: 14px; height: 14px; }
.user-detail-action-danger { color: var(--danger) !important; }

.user-detail-hero {
  margin-bottom: 0;
  overflow: hidden;
}

.user-detail-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 8px;
}

.user-detail-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.user-detail-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50% !important;
  background: var(--black);
  color: var(--white);
  font-size: 1.25rem;
  font-weight: 700;
}

.user-detail-presence {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.user-detail-presence.is-online { background: var(--success); }
.user-detail-presence.is-offline { background: var(--text-muted); }

.user-detail-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.user-detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  text-transform: uppercase;
  line-height: 1.2;
}

.user-detail-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.user-detail-contact span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-detail-contact i { width: 14px; height: 14px; color: var(--text-muted); }

.user-detail-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--border-light);
  margin-top: 12px;
}

.user-detail-stat {
  padding: 14px 16px;
  border-right: 1px solid var(--border-light);
}

.user-detail-stat:last-child { border-right: none; }

.user-detail-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.user-detail-stat-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-detail-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  padding: 0;
}

.user-detail-status-dot.badge-active { background: var(--success); }
.user-detail-status-dot.badge-inactive { background: var(--warning); }
.user-detail-status-dot.badge-blocked { background: var(--danger); }

.user-detail-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light);
  margin: 16px 0 20px;
  padding: 0 4px;
  scroll-behavior: smooth;
}

.user-detail-tab {
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: color 180ms ease, background 180ms ease;
}

.user-detail-tab:hover {
  color: var(--text);
  background: var(--bg);
}

.user-detail-tab.is-active {
  color: var(--accent);
}

.user-detail-tab.is-active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.user-detail-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.user-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.user-detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}

.user-detail-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.user-detail-field-value {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.user-detail-email-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-detail-manager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-detail-path {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.user-detail-path::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: var(--border);
}

.user-detail-path li {
  position: relative;
  padding-bottom: 14px;
}

.user-detail-path li:last-child { padding-bottom: 0; }

.user-detail-path-node {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  position: relative;
  z-index: 1;
}

.user-detail-path-node:hover .text-sm { color: var(--accent); }

.user-detail-path .avatar {
  box-shadow: 0 0 0 3px var(--surface);
}

.user-detail-you {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

.user-detail-path li.is-you .avatar {
  background: var(--accent);
  color: #fff;
}

.user-detail-quick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.user-detail-quick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px;
  border: none;
  background: none;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease;
}

.user-detail-quick-item span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-detail-quick-item i { width: 16px; height: 16px; color: var(--text-muted); }
.user-detail-quick-item:hover { background: var(--bg); color: var(--accent); }
.user-detail-quick-item:hover i { color: var(--accent); }

.user-detail-perm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-detail-reports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.user-detail-report-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-btn);
  text-decoration: none;
  color: inherit;
}

.user-detail-report-row:hover { background: var(--bg); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.min-w-0 { min-width: 0; }
.flex-1 { flex: 1; }

@media (max-width: 1100px) {
  .user-detail-stats { grid-template-columns: repeat(3, 1fr); }
  .user-detail-stat:nth-child(3n) { border-right: none; }
  .user-detail-stat:nth-child(n+4) { border-top: 1px solid var(--border-light); }
}

@media (max-width: 900px) {
  .user-detail-body { grid-template-columns: 1fr; }
  .user-detail-reports { grid-template-columns: 1fr; }
  .user-detail-edit-btn { display: none; }
}

@media (max-width: 640px) {
  .user-detail-stats { grid-template-columns: 1fr 1fr; }
  .user-detail-stat { border-right: 1px solid var(--border-light); }
  .user-detail-stat:nth-child(2n) { border-right: none; }
  .user-detail-stat:nth-child(n+3) { border-top: 1px solid var(--border-light); }
  .user-detail-info-grid { grid-template-columns: 1fr; }
  .user-detail-name { font-size: 1.1rem; }
}

/* -- User documents -- */
.user-docs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-docs-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

/* â”€â”€ Bento + command search (Apps / hubs) â”€â”€ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.bento-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  min-height: 88px;
}
.bento-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
.bento-tile.is-muted { opacity: .65; }
.bento-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bento-tile-icon svg { width: 18px; height: 18px; }
.bento-tile-body { flex: 1; min-width: 0; }
.bento-tile-body h3 { font-size: 14px; font-weight: 600; margin: 0; }
.bento-chevron { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.cmdk-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow: auto;
  z-index: 80;
}
.cmdk-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.cmdk-item:hover, .cmdk-item.is-active { background: var(--accent-light); }
.cmdk-item-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-right: 8px;
}
.premium-topbar-search { position: relative; }
.topbar-theme-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.topbar-theme-btn:hover { color: var(--accent); border-color: var(--accent); }
.topbar-theme-btn svg { width: 16px; height: 16px; }
body.density-compact {
  /* spacing tokens come from ui-theme :root */
}
body.density-compact .card-body { padding: var(--space-2) var(--space-3); }
body.density-compact .btn { height: var(--btn-height, 30px); padding-inline: 12px; font-size: 12.5px; }
body.density-compact .form-group { margin-bottom: var(--space-2); }
body.density-compact .form-input,
body.density-compact .form-select { height: var(--control-height, 34px); font-size: 12.5px; border-radius: var(--radius-input); }
body.density-compact table td,
body.density-compact table th { padding: 8px 10px; }
body.density-compact .sidebar-link { padding: 5px 8px; font-size: 12px; }
body.density-compact .premium-topbar-inner { min-height: var(--topbar-height); }
body.density-compact .page-header { margin-bottom: var(--space-2); }
body.density-compact .section-gap { margin-bottom: var(--space-2); }
body.density-compact .card { border-radius: var(--radius-card); }
body.density-compact .premium-topbar-title { font-size: 1.05rem; }

body.density-dense {
  /* spacing tokens come from ui-theme :root */
}
body.density-dense .card-body { padding: var(--space-2); }
body.density-dense .btn { height: var(--btn-height, 28px); padding-inline: 10px; font-size: 12px; }
body.density-dense .form-group { margin-bottom: var(--space-1); }
body.density-dense .form-input,
body.density-dense .form-select { height: var(--control-height, 32px); font-size: 12px; border-radius: var(--radius-input); }
body.density-dense table td,
body.density-dense table th { padding: 6px 8px; }
body.density-dense .sidebar-link { padding: 4px 7px; font-size: 11.5px; }
body.density-dense .premium-topbar-inner { min-height: var(--topbar-height); }
body.density-dense .page-header { margin-bottom: var(--space-1); }
body.density-dense .section-gap { margin-bottom: var(--space-1); }
body.density-dense .card { border-radius: var(--radius-card); }
body.density-dense .premium-topbar-title { font-size: 1rem; }
body.density-dense .premium-topbar-desc { font-size: 11px; }

body.density-comfortable .form-input,
body.density-comfortable .form-select { height: var(--control-height, 40px); border-radius: var(--radius-input); }
body.density-comfortable .btn { height: var(--btn-height, 36px); border-radius: var(--radius-btn); }

.auth-split-hero-custom {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  border-radius: 24px;
  background-image: var(--auth-login-bg);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-md);
}
body.auth-has-custom-bg .auth-split-visual {
  background-image:
    linear-gradient(160deg, rgba(255,255,255,.72), rgba(255,255,255,.45)),
    var(--auth-login-bg);
  background-size: cover;
  background-position: center;
}

/* â”€â”€ Bento + command search (duplicate block â€” removed) â”€â”€ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.bento-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  min-height: 88px;
}
.bento-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
.bento-tile.is-muted { opacity: .65; }
.bento-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bento-tile-icon svg { width: 18px; height: 18px; }
.bento-tile-body { flex: 1; min-width: 0; }
.bento-tile-body h3 { font-size: 0.95rem; font-weight: 600; margin: 0; }
.bento-chevron { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.cmdk-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow: auto;
  z-index: 80;
}
.cmdk-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.cmdk-item:hover, .cmdk-item.is-active { background: var(--accent-light); }
.cmdk-item-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-right: 8px;
}
.premium-topbar-search { position: relative; }
.topbar-theme-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.topbar-theme-btn:hover { color: var(--accent); border-color: var(--accent); }
.topbar-theme-btn svg { width: 16px; height: 16px; }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   PROFESSIONAL UI â€” Bento Grid, Minimalist Nav
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Alert dismiss â”€â”€ */
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .6;
  transition: var(--transition);
  flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }
.alert-close svg { width: 14px; height: 14px; }

/* â”€â”€ Form input with icon â”€â”€ */
.form-field { position: relative; }
.form-field .form-input { padding-left: 38px; }
.form-field .form-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}
.form-field .form-input-icon svg { width: 16px; height: 16px; }
.form-field .form-input:focus ~ .form-input-icon { color: var(--accent); }

.form-field-right {
  position: relative;
}
.form-field-right .form-input { padding-right: 40px; }
.form-field-right .form-input-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  z-index: 1;
}
.form-field-right .form-input-toggle:hover { color: var(--text); }
.form-field-right .form-input-toggle svg { width: 16px; height: 16px; }

/* â”€â”€ Form helper / hint â”€â”€ */
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* â”€â”€ Form error â”€â”€ */
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.4;
}
.form-error svg { width: 12px; height: 12px; flex-shrink: 0; }

/* â”€â”€ Form grid â”€â”€ */
.form-grid {
  display: grid;
  gap: 20px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* â”€â”€ Toggle switch â”€â”€ */
.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  transition: var(--transition);
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--white);
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle-input { display: none; }
.toggle-input:checked + .toggle-switch {
  background: var(--accent);
}
.toggle-input:checked + .toggle-switch::after {
  transform: translateX(18px);
}
.toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* â”€â”€ Info callout â”€â”€ */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.callout svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.callout p { margin: 0; }
.callout p + p { margin-top: 6px; }
.callout strong { font-weight: 600; }
.callout code {
  background: rgba(0,0,0,.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.callout-info {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid rgba(59,130,246,.2);
}
.callout-info code { background: rgba(59,130,246,.1); }
.callout-warning {
  background: var(--warning-bg);
  color: #92400E;
  border: 1px solid rgba(245,158,11,.2);
}
.callout-warning code { background: rgba(245,158,11,.1); }
.callout-danger {
  background: var(--danger-bg);
  color: #991B1B;
  border: 1px solid rgba(239,68,68,.2);
}
.callout-danger code { background: rgba(239,68,68,.1); }
.callout-success {
  background: var(--success-bg);
  color: #166534;
  border: 1px solid rgba(34,197,94,.2);
}
.callout-success code { background: rgba(34,197,94,.1); }

/* â”€â”€ Bento grid (enhanced) â”€â”€ */
.bento-grid {
  display: grid;
  gap: 16px;
}
.bento-grid-2 { grid-template-columns: repeat(2, 1fr); }
.bento-grid-3 { grid-template-columns: repeat(3, 1fr); }
.bento-grid-4 { grid-template-columns: repeat(4, 1fr); }
.bento-grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

@media (max-width: 1024px) {
  .bento-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .bento-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .bento-grid-2, .bento-grid-3, .bento-grid-4 { grid-template-columns: 1fr; }
}

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-3);
  transition: var(--transition);
}
.bento-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* â”€â”€ Bento tile (nav/feature) â”€â”€ */
.bento-tile-lg {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  min-height: 140px;
}
.bento-tile-lg:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.bento-tile-lg-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bento-tile-lg-icon svg { width: 20px; height: 20px; }
.bento-tile-lg h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.bento-tile-lg p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}
.bento-tile-lg .bento-chevron {
  margin-top: auto;
  color: var(--text-muted);
}

/* â”€â”€ Badge allow/deny â”€â”€ */
.badge-allow { background: var(--success-bg); color: #16A34A; }
.badge-deny  { background: var(--danger-bg); color: var(--danger); }

/* â”€â”€ Card danger zone â”€â”€ */
.card-danger {
  border-color: rgba(239,68,68,.25);
}
.card-danger .card-header h2 {
  color: var(--danger);
}

/* â”€â”€ Page max widths â”€â”€ */
.page-narrow { max-width: 520px; }
.page-medium { max-width: 640px; }
.page-wide   { max-width: 900px; }

/* â”€â”€ Section spacing â”€â”€ */
.section-gap { margin-top: 20px; }
.section-gap-lg { margin-top: 32px; }

/* â”€â”€ Flex helpers â”€â”€ */
.flex-center { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* â”€â”€ Loading spinner â”€â”€ */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-loading {
  pointer-events: none;
  opacity: .78;
  position: relative;
}
.btn-loading .spinner { margin-right: 6px; display: inline-block; vertical-align: middle; }

.btn:not(.btn-loading):active { transform: translateY(1px); }

/* â”€â”€ Auth form fields â”€â”€ */
[x-cloak] { display: none !important; }

.auth-field { margin-bottom: 20px; }
.auth-field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.auth-field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap .auth-input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}
.auth-input-wrap .auth-input-icon svg { width: 16px; height: 16px; }
.auth-input-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
}
.auth-input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-input-wrap input::placeholder { color: var(--text-muted); }
.auth-toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: inline-flex;
}
.auth-toggle-pw:hover { color: var(--text); }
.auth-toggle-pw svg { width: 16px; height: 16px; }

.auth-cta {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.auth-cta:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}
.auth-cta:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.auth-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.auth-link:hover { text-decoration: underline; }

.auth-split-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.auth-split-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auth-split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.auth-split-row-links {
  display: flex;
  gap: 12px;
  align-items: center;
}
.auth-link-btn {
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
}

.auth-success-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--success-bg);
  color: #166534;
  border: 1px solid rgba(34,197,94,.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.auth-success-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

.auth-callout {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.auth-callout-icon {
  flex-shrink: 0;
  color: var(--accent);
}
.auth-callout-icon svg { width: 18px; height: 18px; }

.auth-method-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.auth-method-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.auth-method-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.auth-method-tab svg { width: 14px; height: 14px; }

.auth-jwt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  margin-top: 12px;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.auth-jwt-card:hover { border-color: var(--accent); background: var(--accent-light); }
.auth-jwt-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-btn);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-jwt-card-icon svg { width: 16px; height: 16px; }
.auth-jwt-card-title { font-size: 13px; font-weight: 600; }
.auth-jwt-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.auth-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  transition: var(--transition);
}
.auth-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-methods-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.auth-methods-overlay.is-open { opacity: 1; pointer-events: auto; }
.auth-methods-panel {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  padding: 24px;
}
.auth-methods-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.auth-methods-header h2 { font-size: 15px; font-weight: 600; }
.auth-methods-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
}
.auth-methods-close:hover { color: var(--text); background: var(--bg); }
.auth-methods-close svg { width: 18px; height: 18px; }

/* â”€â”€ Minimalist nav helpers â”€â”€ */
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.nav-pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.nav-pill.is-active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}
.nav-pill svg { width: 14px; height: 14px; }

/* â”€â”€ Table improvements â”€â”€ */
.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.table-empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .4; }

/* â”€â”€ Responsive helpers â”€â”€ */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* â”€â”€ Utility: text transforms â”€â”€ */
.text-uppercase-label {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* â”€â”€ Utility: monospace code blocks â”€â”€ */
.text-monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* â”€â”€ Utility: overflow scroll area â”€â”€ */
.scroll-area {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
}

/* â”€â”€ Utility: inline form row â”€â”€ */
.form-row-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* â”€â”€ Utility: health check card â”€â”€ */
.health-card {
  border-left: 3px solid var(--border);
  margin: 0;
}
.health-card .card-body {
  padding: 16px;
}

/* â”€â”€ Utility: stat color variants â”€â”€ */
.stat-ok { color: var(--success); }
.stat-warn { color: var(--warning, #b45309); }
.stat-fail { color: var(--danger); }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   DOCS â€” AppDocs layout & prose
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr 180px;
  gap: 28px;
  align-items: start;
}

@media (max-width: 1200px) {
  .docs-layout { grid-template-columns: 240px 1fr; }
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
}

/* â”€â”€ Sidebar â”€â”€ */

.docs-sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: calc(100vh - 96px);
}

.docs-sidebar-inner {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.docs-sidebar-search {
  position: relative;
  margin-bottom: 12px;
}

.docs-sidebar-search input {
  width: 100%;
  padding: 8px 32px 8px 32px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.docs-sidebar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.docs-sidebar-search input::placeholder {
  color: var(--text-muted);
}

.docs-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.docs-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--border-light);
  color: var(--text-muted);
  border: 1px solid var(--border);
  pointer-events: none;
}

.docs-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-search-clear:hover {
  color: var(--text);
}

/* â”€â”€ Nav â”€â”€ */

.docs-nav-section {
  margin-bottom: 16px;
}

.docs-nav-section:last-child {
  margin-bottom: 0;
}

.docs-nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 8px;
  margin-bottom: 2px;
}

.docs-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-secondary);
  transition: var(--transition);
  text-decoration: none;
  position: relative;
}

.docs-nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.docs-nav-item.is-active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.docs-nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.docs-nav-item i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.docs-nav-item.is-active i {
  opacity: 1;
}

/* â”€â”€ Sidebar footer â”€â”€ */

.docs-sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.docs-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}

.docs-sidebar-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.docs-sidebar-btn i {
  width: 14px;
  height: 14px;
}

/* â”€â”€ Main content â”€â”€ */

.docs-main {
  min-width: 0;
}

.docs-prose {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px 36px;
}

.docs-prose h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.docs-prose h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
  position: relative;
}

.docs-prose h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 22px 0 8px;
  color: var(--text);
  position: relative;
}

.docs-prose p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.docs-prose ul,
.docs-prose ol {
  margin: 8px 0 16px;
  padding-left: 22px;
}

.docs-prose li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.docs-prose strong {
  color: var(--text);
  font-weight: 600;
}

.docs-prose a {
  color: var(--accent);
  text-decoration: none;
}

.docs-prose a:hover {
  text-decoration: underline;
}

.docs-prose code {
  font-size: 12.5px;
  background: var(--border-light);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
}

.docs-prose pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  margin: 16px 0;
  position: relative;
}

.docs-prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

.docs-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}

.docs-prose th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.docs-prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.docs-prose tr:last-child td {
  border-bottom: none;
}

/* â”€â”€ Heading anchor link â”€â”€ */

.docs-heading-anchor {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 150ms;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  padding: 2px;
}

.docs-prose h2:hover .docs-heading-anchor,
.docs-prose h3:hover .docs-heading-anchor {
  opacity: 1;
}

.docs-heading-anchor:hover {
  color: var(--accent);
}

/* â”€â”€ Code copy button â”€â”€ */

.docs-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #94A3B8;
  cursor: pointer;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 150ms, background 150ms;
}

.docs-prose pre:hover .docs-copy-btn {
  opacity: 1;
}

.docs-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #E2E8F0;
}

.docs-copy-btn.is-copied {
  background: rgba(34, 197, 94, 0.2);
  color: #22C55E;
  border-color: rgba(34, 197, 94, 0.3);
}

/* â”€â”€ Prev / Next navigation â”€â”€ */

.docs-prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

.docs-prevnext-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
  text-decoration: none;
}

.docs-prevnext-link:hover {
  border-color: var(--accent-border-muted);
  background: var(--accent-light);
  text-decoration: none;
}

.docs-prevnext-next {
  text-align: right;
  grid-column: 2;
}

.docs-prevnext-direction {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.docs-prevnext-next .docs-prevnext-direction {
  justify-content: flex-end;
}

.docs-prevnext-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.docs-prevnext-link:hover .docs-prevnext-title {
  color: var(--accent);
}

.docs-prevnext-direction i {
  width: 13px;
  height: 13px;
}

/* â”€â”€ TOC (right rail) â”€â”€ */

.docs-toc {
  position: sticky;
  top: 76px;
}

@media (max-width: 1200px) {
  .docs-toc { display: none; }
}

.docs-toc-inner {
  padding: 4px 0;
}

.docs-toc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-left: 12px;
}

.docs-toc-item {
  display: block;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: var(--transition);
  line-height: 1.4;
}

.docs-toc-item.is-h3 {
  padding-left: 24px;
  font-size: 12px;
}

.docs-toc-item:hover {
  color: var(--text-secondary);
  border-left-color: var(--border);
}

.docs-toc-item.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

.docs-toc-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 12px;
}

/* â”€â”€ Print styles â”€â”€ */

@media print {
  .docs-sidebar,
  .docs-toc,
  .docs-prevnext,
  .docs-search-kbd,
  .docs-search-clear,
  .docs-copy-btn,
  .docs-sidebar-footer,
  .sidebar,
  .premium-topbar,
  .page-progress,
  .toast-stack,
  #toast-stack {
    display: none !important;
  }
  .docs-layout {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
  .docs-main {
    max-width: 100% !important;
  }
  .docs-prose {
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   PLAYGROUND â€” API console & webhook lab
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.playground-grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 901px) {
  .playground-grid {
    grid-template-columns: 1fr 1fr;
  }
  .playground-card--primary {
    grid-column: 1 / -1;
  }
  .playground-card--full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .playground-grid {
    grid-template-columns: 1fr;
  }
}

.playground-card .card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.playground-card .card-header i {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.playground-card--primary {
  border-top: 3px solid var(--accent);
}

.playground-card--primary .card-header i {
  width: 20px;
  height: 20px;
}

.playground-inline {
  display: flex;
  gap: 8px;
}

.playground-inline .form-input {
  flex: 1;
}

.playground-input-icon {
  position: relative;
}

.playground-input-icon i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.playground-input-icon .form-input {
  padding-left: 30px;
}

.playground-textarea {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

.playground-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.playground-btn-row .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.playground-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.playground-desc code {
  font-size: 11px;
  background: var(--border-light);
  padding: 1px 5px;
  border-radius: 4px;
}

/* â”€â”€ Output area â”€â”€ */

.playground-output {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.playground-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.playground-output-body {
  padding: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow: auto;
  margin: 0;
  color: var(--text);
  background: var(--surface);
}

.playground-output-body code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  padding: 0;
}

/* â”€â”€ Badge â”€â”€ */

.playground-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.playground-badge--success {
  background: var(--success-bg);
  color: var(--success);
}

.playground-badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.playground-badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.playground-badge--info {
  background: var(--accent-light);
  color: var(--accent);
}

.playground-badge--xs {
  font-size: 10px;
  padding: 1px 6px;
}

/* â”€â”€ Copy button â”€â”€ */

.playground-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.playground-copy-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent-border-muted);
}

.playground-copy-btn i {
  width: 13px;
  height: 13px;
}

/* â”€â”€ Curl preview â”€â”€ */

.playground-curl {
  margin-top: 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.playground-curl-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.playground-curl-header i {
  width: 13px;
  height: 13px;
}

.playground-curl-header .playground-copy-btn {
  margin-left: auto;
}

.playground-curl pre {
  padding: 10px 12px;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  color: var(--text-muted);
  background: var(--surface);
}

.playground-curl pre code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  padding: 0;
}

/* â”€â”€ Empty state (logs table) â”€â”€ */

.playground-empty {
  padding: 40px 24px;
  text-align: center;
}

.playground-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-light);
  margin-bottom: 14px;
}

.playground-empty-icon i {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.playground-empty h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.playground-empty p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

.playground-th-action {
  width: 80px;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   TOOLS / UTILITIES â€” Client-side helpers
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.util-page {
  max-width: 100%;
}

/* â”€â”€ Sticky nav â”€â”€ */

.util-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  position: sticky;
  top: 64px;
  z-index: 20;
  background: var(--bg);
  padding: 8px 0;
}

.util-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.util-nav-btn i {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.util-nav-btn.is-active,
.util-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.util-nav-btn.is-active {
  background: var(--accent-light);
}

.util-nav-btn.is-active i,
.util-nav-btn:hover i {
  opacity: 1;
}

.util-nav-link {
  text-decoration: none;
  margin-left: auto;
}

/* â”€â”€ Cards â”€â”€ */

.util-card {
  scroll-margin-top: 120px;
}

.util-card .card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.util-card .card-header i {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.util-card .card-body > .form-input,
.util-card .card-body > .btn {
  margin-bottom: 8px;
}

.util-card .card-body > .form-input:last-child,
.util-card .card-body > .btn:last-child {
  margin-bottom: 0;
}

/* â”€â”€ Output area (reuses playground pattern) â”€â”€ */

.util-output {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.util-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}

.util-output-body {
  padding: 10px 12px;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 240px;
  overflow: auto;
  margin: 0;
  color: var(--text);
  background: var(--surface);
}

.util-output-body--compact {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  margin-top: 8px;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
  color: var(--text);
}

/* â”€â”€ Range slider â”€â”€ */

.util-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.util-range-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.util-range-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: right;
}

/* â”€â”€ Button rows â”€â”€ */

.util-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.util-btn-row:last-child {
  margin-bottom: 0;
}

/* â”€â”€ JSON message â”€â”€ */

.util-json-msg {
  font-size: 12px;
  margin-top: 8px;
}

.util-json-msg--ok {
  color: var(--success);
}

.util-json-msg--err {
  color: var(--danger);
}

/* â”€â”€ Utilities hub â€” Premium Toolkit Console â”€â”€ */

/* â”€â”€ Tint palette (per-tool color system) â”€â”€ */
.utilities-card--indigo  { --tool-c: #6366F1; --tool-c-soft: rgba(99,102,241,.10); --tool-c-glow: rgba(99,102,241,.18); --tool-c-hover: rgba(99,102,241,.06); }
.utilities-card--violet  { --tool-c: #8B5CF6; --tool-c-soft: rgba(139,92,246,.10); --tool-c-glow: rgba(139,92,246,.18); --tool-c-hover: rgba(139,92,246,.06); }
.utilities-card--amber   { --tool-c: #F59E0B; --tool-c-soft: rgba(245,158,11,.10); --tool-c-glow: rgba(245,158,11,.18); --tool-c-hover: rgba(245,158,11,.06); }
.utilities-card--sky     { --tool-c: #0EA5E9; --tool-c-soft: rgba(14,165,233,.10); --tool-c-glow: rgba(14,165,233,.18); --tool-c-hover: rgba(14,165,233,.06); }
.utilities-card--rose    { --tool-c: #F43F5E; --tool-c-soft: rgba(244,63,94,.10);  --tool-c-glow: rgba(244,63,94,.18);  --tool-c-hover: rgba(244,63,94,.06); }
.utilities-card--emerald { --tool-c: #10B981; --tool-c-soft: rgba(16,185,129,.10); --tool-c-glow: rgba(16,185,129,.18); --tool-c-hover: rgba(16,185,129,.06); }
.utilities-card--orange  { --tool-c: #F97316; --tool-c-soft: rgba(249,115,22,.10); --tool-c-glow: rgba(249,115,22,.18); --tool-c-hover: rgba(249,115,22,.06); }
.utilities-card--fuchsia { --tool-c: #D946EF; --tool-c-soft: rgba(217,70,239,.10); --tool-c-glow: rgba(217,70,239,.18); --tool-c-hover: rgba(217,70,239,.06); }
.utilities-card--teal    { --tool-c: #14B8A6; --tool-c-soft: rgba(20,184,166,.10); --tool-c-glow: rgba(20,184,166,.18); --tool-c-hover: rgba(20,184,166,.06); }
.utilities-card--red     { --tool-c: #EF4444; --tool-c-soft: rgba(239,68,68,.10);  --tool-c-glow: rgba(239,68,68,.18);  --tool-c-hover: rgba(239,68,68,.06); }
.utilities-card--cyan    { --tool-c: #06B6D4; --tool-c-soft: rgba(6,182,212,.10);  --tool-c-glow: rgba(6,182,212,.18);  --tool-c-hover: rgba(6,182,212,.06); }
.utilities-card--green   { --tool-c: #22C55E; --tool-c-soft: rgba(34,197,94,.10);  --tool-c-glow: rgba(34,197,94,.18);  --tool-c-hover: rgba(34,197,94,.06); }
.utilities-card--blue    { --tool-c: #3B82F6; --tool-c-soft: rgba(59,130,246,.10); --tool-c-glow: rgba(59,130,246,.18); --tool-c-hover: rgba(59,130,246,.06); }
.utilities-card--slate   { --tool-c: #64748B; --tool-c-soft: rgba(100,116,139,.10); --tool-c-glow: rgba(100,116,139,.18); --tool-c-hover: rgba(100,116,139,.06); }

/* â”€â”€ Hub layout â”€â”€ */
.utilities-hub {
  display: grid;
  gap: 16px;
}

.utilities-hub--pro {
  gap: 14px;
}

/* â”€â”€ Controls bar â”€â”€ */
.utilities-hub-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.utilities-hub-search {
  position: relative;
}

.utilities-hub-search > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.utilities-hub-search .form-input {
  padding-left: 36px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
}

.utilities-hub-search .form-input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-light));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.utilities-hub-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.utilities-hub-sort .form-input {
  width: 116px;
  min-width: 116px;
  padding: 7px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
}

/* â”€â”€ Filter tabs â”€â”€ */
.utilities-hub-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.utilities-tab {
  border: 1px solid var(--border-light);
  border-radius: 11px;
  background: var(--surface);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: var(--transition);
}

.utilities-tab i {
  width: 14px;
  height: 14px;
}

.utilities-tab:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-light));
  background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface));
}

.utilities-tab.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: var(--shadow-accent);
}

.utilities-tab.is-active i {
  color: #fff;
}

.document-vault-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.document-vault-tab {
  border: 1px solid var(--border-light);
  border-radius: 11px;
  background: var(--surface);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.document-vault-tab:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-light));
}

.document-vault-tab.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.document-vault-rename {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 420px;
}

.document-vault-rename .form-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: 13px;
}

.document-vault-viewer-body {
  padding: 0;
  min-height: 60vh;
}

.document-vault-viewer-frame {
  width: 100%;
  height: min(78vh, 900px);
  border: 0;
  display: block;
  background: #0f172a0a;
}

.document-vault-viewer-frame--image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}

.document-vault-viewer-frame--image img {
  max-width: 100%;
  max-height: min(72vh, 860px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.document-vault-viewer-text {
  margin: 0;
  padding: 18px 20px;
  max-height: min(78vh, 900px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.document-vault-viewer-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  padding: 32px;
  color: var(--text-muted);
  text-align: center;
}

.document-vault-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  position: relative;
  transition: border-color .15s, background .15s;
}

.document-vault-dropzone.is-dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
}

.document-vault-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.document-vault-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.document-vault-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.util-tag-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.util-tag-input-row .form-input { flex: 1; min-width: 0; }

.util-unit-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.util-world-clock {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.util-world-clock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.util-world-clock-card {
  position: relative;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bg) 65%, transparent);
}

.util-world-clock-zone {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  padding-right: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.util-world-clock-time {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.util-world-clock-card .util-note-delete {
  position: absolute;
  top: 6px;
  right: 6px;
}

.sp-dropdown-item--danger {
  color: var(--danger);
}

/* â”€â”€ Card grid â”€â”€ */
.utilities-hub-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* â”€â”€ Card â”€â”€ */
.utilities-card {
  position: relative;
  border: 1px solid var(--border-light);
  background: var(--surface);
  border-radius: 16px;
  padding: 0;
  text-decoration: none;
  display: grid;
  gap: 0;
  color: inherit;
  min-height: 168px;
  overflow: hidden;
  transition: all 220ms var(--ease-spring);
  box-shadow: var(--shadow-xs);
}

.utilities-card:hover {
  border-color: color-mix(in srgb, var(--tool-c, var(--accent)) 35%, var(--border-light));
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -4px var(--tool-c-glow, var(--shadow-md)), 0 2px 8px -2px rgba(0,0,0,.04);
}

/* â”€â”€ Top accent line â”€â”€ */
.utilities-card-topline {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--tool-c, var(--accent)), color-mix(in srgb, var(--tool-c, var(--accent)) 40%, #fff));
  opacity: 0;
  transition: opacity 220ms var(--ease-spring);
}

.utilities-card:hover .utilities-card-topline {
  opacity: 1;
}

/* â”€â”€ Card head â”€â”€ */
.utilities-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
}

.utilities-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.utilities-card-icon i {
  width: 20px;
  height: 20px;
  color: #fff;
}

/* Per-tint icon tiles */
.utilities-card-icon--indigo  { background: linear-gradient(135deg, #6366F1, #818CF8); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.utilities-card-icon--violet  { background: linear-gradient(135deg, #8B5CF6, #A78BFA); box-shadow: 0 4px 12px rgba(139,92,246,.3); }
.utilities-card-icon--amber   { background: linear-gradient(135deg, #F59E0B, #FBBF24); box-shadow: 0 4px 12px rgba(245,158,11,.3); }
.utilities-card-icon--sky     { background: linear-gradient(135deg, #0EA5E9, #38BDF8); box-shadow: 0 4px 12px rgba(14,165,233,.3); }
.utilities-card-icon--rose    { background: linear-gradient(135deg, #F43F5E, #FB7185); box-shadow: 0 4px 12px rgba(244,63,94,.3); }
.utilities-card-icon--emerald { background: linear-gradient(135deg, #10B981, #34D399); box-shadow: 0 4px 12px rgba(16,185,129,.3); }
.utilities-card-icon--orange  { background: linear-gradient(135deg, #F97316, #FB923C); box-shadow: 0 4px 12px rgba(249,115,22,.3); }
.utilities-card-icon--fuchsia { background: linear-gradient(135deg, #D946EF, #E879F9); box-shadow: 0 4px 12px rgba(217,70,239,.3); }
.utilities-card-icon--teal    { background: linear-gradient(135deg, #14B8A6, #2DD4BF); box-shadow: 0 4px 12px rgba(20,184,166,.3); }
.utilities-card-icon--red     { background: linear-gradient(135deg, #EF4444, #F87171); box-shadow: 0 4px 12px rgba(239,68,68,.3); }
.utilities-card-icon--cyan    { background: linear-gradient(135deg, #06B6D4, #22D3EE); box-shadow: 0 4px 12px rgba(6,182,212,.3); }
.utilities-card-icon--green   { background: linear-gradient(135deg, #22C55E, #4ADE80); box-shadow: 0 4px 12px rgba(34,197,94,.3); }
.utilities-card-icon--blue    { background: linear-gradient(135deg, #3B82F6, #60A5FA); box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.utilities-card-icon--slate   { background: linear-gradient(135deg, #64748B, #94A3B8); box-shadow: 0 4px 12px rgba(100,116,139,.3); }

.utilities-card:hover .utilities-card-icon {
  transform: scale(1.06);
}

/* â”€â”€ Favorite button â”€â”€ */
.utilities-favorite {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}

.utilities-favorite i {
  width: 16px;
  height: 16px;
}

.utilities-favorite:hover {
  background: var(--tool-c-soft, rgba(var(--accent-rgb), .1));
  color: var(--tool-c, var(--accent));
}

.utilities-favorite.is-active {
  color: var(--tool-c, var(--accent));
}

.utilities-favorite.is-active i {
  fill: var(--tool-c, var(--accent));
}

/* â”€â”€ Card body â”€â”€ */
.utilities-card-body {
  padding: 10px 16px;
}

.utilities-card-body h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.utilities-card:hover .utilities-card-body h3 {
  color: var(--tool-c, var(--accent));
}

.utilities-card-body p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* â”€â”€ Chips â”€â”€ */
.utilities-card-chips {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.utilities-chip {
  border: 1px solid var(--border-light);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .02em;
  background: var(--surface-hover);
  line-height: 1.6;
  transition: var(--transition);
}

.utilities-chip--group {
  background: var(--tool-c-soft, rgba(var(--accent-rgb), .1));
  color: var(--tool-c, var(--accent));
  border-color: transparent;
}

.utilities-card:hover .utilities-chip--group {
  box-shadow: 0 0 0 1px var(--tool-c-soft, rgba(var(--accent-rgb), .12));
}

/* â”€â”€ Card foot â”€â”€ */
.utilities-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-light);
}

.utilities-card-foot i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: all 220ms var(--ease-spring);
  transform: translateX(0);
}

.utilities-card:hover .utilities-card-foot i {
  color: var(--tool-c, var(--accent));
  transform: translateX(3px);
}

.utilities-card-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.utilities-card-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

/* â”€â”€ Empty state â”€â”€ */
.utilities-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.utilities-empty-icon {
  margin: 0 auto 12px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--text-muted);
}

.utilities-empty-icon i {
  width: 22px;
  height: 22px;
}

.utility-detail-shell .card-body {
  padding-top: 12px;
}

.utility-detail-head {
  align-items: flex-start;
}

.utility-detail-head p {
  margin: 4px 0 0;
}

.utility-detail-head-actions {
  display: inline-flex;
  gap: 8px;
}

.utility-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
}

.utility-main-pane,
.utility-side-pane {
  display: grid;
  gap: 10px;
}

.utility-stack {
  display: grid;
  gap: 10px;
}

.utility-grid {
  display: grid;
  gap: 10px;
}

.utility-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.utility-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.utility-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.utility-side-card {
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 10px;
}

.utility-side-card h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
}

.utility-history {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: grid;
  gap: 5px;
}

.utility-link-btn {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.utility-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.utility-calendar-weekday {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.utility-calendar-cell {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  min-height: 32px;
  background: var(--surface-1);
  font-size: 12px;
  color: var(--text-secondary);
}

.utility-calendar-cell.is-empty {
  opacity: .45;
}

.utility-calendar-cell.is-today {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-light));
}

@media (max-width: 1200px) {
  .utilities-hub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .utilities-hub-controls {
    grid-template-columns: 1fr;
  }

  .utilities-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .utility-detail-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .utilities-hub-grid {
    grid-template-columns: 1fr;
  }

  .utility-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   OPERATIONS / RATE LIMITS â€” Throttle profiles
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.rl-page {
  max-width: 100%;
}

.rl-page .card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rl-page .card-header i {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.rl-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.rl-desc strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.rl-desc code {
  font-size: 12px;
  background: var(--border-light);
  padding: 1px 5px;
  border-radius: 4px;
}

.rl-cell-name {
  font-weight: 600;
  font-size: 13px;
}

.rl-th-actions {
  width: 340px;
}

.rl-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rl-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rl-input-sm {
  width: 72px;
  font-size: 12px;
  padding: 5px 8px;
}

.rl-check-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.rl-check-label input[type="checkbox"] {
  accent-color: var(--accent);
}

.rl-check-label--add {
  padding-top: 6px;
}

/* â”€â”€ Add profile form â”€â”€ */

.rl-add-card {
  margin-top: 16px;
}

.rl-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.rl-add-form .form-group {
  margin-bottom: 0;
}

.rl-add-form .btn {
  align-self: end;
  margin-bottom: 1px;
}

/* â”€â”€ Empty state â”€â”€ */

.rl-empty {
  text-align: center;
  padding: 32px 16px;
}

.rl-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.rl-empty-inner i {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 4px;
}

.rl-empty-inner h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rl-empty-inner p {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 320px;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   ADMIN SCRATCHPAD â€” Upgraded Editor
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.sp-container {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  min-height: 480px;
}

/* â”€â”€ Toolbar â”€â”€ */
.sp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 6px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.sp-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sp-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.sp-toolbar-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sp-toolbar-btn.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.sp-toolbar-btn svg {
  width: 15px;
  height: 15px;
}

.sp-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  margin: 0 4px;
}

/* â”€â”€ Dropdown â”€â”€ */
.sp-toolbar-dropdown {
  position: relative;
}

.sp-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 4px;
}

.sp-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.sp-dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sp-dropdown-item svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
}

/* â”€â”€ File upload â”€â”€ */
.sp-file-label {
  cursor: pointer;
}

.sp-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
}

/* â”€â”€ Split Pane â”€â”€ */
.sp-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  flex: 1;
}

.sp-split--single {
  grid-template-columns: 1fr;
}

.sp-editor-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border-light);
}

.sp-split--single .sp-editor-wrap {
  border-right: none;
}

.sp-editor {
  width: 100%;
  flex: 1;
  min-height: 400px;
  padding: 16px;
  border: none;
  outline: none;
  resize: none;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
  tab-size: 2;
  -moz-tab-size: 2;
}

.sp-editor::placeholder {
  color: var(--text-muted);
}

.sp-preview-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
}

.sp-preview-label {
  padding: 8px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.sp-preview {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

/* â”€â”€ Markdown Rendered Styles â”€â”€ */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 16px 0 8px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.markdown-body h1 { font-size: 1.6em; }
.markdown-body h2 { font-size: 1.35em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1em; }

.markdown-body p {
  margin: 0 0 12px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 12px;
  padding-left: 24px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body li input[type="checkbox"] {
  margin-right: 6px;
}

.markdown-body blockquote {
  margin: 0 0 12px;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}

.markdown-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-hover);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  color: var(--accent);
}

.markdown-body pre {
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface-hover);
  overflow-x: auto;
  border: 1px solid var(--border-light);
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.markdown-body table {
  width: 100%;
  margin: 0 0 12px;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  text-align: left;
  font-size: 13px;
}

.markdown-body th {
  background: var(--surface-hover);
  font-weight: 600;
}

.markdown-body hr {
  margin: 16px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.markdown-body img {
  max-width: 100%;
  border-radius: 8px;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
}

.markdown-body a:hover {
  color: var(--accent-hover);
}

.markdown-body strong {
  font-weight: 700;
}

.markdown-body del {
  color: var(--text-muted);
}

/* â”€â”€ Pad Bar (multi-pad switcher) â”€â”€ */
/* â”€â”€ Editor bar (title + actions) â”€â”€ */
.sp-editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}

.sp-pad-title-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.sp-pad-title-input:hover {
  border-color: var(--border-light);
  background: var(--surface-hover);
}

.sp-pad-title-input:focus {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-light));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}

.sp-pad-title-input::placeholder {
  color: var(--text-muted);
  font-weight: 600;
}

.sp-pad-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* â”€â”€ Saved Pads side pane â”€â”€ */
.sp-saved-card {
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-saved-card h3 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sp-saved-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-radius: 99px;
  padding: 1px 7px;
  line-height: 1.5;
}

.sp-saved-search {
  position: relative;
  display: flex;
  align-items: center;
}

.sp-saved-search i {
  position: absolute;
  left: 8px;
  pointer-events: none;
}

.sp-saved-search-input {
  width: 100%;
  padding: 6px 8px 6px 26px;
  font-size: 12px;
}

/* â”€â”€ Saved pads: compact items with hover preview â”€â”€ */
.sp-saved-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sp-saved-item-wrap {
  position: relative;
  border-radius: 8px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}

.sp-saved-item-wrap:hover {
  border-color: var(--border-light);
  border-left-color: color-mix(in srgb, var(--accent) 50%, var(--border-light));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface-hover));
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .03);
  transform: translateX(2px);
}

.sp-saved-item-wrap.is-active {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border-light));
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

/* Compact row */
.sp-saved-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sp-saved-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-light);
  flex-shrink: 0;
  transition: all .2s ease;
}

.sp-saved-item-wrap:hover .sp-saved-dot {
  background: color-mix(in srgb, var(--accent) 60%, var(--border-light));
  transform: scale(1.15);
}

.sp-saved-dot.dot-active {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.sp-saved-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  transition: color .15s ease;
}

.sp-saved-item-wrap:hover .sp-saved-item-title {
  color: var(--text-primary);
}

.sp-saved-item-wrap.is-active .sp-saved-item-title {
  color: var(--accent);
  font-weight: 600;
}

.sp-saved-item-badge {
  font-size: 8px;
  font-weight: 700;
  color: var(--warning);
  background: var(--warning-bg);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.4;
}

/* Delete icon on compact row */
.sp-saved-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .15s ease, transform .15s ease, background .15s ease, color .15s ease;
}

.sp-saved-item-wrap:hover .sp-saved-delete {
  opacity: 1;
  transform: scale(1);
}

.sp-saved-delete:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

/* Hover preview panel */
.sp-saved-preview {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .25s cubic-bezier(.4, 0, .2, 1), opacity .2s ease;
  pointer-events: none;
}

.sp-saved-preview > * {
  overflow: hidden;
}

.sp-saved-item-wrap:hover .sp-saved-preview {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}

.sp-saved-preview-inner {
  padding: 0 8px 8px 21px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}

.sp-saved-preview-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 6px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-saved-preview-body {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 5px;
}

.sp-saved-preview-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: .7;
}

.sp-saved-preview-meta .sp-footer-dot {
  width: 2px;
  height: 2px;
}

.sp-saved-preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 5px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .15s ease .05s, transform .15s ease .05s;
}

.sp-saved-item-wrap:hover .sp-saved-preview-actions {
  opacity: 1;
  transform: translateY(0);
}

.sp-saved-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.sp-saved-new {
  width: 100%;
  margin-top: 4px;
}

/* â”€â”€ Footer â”€â”€ */
.sp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.sp-footer-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sp-footer-center {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sp-footer-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.5;
}

.sp-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* â”€â”€ Status indicator â”€â”€ */
.sp-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 2px 0;
}

.sp-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.sp-status--saving .sp-status-dot {
  background: var(--warning);
  animation: sp-pulse 1s ease-in-out infinite;
}

.sp-status--error .sp-status-dot {
  background: var(--danger);
}

.sp-status--dirty .sp-status-dot {
  background: var(--warning);
}

.sp-footer-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.sp-footer-stat svg {
  width: 11px;
  height: 11px;
}

@keyframes sp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* â”€â”€ Dark Mode (scratchpad only) â”€â”€ */
.sp-dark {
  --sp-bg: #1a1b26;
  --sp-surface: #1e1f2e;
  --sp-surface-hover: #252636;
  --sp-border: #2f3044;
  --sp-text: #c0caf5;
  --sp-text-muted: #565f89;
  --sp-accent: #ff9e64;
  --sp-accent-glow: rgba(255, 158, 100, 0.12);
  --sp-code-bg: #252636;
  --sp-blockquote-bg: rgba(255, 158, 100, 0.06);
  --sp-table-border: #2f3044;
}

.sp-dark .sp-toolbar {
  background: var(--sp-surface);
  border-bottom-color: var(--sp-border);
}

.sp-dark .sp-toolbar-btn {
  color: var(--sp-text-muted);
}

.sp-dark .sp-toolbar-btn:hover {
  background: var(--sp-surface-hover);
  color: var(--sp-text);
}

.sp-dark .sp-toolbar-btn.is-active {
  background: var(--sp-accent-glow);
  color: var(--sp-accent);
}

.sp-dark .sp-toolbar-sep {
  background: var(--sp-border);
}

.sp-dark .sp-editor-wrap {
  border-right-color: var(--sp-border);
}

.sp-dark .sp-editor {
  background: var(--sp-bg);
  color: var(--sp-text);
}

.sp-dark .sp-editor::placeholder {
  color: var(--sp-text-muted);
}

.sp-dark .sp-preview-wrap {
  background: var(--sp-surface);
}

.sp-dark .sp-preview-label {
  color: var(--sp-text-muted);
  border-bottom-color: var(--sp-border);
}

.sp-dark .sp-preview {
  background: var(--sp-surface);
  color: var(--sp-text);
}

.sp-dark .markdown-body h1,
.sp-dark .markdown-body h2,
.sp-dark .markdown-body h3,
.sp-dark .markdown-body h4,
.sp-dark .markdown-body h5,
.sp-dark .markdown-body h6 {
  color: var(--sp-text);
}

.sp-dark .markdown-body blockquote {
  background: var(--sp-blockquote-bg);
  border-left-color: var(--sp-accent);
  color: var(--sp-text);
}

.sp-dark .markdown-body code {
  background: var(--sp-code-bg);
  color: var(--sp-accent);
}

.sp-dark .markdown-body pre {
  background: var(--sp-bg);
  border-color: var(--sp-border);
}

.sp-dark .markdown-body pre code {
  color: var(--sp-text);
}

.sp-dark .markdown-body table {
  border-color: var(--sp-table-border);
}

.sp-dark .markdown-body th,
.sp-dark .markdown-body td {
  border-color: var(--sp-border);
  color: var(--sp-text);
}

.sp-dark .markdown-body th {
  background: var(--sp-bg);
}

.sp-dark .markdown-body hr {
  border-color: var(--sp-border);
}

.sp-dark .markdown-body a {
  color: var(--sp-accent);
}

.sp-dark .markdown-body del {
  color: var(--sp-text-muted);
}

.sp-dark .sp-footer {
  background: var(--sp-surface);
  border-top-color: var(--sp-border);
}

.sp-dark .sp-footer-center {
  color: var(--sp-text-muted);
}

.sp-dark .sp-footer-dot {
  background: var(--sp-text-muted);
}

.sp-dark .sp-dropdown {
  background: var(--sp-surface);
  border-color: var(--sp-border);
}

.sp-dark .sp-dropdown-item {
  color: var(--sp-text-muted);
}

.sp-dark .sp-dropdown-item:hover {
  background: var(--sp-surface-hover);
  color: var(--sp-text);
}

.sp-dark .sp-editor-bar {
  background: var(--sp-surface);
  border-bottom-color: var(--sp-border);
}

.sp-dark .sp-pad-title-input {
  color: var(--sp-text);
}

.sp-dark .sp-pad-title-input:hover {
  background: var(--sp-surface-hover);
}

.sp-dark .sp-pad-title-input:focus {
  background: var(--sp-bg);
}

.sp-dark .sp-pad-title-input::placeholder {
  color: var(--sp-text-muted);
}

.sp-dark .sp-saved-card {
  background: var(--sp-surface);
  border-color: var(--sp-border);
}

.sp-dark .sp-saved-count {
  background: var(--sp-surface-hover);
  color: var(--sp-text-muted);
}

.sp-dark .sp-saved-item-wrap:hover {
  border-color: var(--sp-border);
  border-left-color: var(--sp-accent);
  background: color-mix(in srgb, var(--sp-accent) 5%, var(--sp-surface-hover));
}

.sp-dark .sp-saved-item-wrap.is-active {
  border-color: color-mix(in srgb, var(--sp-accent) 40%, var(--sp-border));
  border-left-color: var(--sp-accent);
  background: var(--sp-accent-glow);
}

.sp-dark .sp-saved-item-title {
  color: var(--sp-text);
}

.sp-dark .sp-saved-item-wrap:hover .sp-saved-item-title {
  color: var(--sp-text);
}

.sp-dark .sp-saved-item-wrap.is-active .sp-saved-item-title {
  color: var(--sp-accent);
}

.sp-dark .sp-saved-preview-inner {
  border-top-color: var(--sp-border);
}

.sp-dark .sp-saved-preview-title {
  color: var(--sp-text);
}

.sp-dark .sp-saved-preview-body,
.sp-dark .sp-saved-preview-meta {
  color: var(--sp-text-muted);
}

.sp-dark .sp-saved-delete {
  color: var(--sp-text-muted);
}

.sp-dark .sp-saved-delete:hover {
  background: color-mix(in srgb, #ef4444 15%, transparent);
  color: #ef4444;
}

.sp-dark .sp-saved-empty {
  color: var(--sp-text-muted);
}

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 900px) {
  .sp-split {
    grid-template-columns: 1fr;
  }

  .sp-split--single {
    grid-template-columns: 1fr;
  }

  .sp-editor-wrap {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }

  .sp-dark .sp-editor-wrap {
    border-bottom-color: var(--sp-border);
  }

  .sp-editor {
    min-height: 260px;
  }

  .sp-preview-wrap {
    min-height: 200px;
  }

  .sp-footer-center {
    display: none;
  }
}

@media (max-width: 640px) {
  .sp-toolbar {
    padding: 4px 6px;
  }

  .sp-toolbar-btn {
    width: 28px;
    height: 28px;
  }

  .sp-toolbar-btn svg {
    width: 13px;
    height: 13px;
  }

  .sp-editor {
    padding: 12px;
    font-size: 12px;
  }

  .sp-preview {
    padding: 12px;
    font-size: 13px;
  }

  .sp-footer {
    flex-wrap: wrap;
    gap: 6px;
  }

  .sp-footer-left {
    flex: 1;
  }

  .sp-editor-bar {
    padding: 6px 8px;
  }

  .sp-pad-title-input {
    font-size: 13px;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   UTILITIES PRO â€” All Tool Upgrades
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Shared â”€â”€ */
.util-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.util-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.util-copy-btn:hover { background: var(--border); color: var(--text); }

/* â”€â”€ Search Bar â”€â”€ */
.util-search-bar { position: relative; }
.util-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.util-search-input { padding-left: 34px !important; }

/* â”€â”€ Notes List â”€â”€ */
.util-note-meta { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.util-note-count { font-size: 11px; color: var(--text-muted); }
.util-note-list { display: grid; gap: 4px; max-height: 280px; overflow-y: auto; }
.util-note-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
  transition: var(--transition);
}
.util-note-item:hover { border-color: var(--accent-border-muted); }
.util-note-item.is-pinned { border-left: 3px solid var(--accent); }
.util-note-item.is-active { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: var(--accent); }
.util-note-item-body {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}
.util-note-pin { color: var(--accent); flex-shrink: 0; }
.util-note-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.util-note-date { font-size: 10px; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }
.util-note-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.util-note-delete:hover { background: var(--danger-bg); color: var(--danger); }

.util-note-preview-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.util-note-preview-body {
  min-height: 160px;
  white-space: pre-wrap;
  word-break: break-word;
}

.utility-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.utility-history-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.utility-history-item:hover {
  border-color: var(--accent-border-muted);
  color: var(--text);
}

/* â”€â”€ Calculator â”€â”€ */
.util-calc { display: grid; gap: 10px; }
.util-calc:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 3px; border-radius: 12px; }
.util-calc-display {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-2, var(--surface-hover));
  text-align: right;
  min-height: 56px;
  display: grid;
  gap: 4px;
}
.util-calc-expr { font-size: 13px; color: var(--text-muted); word-break: break-all; min-height: 18px; }
.util-calc-hint { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.util-calc-result { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.util-calc-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.util-calc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.util-calc-btn:hover { background: var(--surface-hover); border-color: var(--border); }
.util-calc-num { font-weight: 600; }
.util-calc-op { color: var(--accent); font-weight: 600; }
.util-calc-fn { font-size: 12px; color: var(--text-muted); }
.util-calc-eq { background: var(--accent); color: var(--white, #fff); border-color: var(--accent); font-weight: 700; }
.util-calc-eq:hover { background: var(--accent-hover); }
.util-calc-wide { grid-column: span 2; }
.util-calc-mem { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent); }
.util-calc-mem-label { font-weight: 700; }
.util-calc-bases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.util-calc-base-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-hover);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  word-break: break-all;
  text-align: center;
}
.util-calc-base-item small { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* â”€â”€ JSON Formatter â”€â”€ */
.util-json-header { display: flex; align-items: center; gap: 8px; }
.util-json-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.util-json-badge.is-valid { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.util-json-badge.is-invalid { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.util-json-size { font-size: 11px; color: var(--text-muted); }
.util-input-valid { border-color: var(--success) !important; }
.util-input-invalid { border-color: var(--danger) !important; }
.util-json-compare {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-hover);
  font-size: 12px;
  color: var(--text-muted);
}
.util-json-size-arrow { color: var(--accent); }
.util-json-size-diff.is-smaller { color: var(--success); }
.util-json-size-diff.is-bigger { color: var(--warning); }

/* â”€â”€ JWT Parts â”€â”€ */
.util-jwt-input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.util-jwt-parts { display: grid; gap: 8px; }
.util-jwt-part { border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; }
.util-jwt-part-label {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border-light);
}
.util-jwt-part-body {
  margin: 0;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  max-height: 160px;
  overflow: auto;
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-all;
}
.util-jwt-sig { color: var(--text-muted); font-size: 11px; }
.util-jwt-expiry { margin-top: 6px; }
.util-jwt-expiry-row { display: flex; align-items: center; gap: 8px; }
.util-jwt-expiry-label { font-size: 12px; color: var(--text-muted); }
.util-jwt-expiry-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.util-jwt-expiry-badge.is-valid { background: var(--success-bg); color: var(--success); }
.util-jwt-expiry-badge.is-expired { background: var(--danger-bg); color: var(--danger); }

/* â”€â”€ JWT Generator â”€â”€ */
.util-jwt-custom-claims { border: 1px solid var(--border-light); border-radius: 10px; padding: 8px; }
.util-jwt-custom-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.util-jwt-claim-row { gap: 4px !important; }
.util-jwt-claim-val-row { display: grid; grid-template-columns: 1fr auto; gap: 4px; }
.util-jwt-preview { border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; }
.util-jwt-preview-label { padding: 5px 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--surface-hover); }
.util-jwt-preview-body { margin: 0; padding: 10px; font-size: 11px; max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-all; background: var(--surface); }

/* â”€â”€ Permission Results â”€â”€ */
.util-perm-results { border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; }
.util-perm-results-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; font-size: 12px; font-weight: 600; background: var(--surface-hover); }
.util-perm-table-wrap { overflow-x: auto; }
.util-perm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.util-perm-table th { padding: 6px 10px; text-align: left; font-weight: 600; color: var(--text-muted); background: var(--surface-hover); border-bottom: 1px solid var(--border-light); }
.util-perm-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); }
.util-perm-code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; }
.util-perm-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.util-perm-badge.is-granted { background: var(--success-bg); color: var(--success); }
.util-perm-badge.is-denied { background: var(--danger-bg); color: var(--danger); }
.util-perm-detail { font-size: 11px; color: var(--text-muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* â”€â”€ Generator â”€â”€ */
.util-gen-opts { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 0; }
.util-range-val { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.util-gen-result { border: 1px solid var(--border-light); border-radius: 10px; overflow: hidden; }
.util-gen-output {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--surface-hover);
}
.util-gen-secret { flex: 1; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; font-weight: 600; word-break: break-all; color: var(--text); }
.util-gen-entropy { padding: 5px 10px; border-top: 1px solid var(--border-light); }
.util-entropy-badge { font-size: 11px; font-weight: 600; color: var(--accent); }
.util-gen-batch { display: grid; gap: 4px; }
.util-gen-batch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
}
.util-gen-batch-row code { flex: 1; word-break: break-all; }

/* â”€â”€ Password Strength â”€â”€ */
.util-pwd-field { position: relative; }
.util-pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.util-pwd-meter { display: grid; gap: 4px; }
.util-pwd-meter-bar { height: 6px; border-radius: 3px; background: var(--border-light); overflow: hidden; }
.util-pwd-meter-fill { height: 100%; border-radius: 3px; transition: width 300ms ease, background 300ms ease; }
.util-pwd-meter-fill.is-weak { background: var(--danger); }
.util-pwd-meter-fill.is-fair { background: var(--warning); }
.util-pwd-meter-fill.is-good { background: #22c55e; }
.util-pwd-meter-fill.is-strong { background: var(--success); }
.util-pwd-meter-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); }
.util-pwd-meter-labels span.is-active { color: var(--text); font-weight: 600; }
.util-pwd-details { display: grid; gap: 8px; }
.util-pwd-score-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.util-pwd-score-label { color: var(--text-muted); }
.util-pwd-score-val { font-weight: 700; }
.util-pwd-score-val.is-weak { color: var(--danger); }
.util-pwd-score-val.is-fair { color: var(--warning); }
.util-pwd-score-val.is-good { color: #22c55e; }
.util-pwd-score-val.is-strong { color: var(--success); }
.util-pwd-crack { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.util-pwd-checks { display: grid; gap: 3px; }
.util-pwd-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.util-pwd-check.is-pass { color: var(--success); }
.util-pwd-check.is-fail { color: var(--text-muted); }
.util-pwd-advice { font-size: 12px; color: var(--text-muted); }
.util-pwd-advice strong { color: var(--text-secondary); display: block; margin-bottom: 2px; }
.util-pwd-tip { display: inline-block; margin-right: 6px; }

/* â”€â”€ Timezone â”€â”€ */
.util-tz-input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.util-tz-offsets { display: grid; gap: 4px; }
.util-tz-offset-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; background: var(--surface-hover); font-size: 12px; }
.util-tz-offset-label { font-weight: 600; color: var(--text-secondary); min-width: 120px; }
.util-tz-offset-val { font-family: 'SF Mono', 'Fira Code', monospace; color: var(--text-muted); }
.util-tz-relative { font-size: 12px; color: var(--accent); font-weight: 500; padding: 4px 0; }

/* â”€â”€ Timestamp â”€â”€ */
.util-ts-input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.util-ts-results { display: grid; gap: 4px; }
.util-ts-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface);
}
.util-ts-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); min-width: 80px; flex-shrink: 0; }
.util-ts-value { flex: 1; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; word-break: break-all; }
.util-ts-countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

/* â”€â”€ Calendar â”€â”€ */
.util-cal-nav { display: flex; align-items: center; gap: 8px; }
.util-cal-note-area { display: grid; gap: 6px; }
.util-cal-note-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.utility-calendar-cell.has-note::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin: 2px auto 0;
}
.utility-calendar-cell.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* â”€â”€ Audit Explorer â”€â”€ */
.util-audit-templates { display: grid; gap: 6px; }
.util-audit-template-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.util-audit-date-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; align-items: center; }
.util-audit-date-sep { font-size: 12px; color: var(--text-muted); text-align: center; }



