/* csv2ld — custom design system layered on Pico.css
   Goal: a polished "motorsport telemetry" look — dark branded header, tinted
   canvas, elevated white cards, a confident red accent, and clean type. */

:root {
  /* palette */
  --bg-1: #eef1f6;
  --bg-2: #e5e9f2;
  --surface: #ffffff;
  --ink: #0b1220;
  --muted: #64748b;
  --line: #e4e8f0;
  --accent: #e11d48;
  --accent-hover: #be123c;
  --accent-soft: #fff1f3;
  --header: #0b1220;
  --header-ink: #e7ebf3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 12px 28px -14px rgba(16, 24, 40, 0.28);
  --radius: 14px;

  /* Pico overrides */
  --pico-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pico-border-radius: 10px;
  --pico-primary: var(--accent);
  --pico-primary-hover: var(--accent-hover);
  --pico-primary-focus: rgba(225, 29, 72, 0.25);
  --pico-primary-inverse: #ffffff;
  --pico-color: var(--ink);
  --pico-muted-color: var(--muted);
  --pico-form-element-spacing-vertical: 0.7rem;
  --pico-form-element-spacing-horizontal: 0.9rem;
  --pico-spacing: 1.1rem;
}

/* base canvas */
body {
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #fde7ec 0%, rgba(253, 231, 236, 0) 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
}
main.container { padding-block: 0 3rem; max-width: 1040px; }
h1, h2, h3 { letter-spacing: -0.02em; }
h1 { font-weight: 750; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--accent-soft); color: var(--accent-hover); }

/* ---------------- header ---------------- */
.site-header {
  background: var(--header);
  border-bottom: 1px solid #131c2e;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  margin-bottom: 2rem;
}
.site-header nav { padding-block: 0.55rem; }
.site-header nav a { color: var(--header-ink); }
.site-header nav a:hover { color: #fff; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; color: #fff; }
.brand-mark {
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 0.15rem 0.5rem;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 8px -2px rgba(225, 29, 72, 0.6);
}
.site-header .brand span:last-child { color: #aeb8cc; font-weight: 600; font-size: 0.92rem; }
.site-header .user-chip { color: #8b97ad; font-size: 0.88rem; }
.site-header nav ul:first-child li:not(:first-child) a { color: #c4ccdb; font-weight: 500; }
.site-header .secondary.outline {
  --pico-color: #c4ccdb;
  border-color: #2b3852;
  color: #c4ccdb;
  padding: 0.35rem 0.8rem;
}
.site-header .secondary.outline:hover { color: #fff; border-color: #3b4a68; background: #17223a; }

/* ---------------- cards ---------------- */
.card,
figure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 1.6rem 1.7rem; margin-bottom: 1.75rem; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.section-head h2 { margin: 0; }
.muted { color: var(--muted); }
.page-intro { margin-bottom: 1.5rem; }
.page-intro h1 { margin-bottom: 0.15rem; }

/* ---------------- buttons ---------------- */
button, [role="button"], input[type="submit"] { font-weight: 600; border-radius: 10px; }
.btn-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
a[role="button"] { text-decoration: none; }

/* ---------------- forms ---------------- */
.app-form label, .stacked-form label {
  display: block; font-weight: 600; font-size: 0.9rem; color: #334155; margin-bottom: 0.35rem;
}
.app-form input, .app-form select, .stacked-form input {
  display: block; width: 100%;
}
.app-form .field { margin-bottom: 1.05rem; }
.app-form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1.1rem; }
.app-form fieldset { border: 1px dashed var(--line); border-radius: 10px; padding: 1rem 1.1rem 0.2rem; margin: 0.4rem 0 1.1rem; }
.app-form legend { font-weight: 600; font-size: 0.85rem; color: var(--muted); padding: 0 0.4rem; }
.form-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.4rem; }

.toolbar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.toolbar form { margin: 0; display: flex; gap: 0.5rem; align-items: center; }
.toolbar input[type="file"] { margin: 0; }

/* ---------------- tables ---------------- */
figure { overflow: hidden; margin: 0; }
figure table { margin: 0; }
table thead th {
  background: #f7f8fb; color: #475569; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.03em; border-bottom: 1px solid var(--line);
}
table tbody tr { transition: background 0.12s ease; }
table tbody tr:hover { background: #fafbfe; }
table td, table th { padding: 0.7rem 0.9rem; vertical-align: middle; }
.row-actions { display: inline-flex; gap: 0.35rem; }
.row-actions button { margin: 0; padding: 0.15rem 0.6rem; font-size: 0.82rem; }
.empty-state { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-block; padding: 0.18rem 0.65rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; text-transform: capitalize;
  background: #eef2f7; color: #334155;
}
.badge-queued { background: #eef2f7; color: #475569; }
.badge-running { background: #e0edff; color: #1d4ed8; }
.badge-complete { background: #dcfce7; color: #15803d; }
.badge-failed { background: #ffe4e6; color: #be123c; }

/* ---------------- auth ---------------- */
.auth-shell { min-height: calc(100vh - 6rem); display: grid; place-items: center; padding: 1rem; }
.auth-card {
  width: 100%; max-width: 27rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 2.25rem 2.25rem 2rem;
  box-shadow: var(--shadow);
}
.auth-card .brand { justify-content: flex-start; margin-bottom: 0.6rem; }
.auth-card .brand .brand-mark { font-size: 1.05rem; padding: 0.25rem 0.6rem; }
.auth-card .subtitle { color: var(--muted); margin-bottom: 1.6rem; }
.auth-card button { width: 100%; margin-top: 0.6rem; }
.form-error {
  background: var(--accent-soft); color: var(--accent-hover); border: 1px solid #fecdd3;
  border-radius: 10px; padding: 0.65rem 0.85rem; font-size: 0.9rem; margin-bottom: 1.1rem;
}

/* dark theme softening */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-1: #0d1220; --bg-2: #0a0f1b; --surface: #121a2b; --ink: #e7ebf3;
    --muted: #93a0b8; --line: #22304a; --accent-soft: #2a1420;
  }
  :root:not([data-theme="light"]) table thead th { background: #16203350; color: #93a0b8; }
  :root:not([data-theme="light"]) table tbody tr:hover { background: #16203330; }
  :root:not([data-theme="light"]) .app-form label,
  :root:not([data-theme="light"]) .stacked-form label { color: #c4ccdb; }
}
