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

:root {
  --bg: #ffffff;
  --text: #0b0b0f;
  --primary: #6c8cff;
  --primary-contrast: #0b0b0f;
  --secondary: #eceef2;
  --secondary-contrast: #0b0b0f;
  --overdue: #ef4444;
  --overdue-contrast: #ffffff;
  --due-today: #f5b942;
  --upcoming: #9ca3af;
  --taken: #22c55e;
  --taken-contrast: #ffffff;
  --skipped: #6b7280;

  --surface: var(--bg);
  --text-muted: color-mix(in srgb, var(--text), var(--bg) 45%);
  --border: color-mix(in srgb, var(--bg), var(--text) 15%);
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.25rem;
  margin: 2rem 0 1rem;
}

p {
  color: var(--text-muted);
}

a {
  color: var(--primary);
}

/* Landing/placeholder-style centered pages */
body:has(main.auth-page) {
  display: flex;
  align-items: center;
  justify-content: center;
}

main.auth-page {
  width: 100%;
  max-width: 360px;
  padding: 2rem;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  text-align: left;
}

.auth-switch {
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

button,
.button-yellow {
  background: var(--primary);
  color: var(--primary-contrast);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.button-yellow:hover {
  filter: brightness(1.08);
}

.button-secondary {
  background: var(--secondary);
  color: var(--secondary-contrast);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.button-secondary:hover {
  filter: brightness(0.96);
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
}

.link-button--danger {
  color: var(--overdue);
}

.form-error {
  color: var(--overdue);
  background: color-mix(in srgb, var(--overdue) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--overdue) 35%, transparent);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

/* App shell */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.public-header--single {
  justify-content: flex-start;
}

.app-nav-brand {
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo {
  flex-shrink: 0;
}

.brand-dot {
  fill: var(--primary);
}

.brand-bond {
  stroke: var(--primary-contrast);
}

.brand-word {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-word-io {
  color: var(--primary);
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-brand .brand-word {
  font-size: 1.3rem;
}

.app-nav-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.app-nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
}

.app-nav-links a:hover {
  color: var(--text);
  border-color: var(--primary);
}

.app-nav-icon-btn {
  background: none;
  border: 2px solid var(--secondary);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-nav-icon-btn:hover {
  border-color: var(--primary);
}

.app-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Peptide form + table */
.peptide-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 480px;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row label {
  flex: 1;
  min-width: 120px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.empty-state {
  font-size: 0.9rem;
}

.peptide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.peptide-table th,
.peptide-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.peptide-table .row-inactive {
  opacity: 0.5;
}

/* Admin */
.admin-note {
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  max-width: 640px;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-tile-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-tile-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 2rem;
  position: relative;
}

.chart-card-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.chart-card-header h2 {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chart-hero {
  font-size: 1.8rem;
  font-weight: 600;
  margin-right: 0.4rem;
}

.chart-hero-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.range-toggle {
  display: flex;
  gap: 0.4rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.range-toggle a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
}

.range-toggle a:hover {
  color: var(--text);
  border-color: var(--primary);
}

.range-toggle a.range-toggle-active {
  color: var(--text);
  border-color: var(--primary);
  font-weight: 700;
}

.signups-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--text-muted);
  font-size: 9px;
}

.chart-bar {
  fill: var(--primary);
}

.chart-bar:hover {
  fill: color-mix(in srgb, var(--primary) 80%, white);
}

.chart-bar--taken {
  fill: var(--taken);
}

.chart-bar--other {
  fill: var(--overdue);
}

.upsell-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 480px;
  position: relative;
}

.upsell-card p {
  margin: 1rem 0 1.25rem;
}

.pricing-badge--static {
  position: static;
  display: inline-block;
}

.upsell-price {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
}

.upsell-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.upsell-features li {
  padding-left: 1.1rem;
  position: relative;
}

.upsell-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.pricing-current-label {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
}

.chart-tooltip {
  position: absolute;
  background: var(--secondary);
  color: var(--secondary-contrast);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

.peptide-table-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
}

/* Calendar */
.view-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.view-toggle-row .view-toggle {
  margin-bottom: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-dialog .peptide-form {
  border: none;
  padding: 0;
  max-width: none;
}

.modal-dialog--wide {
  max-width: 560px;
}

.day-detail-row-dose {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.day-detail-readonly-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

.day-detail-row {
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}

.day-detail-row:last-child {
  margin-bottom: 0;
}

.day-detail-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.day-detail-row-top .dose-pill-name {
  font-size: 1rem;
}

.day-detail-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.day-detail-row-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.day-detail-dose-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.day-detail-dose-input {
  width: 100px;
}

.day-detail-unit-input {
  height: 2.4rem;
}

.day-detail-save-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.day-detail-save-actions button {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}

.day-detail-row .dose-pill-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.day-detail-delete-row {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.day-detail-delete-peptide {
  font-size: 0.75rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.dose-pill-time {
  opacity: 0.7;
  font-size: 0.65rem;
}

.view-toggle {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.view-toggle a,
.view-toggle-active {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

.view-toggle a:hover {
  color: var(--text);
  border-color: var(--primary);
}

.view-toggle-active {
  color: var(--text);
  border-color: var(--primary);
  font-weight: 700;
}

.day-view-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.day-view-nav {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--secondary-contrast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.1rem;
  flex: none;
}

.day-view-nav:hover {
  filter: brightness(0.96);
}

.day-view-date {
  font-size: 1.4rem;
  font-weight: 700;
  min-width: 100px;
  text-align: center;
}

.day-view-date--today {
  color: var(--primary);
}

.day-view-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0.5rem 1.5rem;
  overflow: hidden;
}

.day-view-card .empty-state {
  padding: 1.5rem 0;
  text-align: center;
}

.day-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1rem;
  margin: 0 -1rem;
  border-bottom: 1px solid var(--border);
}

.day-view-row:last-child {
  border-bottom: none;
}

.day-view-row.dose-pill--overdue { background: color-mix(in srgb, var(--overdue) 12%, transparent); border: none; border-bottom: 1px solid var(--border); }
.day-view-row.dose-pill--due_today { background: color-mix(in srgb, var(--due-today) 14%, transparent); border: none; border-bottom: 1px solid var(--border); }
.day-view-row.dose-pill--upcoming { background: color-mix(in srgb, var(--upcoming) 14%, transparent); border: none; border-bottom: 1px solid var(--border); }
.day-view-row.dose-pill--taken { background: color-mix(in srgb, var(--taken) 12%, transparent); border: none; border-bottom: 1px solid var(--border); }
.day-view-row.dose-pill--skipped { background: color-mix(in srgb, var(--skipped) 12%, transparent); border: none; border-bottom: 1px solid var(--border); }

.day-view-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.day-view-name {
  font-size: 1rem;
  font-weight: 600;
}

.day-view-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.day-view-status-label {
  font-weight: 600;
}

.day-view-actions {
  display: flex;
  gap: 0.6rem;
  flex: none;
}

.day-view-row .dose-action--taken {
  background: transparent;
  border: 2px solid var(--taken);
  color: var(--taken);
}

.day-view-row .dose-action--taken.dose-action--active {
  background: var(--taken);
  color: var(--taken-contrast);
}

.day-view-row .dose-action--skip {
  background: transparent;
  border: 2px solid var(--overdue);
  color: var(--overdue);
}

.day-view-row .dose-action--skip.dose-action--active {
  background: var(--overdue);
  color: var(--overdue-contrast);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  display: inline-block;
}

.legend-swatch--overdue { background: var(--overdue); }
.legend-swatch--due_today { background: var(--due-today); }
.legend-swatch--upcoming { background: var(--upcoming); }
.legend-swatch--taken { background: var(--taken); }
.legend-swatch--skipped { background: var(--skipped); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 0.25rem;
}

.calendar-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 90px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  cursor: pointer;
}

.calendar-cell:hover {
  border-color: var(--primary);
}

.calendar-cell--muted {
  opacity: 0.4;
}

.calendar-cell--today {
  border-color: var(--primary);
}

.calendar-cell-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dose-pill {
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dose-pill-name {
  font-weight: 600;
}

.dose-pill-amount {
  opacity: 0.85;
}

.dose-pill--overdue { background: color-mix(in srgb, var(--overdue) 18%, transparent); border: 1px solid var(--overdue); }
.dose-pill--due_today { background: color-mix(in srgb, var(--due-today) 20%, transparent); border: 1px solid var(--due-today); }
.dose-pill--upcoming { background: color-mix(in srgb, var(--upcoming) 22%, transparent); border: 1px solid var(--upcoming); }
.dose-pill--taken { background: color-mix(in srgb, var(--taken) 18%, transparent); border: 1px solid var(--taken); }
.dose-pill--skipped { background: color-mix(in srgb, var(--skipped) 18%, transparent); border: 1px solid var(--skipped); }

.dose-pill-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.15rem;
  align-items: center;
}

.dose-action {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dose-action--taken {
  background: var(--taken);
  color: var(--taken-contrast);
}

.dose-action--skip {
  background: var(--overdue);
  color: var(--overdue-contrast);
}

.dose-action--reset {
  background: var(--secondary);
  color: var(--secondary-contrast);
  font-size: 1.05rem;
}

@media (max-width: 640px) {
  .calendar-legend {
    display: none;
  }
  .calendar-grid {
    gap: 3px;
  }
  .calendar-cell {
    min-height: 58px;
    padding: 0.25rem;
  }
  .dose-pill {
    font-size: 0.58rem;
    padding: 0.2rem 0.3rem;
  }
  .app-nav,
  .public-header {
    padding: 0.85rem 1rem;
  }
  .app-nav-links {
    gap: 0.4rem;
  }
  .app-nav-links a:not(.app-nav-icon-btn) {
    padding: 0.5rem 0.7rem;
  }
  .app-page {
    padding: 1rem;
  }
  .modal-dialog {
    padding: 1.1rem;
    max-height: 88vh;
  }
  .day-detail-row-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .day-detail-dose-input {
    width: 100%;
  }
  .form-row {
    flex-direction: column;
  }
  .dose-action {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  .calendar-header h1 {
    font-size: 1.3rem;
  }
  .stat-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-content {
    padding-left: 0;
  }
}

/* Pricing */
.auth-plan-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.pricing-page {
  max-width: 760px;
}

.pricing-title {
  text-align: center;
  margin-bottom: 0.5rem;
}

.pricing-subtitle {
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-card--featured {
  border-color: var(--primary);
}

.pricing-badge {
  position: absolute;
  top: -0.7rem;
  right: 1.25rem;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.pricing-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.pricing-price {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.pricing-price-period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-blurb {
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.pricing-features li {
  padding-left: 1.1rem;
  position: relative;
}

.pricing-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.pricing-soon {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  vertical-align: middle;
}

.pricing-cta {
  text-align: center;
  justify-content: center;
}

/* Admin portal shell + burger sidebar */
.admin-shell {
  position: relative;
}

.admin-content {
  max-width: 900px;
}

.admin-burger {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 1rem;
}

.admin-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
}

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 5rem 1rem 1.5rem;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 58;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.admin-sidebar--open {
  transform: translateX(0);
}

.admin-sidebar-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-grow: 1;
}

.admin-sidebar-nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.admin-sidebar-nav a:hover {
  color: var(--text);
  background: var(--secondary);
}

.admin-sidebar-nav a.admin-sidebar-link-active {
  color: var(--text);
  background: var(--secondary);
  font-weight: 700;
}

.admin-sidebar-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.55rem 0.8rem;
}

.admin-sidebar-back:hover {
  color: var(--text);
}

.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 57;
}

/* Customize modal */
.customize-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.customize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
}

.customize-row-label {
  flex: 1;
}

.customize-row-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.customize-swatch {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.customize-hex {
  width: 90px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  padding: 0.4rem 0.5rem;
  text-transform: lowercase;
}

.customize-actions {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.color-picker-popover {
  position: fixed;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  width: 220px;
}

.color-picker-sv {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 6px;
  margin-bottom: 0.7rem;
  background-image:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, transparent);
  background-color: #ff0000;
  cursor: crosshair;
  user-select: none;
}

.color-picker-sv-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.color-picker-hue {
  width: 100%;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.color-picker-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #333;
  cursor: pointer;
}

.color-picker-hue::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #333;
  cursor: pointer;
}

/* Settings */
.settings-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h2,
.settings-section h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.modal-dialog .settings-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
}

.settings-form {
  max-width: 420px;
}

.settings-hint {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.settings-plan-form label {
  max-width: 220px;
}

/* Calculator */
.calculator-form {
  max-width: 420px;
  margin-bottom: 1.5rem;
}

.calculator-input-group {
  display: flex;
  gap: 0.5rem;
}

.calculator-input-group input {
  flex: 1;
}

.calculator-input-group select {
  width: 90px;
}

.calculator-input-suffix {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0 0.5rem;
}

.calculator-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  max-width: 600px;
  margin-bottom: 1rem;
}

.calculator-note {
  max-width: 500px;
}
