:root {
  --dark: #29333C;
  --blue: #78D1FE;
  --gray: #696D70;
  --white: #FFFFFF;
  --dark-2: #1e262d;
  --dark-3: #344050;
  --blue-dim: rgba(120, 209, 254, 0.12);
  --blue-mid: rgba(120, 209, 254, 0.25);
  --border-color: rgba(255, 255, 255, 0.08);
  --hover-bg: rgba(255, 255, 255, 0.04);
  --surface-bg: rgba(255, 255, 255, 0.03);
  --text-muted: rgba(255, 255, 255, 0.55);
  --input-bg: rgba(255, 255, 255, 0.07);
  --input-border: rgba(255, 255, 255, 0.14);
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --dark: #FFFFFF;
  --dark-2: #F8FAFC;
  --dark-3: #E2E8F0;
  --white: #1E293B;
  --gray: #64748B;
  --blue: #0284C7;
  --blue-dim: rgba(2, 132, 199, 0.12);
  --blue-mid: rgba(2, 132, 199, 0.25);
  --border-color: rgba(0, 0, 0, 0.1);
  --hover-bg: rgba(0, 0, 0, 0.05);
  --surface-bg: #FFFFFF;
  --text-muted: rgba(30, 41, 59, 0.65);
  --input-bg: rgba(0, 0, 0, 0.04);
  --input-border: rgba(0, 0, 0, 0.18);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--dark-2);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Base Styles Extracted from design */
a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: var(--dark);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid rgba(120, 209, 254, 0.4);
}

.btn-secondary:hover {
  background: var(--blue-dim);
  border-color: var(--blue);
}

.btn-ghost {
  background: transparent;
  color: var(--white);
}

.btn-ghost:hover {
  background: var(--hover-bg);
}

/* Layout Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--dark-2);
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  position: fixed;
  height: 100vh;
  transition: transform 0.3s ease;
  z-index: 20;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 8px;
  font-family: 'Anton', sans-serif;
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-family: 'Anton', sans-serif;
  font-size: 18px;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(105, 109, 112, 0.8);
  text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.18s;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: var(--white);
  background: var(--hover-bg);
}

.nav-item.active {
  color: var(--blue);
  background: var(--blue-dim);
  border-left-color: var(--blue);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.2s;
}

.user-profile:hover {
  background: var(--hover-bg);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--blue);
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--gray);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.logout-btn:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main.expanded {
  margin-left: 0;
}

.topbar {
  background: var(--dark);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
}

.menu-toggle {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  margin-right: 16px;
  padding: 0;
}

.menu-toggle:hover {
  background: var(--hover-bg);
}

.page-title {
  font-family: 'Anton', sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
}

.content {
  padding: 24px;
}

/* HTMX Skeleton Loader */
#qr-preview-container {
  transition: opacity 0.2s;
  position: relative;
  overflow: hidden;
}

#qr-preview-container.htmx-request svg {
  opacity: 0.1;
  transition: opacity 0.2s;
}

#qr-preview-container.htmx-request::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(120, 209, 254, 0.15) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: inherit;
  pointer-events: none;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ─── Shared Form Controls ─────────────────────────────────── */
/* Usable via class="form-input" or class="input" in any template */
.form-input,
.input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.input:focus {
  border-color: var(--blue);
  background: var(--blue-dim);
  box-shadow: 0 0 0 3px var(--blue-mid);
  outline: none;
}

.form-input::placeholder,
.input::placeholder {
  color: var(--text-muted);
}

.input option {
  background-color: var(--dark);
  color: var(--white);
}

/* ─── Badges ───────────────────────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-dim);
  color: var(--blue);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  min-width: 22px;
}

.badge-pro {
  display: inline-block;
  background: var(--blue);
  color: var(--dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 8px;
}

/* ─── Alert / Banner ──────────────────────────────────────── */
.alert-info {
  background: var(--blue-dim);
  border-left: 3px solid var(--blue);
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 24px;
  color: var(--blue);
  font-size: 13px;
}

.alert-error {
  background: rgba(255, 107, 107, 0.1);
  border-left: 3px solid #ff6b6b;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 24px;
  color: #ff6b6b;
  font-size: 13px;
}

/* ─── Shared Panel ────────────────────────────────────────── */
.panel {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}