:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;
  --red-50: #fef2f2;
  --red-200: #fecaca;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --amber-50: #fffbeb;
  --amber-200: #fde68a;
  --amber-700: #b45309;
  --emerald-50: #ecfdf5;
  --emerald-200: #a7f3d0;
  --emerald-700: #047857;
}

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

html,
body,
#root {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--slate-100);
  color: var(--slate-950);
}

a {
  color: inherit;
}

.app-main {
  padding: 1rem;
}

.app-main--dense {
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  background: transparent;
  color: inherit;
  border: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--slate-300);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.row-actions--end {
  justify-content: flex-end;
}

.action-menu {
  position: relative;
}

.action-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: 0.75rem;
  background: #fff;
  color: var(--slate-700);
}

.action-menu-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 30;
  min-width: 10rem;
  border: 1px solid var(--slate-200);
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  padding: 0.35rem;
}

.action-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.65rem;
  color: var(--slate-700);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}

.action-menu-item:hover {
  background: var(--slate-50);
}

.action-menu-item--danger {
  color: var(--red-700);
}

.danger-link-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.danger-link-button {
  border: 1px solid var(--red-200);
  background: var(--red-50);
  color: var(--red-700);
}

.danger-button {
  border: 1px solid var(--red-700);
  background: var(--red-700);
  color: #fff;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-500);
  line-height: 0;
}

.toast-viewport {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  border-radius: 0.95rem;
  border: 1px solid var(--slate-200);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 0.85rem 1rem;
  backdrop-filter: blur(14px);
}

.toast--success {
  border-color: #bbf7d0;
}

.toast--error {
  border-color: #fecaca;
}

.toast-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate-950);
}

.toast-message {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--slate-500);
  line-height: 1.45;
}

.confirm-modal-panel {
  width: min(100%, 30rem);
  border-radius: 1.25rem;
  border: 1px solid var(--slate-200);
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  padding: 1.25rem;
}

.confirm-modal-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.page-shell-standard {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.overview-chart-card {
  overflow: hidden;
}

.overview-chart-card__header {
  padding: 1.5rem 1.5rem 0;
}

.overview-chart-scroll {
  overflow-x: auto;
  padding: 1rem 1.25rem 1.25rem;
}

.overview-chart {
  min-width: 720px;
  height: 240px;
  display: block;
}

.overview-empty-state {
  padding: 1.5rem;
  color: var(--slate-500);
  font-size: 0.875rem;
}

.overview-stat-card {
  padding: 1.5rem;
}

.overview-mini-card {
  padding: 1rem 1.125rem;
  border: 1px solid var(--slate-100);
  border-radius: 1rem;
  background: var(--slate-50);
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--slate-200);
  border-radius: 0.75rem;
  background: #fff;
  color: var(--slate-600);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.settings-tab:hover {
  background: var(--slate-50);
  color: var(--slate-950);
}

.settings-tab--active {
  border-color: var(--slate-950);
  background: var(--slate-950);
  color: #fff;
}

.action-link {
  text-decoration: none;
}

.auth-shell,
.wizard-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card,
.wizard-card {
  width: min(100%, 42rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
}

.auth-frame {
  --auth-primary-width: min(65%, 18rem);
  width: min(100%, 36rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.auth-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-brand {
  width: var(--auth-primary-width);
  height: auto;
  object-fit: contain;
}

.auth-actions {
  width: var(--auth-primary-width);
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-dev-panel {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.wizard-steps {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.wizard-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.875rem;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  border: 1px solid var(--slate-200);
  border-radius: 1rem;
  background: var(--slate-50);
}

.wizard-step__status {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--slate-300);
  background: #fff;
  color: var(--slate-700);
  font-size: 0.875rem;
  font-weight: 600;
}

.wizard-step__status--complete {
  border-color: var(--emerald-200);
  background: var(--emerald-50);
  color: var(--emerald-700);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem;
  background: rgba(2, 6, 23, 0.45);
}

.drawer-overlay--modal {
  align-items: center;
  justify-content: center;
}

.drawer-panel {
  width: min(100%, 42rem);
  height: calc(100vh - 1.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
}

.drawer-panel--modal {
  height: auto;
  max-height: calc(100vh - 1.5rem);
}

.drawer-panel--compact {
  width: min(100%, 32rem);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--slate-200);
}

.drawer-close {
  flex-shrink: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.table-dominant-shell {
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 20px rgba(15, 23, 42, 0.06);
}

.table-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.table-toolbar--stacked {
  gap: 0.5rem;
}

.table-toolbar-meta {
  min-width: 0;
}

.table-page-fill {
  min-height: calc(100vh - 1rem);
  display: flex;
  flex-direction: column;
}

.full-body-table {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.table-scroll-region {
  flex: 1;
}

.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.self-start { align-self: flex-start; }

.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.min-h-full { min-height: 100%; }
.min-w-0 { min-width: 0; }
.max-w-md { max-width: 28rem; }
.w-fit { width: fit-content; }
.w-full { width: 100%; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.border,
.border-b,
.border-r {
  border-style: solid;
}

.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-r { border-right-width: 1px; }

.border-slate-100 { border-color: var(--slate-100); }
.border-slate-200 { border-color: var(--slate-200); }
.border-slate-700 { border-color: var(--slate-700); }
.border-slate-800 { border-color: var(--slate-800); }
.border-red-200 { border-color: var(--red-200); }
.border-amber-200 { border-color: var(--amber-200); }
.border-emerald-200 { border-color: var(--emerald-200); }

.bg-transparent { background: transparent; }
.bg-white { background: #fff; }
.bg-slate-50 { background: var(--slate-50); }
.bg-slate-100 { background: var(--slate-100); }
.bg-slate-900 { background: var(--slate-900); }
.bg-slate-950 { background: var(--slate-950); }
.bg-red-50 { background: var(--red-50); }
.bg-amber-50 { background: var(--amber-50); }
.bg-emerald-50 { background: var(--emerald-50); }

.text-left { text-align: left; }
.text-right { text-align: right; }
.text-white { color: #fff; }
.text-red-600 { color: var(--red-600); }
.text-red-700 { color: var(--red-700); }
.text-slate-50 { color: var(--slate-50); }
.text-slate-200 { color: var(--slate-200); }
.text-slate-100 { color: var(--slate-100); }
.text-slate-300 { color: var(--slate-300); }
.text-slate-400 { color: var(--slate-400); }
.text-slate-500 { color: var(--slate-500); }
.text-slate-600 { color: var(--slate-600); }
.text-slate-700 { color: var(--slate-700); }
.text-slate-900 { color: var(--slate-900); }
.text-slate-950 { color: var(--slate-950); }
.text-amber-700 { color: var(--amber-700); }
.text-emerald-700 { color: var(--emerald-700); }

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.leading-6 { line-height: 1.5rem; }
.tracking-tight { letter-spacing: -0.025em; }
.uppercase { text-transform: uppercase; }

.shadow-card { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08); }
.shadow-sm { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }

.transition {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.outline-none {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-8 { padding-top: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-auto { margin-top: auto; }
.mb-4 { margin-bottom: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }

[class~="placeholder:text-slate-400"]::placeholder { color: var(--slate-400); }
[class~="focus:border-slate-300"]:focus { border-color: var(--slate-300); }
[class~="focus:ring-2"]:focus,
[class~="focus:ring-slate-950/10"]:focus {
  box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.1);
}

[class~="hover:bg-slate-50"]:hover { background: var(--slate-50); }
[class~="hover:bg-slate-800"]:hover { background: var(--slate-800); }
[class~="hover:text-white"]:hover { color: #fff; }
[class~="last:border-0"]:last-child { border-bottom-width: 0; }
[class~="tracking-[0.18em]"] { letter-spacing: 0.18em; }
[class~="tracking-[0.2em]"] { letter-spacing: 0.2em; }
[class~="min-h-[96px]"] { min-height: 96px; }

.range-filter-thumb::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  border: 2px solid var(--slate-950);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
  cursor: pointer;
}

.range-filter-thumb::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  border: 2px solid var(--slate-950);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
  cursor: pointer;
}

@media (min-width: 640px) {
  .app-main {
    padding: 1.5rem;
  }

  .app-main--dense {
    padding: 0;
  }

  .table-page-fill {
    min-height: calc(100vh - 1.5rem);
  }

  .page-actions {
    justify-content: flex-end;
  }

  .table-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  [class~="sm:flex-row"] { flex-direction: row; }
  [class~="sm:grid-cols-2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [class~="sm:items-center"] { align-items: center; }
  [class~="sm:items-end"] { align-items: flex-end; }
  [class~="sm:justify-between"] { justify-content: space-between; }
  [class~="sm:p-6"] { padding: 1.5rem; }
  [class~="sm:w-72"] { width: 18rem; }
  [class~="sm:w-auto"] { width: auto; }
}

@media (min-width: 768px) {
  [class~="md:grid-cols-2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .app-main {
    padding: 2rem;
  }

  .app-main--dense {
    padding: 0;
  }

  .table-page-fill {
    min-height: calc(100vh - 1.75rem);
  }

  [class~="lg:grid"] { display: grid; }
  [class~="lg:grid-cols-2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [class~="lg:grid-cols-3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  [class~="lg:grid-cols-4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  [class~="lg:grid-cols-[280px_minmax(0,1fr)]"] { grid-template-columns: 280px minmax(0, 1fr); }
  [class~="lg:col-span-2"] { grid-column: span 2 / span 2; }
  [class~="lg:sticky"] { position: sticky; }
  [class~="lg:top-0"] { top: 0; }
  [class~="lg:h-screen"] { height: 100vh; }
  [class~="lg:self-start"] { align-self: flex-start; }
  [class~="lg:overflow-y-auto"] { overflow-y: auto; }
  [class~="lg:border-b-0"] { border-bottom-width: 0; }
  [class~="lg:border-r"] { border-right-width: 1px; border-right-style: solid; }
  [class~="lg:p-8"] { padding: 2rem; }
}

@media (min-width: 1280px) {
  [class~="xl:grid-cols-4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  [class~="xl:grid-cols-[minmax(0,1.4fr)_minmax(320px,0.9fr)]"] { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr); }
  [class~="xl:grid-cols-[minmax(0,1.5fr)_minmax(360px,0.9fr)]"] { grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.9fr); }
  [class~="xl:grid-cols-[minmax(0,1.6fr)_minmax(360px,0.9fr)]"] { grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.9fr); }
}
