/* ============================================================
   DENTALAB — Component Library
   Depends on colors_and_type.css
   ============================================================ */

@import url('./colors_and_type.css');

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--fg-1);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
a { color: var(--brand-primary); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--brand-primary-hover); }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

::selection { background: var(--brand-primary-soft); color: var(--brand-primary); }

/* Scrollbar — minimal */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--neutral-200);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-app);
}
::-webkit-scrollbar-thumb:hover { background: var(--neutral-300); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--neutral-700); border-color: var(--bg-app); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--dur-slow) var(--ease-out);
}
.app[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.app[data-layout="doctor"] {
  grid-template-columns: 1fr;
  grid-template-areas: "topbar" "main";
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  grid-area: sidebar;
  background: var(--surface-1);
  border-right: 1px solid var(--border-1);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: var(--z-sidebar);
  transition: padding var(--dur-slow) var(--ease-out);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  height: 32px;
  flex-shrink: 0;
}
.sidebar__logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand-gradient);
  display: grid;
  place-items: center;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-brand);
}
.sidebar__logo svg { width: 18px; height: 18px; }
.sidebar__title {
  font-size: 15px;
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-snug);
  color: var(--fg-1);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out);
}
.app[data-sidebar="collapsed"] .sidebar__title,
.app[data-sidebar="collapsed"] .nav-section__label,
.app[data-sidebar="collapsed"] .nav-item__label,
.app[data-sidebar="collapsed"] .nav-item__badge,
.app[data-sidebar="collapsed"] .sidebar__footer-text { opacity: 0; pointer-events: none; }

.sidebar__nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-5); }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section__label {
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-4);
  padding: 6px 12px 4px;
  transition: opacity var(--dur-base) var(--ease-out);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--fg-2);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  position: relative;
  white-space: nowrap;
}
.nav-item__icon {
  width: 20px; height: 20px;
  font-size: 20px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: var(--fg-3);
  transition: color var(--dur-fast) var(--ease-out);
}
.nav-item__label { flex: 1; transition: opacity var(--dur-base) var(--ease-out); }
.nav-item__badge {
  background: var(--neutral-150);
  color: var(--fg-2);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  transition: opacity var(--dur-base) var(--ease-out);
}
.nav-item:hover { background: var(--neutral-100); color: var(--fg-1); }
.nav-item:hover .nav-item__icon { color: var(--fg-1); }
.nav-item.is-active {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}
.nav-item.is-active .nav-item__icon { color: var(--brand-primary); }
.nav-item.is-active .nav-item__badge { background: var(--brand-primary); color: white; }
[data-theme="dark"] .nav-item:hover { background: var(--surface-3); }

.sidebar__footer {
  padding: 10px;
  border-top: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar__footer-text { flex: 1; min-width: 0; transition: opacity var(--dur-base) var(--ease-out); }
.sidebar__footer-name { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__footer-role { font-size: var(--fs-caption); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  grid-area: topbar;
  height: var(--topbar-h);
  background: var(--surface-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-1);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
}
.topbar__toggle {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 18px;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.topbar__toggle:hover { background: var(--neutral-100); color: var(--fg-1); }
[data-theme="dark"] .topbar__toggle:hover { background: var(--surface-3); }

.topbar__search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar__search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--fg-1);
  font-size: var(--fs-body);
  font-family: inherit;
  transition: all var(--dur-fast) var(--ease-out);
}
.topbar__search-input::placeholder { color: var(--fg-4); }
.topbar__search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--surface-1);
  box-shadow: var(--shadow-focus-ring);
}
.topbar__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-4);
  font-size: 18px;
  pointer-events: none;
}
.topbar__search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-4);
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  pointer-events: none;
}

.topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar__btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  color: var(--fg-2);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 18px;
  position: relative;
  transition: all var(--dur-fast) var(--ease-out);
}
.topbar__btn:hover { background: var(--surface-2); color: var(--fg-1); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.topbar__btn .dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-danger);
  border: 2px solid var(--surface-1);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.topbar__user:hover { background: var(--surface-2); box-shadow: var(--shadow-sm); }
.topbar__user-name { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--fg-1); }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  grid-area: main;
  padding: var(--space-7) var(--space-7) var(--space-9);
  background: var(--bg-app);
  min-width: 0;
}
.main__inner { max-width: var(--content-max); margin: 0 auto; }

/* Page header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
  flex-wrap: wrap;
}
.page-header__title { margin: 0 0 4px; }
.page-header__sub { margin: 0; color: var(--fg-3); font-size: var(--fs-body); }
.page-header__breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-caption);
  color: var(--fg-4);
  margin-bottom: 8px;
}
.page-header__breadcrumbs a { color: var(--fg-4); }
.page-header__breadcrumbs a:hover { color: var(--fg-1); }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: white;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
  user-select: none;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.avatar--xl { width: 56px; height: 56px; font-size: 18px; }
.avatar--neutral { background: var(--neutral-200); color: var(--fg-2); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid var(--surface-1); box-shadow: var(--shadow-xs); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.card--glass {
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-glass);
}
.card--gradient-border {
  position: relative;
  background: var(--surface-1);
  border: 1px solid transparent;
  background-clip: padding-box;
}
.card--gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--brand-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.card__header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.card__title { margin: 0; font-size: var(--fs-h5); font-weight: var(--fw-semibold); color: var(--fg-1); }
.card__sub { margin: 2px 0 0; font-size: var(--fs-body-sm); color: var(--fg-3); }
.card__footer { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-2); }

/* Stat card */
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-card__label { font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--fg-3); }
.stat-card__icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}
.stat-card__icon--success { background: var(--color-success-soft); color: var(--color-success); }
.stat-card__icon--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-card__icon--info    { background: var(--color-info-soft);    color: var(--color-info); }
.stat-card__value {
  font-size: 28px; font-weight: var(--fw-bold); color: var(--fg-1); line-height: 1.1;
  letter-spacing: var(--ls-tight);
}
.stat-card__delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-caption); font-weight: var(--fw-semibold);
}
.stat-card__delta--up { color: var(--color-success); }
.stat-card__delta--down { color: var(--color-danger); }
.stat-card__delta-period { color: var(--fg-4); font-weight: var(--fw-medium); margin-left: 4px; }
.stat-card__spark {
  position: absolute; right: 0; bottom: 0; left: 0;
  height: 36px; opacity: 0.6; pointer-events: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn i { font-size: 17px; line-height: 1; }

/* Ripple */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.5);
  animation: ripple var(--dur-slower) var(--ease-out);
  pointer-events: none;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.btn--primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover:not(:disabled) {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 102, 255, 0.32);
}
.btn--primary:active { transform: translateY(0) scale(0.98); }

.btn--gradient {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-brand);
}
.btn--gradient:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 102, 255, 0.32);
  filter: brightness(1.05);
}

.btn--secondary {
  background: var(--surface-1);
  border-color: var(--border-1);
  color: var(--fg-1);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn--secondary:active { transform: translateY(0) scale(0.98); }

.btn--ghost {
  background: transparent;
  color: var(--fg-2);
}
.btn--ghost:hover:not(:disabled) { background: var(--neutral-100); color: var(--fg-1); }
[data-theme="dark"] .btn--ghost:hover { background: var(--surface-3); }

.btn--danger {
  background: var(--color-danger);
  color: white;
}
.btn--danger:hover:not(:disabled) {
  background: #D63427;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(240, 68, 56, 0.32);
}

.btn--sm { padding: 6px 13px; font-size: var(--fs-body-sm); }
.btn--sm i { font-size: 15px; }
.btn--lg { padding: 12px 22px; font-size: 15px; }
.btn--icon { padding: 9px; width: 38px; height: 38px; }
.btn--icon.btn--sm { width: 32px; height: 32px; padding: 6px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-pill);
  background: var(--neutral-150);
  color: var(--fg-2);
  white-space: nowrap;
  line-height: 1.4;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge--no-dot::before { display: none; }
.badge--success { background: var(--color-success-soft); color: var(--color-success); }
.badge--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge--danger  { background: var(--color-danger-soft);  color: var(--color-danger); }
.badge--info    { background: var(--color-info-soft);    color: var(--color-info); }
.badge--primary { background: var(--brand-primary-soft); color: var(--brand-primary); }
.badge--neutral { background: var(--neutral-150); color: var(--fg-2); }
[data-theme="dark"] .badge--neutral { background: var(--surface-3); color: var(--fg-2); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-2);
  flex-wrap: wrap;
}
.table-toolbar .field { width: 280px; max-width: 100%; }
.table-toolbar__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body-sm);
}
.table thead th {
  background: var(--surface-2);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: var(--fg-3);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-1);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
.table thead th.is-sortable { cursor: pointer; user-select: none; }
.table thead th.is-sortable:hover { color: var(--fg-1); }
.table thead th .sort-icon { margin-left: 4px; opacity: 0.5; font-size: 12px; }
.table thead th.is-sorted .sort-icon { opacity: 1; color: var(--brand-primary); }
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-2);
  color: var(--fg-2);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .td-primary { color: var(--fg-1); font-weight: var(--fw-medium); }
.table .td-mono { font-family: var(--font-mono); font-size: var(--fs-body-sm); color: var(--fg-2); }
.table .cell-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ============================================================
   FIELDS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
}
.field__hint { font-size: var(--fs-caption); color: var(--fg-4); }
.field__error { font-size: var(--fs-caption); color: var(--color-danger); }
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--fg-1);
  font-size: var(--fs-body);
  font-family: inherit;
  transition: all var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus-ring);
}
.textarea { resize: vertical; min-height: 88px; line-height: var(--lh-normal); }
.input--with-icon { padding-left: 36px; }
.field--icon { position: relative; }
.field--icon .field__icon {
  position: absolute;
  left: 10px;
  bottom: 9px;
  color: var(--fg-4);
  font-size: 18px;
  pointer-events: none;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237B8593' stroke-width='1.5'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

/* Toggle */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 36px; height: 20px;
  background: var(--neutral-300);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background var(--dur-base) var(--ease-out);
}
.toggle__track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-spring);
}
.toggle input:checked ~ .toggle__track { background: var(--brand-primary); }
.toggle input:checked ~ .toggle__track::after { transform: translateX(16px); }
.toggle__label { font-size: var(--fs-body); color: var(--fg-1); }

/* Checkbox */
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox__box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  display: grid; place-items: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.checkbox__box::after {
  content: '';
  width: 10px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8l3.5 3.5L13 5'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring);
}
.checkbox input:checked ~ .checkbox__box { background: var(--brand-primary); border-color: var(--brand-primary); }
.checkbox input:checked ~ .checkbox__box::after { opacity: 1; transform: scale(1); }
.checkbox__label { font-size: var(--fs-body); color: var(--fg-1); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: var(--space-5);
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--fg-3);
  cursor: pointer;
  position: relative;
  transition: color var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.tab:hover { color: var(--fg-1); }
.tab.is-active { color: var(--brand-primary); }
.tab.is-active::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--brand-primary);
  border-radius: 2px;
  animation: tab-indicator var(--dur-base) var(--ease-out);
}
@keyframes tab-indicator { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
  width: 100%;
  height: 6px;
  background: var(--neutral-150);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease-out);
}
[data-theme="dark"] .progress { background: var(--surface-3); }

/* Steps */
.steps { display: flex; align-items: center; gap: 0; flex-wrap: nowrap; }
.step { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.step__dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 2px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: var(--fw-semibold);
  color: var(--fg-3);
  flex-shrink: 0;
  transition: all var(--dur-base) var(--ease-out);
}
.step__line {
  flex: 1;
  height: 2px;
  background: var(--border-1);
  border-radius: 2px;
  transition: background var(--dur-base) var(--ease-out);
}
.step:last-child .step__line { display: none; }
.step__label { font-size: var(--fs-body-sm); font-weight: var(--fw-medium); color: var(--fg-3); white-space: nowrap; }
.step.is-complete .step__dot { background: var(--color-success); border-color: var(--color-success); color: white; }
.step.is-complete .step__line { background: var(--color-success); }
.step.is-complete .step__label { color: var(--fg-2); }
.step.is-active .step__dot { background: var(--brand-primary); border-color: var(--brand-primary); color: white; box-shadow: 0 0 0 4px var(--brand-primary-soft); }
.step.is-active .step__label { color: var(--fg-1); font-weight: var(--fw-semibold); }

/* ============================================================
   DROPDOWN / MENU
   ============================================================ */
.menu {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.menu__item:hover { background: var(--neutral-100); color: var(--fg-1); }
[data-theme="dark"] .menu__item:hover { background: var(--surface-3); }
.menu__item i { font-size: 17px; color: var(--fg-3); }
.menu__item--danger { color: var(--color-danger); }
.menu__item--danger i { color: var(--color-danger); }
.menu__sep { height: 1px; background: var(--border-2); margin: 4px 0; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-down{ from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scale-in  { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* Animations enhance entry — static state is the final state, so screenshots & no-JS look correct. */
.anim-fade-in    { animation: fade-in var(--dur-slow) var(--ease-out) both; }
.anim-slide-up   { animation: slide-up var(--dur-slow) var(--ease-out) both; }
.anim-slide-down { animation: slide-down var(--dur-slow) var(--ease-out) both; }
.anim-scale-in   { animation: scale-in var(--dur-slow) var(--ease-spring) both; }

/* Stagger helpers */
.anim-stagger > * { animation: slide-up var(--dur-slow) var(--ease-out) both; }
.anim-stagger > *:nth-child(1) { animation-delay: 0ms; }
.anim-stagger > *:nth-child(2) { animation-delay: 60ms; }
.anim-stagger > *:nth-child(3) { animation-delay: 120ms; }
.anim-stagger > *:nth-child(4) { animation-delay: 180ms; }
.anim-stagger > *:nth-child(5) { animation-delay: 240ms; }
.anim-stagger > *:nth-child(6) { animation-delay: 300ms; }
.anim-stagger > *:nth-child(7) { animation-delay: 360ms; }
.anim-stagger > *:nth-child(8) { animation-delay: 420ms; }

/* ============================================================
   UTILITY
   ============================================================ */
.grid-cards-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); }
.grid-cards-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
.grid-cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 1100px) {
  .grid-cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-cards-4, .grid-cards-3, .grid-cards-2 { grid-template-columns: 1fr; }
}

.stack { display: flex; flex-direction: column; }
.stack-2 { gap: var(--space-2); }
.stack-3 { gap: var(--space-3); }
.stack-4 { gap: var(--space-4); }
.stack-5 { gap: var(--space-5); }
.stack-6 { gap: var(--space-6); }
.stack-7 { gap: var(--space-7); }

.row { display: flex; align-items: center; }
.row-2 { gap: var(--space-2); }
.row-3 { gap: var(--space-3); }
.row-4 { gap: var(--space-4); }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.row-wrap { flex-wrap: wrap; }

.muted { color: var(--fg-3); }
.muted-strong { color: var(--fg-4); }
.text-right { text-align: right; }

/* Decorative aurora background for hero sections */
.aurora {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.aurora::before, .aurora::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}
.aurora::before {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #0066FF, transparent 70%);
  top: -100px; left: -80px;
}
.aurora::after {
  width: 320px; height: 320px;
  background: radial-gradient(circle, #00D4FF, transparent 70%);
  bottom: -120px; right: -60px;
}
[data-theme="dark"] .aurora::before, [data-theme="dark"] .aurora::after { opacity: 0.32; }
