/* Hand-written Tailwind subset. Used as the shipped bundle until/unless a
 * full Tailwind rebuild replaces it. Only the classes the templates actually
 * use are defined here — keep this file close to that set. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: #e2e8f0;
  background: linear-gradient(135deg, #0b1120 0%, #0f172a 45%, #1e1b4b 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Layout ---------------------------------------------------------------- */
.min-h-screen { min-height: 100vh; }
.max-w-md   { max-width: 28rem; }
.max-w-4xl  { max-width: 56rem; }
.max-w-5xl  { max-width: 64rem; }
.mx-auto    { margin-left: auto; margin-right: auto; }
.min-w-0    { min-width: 0; }
.w-full     { width: 100%; }
.shrink-0   { flex-shrink: 0; }
.flex-1     { flex: 1 1 0%; }

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

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.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-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.ml-auto { margin-left: auto; }
.mt-auto { margin-top: auto; }

.space-y-0\.5 > * + * { margin-top: 0.125rem; }
.space-y-1   > * + * { margin-top: 0.25rem; }
.space-y-2   > * + * { margin-top: 0.5rem; }
.space-y-3   > * + * { margin-top: 0.75rem; }
.space-y-4   > * + * { margin-top: 1rem; }
.space-y-5   > * + * { margin-top: 1.25rem; }

.flex      { display: flex; }
.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; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-x-3 { column-gap: 0.75rem; }
.gap-x-6 { column-gap: 1.5rem; }
.gap-x-8 { column-gap: 2rem; }
.gap-y-1 { row-gap: 0.25rem; }
.gap-y-2 { row-gap: 0.5rem; }
.gap-y-3 { row-gap: 0.75rem; }
.gap-y-4 { row-gap: 1rem; }

.grid      { display: grid; }
.block     { display: block; }
.inline-flex { display: inline-flex; align-items: center; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-span-2  { grid-column: span 2 / span 2; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.break-all    { word-break: break-all; }
.break-words  { overflow-wrap: break-word; word-break: break-word; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.list-decimal { list-style-type: decimal; }
.list-disc    { list-style-type: disc; }
.list-inside  { list-style-position: inside; }
.cursor-pointer    { cursor: pointer; }
.cursor-not-allowed{ cursor: not-allowed; }
.divide-y > * + * { border-top: 1px solid #1e293b; }

/* Typography ------------------------------------------------------------ */
.text-xs { font-size: 0.75rem;  }
.text-sm { font-size: 0.875rem; }
.text-base{ font-size: 1rem;    }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem;  }
.text-2xl{ font-size: 1.5rem;   }
.text-3xl{ font-size: 1.875rem; line-height: 2.25rem; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tracking-tight { letter-spacing: -0.015em; }
.tracking-wide  { letter-spacing: 0.04em; }
.leading-tight  { line-height: 1.2; }
.leading-snug   { line-height: 1.35; }
.uppercase { text-transform: uppercase; }
.underline { text-decoration: underline; }
.no-underline { text-decoration: none; }

/* Color palette --------------------------------------------------------- */
/* Slate family — the chrome of the dark theme. */
.bg-slate-50  { background: #f8fafc; }
.bg-slate-100 { background: #f1f5f9; }
.bg-slate-200 { background: #e2e8f0; }
.bg-slate-300 { background: #cbd5e1; }
.bg-slate-600 { background: #475569; }
.bg-slate-700 { background: #334155; }
.bg-slate-800 { background: #1e293b; }
.bg-slate-900 { background: #0f172a; }
.bg-slate-950 { background: #020617; }
.text-white       { color: #ffffff; }
.text-slate-100   { color: #f1f5f9; }
.text-slate-200   { color: #e2e8f0; }
.text-slate-300   { color: #cbd5e1; }
.text-slate-400   { color: #94a3b8; }
.text-slate-500   { color: #64748b; }
.text-slate-600   { color: #475569; }
.text-slate-700   { color: #334155; }
.text-slate-900   { color: #0f172a; }
.border-slate-200 { border-color: #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }
.border-slate-600 { border-color: #475569; }
.border-slate-700 { border-color: #334155; }
.border-slate-800 { border-color: #1e293b; }

/* Accent palettes — solid tints so the badge classes work without opacity. */
.bg-emerald-50  { background: #ecfdf5; }
.bg-emerald-500 { background: #10b981; }
.bg-emerald-600 { background: #059669; }
.bg-emerald-900 { background: #064e3b; }
.text-emerald-200 { color: #a7f3d0; }
.text-emerald-300 { color: #6ee7b7; }
.text-emerald-700 { color: #047857; }
.border-emerald-200 { border-color: #a7f3d0; }
.border-emerald-700 { border-color: #047857; }

.bg-sky-50  { background: #f0f9ff; }
.bg-sky-500 { background: #0ea5e9; }
.bg-sky-900 { background: #0c4a6e; }
.text-sky-200 { color: #bae6fd; }
.text-sky-300 { color: #7dd3fc; }
.text-sky-700 { color: #0369a1; }
.border-sky-700 { border-color: #0369a1; }

.bg-rose-50  { background: #fff1f2; }
.bg-rose-900 { background: #881337; }
.text-rose-200 { color: #fecdd3; }
.text-rose-300 { color: #fda4af; }
.text-rose-400 { color: #fb7185; }
.text-rose-700 { color: #be123c; }
.border-rose-200 { border-color: #fecdd3; }
.border-rose-700 { border-color: #be123c; }

.bg-amber-50  { background: #fffbeb; }
.bg-amber-900 { background: #78350f; }
.text-amber-200 { color: #fde68a; }
.text-amber-300 { color: #fcd34d; }
.text-amber-700 { color: #b45309; }
.text-amber-800 { color: #92400e; }
.border-amber-200 { border-color: #fde68a; }
.border-amber-700 { border-color: #b45309; }

.bg-blue-600 { background: #2563eb; }
.text-blue-300 { color: #93c5fd; }
.text-blue-600 { color: #2563eb; }
.text-indigo-300 { color: #a5b4fc; }

/* Borders, rings, shadows ---------------------------------------------- */
.border      { border-width: 1px; border-style: solid; }
.border-t    { border-top-width: 1px;    border-top-style: solid; }
.rounded     { 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;   }
.shadow-sm   { box-shadow: 0 1px 2px 0 rgba(0,0,0,0.20); }
.shadow      { box-shadow: 0 1px 3px 0 rgba(0,0,0,0.30), 0 1px 2px -1px rgba(0,0,0,0.30); }
.shadow-md   { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.30), 0 2px 4px -2px rgba(0,0,0,0.30); }
.shadow-lg   { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.35), 0 4px 6px -4px rgba(0,0,0,0.30); }
.shadow-xl   { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.40), 0 8px 10px -6px rgba(0,0,0,0.30); }
.ring-1      { box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.18); } /* slate-400/18 */

/* Interactions ---------------------------------------------------------- */
a { color: inherit; }
a.no-underline:hover, .no-underline { text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; pointer-events: none; }

.transition { transition: all 150ms ease; }

.hover\:bg-slate-100:hover { background: #f1f5f9; }
.hover\:bg-slate-600:hover { background: #475569; }
.hover\:bg-slate-700:hover { background: #334155; }
.hover\:bg-slate-800:hover { background: #1e293b; }
.hover\:bg-emerald-400:hover { background: #34d399; }
.hover\:bg-emerald-500:hover { background: #10b981; }
.hover\:bg-blue-500:hover  { background: #3b82f6; }
.hover\:border-slate-500:hover { border-color: #64748b; }
.hover\:border-slate-600:hover { border-color: #475569; }
.hover\:text-white:hover  { color: #ffffff; }
.hover\:underline:hover   { text-decoration: underline; }

.disabled\:opacity-50:disabled { opacity: 0.5; }
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }
.disabled\:shadow-none:disabled { box-shadow: none; }

/* Forms ----------------------------------------------------------------- */
input[type="text"], input[type="password"] {
  font: inherit;
  color: #f1f5f9;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: 2px solid #60a5fa;
  outline-offset: -1px;
  border-color: #60a5fa;
}
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  color: #f1f5f9;
  background: #0b1120;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  padding: 0.75rem;
  width: 100%;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
       font-size: 0.85em; background: #0f172a; color: #e2e8f0;
       padding: 0 0.3rem; border-radius: 4px; }
details summary { user-select: none; }
hr { border: 0; border-top: 1px solid #334155; margin: 1rem 0; }

/* Cards / panels — used as a class pair like
 * `.surface .surface-elev` for the elevated dark card. */
.surface {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid #1e293b;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.55);
}
.surface-elev { background: rgba(30, 41, 59, 0.85); }
.surface-light { background: rgba(255,255,255,0.94); color: #0f172a; }

/* Definition-list label/value rhythm. The colon is set in CSS so templates
 * stay clean ("Date" not "Date:") — this also keeps i18n cheap if labels
 * are ever translated. Wrapper divs let us group dt/dd into "field" tiles. */
dl dt::after { content: ":"; color: inherit; opacity: 0.85; }
dl.field-grid { display: grid; gap: 1rem 1.5rem; }
dl.field-grid > div { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
dl.field-grid dt {
  font-size: 0.7rem;
  font-weight: 500;
  color: #94a3b8;            /* slate-400 — slightly muted */
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
dl.field-grid dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: #f1f5f9;            /* slate-100 — contrasted value */
  line-height: 1.3;
  min-width: 0;
}
dl.field-grid dd a { color: #7dd3fc; }
dl.field-grid dd a:hover { color: #ffffff; }
dl.field-grid dd.truncate { display: block; }

/* For the detail page's traditional grid-cols-3 dl: keep the label/value
 * columns but apply consistent spacing and the colon suffix. */
dl.field-rows { display: grid; gap: 0.75rem 1rem; }

/* Buttons --------------------------------------------------------------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.875rem; font-weight: 600;
  color: #ffffff;
  background: #10b981;
  border-radius: 0.5rem;
  padding: 0.5rem 0.9rem;
  box-shadow: 0 8px 20px -10px rgba(16, 185, 129, 0.6);
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.btn-primary:hover { background: #34d399; transform: translateY(-1px); }
.btn-primary:disabled {
  background: #1e293b; color: #64748b; box-shadow: none; transform: none;
}

.btn-secondary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.875rem; font-weight: 500;
  color: #e2e8f0;
  background: #334155;
  border: 1px solid #475569;
  border-radius: 0.5rem;
  padding: 0.45rem 0.85rem;
  transition: background 150ms ease, border-color 150ms ease;
}
.btn-secondary:hover { background: #475569; border-color: #64748b; }

.btn-subtle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.875rem; font-weight: 500;
  color: #cbd5e1;
  background: transparent;
  border-radius: 0.5rem;
  padding: 0.45rem 0.75rem;
  transition: color 150ms ease, background 150ms ease;
}
.btn-subtle:hover { color: #ffffff; background: rgba(148,163,184,0.12); }

/* Stat chips (header) --------------------------------------------------- */
.stat-chip {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  font-size: 0.75rem; color: #cbd5e1;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #1e293b;
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
}
.stat-chip strong { font-size: 0.9rem; font-weight: 600; color: #ffffff; }
.stat-chip.is-ready strong { color: #6ee7b7; }
.stat-chip.is-refresh strong { color: #7dd3fc; }

/* Card row — horizontal/elongated dashboard row */
.card-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid #1e293b;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.55);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.card-row:hover {
  border-color: #475569;
  transform: translateY(-1px);
  box-shadow: 0 18px 35px -16px rgba(0,0,0,0.7);
}
@media (min-width: 768px) {
  .card-row { gap: 2rem; }
}

@media (min-width: 768px) {
  .card-row { flex-direction: row; align-items: center; }
  .md\:flex-row { flex-direction: row; }
  .md\:items-center { align-items: center; }
  .md\:text-right { text-align: right; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Status pill — base + per-variant classes from badgeForHealth. */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.28rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
}
.badge::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 9999px; background: currentColor; opacity: 0.85; flex-shrink: 0; }
.badge .badge-prefix {
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-right: 0.2rem;
}

/* Timeline on the source detail page — numbered, with a thin vertical rule. */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li {
  position: relative;
  padding-left: 1.25rem;
  padding-bottom: 1.25rem;
  border-left: 1px solid #334155;
}
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: -0.42rem;
  top: 0.35rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 9999px;
  background: #0f172a;
  border: 2px solid #475569;
}
.timeline > li > h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
}
.timeline > li > h4 { margin: 0; }

/* Errors banner (used on cards). */
.alert-error {
  font-size: 0.8rem;
  color: #fecaca;
  background: rgba(190, 18, 60, 0.15);
  border: 1px solid #be123c;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}
.alert-warning {
  font-size: 0.8rem;
  color: #fde68a;
  background: rgba(120, 53, 15, 0.18);
  border: 1px solid #b45309;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}
