@font-face {
  font-family: 'TTNormsProCondensed';
  src: url('/admin/static/assets/fonts/TTNormsProCondensed-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Mistrully';
  src: url('/admin/static/assets/fonts/Mistrully.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Dark Theme Palette */
  --bg: #050718; /* Deep dark blue/black */
  --bg-alt: #08132b;
  --card: rgba(9, 16, 34, 0.92);
  --muted: rgba(95, 114, 137, 0.28);
  --muted-strong: rgba(166, 188, 214, 0.55);
  --text: #f2f5fb;
  --text-muted: rgba(191, 205, 225, 0.75);
  
  /* Brand Colors */
  --primary: #5fd574; /* From landing btn-primary gradient start */
  --primary-dark: #2dbb80; /* From landing btn-primary gradient end */
  --primary-ink: #051f10;
  
  --accent: #ec7a37; /* From landing --accent */
  --accent-soft: rgba(236, 122, 55, 0.25);
  
  --link: #94ddb0;
  --input-bg: rgba(8, 18, 34, 0.85);
  --border: rgba(72, 101, 131, 0.38);
  
  /* Shadows & Radius */
  --shadow-primary: rgba(95, 213, 116, 0.32);
  --shadow-card: 0 24px 48px rgba(5, 12, 24, 0.55);
  --radius-card: 24px;
  --radius-pill: 999px;
}

:root[data-theme='light'] {
  color-scheme: light;
  /* Light Theme Palette matching landing.css */
  --bg: #f6f7fb; /* --surface-light */
  --bg-alt: #ffffff;
  --card: #ffffff; /* --surface-card */
  --muted: rgba(11, 48, 79, 0.12);
  --muted-strong: rgba(11, 48, 79, 0.24);
  --text: #0b1f33; /* --text-primary */
  --text-muted: #5f7289; /* --text-muted */
  
  --primary: #2dbb80; /* Using the greener end for better contrast on light */
  --primary-dark: #1f9d6f;
  --primary-ink: #ffffff;
  
  --accent: #ec7a37;
  --accent-soft: rgba(236, 122, 55, 0.15);
  
  --link: #1f9d6f;
  --input-bg: #ffffff;
  --border: rgba(11, 48, 79, 0.14);
  
  --shadow-primary: rgba(45, 187, 128, 0.28);
  --shadow-card: 0 24px 48px rgba(5, 21, 35, 0.08);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

/* Header */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--muted);
  box-shadow: 0 4px 20px rgba(8, 15, 35, 0.06);
}

[data-theme='dark'] .admin-header {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.admin-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  height: auto;
  padding: 0;
  background: transparent;
}
.admin-logo-img {
  width: 140px;
  height: auto;
  display: block;
}

.admin-logo-img--dark { display: none; }
[data-theme='dark'] .admin-logo-img--light { display: none; }
[data-theme='dark'] .admin-logo-img--dark { display: block; }

.admin-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-brand-title {
  font-family: 'TTNormsProCondensed', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.admin-brand-subtitle {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

/* Navigation */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.admin-nav a:hover {
  background: var(--muted);
  color: var(--text);
  text-decoration: none;
}

.admin-nav a.active {
  background: rgba(97, 206, 112, 0.12);
  color: var(--primary-dark);
  border-color: rgba(97, 206, 112, 0.2);
}
[data-theme='dark'] .admin-nav a.active {
  background: rgba(95, 213, 116, 0.15);
  color: var(--primary);
  border-color: rgba(95, 213, 116, 0.3);
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}
[data-theme='dark'] .theme-toggle:hover {
  color: var(--primary);
}

.theme-toggle__icon {
  font-size: 16px;
  line-height: 1;
}

.logout-btn {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.logout-btn:hover {
  background: rgba(236, 122, 55, 0.25);
  border-color: var(--accent);
}

/* Layout & Typography */
.wrap {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 24px 64px;
  display: block;
}

.h1 {
  font-family: 'TTNormsProCondensed', 'Inter', sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.h2 {
  font-family: 'TTNormsProCondensed', 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin: 24px 0 12px;
  color: var(--text);
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--muted);
  border-radius: var(--radius-card);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

/* Forms */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}

.row > * {
  flex: 1 1 280px;
}

label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 8px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--muted-strong);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--shadow-primary);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Buttons */
button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--primary-ink);
  font-family: 'TTNormsProCondensed', 'Inter', sans-serif;
  font-weight: 700;
  border: 0;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 20px var(--shadow-primary);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px var(--shadow-primary);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--muted-strong);
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

button.dark {
  background: rgba(11, 48, 79, 0.1);
  border: 1px solid transparent;
  color: var(--text);
  box-shadow: none;
}
[data-theme='dark'] button.dark {
  background: rgba(255, 255, 255, 0.1);
}

button.dark:hover {
  background: rgba(11, 48, 79, 0.15);
  transform: translateY(-1px);
}
[data-theme='dark'] button.dark:hover {
  background: rgba(255, 255, 255, 0.15);
}

button.danger {
  background: rgba(236, 122, 55, 0.12);
  border: 1px solid rgba(236, 122, 55, 0.3);
  color: var(--accent);
  box-shadow: none;
}

button.danger:hover {
  background: rgba(236, 122, 55, 0.22);
  border-color: var(--accent);
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: grayscale(0.5);
}

/* Status & Badges */
.muted { color: var(--text-muted); }
.ok { color: var(--primary); }
.err { color: var(--accent); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.status-pill.pending {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(236, 122, 55, 0.3);
}

.status-pill.complete {
  background: rgba(95, 213, 116, 0.15);
  color: var(--primary);
  border-color: rgba(95, 213, 116, 0.3);
}

/* Plan Cards (Specific to Onboarding/Billing) */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.plan-card {
  background: var(--card);
  border: 1px solid var(--muted);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border 0.2s ease, transform 0.2s ease;
}

.plan-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-card);
}

.plan-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.plan-feature::before {
  content: '✓';
  font-weight: 900;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(95, 213, 116, 0.2);
  font-size: 12px;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--muted-strong);
  font-weight: 600;
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--muted);
  font-size: 14px;
  color: var(--text);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: rgba(11, 48, 79, 0.03);
}
[data-theme='dark'] .data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Tags & Pills */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--muted-strong);
  background: transparent;
  color: var(--text);
}

.tag-chip__remove {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
}

.tag-chip__remove:hover { color: var(--accent); }

.tag-editor {
  border-radius: 16px;
  border: 1px solid var(--muted);
  background: rgba(11, 48, 79, 0.02);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
[data-theme='dark'] .tag-editor {
  background: rgba(255, 255, 255, 0.02);
}

/* Modal & Tier Selection */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1200;
}
.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 28, 0.72);
  backdrop-filter: blur(14px);
}
[data-theme='light'] .modal__backdrop {
  background: rgba(7, 24, 52, 0.18);
  backdrop-filter: blur(18px);
}

.modal__card {
  position: relative;
  width: min(640px, calc(100% - 32px));
  background: var(--card);
  border: 1px solid var(--muted);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 1;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal__title {
  font-family: 'TTNormsProCondensed', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.modal__body {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 6px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--muted);
  margin-top: 4px;
}

.tier-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--muted);
  border-radius: 20px;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 92%, rgba(148, 163, 184, 0.08));
  box-shadow: 0 20px 44px rgba(7, 20, 38, 0.45);
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, background 0.25s ease;
}
[data-theme='light'] .tier-option {
  background: color-mix(in srgb, var(--card) 97%, rgba(12, 52, 84, 0.1));
  border-color: rgba(12, 52, 84, 0.18);
  box-shadow: 0 18px 40px rgba(12, 52, 84, 0.16);
}

.tier-option:hover {
  transform: translateY(-2px);
  border-color: var(--muted-strong);
}

.tier-option.is-selected {
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
  background: var(--card);
  background: color-mix(in srgb, var(--card) 90%, rgba(95, 213, 116, 0.15));
}

.tier-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tier-option__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--muted-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.tier-option__check::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0);
  transition: transform 0.2s ease, background 0.2s ease;
}

.tier-option input:checked + .tier-option__check {
  border-color: var(--primary);
  background: rgba(95, 213, 116, 0.18);
  box-shadow: 0 0 0 4px rgba(95, 213, 116, 0.22);
}

.tier-option input:checked + .tier-option__check::after {
  background: var(--primary);
  transform: scale(1);
}

.tier-option__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tier-option__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tier-option__title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  font-family: 'TTNormsProCondensed', 'Inter', sans-serif;
}

.tier-option__badge {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(95, 213, 116, 0.18);
  border: 1px solid rgba(95, 213, 116, 0.4);
  color: var(--text);
  box-shadow: 0 14px 28px rgba(95, 213, 116, 0.1);
  white-space: nowrap;
}

.tier-option--default .tier-option__badge {
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(148, 163, 184, 0.45);
  color: var(--text);
  box-shadow: none;
}

.tier-option.is-selected .tier-option__badge {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-ink);
}

.tier-option__description {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.tier-option__features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.tier-option__features li {
  position: relative;
  padding-left: 18px;
  color: var(--text-muted);
}

.tier-option__features li::before {
  content: '•';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}

.tier-option.is-selected .tier-option__title { color: var(--primary); }
.tier-option.is-selected .tier-option__features li { color: var(--text); }

#tierModalStatus {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 18px;
}

@media (max-width: 560px) {
  .modal__card { padding: 22px 20px; }
  .tier-option {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
  }
  .tier-option__check { margin-top: 0; }
  .tier-option__header { flex-direction: column; align-items: flex-start; }
}
