/* ---------------------------------------------------------------------------
   shadcn/ui, hand-written for vanilla pages.

   The import pages have no build step and no framework, so this is the shadcn
   default (slate) theme as plain CSS: the same HSL tokens, the same component
   anatomy - table, card, button, input, badge - under the same class names the
   React components render. Served at /ui/shadcn.css.
   --------------------------------------------------------------------------- */

:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --primary: 222.2 47.4% 11.2%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 72.2% 50.6%;
  --destructive-foreground: 210 40% 98%;
  --success: 142.1 76.2% 36.3%;
  --warning: 32.1 94.6% 43.7%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 222.2 84% 4.9%;
  --radius: 0.5rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- layout */

.shell { max-width: 72rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-lg { gap: 1.5rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----------------------------------------------------------- typography */

h1, h2, h3 { margin: 0; letter-spacing: -0.015em; font-weight: 600; }
h1 { font-size: 1.5rem; line-height: 2rem; }
h2 { font-size: 1.125rem; line-height: 1.75rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0; }
code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 0.8125rem; }
.xs { font-size: 0.75rem; }
.strong { font-weight: 500; }

/* ------------------------------------------------------------------- card */

.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.card-header { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.375rem; }
/* a header that carries an action keeps the text on the left and the button on the
   right, instead of inheriting the stacked layout */
.card-header.row-between { flex-direction: row; align-items: center; justify-content: space-between; }
.card-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.card-description { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.card-content { padding: 0 1.5rem 1.5rem; }
.card-content-flush { padding: 0; }

/* ------------------------------------------------------------------ table */

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; caption-side: bottom; font-size: 0.875rem; }
.table thead tr { border-bottom: 1px solid hsl(var(--border)); }
.table th {
  height: 3rem;
  padding: 0 1rem;
  text-align: left;
  vertical-align: middle;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}
.table td { padding: 0.875rem 1rem; vertical-align: middle; }
.table tbody tr { border-bottom: 1px solid hsl(var(--border)); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr[data-clickable] { cursor: pointer; }
.table tbody tr[data-clickable]:hover { background: hsl(var(--muted) / 0.5); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

/* ----------------------------------------------------------------- button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: hsl(var(--primary) / 0.9); }
.btn:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--input));
}
.btn-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }

/* ------------------------------------------------------------ form fields */

.label { display: block; font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.375rem; }
.input, .file {
  display: block;
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 0.875rem;
}
.input:focus-visible, .file:focus-visible {
  outline: 2px solid hsl(var(--ring)); outline-offset: 2px; border-color: hsl(var(--ring));
}
.file { height: auto; padding: 0.4375rem 0.75rem; }
.file::file-selector-button {
  margin: -0.4375rem 0.75rem -0.4375rem -0.75rem;
  padding: 0.4375rem 0.75rem;
  border: 0;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.field { display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ badge */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-outline { border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.badge-success { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.badge-warning { background: hsl(var(--warning) / 0.14); color: hsl(var(--warning)); }
.badge-destructive { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }

/* ------------------------------------------------------------ alert, misc */

.alert {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.alert-title { font-weight: 500; }
.alert-destructive {
  border-color: hsl(var(--destructive) / 0.4);
  background: hsl(var(--destructive) / 0.06);
  color: hsl(var(--destructive));
}
.alert-warning {
  border-color: hsl(var(--warning) / 0.4);
  background: hsl(var(--warning) / 0.07);
  color: hsl(var(--warning));
}
.alert-success {
  border-color: hsl(var(--success) / 0.35);
  background: hsl(var(--success) / 0.07);
  color: hsl(var(--success));
}

.spinner {
  width: 0.875rem; height: 0.875rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem;
              color: hsl(var(--muted-foreground)); margin-bottom: 0.75rem; }
.breadcrumb a:hover { color: hsl(var(--foreground)); }
