@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

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

:root {
  --bg: #09090b;
  --bg-card: #111113;
  --bg-elevated: #18181b;
  --border: #27272a;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --green: #22c55e;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 280px;
  --header-h: 64px;
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --font: var(--font-sans);
}

[data-theme="light"] {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-elevated: #f4f4f5;
  --border: #e4e4e7;
  --text: #09090b;
  --text-muted: #52525b;
  --text-dim: #71717a;
  --accent-glow: rgba(59, 130, 246, 0.08);
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: -0.025em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  transition: all .2s;
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { background: var(--bg-elevated); }
.btn-ghost { color: var(--text-muted); padding: 8px 14px; }
.btn-ghost:hover { color: var(--text); }

/* ── Public Nav ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
}
[data-theme="light"] .nav { background: rgba(250, 250, 250, 0.85); }

.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.logo-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  display: block;
  background: transparent;
}
.logo-img-mask {
  width: 44px;
  height: 44px;
  border-radius: 0;
  object-fit: cover;
  object-position: center 28%;
  background: transparent;
  flex-shrink: 0;
}

/* Fidelio365 brand — mask | FIDELIO | gold 365 */
.brand-mask {
  flex-shrink: 0;
  display: block;
  object-fit: cover;
  object-position: center 28%;
  background: transparent;
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  min-width: 0;
  white-space: nowrap;
}
.brand-wordmark {
  display: block;
  width: auto;
  height: 36px;
  max-width: 220px;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  filter: brightness(1.45) contrast(1.25);
}
[data-theme="light"] .brand-wordmark,
[data-theme="light"] .brand-lockup-sidebar .brand-wordmark,
[data-theme="light"] .brand-lockup-footer .brand-wordmark {
  filter: brightness(0) contrast(1.1);
}
.brand-mask-light { display: none; }
[data-theme="light"] .brand-mask-dark { display: none; }
[data-theme="light"] .brand-mask-light { display: block; }
.brand-365 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
  text-shadow: none;
}
.logo-dot {
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 12px;
  flex-shrink: 0;
}

.brand-mask-nav,
.nav .logo-img-mask,
.nav .brand-mask {
  width: 44px;
  height: 44px;
}
.brand-lockup-nav .brand-wordmark {
  height: 38px;
  max-width: 210px;
}
.brand-lockup-nav .brand-365 { font-size: 17px; }

.brand-mask-sidebar,
.sidebar-header .logo-img-mask,
.sidebar-header .brand-mask,
.sidebar-header .logo-img {
  width: 40px !important;
  height: 40px !important;
  flex-shrink: 0;
  transform: none !important;
}
.brand-lockup-sidebar {
  gap: 6px;
  flex-shrink: 0;
}
.brand-lockup-sidebar .brand-wordmark {
  height: 28px !important;
  max-width: 150px !important;
  width: auto;
  flex-shrink: 0;
  filter: brightness(1.5) contrast(1.3);
}
.brand-lockup-sidebar .brand-365 {
  font-size: 15px !important;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-mask-footer,
.footer-brand .logo-img-mask,
.footer-brand .brand-mask {
  width: 40px;
  height: 40px;
}
.brand-lockup-footer {
  gap: 6px;
}
.brand-lockup-footer .brand-wordmark {
  height: 30px;
  max-width: 170px;
  filter: brightness(1.5) contrast(1.3);
}
.brand-lockup-footer .brand-365 { font-size: 15px; }

.brand-mask-auth,
.auth-brand .brand-mask,
.auth-logo-img {
  width: 88px;
  height: 88px;
}
.brand-lockup-auth { gap: 12px; }
.brand-lockup-auth .brand-wordmark,
.auth-brand-wordmark {
  height: 76px;
  max-width: 420px;
  filter: brightness(1.5) contrast(1.3);
}
[data-theme="light"] .brand-lockup-auth .brand-wordmark,
[data-theme="light"] .auth-brand-wordmark {
  filter: brightness(0) contrast(1.1);
}
.brand-lockup-auth .brand-365,
.auth-brand .brand-365 {
  font-size: 32px;
  color: var(--accent);
}

.cta-icon .logo-img {
  width: 80px;
  height: 80px;
}

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 8px 14px; border-radius: 6px;
  font-size: 14px; color: var(--text-muted);
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .2s;
}
.theme-toggle:hover { background: var(--bg-elevated); color: var(--text); }

/* ── Hero ── */
.hero {
  padding: 140px 24px 80px; text-align: center;
  position: relative; overflow: hidden;
}
.hero-glow {
  position: absolute; top: -200px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-card);
  font-size: 13px; color: var(--text-muted); margin-bottom: 28px;
}
.hero-badge svg { color: var(--accent); flex-shrink: 0; }
.hero h1 {
  font-size: clamp(36px, 6vw, 64px); font-weight: 700;
  line-height: 1.1; letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent), #818cf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 18px; color: var(--text-muted);
  max-width: 560px; margin: 0 auto 36px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; flex-direction: column; align-items: center; }
@media (min-width: 640px) {
  .hero-actions { flex-direction: row; }
}
.hero-tags {
  display: flex; gap: 24px; justify-content: center;
  margin-top: 48px; flex-wrap: wrap;
}
.hero-tags span {
  font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
}
.hero-tags span::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
}

/* ── Sections ── */
section { padding: 80px 24px; }
.section-label {
  font-size: 13px; font-weight: 500; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px;
}
.section-title {
  font-size: clamp(28px, 4vw, 40px); font-weight: 700;
  letter-spacing: -0.02em; margin-bottom: 12px;
}
.section-desc {
  font-size: 16px; color: var(--text-muted);
  max-width: 520px; margin-bottom: 48px;
}

/* ── Feature Grid ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.feature-card {
  padding: 28px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
  transition: border-color .2s;
}
.feature-card:hover { border-color: #3f3f46; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-glow); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

/* ── Steps ── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.step-card {
  padding: 28px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
}
.step-num {
  font-size: 13px; font-weight: 600; color: var(--accent);
  margin-bottom: 12px;
}
.step-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.step-card p { font-size: 14px; color: var(--text-muted); }

/* ── Stats ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px; max-width: 640px; margin: 0 auto;
}
.stat-card {
  text-align: center; padding: 32px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
}
.stat-card .num {
  font-size: 36px; font-weight: 700; color: var(--accent);
  margin-bottom: 4px;
}
.stat-card .label { font-size: 14px; color: var(--text-muted); }

/* ── CTA ── */
.cta {
  text-align: center; padding: 80px 24px;
  border-top: 1px solid var(--border);
}
.cta-icon { margin-bottom: 16px; color: var(--accent); display: flex; justify-content: center; }
.cta h2 { font-size: clamp(28px, 4vw, 36px); font-weight: 700; margin-bottom: 12px; }
.cta p { color: var(--text-muted); margin-bottom: 28px; font-size: 16px; }
.cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 24px 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px; max-width: 1120px; margin: 0 auto 40px;
}
.footer-brand p { font-size: 14px; color: var(--text-muted); margin-top: 12px; max-width: 280px; }
.footer-col h4 { font-size: 13px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.footer-col li { margin-bottom: 10px; }
.footer-col a { font-size: 14px; color: var(--text-muted); transition: color .2s; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  max-width: 1120px; margin: 0 auto;
  padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-dim);
}
.status-dot {
  display: flex; align-items: center; gap: 8px;
}
.status-dot::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
}

/* ── Page Header (inner pages) ── */
.page-header {
  padding: 120px 24px 48px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 36px; font-weight: 700; margin-bottom: 8px; }
.page-header p { color: var(--text-muted); font-size: 16px; }

/* ── Accordion ── */
.accordion { max-width: 720px; margin: 0 auto; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-trigger {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 0; font-size: 15px; font-weight: 500; text-align: left;
}
.accordion-trigger svg { transition: transform .2s; flex-shrink: 0; color: var(--text-dim); pointer-events: none; }
.accordion-item.open .accordion-trigger svg { transform: rotate(180deg); }
.accordion-content {
  max-height: 0; overflow: hidden; transition: max-height .3s ease;
}
.accordion-item.open > .accordion-content {
  max-height: 80vh;
}
.accordion-content-inner {
  padding: 0 0 20px; font-size: 14px; color: var(--text-muted); line-height: 1.6;
}

/* ── Prose (legal pages) ── */
.prose { max-width: 720px; margin: 0 auto; padding: 48px 24px 80px; }
.prose h2 { font-size: 20px; font-weight: 600; margin: 32px 0 12px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 15px; color: var(--text-muted); line-height: 1.7; }
.prose ul { padding-left: 20px; list-style: disc; margin: 8px 0; }

/* ── Dashboard Layout ── */
.dashboard-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); border-right: 1px solid var(--border);
  background: var(--bg); display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  transition: transform .3s;
}
.sidebar-header {
  padding: 16px 16px 14px;
  flex-shrink: 0;
}
.sidebar-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  height: auto;
}
.sidebar-admin .logo-dot {
  color: #f59e0b;
  font-weight: 600;
}
.sidebar-body {
  flex: 1; min-height: 0; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-body::-webkit-scrollbar { width: 6px; }
.sidebar-body::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
}
.sidebar-section { padding: 4px 10px 14px; }
.sidebar-section-main { padding-top: 8px; }
.sidebar-section-user,
.sidebar-section-help {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 10px 8px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  width: 100%;
}
.sidebar-link:hover { background: var(--bg-elevated); color: var(--text); }
.sidebar-link.active,
.sidebar-link.is-active {
  background: var(--bg-elevated);
  color: var(--text);
}
.sidebar-menu-group.open .sidebar-menu-trigger:not(.is-active) {
  color: var(--text);
}
.sidebar-label-text { flex: 1; min-width: 0; }

.sidebar-icon-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  flex-shrink: 0; color: var(--text-dim);
  transition: background .15s, color .15s;
}
.sidebar-icon { width: 16px; height: 16px; }
.sidebar-link:hover .sidebar-icon-wrap { color: var(--text); }
.sidebar-link.active .sidebar-icon-wrap,
.sidebar-link.is-active .sidebar-icon-wrap {
  background: transparent;
  color: var(--text);
}

.sidebar-chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  opacity: 0.45; transition: transform .2s, opacity .15s;
}
.sidebar-link:hover .sidebar-chevron { opacity: 0.7; }
.sidebar-menu-group.open .sidebar-chevron { transform: rotate(180deg); }

.sidebar-menu {
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-menu > li { list-style: none; }
.sidebar-menu-main { gap: 4px; }

.sidebar-menu-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-menu-trigger {
  width: 100%; text-align: left; border: none; background: none;
  font: inherit; cursor: pointer;
}

/* Collapsible sidebar groups (Profile, Tools, …) */
.sidebar-menu-group:not(.open) .sidebar-submenu {
  display: none;
}
.sidebar-menu-group--tree .sidebar-menu-trigger,
.sidebar-menu-group--profile .sidebar-menu-trigger {
  margin-bottom: 0;
  color: var(--text);
  font-weight: 500;
  background: transparent;
}
.sidebar-menu-group--tree .sidebar-menu-trigger:hover,
.sidebar-menu-group--profile .sidebar-menu-trigger:hover {
  background: var(--bg-elevated);
}
.sidebar-menu-group--tree .sidebar-menu-trigger .sidebar-icon-wrap,
.sidebar-menu-group--profile .sidebar-menu-trigger .sidebar-icon-wrap {
  color: var(--text-muted);
}
.sidebar-menu-group--tree .sidebar-menu-trigger.is-active,
.sidebar-menu-group--profile .sidebar-menu-trigger.is-active {
  background: var(--bg-elevated);
  color: var(--text);
}
.sidebar-menu-group--tree .sidebar-submenu,
.sidebar-menu-group--profile .sidebar-submenu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px;
  padding: 0 0 2px 14px;
  margin-left: 21px;
  border-left: 1px solid var(--border);
  list-style: none;
}
.sidebar-menu-group--tree .sidebar-submenu > li,
.sidebar-menu-group--profile .sidebar-submenu > li {
  list-style: none;
}
.sidebar-menu-group--tree .sidebar-sublink,
.sidebar-menu-group--profile .sidebar-sublink {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.sidebar-menu-group--tree .sidebar-sublink:hover,
.sidebar-menu-group--profile .sidebar-sublink:hover {
  background: var(--bg-elevated);
  color: var(--text);
}
.sidebar-menu-group--tree .sidebar-sublink.active,
.sidebar-menu-group--profile .sidebar-sublink.active {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 400;
}

/* Profile group — sidebar tree with vertical connector */
.sidebar-menu-group--profile {
  position: relative;
}
.sidebar-section-user .sidebar-menu {
  gap: 1px;
}

.sidebar-submenu li { list-style: none; }
.sidebar-sublink {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px; font-weight: 400;
  color: var(--text-dim);
  transition: background .15s, color .15s;
}
.sidebar-sublink:hover {
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.sidebar-sublink.active {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 500;
}

.sidebar-footer {
  flex-shrink: 0; padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user-wrap {
  position: relative;
}
.sidebar-user-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 60;
}
.sidebar-user-wrap.open .sidebar-user-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sidebar-user-popover-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 2px 4px 10px;
}
.sidebar-user-popover-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 4px 10px;
}
.sidebar-user-popover-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.sidebar-user-popover-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
}
.sidebar-user-popover-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0 8px;
}
.sidebar-user-popover-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-user-popover-action:hover {
  background: var(--bg-elevated);
}
.sidebar-user-logout,
.sidebar-user-logout .sidebar-user-popover-icon {
  color: #ef4444;
}
.sidebar-user-logout:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border-radius: 10px;
  font-size: 14px; color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sidebar-user:hover { background: #1f1f23; border-color: #3f3f46; }
[data-theme="light"] .sidebar-user:hover { background: #ececee; border-color: #d4d4d8; }
[data-theme="light"] .user-avatar.user-avatar-icon { background: #f4f4f5; }
[data-theme="light"] .sidebar-user-popover { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08); }
[data-theme="light"] .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.sidebar-user-meta {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0; line-height: 1.3;
}
.sidebar-user-name {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 500;
  color: var(--text);
}
.sidebar-user-role {
  font-size: 11px; color: var(--text-dim);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
}
.user-avatar.user-avatar-icon {
  background: #27272a;
  color: var(--text-muted);
}
.user-avatar.user-avatar-icon .sidebar-user-popover-icon {
  width: 16px;
  height: 16px;
}

.dashboard-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  overflow-x: hidden;
}

.dash-header {
  height: var(--header-h); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--bg);
  position: sticky; top: 0; z-index: 40;
}
.dash-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.dash-header-right { display: flex; align-items: center; gap: 8px; }
.sidebar-toggle {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: 8px;
  color: var(--text-muted); border: none; background: transparent; cursor: pointer;
}
.sidebar-toggle:hover { background: var(--bg-elevated); color: var(--text); }

.dash-header-crumb {
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: color .15s;
}
.dash-header-crumb:hover { color: var(--text); }
.dash-header-link {
  font-size: 14px; color: var(--text-muted); padding: 6px 10px; border-radius: 6px;
}
.dash-header-link:hover { color: var(--text); background: var(--bg-elevated); }

.dash-content { padding: 24px; max-width: none; min-width: 0; }
.dash-content-inner { max-width: 1200px; }

.dash-greeting h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.dash-greeting h1 span { color: var(--accent); }
.dash-greeting p { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

.dash-announcement {
  margin: -12px 0 28px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.dash-announcement-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.dash-announcement-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.dash-stat {
  padding: 20px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
}
.dash-stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.dash-stat-label { font-size: 13px; color: var(--text-muted); }
.dash-stat-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-elevated); color: var(--text-dim);
}
.dash-stat-num { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.dash-stat-desc { font-size: 12px; color: var(--text-dim); }

.dash-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.dash-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
  padding: 24px;
}
.dash-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.dash-card-header h3 { font-size: 15px; font-weight: 600; }
.dash-card-header a { font-size: 13px; color: var(--accent); }
.dash-card-header p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-dim);
}
.empty-state-icon { display: flex; justify-content: center; margin-bottom: 12px; opacity: .45; color: var(--text-dim); }
.empty-state-icon svg { width: 40px; height: 40px; }
.empty-state p { font-size: 14px; }
.empty-state small { font-size: 13px; color: var(--text-dim); }

.quick-actions { display: flex; flex-direction: column; gap: 4px; }
.quick-action {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 14px; color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all .15s;
}
.quick-action:hover { background: var(--bg-elevated); color: var(--text); }
.quick-action svg { width: 16px; height: 16px; color: var(--text-dim); }

.perks-card {
  margin-top: 16px; padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
}
.perks-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.perks-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── Dash pages ── */
.dash-content-wide { max-width: 100%; }
.dash-breadcrumb { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.dash-breadcrumb a { color: var(--text-muted); }
.dash-breadcrumb a:hover { color: var(--text); }

.page-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-top { margin-bottom: 20px; }
.page-top h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.02em; }
.page-top p { font-size: 14px; color: var(--text-muted); }
.page-top-split {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-top-stats { font-size: 14px; color: var(--text-muted); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }

.dash-card-flush { padding: 0; overflow: hidden; }

.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.table-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); min-width: 240px;
}
.table-search svg { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
.table-search input {
  border: none; background: none; outline: none;
  font: inherit; font-size: 14px; color: var(--text); width: 100%;
}
.table-count { font-size: 13px; color: var(--text-dim); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 12px 20px; font-size: 12px; font-weight: 500;
  color: var(--text-dim); border-bottom: 1px solid var(--border); background: var(--bg);
}
.data-table td {
  padding: 14px 20px; border-bottom: 1px solid var(--border); color: var(--text-muted);
}
.data-table tbody tr:hover { background: var(--bg-elevated); }
.data-table tbody tr:last-child td { border-bottom: none; }

.cell-mono {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--text);
}
.cell-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 12px; background: var(--bg-elevated); color: var(--text-muted);
  border: 1px solid var(--border);
}
.cell-actions { text-align: right; white-space: nowrap; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim); transition: all .15s;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn-danger:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.status-live { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.status-paused { background: rgba(161, 161, 170, 0.12); color: var(--text-dim); }

.form-card { max-width: 560px; }
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 8px; color: var(--text);
}
.form-group input,
.form-group textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  font: inherit; font-size: 14px; color: var(--text);
  transition: border-color .15s;
}
.form-group select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%; height: 40px; padding: 0 36px 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  font: inherit; font-size: 14px; color: var(--text);
  transition: border-color .15s; cursor: pointer;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  padding-top: 8px; border-top: 1px solid var(--border); margin-top: 24px;
}
.form-actions-center { justify-content: center; }

.btn-danger {
  background: #ef4444; color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.confirm-card {
  max-width: 420px; margin: 40px auto; text-align: center; padding: 40px 32px;
}
.confirm-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.confirm-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.confirm-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.confirm-icon svg { width: 24px; height: 24px; }
.confirm-icon-danger {
  background: rgba(239, 68, 68, 0.12); color: #ef4444;
}

.section-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 24px; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-card); width: fit-content;
}
.section-nav-link {
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: all .15s;
}
.section-nav-link:hover { color: var(--text); background: var(--bg-elevated); }
.section-nav-link.active {
  background: var(--bg-elevated); color: var(--text);
}

.progress-bar {
  height: 6px; border-radius: 999px; background: var(--bg-elevated);
  overflow: hidden; min-width: 80px;
}
.progress-bar-fill {
  height: 100%; border-radius: 999px; background: var(--accent);
}

/* ── Auth pages (matched to Fidelio365 /auth/login) ── */
.auth-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #000;
  color: #fafafa;
}
@media (min-width: 768px) {
  .auth-page { padding: 40px; }
}
.auth-wrap {
  width: 100%;
  max-width: 24rem; /* max-w-sm */
}
.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  margin-bottom: 32px;
}
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: #fafafa;
  text-decoration: none;
}
.auth-logo-img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  object-position: center 28%;
  flex-shrink: 0;
  display: block;
  background: transparent;
}
.auth-header h1 {
  font-size: 1.25rem; /* text-xl */
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: #fafafa;
}
.auth-sub {
  font-size: 12px;
  line-height: 1.5;
  color: #a1a1aa;
  margin: 0;
}
.auth-card {
  border-radius: 12px;
  padding: 24px;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(39, 39, 42, 0.6);
}
.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #71717a;
  line-height: 1.5;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth-form .form-group label {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 0;
  color: #a1a1aa;
  line-height: 1.5;
}
.auth-form .form-group input {
  height: 28px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #27272a;
  background: rgba(39, 39, 42, 0.3);
  font-size: 13px;
  line-height: 1.4;
  color: #fafafa;
}
.auth-form .form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}
.required { color: #ef4444; }
.optional {
  color: #71717a;
  font-weight: 400;
}
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  width: 100%;
  padding-right: 36px;
}
.password-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  transition: color .15s, background .15s;
}
.password-toggle:hover {
  color: #fafafa;
  background: rgba(39, 39, 42, 0.5);
}
.password-toggle svg {
  width: 14px;
  height: 14px;
}
.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0;
  gap: 8px;
}
.auth-actions .btn-primary {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
}
.auth-actions .btn-primary:hover { background: var(--accent-hover); }
.auth-actions .btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.auth-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
}
.auth-info {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: #a1a1aa;
}
.auth-footer a {
  color: #fafafa;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-footer a:hover { opacity: 0.9; }
.auth-footer-muted {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: #71717a;
}
.auth-footer-muted a {
  color: #fafafa;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
body.sidebar-open .sidebar-backdrop { display: block; }
body.sidebar-open { overflow: hidden; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dashboard-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .dash-header { padding: 0 16px; }
  .dash-content { padding: 16px; }
  .page-top,
  .page-top-split {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-top-split .btn,
  .page-top .btn { width: 100%; justify-content: center; }
  .page-top-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    line-height: 1.45;
  }
  .page-top-stats-sep { display: none; }
  .dash-stats { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-search { min-width: 0; width: 100%; }
  .data-table { font-size: 13px; }
  .data-table th,
  .data-table td { padding: 10px 12px; white-space: nowrap; }
}

@media (max-width: 480px) {
  .dash-content { padding: 12px; }
  .dash-header { padding: 0 12px; }
  .page-top h1,
  .dash-greeting h1 { font-size: 20px; }
  .dash-header-crumb { font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-card { border-radius: 10px; }
  .dash-card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
}
