/* Bodacker design system: tokens, layout, shared components.
   Buttons, header, radii and type follow the showcase site (website/, shadcn defaults)
   so the landing, login, signup and client space read as one product.
   Page-specific styles live in home.css (landing) and signup.css (onboarding). */

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-faint: #94a3b8;
  --color-muted-bg: #f1f5f9;
  --color-primary: hsl(207, 90%, 54%);
  --color-primary-dark: hsl(207, 90%, 44%);
  --color-primary-soft: hsla(207, 90%, 54%, 0.1);
  --color-border: #e2e8f0;
  --color-warning: #f59e0b;
  --color-warning-text: #b45309;
  --color-warning-soft: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-soft: #fee2e2;
  --color-success: #16a34a;
  --color-success-soft: #dcfce7;
  --color-violet: #6d28d9;
  --color-violet-soft: #ede9fe;
  --ring: hsla(207, 90%, 54%, 0.16);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 30px rgba(15, 23, 42, 0.06);
  --gradient-brand: linear-gradient(135deg, #2563eb, #0ea5e9);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: radial-gradient(900px 420px at 50% -80px, hsla(207, 90%, 54%, 0.16), transparent 70%), var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > .main { flex: 1 0 auto; }
body > .footer { flex-shrink: 0; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header: transparent and sticky; topbar.js adds .is-scrolled to show a blurred backdrop. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background-color 200ms, box-shadow 200ms;
}
.topbar.is-scrolled {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  padding: 0 2rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  justify-self: start;
  color: var(--color-primary);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 12px;
  background: var(--gradient-brand);
  color: #fff;
  transition: transform 150ms var(--ease);
}
.brand:hover .brand-icon { transform: scale(1.05); }
.brand:focus-visible, .topbar a:focus-visible, .topbar button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 4px; border-radius: 8px; }
.app-nav, .landing-nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.app-nav::-webkit-scrollbar { display: none; }
.nav-tab, .landing-nav a {
  flex-shrink: 0;
  padding: 0.5rem 0.9rem;
  border-radius: 12px;
  color: var(--color-muted);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms, background-color 150ms;
}
.nav-tab:hover, .landing-nav a:hover { color: var(--color-text); }
.nav-tab--active { background: var(--color-surface); color: var(--color-text); font-weight: 600; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07); }
.nav-account {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.nav-account form { margin: 0; }
.nav-user { max-width: 220px; overflow: hidden; color: var(--color-muted); text-overflow: ellipsis; white-space: nowrap; }
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 1rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #171717;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms;
}
.nav-link:hover { background: #f5f5f4; }
.nav-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.text-link {
  align-items: center;
  color: var(--color-primary);
  display: inline-flex;
  font-weight: 700;
  text-decoration: none;
}
.text-link:hover { color: var(--color-primary-dark); }

/* Buttons: the showcase site's buttons (6px radius, 44px tall, medium weight, flat). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms, box-shadow 150ms, opacity 150ms;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--color-primary); }
.btn-sm { min-height: 40px; padding: 0 1rem; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
.btn-primary:hover { background: hsla(207, 90%, 54%, 0.9); }
.btn-primary:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; }
.btn-secondary { background: var(--color-surface); color: #171717; box-shadow: inset 0 0 0 1px #e7e5e4; }
.btn-secondary:hover { background: #f5f5f4; }
.btn-ghost { background: transparent; color: var(--color-muted); padding: 0 0.75rem; }
.btn-ghost:hover { background: #f5f5f4; color: var(--color-text); }
.btn-danger { background: var(--color-surface); color: var(--color-danger); box-shadow: inset 0 0 0 1px #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--color-muted-bg);
  color: #334155;
}
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.badge-success { background: var(--color-success-soft); color: #15803d; }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning-text); }
.badge-example { background: var(--color-warning-soft); color: var(--color-warning-text); }
.badge-danger { background: var(--color-danger-soft); color: #b91c1c; }
.badge-violet { background: var(--color-violet-soft); color: var(--color-violet); }

/* Chip: small rounded label above a title. */
.chip {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Icon pastilles: white glyph on a coloured tile (see _icons.html). */
.ico {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 8px 16px -8px var(--tone-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.ico--lg { width: 52px; height: 52px; border-radius: 16px; }
.ico--md { width: 42px; height: 42px; border-radius: 13px; }
.ico--sm { width: 34px; height: 34px; border-radius: 11px; }
.ico--xs { width: 26px; height: 26px; border-radius: 8px; }
.ico--blue { background: var(--gradient-brand); --tone-shadow: rgba(37, 99, 235, 0.55); }
.ico--indigo { background: linear-gradient(135deg, #4f46e5, #2563eb); --tone-shadow: rgba(79, 70, 229, 0.55); }
.ico--amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); --tone-shadow: rgba(245, 158, 11, 0.55); }
.ico--red { background: linear-gradient(135deg, #dc2626, #ef4444); --tone-shadow: rgba(220, 38, 38, 0.5); }
.ico--green { background: linear-gradient(135deg, #16a34a, #22c55e); --tone-shadow: rgba(22, 163, 74, 0.5); }
.ico--slate { background: linear-gradient(135deg, #64748b, #94a3b8); --tone-shadow: rgba(100, 116, 139, 0.5); }
.ico-dot { position: absolute; top: -3px; right: -3px; width: 13px; height: 13px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2.5px #fff; }

/* Illustrated tiles: the large answer cards of the onboarding and the dashboard shortcuts. */
.tiles { display: grid; gap: 1.4rem; width: 100%; justify-content: center; }
.tiles--2 { grid-template-columns: repeat(2, minmax(0, 340px)); }
.tiles--3 { grid-template-columns: repeat(3, minmax(0, 280px)); }
.tiles--4 { grid-template-columns: repeat(4, minmax(0, 240px)); }
.tiles--fill { grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 14px 22px;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: inherit;
  font: inherit;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 160ms;
}
button.tile, label.tile { cursor: pointer; }
button.tile:hover, label.tile:hover { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 18px 40px rgba(15, 23, 42, 0.1); }
.tile:focus-visible, .tile:focus-within { outline: none; box-shadow: 0 0 0 4px var(--ring), var(--shadow-card); }
.tile.is-selected, .tile:has(input:checked) { border-color: var(--color-primary); transform: translateY(-6px); box-shadow: 0 24px 50px hsla(207, 90%, 54%, 0.25); }
.tile__art { display: grid; place-items: center; height: 150px; border-radius: 16px; background: linear-gradient(160deg, #eff6ff, #e0f2fe); transition: background 200ms; }
.tiles--4 .tile__art { height: 132px; }
.tile.is-selected .tile__art, .tile:has(input:checked) .tile__art { background: linear-gradient(160deg, #dbeafe, #bae6fd); }
.tile__art img { display: block; transition: transform 300ms var(--ease); }
button.tile:hover .tile__art img, label.tile:hover .tile__art img { transform: scale(1.04); }
.tile__body { display: block; }
.tile__title { display: block; margin-top: 18px; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.tile__desc { display: block; margin-top: 4px; font-size: 0.875rem; color: var(--color-muted); }
.tile__tick { position: absolute; z-index: 1; top: 22px; right: 22px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-primary); color: #fff; box-shadow: 0 0 0 4px #fff; transform: scale(0); transition: transform 260ms var(--ease); }
.tile.is-selected .tile__tick, .tile.is-done .tile__tick, .tile:has(input:checked) .tile__tick { transform: scale(1); }
.tile.is-done { border-color: hsla(142, 70%, 40%, 0.35); }
.tile.is-done .tile__tick { background: var(--color-success); }
.tile input[type="radio"], .tile input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.35rem; font-weight: 500; }
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="search"],
.field input[type="file"],
.field input[type="password"],
.field textarea,
.field select,
.input {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  font: inherit;
  color: inherit;
  transition: border-color 150ms, box-shadow 150ms;
}
.field input:focus, .field textarea:focus, .field select:focus, .input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.field-errors { color: var(--color-danger); margin: 0.35rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; }

/* Banners */
.banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.banner--success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.banner--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.banner--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.banner--warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1rem;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.text-muted { color: var(--color-muted); }

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* ===== Client space: dashboard, watchlist, alerts, import and billing ===== */
.app-shell { display: grid; gap: 1.25rem; padding: 1.5rem 0 5rem; }
/* Let grid children shrink below their content width so .table-wrap scrolls
   instead of pushing the page wider on small screens. */
.app-shell > * { min-width: 0; }
.app-shell .card { margin-bottom: 0; }
.app-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 0.5rem; }
.app-header > * { min-width: 0; }
.app-header h1 { margin: 12px 0 0; font-size: clamp(1.75rem, 3.6vw, 2.25rem); line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.app-header p { max-width: 60ch; margin: 6px 0 0; color: var(--color-muted); }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.back-link { justify-self: start; font-size: 0.9rem; color: var(--color-muted); text-decoration: none; }
.back-link:hover { color: var(--color-text); }
.section-title { margin: 0.75rem 0 0; padding: 0; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; }
.note { margin: 0; font-size: 0.875rem; color: var(--color-muted); }
.list-meta { margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--color-muted); }
.panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.panel-header h2 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 1rem; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }

/* Dashboard: getting-started tiles, ready line, figures and recent alerts. */
.tile--action .tile__body { display: flex; flex-direction: column; align-items: center; }
.tile--action .tile__body > form { max-width: 100%; }
.tile--action .btn { max-width: 100%; white-space: normal; }
.tile--action .tile__body > .btn, .tile--action .tile__body > form { margin-top: 16px; }
.tile__done { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-top: 16px; font-size: 0.875rem; font-weight: 600; color: var(--color-success); }
.tile__done::before { content: "✓"; }
.ready { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 14px 20px; border-radius: 18px; background: #f0fdf4; color: #15803d; font-weight: 600; }
.ready form { margin: 0; }
.ready .link-button { color: inherit; font-weight: 500; text-decoration-color: currentColor; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.kpi { display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-card); }
.kpi__text { min-width: 0; }
.kpi__text strong { display: block; font-size: 1.875rem; line-height: 1.05; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.kpi__text span { display: block; margin-top: 4px; font-size: 0.875rem; font-weight: 500; }
.kpi__text small { display: block; font-size: 0.78rem; color: var(--color-muted); }
.alert-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--color-border); }
.alert-row p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; font-size: 0.95rem; }
.alert-row small { color: var(--color-muted); font-size: 0.8rem; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 1rem 0.75rem 0.5rem; text-align: center; }
.empty-state__art { display: grid; place-items: center; width: 220px; height: 130px; border-radius: 18px; background: linear-gradient(160deg, #eff6ff, #e0f2fe); }
.empty-state h3 { margin: 1rem 0 0; font-size: 1.05rem; }
.empty-state p { max-width: 42ch; margin: 4px 0 1rem; font-size: 0.875rem; color: var(--color-muted); }

/* Tables; .table--stack turns rows into records on phones. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { padding: 10px 12px; border-bottom: 1px solid var(--color-border); text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-muted); white-space: nowrap; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 150ms; }
.table tbody tr:hover { background: #fafcff; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; }
.cell-icon { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.table-actions { text-align: right; }
.table-actions form { margin: 0; }
.btn-ghost-danger { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--color-danger); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.btn-ghost-danger:hover { background: #fef2f2; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1.25rem; }
.pagination-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border); color: var(--color-text); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.pagination-link:hover { box-shadow: inset 0 0 0 1px var(--color-faint); }
.pagination-info { font-size: 0.875rem; color: var(--color-muted); }

/* Watchlist search and add forms. */
.toolbar { display: grid; gap: 14px; margin-bottom: 1.1rem; }
.toolbar-search { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.searchbox { position: relative; flex: 1 1 260px; min-width: 0; }
.searchbox svg { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.searchbox .input { padding-left: 42px; }
.inline-form { display: grid; grid-template-columns: 1.1fr 1.4fr 1.2fr auto; align-items: end; gap: 10px; padding: 16px; border-radius: 18px; background: var(--color-muted-bg); }
.inline-form .field { margin-bottom: 0; }
.inline-form label { font-size: 0.85rem; }

/* Alert settings: a switch and one card per event, with the real radio/checkbox inside. */
.settings-form { display: grid; gap: 1.25rem; }
.switch-row { display: flex; align-items: center; gap: 14px; }
.switch-row__text { flex: 1; min-width: 0; cursor: pointer; }
.switch-row__text b { display: block; font-size: 1rem; }
.switch-row__text span { font-size: 0.875rem; color: var(--color-muted); }
.switch { position: relative; flex-shrink: 0; width: 52px; height: 30px; margin: 0; border-radius: 999px; background: #cbd5e1; appearance: none; cursor: pointer; transition: background-color 200ms; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2); transition: transform 220ms var(--ease); }
.switch:checked { background: var(--color-primary); }
.switch:checked::after { transform: translateX(22px); }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.event-settings { min-width: 0; margin: 0; padding: 0; border: 0; }
.event-settings legend { margin-bottom: 1rem; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.option { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid transparent; border-radius: 18px; background: var(--color-muted-bg); cursor: pointer; transition: border-color 150ms, background-color 150ms, box-shadow 150ms; }
.option:hover { background: #eaf1f9; }
.option:has(input:checked) { border-color: var(--color-primary); background: var(--color-surface); box-shadow: 0 10px 24px hsla(207, 90%, 54%, 0.16); }
.option:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option__text { flex: 1; min-width: 0; font-size: 0.95rem; font-weight: 600; overflow-wrap: anywhere; }
.option__mark { flex-shrink: 0; width: 20px; height: 20px; border: 2px solid #cbd5e1; border-radius: 50%; background: #fff; }
.option:has(input[type="checkbox"]) .option__mark { border-radius: 6px; }
.option:has(input:checked) .option__mark { border: 6px solid var(--color-primary); }
.option:has(input[type="checkbox"]:checked) .option__mark { border: 0; background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat; }

/* Import: dropzone and result figures. */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; padding: 34px 24px; border: 2px dashed #bfdbfe; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.75); text-align: center; cursor: pointer; transition: border-color 150ms, background-color 150ms; }
.dropzone:hover, .dropzone--active { border-color: var(--color-primary); background: var(--color-surface); }
.dropzone:focus-within { box-shadow: 0 0 0 4px var(--ring); }
.dropzone__art { display: grid; place-items: center; width: 230px; height: 150px; border-radius: 18px; background: linear-gradient(160deg, #eff6ff, #e0f2fe); }
.dropzone-title { margin-top: 18px; font-size: 1.2rem; letter-spacing: -0.02em; }
.dropzone-hint { max-width: 52ch; margin: 6px 0 18px; font-size: 0.875rem; color: var(--color-muted); }
.dropzone-file { margin: -6px 0 14px; padding: 4px 12px; border-radius: 999px; background: var(--color-primary-soft); color: var(--color-primary-dark); font-size: 0.85rem; font-weight: 600; }
/* Without upload.js the native file input stays visible; once enhanced, the styled button replaces it. */
.dropzone-input { max-width: 100%; }
.dropzone.is-enhanced .dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:not(.is-enhanced) .dropzone-button { display: none; }
.upload-submit { margin-top: 1rem; }
.upload-pending { display: flex; align-items: center; gap: 16px; }
.upload-pending p { margin: 0; font-weight: 600; }
.upload-pending small { color: var(--color-muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--color-primary-soft); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.summary-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 0; }
.summary-stats > div { display: flex; flex-direction: column-reverse; padding: 24px; border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-card); text-align: center; }
.summary-stats dt { margin-top: 8px; font-size: 0.875rem; color: var(--color-muted); }
.summary-stats dd { margin: 0; font-size: 2.75rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.summary-stats__ok dd { color: var(--color-success); }

/* Billing. */
.billing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.billing-column { display: grid; gap: 20px; }
.billing-card p, .billing-card form { margin: 0 0 0.85rem; }
.billing-card > :last-child { margin-bottom: 0; }

/* Footer */
.footer {
  padding: 1.75rem 0;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.9rem;
  background: var(--color-surface);
}
.footer .container {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

/* Focused screens: login, code verification and every onboarding step. */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1160px;
  margin: 0 auto;
  padding: 2.25rem 0 5rem;
  text-align: center;
  animation: screen-in 450ms var(--ease) both;
}
@keyframes screen-in { from { opacity: 0; transform: translateY(12px); } }
.screen-art {
  display: grid;
  place-items: center;
  width: 230px;
  height: 150px;
  margin-bottom: 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #dbeafe, #e0f2fe);
  box-shadow: 0 18px 40px hsla(207, 90%, 54%, 0.18);
}
.screen h1 {
  max-width: 860px;
  margin: 16px 0 0;
  font-size: clamp(1.9rem, 4.4vw, 2.6rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.screen-sub { max-width: 620px; margin: 10px 0 0; font-size: 1.05rem; color: var(--color-muted); text-wrap: pretty; overflow-wrap: anywhere; }
.screen-sub a, .screen-link a { color: var(--color-text); font-weight: 500; text-decoration-color: #cbd5e1; text-underline-offset: 3px; }
.screen-form { width: 100%; max-width: 460px; margin-top: 2rem; text-align: left; }
.screen-form .btn-primary { width: 100%; margin-top: 1.25rem; }
.screen .banner { width: 100%; max-width: 460px; margin: 1.25rem 0 0; text-align: left; }
.screen-link { margin: 1.4rem 0 0; font-size: 0.95rem; color: var(--color-muted); }
.field-xl {
  width: 100%;
  height: 56px;
  padding: 0 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 500;
  text-align: center;
  transition: border-color 150ms, box-shadow 150ms;
}
.field-xl::placeholder { color: var(--color-faint); font-weight: 400; }
.field-xl:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--ring); }

/* Six-digit code boxes (enhanced by signup-otp.js; the plain code field is the fallback). */
.signup-otp-fields { margin: 0; padding: 0; border: 0; }
.signup-otp-fields legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.signup-otp-digits { display: flex; justify-content: center; gap: 12px; }
.signup-otp-digit {
  width: 62px;
  height: 72px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  font: inherit;
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  transition: border-color 150ms, box-shadow 150ms;
}
.signup-otp-digit:nth-child(3) { margin-right: 14px; }
.signup-otp-digit:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--ring); }
.signup-otp-digit[aria-invalid="true"] { border-color: var(--color-danger); }
.code-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; margin-top: 1.25rem; font-size: 0.95rem; }
.code-actions form { margin: 0; }
.link-button { padding: 0; border: 0; background: none; color: var(--color-muted); font: inherit; text-decoration: underline; text-decoration-color: #cbd5e1; text-underline-offset: 3px; cursor: pointer; }
.link-button:hover, .code-actions a:hover { color: var(--color-text); }
.code-actions a { color: var(--color-muted); text-decoration-color: #cbd5e1; text-underline-offset: 3px; }

/* ===== Responsive ===== */
/* Desktop first; tiles, tables and the header reflow for tablets (900px) and phones (640px). */
@media (max-width: 1060px) {
  .inline-form { grid-template-columns: 1fr 1fr; }
  .inline-form .btn { grid-column: 1 / -1; }
  .tiles--4 { grid-template-columns: repeat(2, minmax(0, 280px)); }
}

@media (max-width: 900px) {
  /* Three tiles side by side become a list of horizontal tiles. */
  .tiles--3, .tiles--fill { grid-template-columns: minmax(0, 560px); gap: 14px; }
  .tiles--fill { grid-template-columns: minmax(0, 1fr); }
  .tiles--3 .tile, .tiles--fill .tile { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; column-gap: 18px; padding: 10px 48px 10px 10px; text-align: left; border-radius: 20px; }
  .tiles--3 .tile__art, .tiles--fill .tile__art { height: 88px; border-radius: 14px; }
  .tiles--3 .tile__art img, .tiles--fill .tile__art img { width: 108px; height: 76px; }
  .tiles--3 .tile__title, .tiles--fill .tile__title { margin-top: 0; font-size: 1rem; }
  .tiles--3 .tile__tick, .tiles--fill .tile__tick { top: 50%; right: 14px; margin-top: -13px; width: 26px; height: 26px; }
  .tiles--3 .tile.is-selected, .tiles--3 .tile:has(input:checked) { transform: none; }
  /* The section links of the landing collapse; app tabs move to a scrollable second row. */
  .landing-nav { display: none; }
  .topbar-inner { padding: 0 1.25rem; }
  .topbar-inner--app { grid-template-columns: auto 1fr; row-gap: 0.25rem; padding-bottom: 0.5rem; }
  .topbar-inner--app .app-nav { grid-column: 1 / -1; grid-row: 2; }
  .topbar-inner--app .nav-account { grid-column: 2; }
  .kpis, .billing-grid { grid-template-columns: minmax(0, 1fr); }
  .tiles--fill .tile--action .tile__body { align-items: flex-start; }
  .tiles--fill .tile--action .tile__body > .btn, .tiles--fill .tile--action .tile__body > form, .tiles--fill .tile__done { margin-top: 10px; }
}

@media (max-width: 760px) {
  /* Tables become stacked records; each cell shows its column name. */
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
  .table--stack tr:last-child { border-bottom: 0; }
  .table--stack td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  .table--stack td::before { content: attr(data-label); color: var(--color-muted); font-size: 0.8rem; text-align: left; }
  .table--stack .table-first { justify-content: flex-start; font-size: 0.95rem; font-weight: 600; text-align: left; }
  .table--stack .table-first::before, .table--stack .table-actions::before { display: none; }
  .table--stack .table-actions { justify-content: flex-end; }
  .tiles--2 { grid-template-columns: minmax(0, 420px); gap: 30px; }
}

@media (max-width: 640px) {
  .tiles--3, .tiles--4 { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tiles--4 .tile { display: grid; grid-template-columns: 96px 1fr; align-items: center; column-gap: 14px; padding: 10px 46px 10px 10px; text-align: left; border-radius: 20px; }
  .tiles--4 .tile__art { height: 80px; border-radius: 14px; }
  .tiles--4 .tile__art img { width: 100px; height: 70px; }
  .tiles--4 .tile__title { margin-top: 0; font-size: 1rem; }
  .tiles--4 .tile__tick { top: 50%; right: 14px; margin-top: -13px; width: 26px; height: 26px; }
  .tiles--4 .tile.is-selected, .tiles--4 .tile:has(input:checked) { transform: none; }
  .tiles--3 .tile, .tiles--fill .tile { grid-template-columns: 96px minmax(0, 1fr); column-gap: 14px; }
  .tiles--3 .tile__art, .tiles--fill .tile__art { height: 80px; }
  .tiles--3 .tile__art img, .tiles--fill .tile__art img { width: 100px; height: 70px; }
  .screen { padding: 1.25rem 0 4rem; }
  .screen-art { width: 180px; height: 118px; margin-bottom: 16px; }
  .screen-art img { width: 140px; height: 99px; }
  .field-xl { height: 52px; font-size: 1.1rem; }
  .signup-otp-digits { gap: 6px; }
  .signup-otp-digit { width: 44px; height: 56px; font-size: 1.35rem; border-radius: 8px; }
  .signup-otp-digit:nth-child(3) { margin-right: 6px; }
  .container { padding: 0 1rem; }
  .footer .container { align-items: flex-start; flex-direction: column; }
  .brand { font-size: 1.2rem; }
  .nav-user, .nav-avatar { display: none; }
  .topbar-inner { grid-template-columns: auto 1fr auto; min-height: 64px; padding: 0 1rem; }
  .topbar-inner--app { grid-template-columns: auto 1fr; }
  .nav-cta { display: none; }

  .app-shell { padding: 1rem 0 4rem; gap: 1rem; }
  .app-header .panel-actions, .app-header .panel-actions .btn { width: 100%; }
  .card { padding: 1rem; border-radius: var(--radius-lg); }
  .kpi { padding: 16px 18px; }
  .ready { grid-template-columns: auto minmax(0, 1fr); }
  .ready form { grid-column: 2; }
  .toolbar-search .btn { flex: 1 1 auto; }
  .inline-form { grid-template-columns: minmax(0, 1fr); }
  .option-grid { grid-template-columns: minmax(0, 1fr); }
  .dropzone__art, .empty-state__art { width: 180px; height: 118px; }
  .dropzone__art img, .empty-state__art img { width: 140px; height: 99px; }
  .summary-stats { gap: 8px; }
  .summary-stats > div { padding: 16px 8px; border-radius: 18px; }
  .summary-stats dd { font-size: 2rem; }
}

/* ===== Company details pop-up (dashboard, after payment) ===== */
.company-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.company-dialog:not([open]) { display: none; }
.company-dialog::backdrop { background: rgba(15, 23, 42, 0.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.company-dialog__form { position: relative; padding: 26px 28px 0; }
.company-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
}
.company-dialog__close:hover { background: #f5f5f4; color: var(--color-text); }
.company-dialog__close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.company-dialog__head { display: grid; justify-items: start; gap: 8px; margin-bottom: 18px; padding-right: 40px; }
.company-dialog__head h2 { margin: 4px 0 0; font-size: 1.375rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.company-dialog__head p { max-width: 46ch; margin: 0; color: var(--color-muted); font-size: 0.95rem; }
.company-dialog__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.company-dialog__fields .field--wide { grid-column: 1 / -1; }
.company-dialog__fields label { font-size: 0.85rem; font-weight: 600; color: #334155; }
.company-dialog__fields .field { margin-bottom: 0.75rem; }
.company-dialog__actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 0.75rem; margin: 0.5rem -28px 0; padding: 14px 28px 18px; border-top: 1px solid var(--color-border); background: var(--color-surface); }
.company-reminder { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border: 1px solid #bfdbfe; border-radius: var(--radius); background: #eff6ff; color: #1e3a8a; font-size: 0.9rem; }

@media (max-width: 640px) {
  /* Phones: the pop-up becomes a sheet anchored to the bottom of the screen. */
  .company-dialog { width: 100vw; max-width: 100vw; max-height: 92svh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .company-dialog__form { padding: 22px 16px 0; }
  .company-dialog__actions { margin-inline: -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .company-dialog__fields { grid-template-columns: minmax(0, 1fr); }
  .company-dialog__actions { flex-direction: column-reverse; }
  .company-dialog__actions .btn { width: 100%; }
}

/* ===== Phone app shell ===== */
/* The app tabs live in a bottom bar on phones; hidden above 640px. */
.app-tabbar { display: none; }

@media (max-width: 640px) {
  .topbar-inner--app { min-height: 60px; padding-bottom: 0; }
  .topbar-inner--app .app-nav { display: none; }
  .topbar-inner--app .nav-account .nav-link { font-size: 0.875rem; }

  .app-tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.06);
  }
  .app-tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 6px 2px;
    border-radius: 12px;
    color: var(--color-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .app-tabbar__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-tabbar__item.is-active { color: var(--color-primary-dark); font-weight: 600; background: var(--color-primary-soft); }
  .app-tabbar__item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
  body:has(.app-tabbar) { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

  /* Recent alerts: the status badge drops under the company. */
  .alert-row { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; }
  .alert-row > .badge, .alert-row > :last-child:not(div) { grid-column: 2; justify-self: start; }

  /* Stacked records: tighter, and long values wrap instead of overflowing. */
  .table--stack tr { padding: 10px 0; }
  .table--stack td { flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 3px 0; font-size: 0.875rem; }
  .table--stack td > * { max-width: 100%; }
  .table--stack td .badge { white-space: normal; text-align: left; }
  .table--stack .table-first { padding-bottom: 6px; font-size: 1rem; }
  .table--stack .table-actions { padding-top: 6px; }

  /* Watchlist: one compact card per company (SIREN and action, name, then details). */
  .table--watchlist tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 12px 0; }
  .table--watchlist td { display: block; width: auto; padding: 0; text-align: left; font-size: 0.8125rem; color: var(--color-muted); }
  .table--watchlist td::before { display: none; }
  .table--watchlist .table-first { flex: 1 1 auto; order: 1; padding: 0; color: var(--color-text); }
  .table--watchlist .table-actions { order: 2; padding: 0; }
  .table--watchlist .wl-label { flex: 1 1 100%; order: 3; margin-bottom: 4px; font-size: 0.9375rem; color: var(--color-text); }
  .table--watchlist .wl-ref { order: 4; }
  .table--watchlist .wl-ref::before { display: inline; content: attr(data-short) " "; font-size: inherit; }
  .table--watchlist .wl-ref.is-empty { display: none; }
  .table--watchlist .wl-source { order: 5; }
  .table--watchlist .wl-date { order: 6; }
  .table--watchlist .wl-date::before { display: inline; content: attr(data-label) " "; font-size: inherit; }

  /* Import result: the three counts side by side, actions full width. */
  .summary-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-stats > div { padding: 14px 6px; }
  .summary-stats dt { font-size: 0.8rem; }
  .panel-actions { width: 100%; }
  .panel-actions .btn { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
