/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ── CSS Reset (modern, lightweight) ───────────────────────────────
 * Replaces Simple.css defaults. Targets browser-native resets that
 * would otherwise conflict with Apple system colors and `[data-theme]`
 * token overrides. Based on moderncss.io reset patterns.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reset form elements to use CSS token colors (Simple.css sets its own) */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 1em;
  line-height: 1.5;
  color: var(--text);
}

/* Reset headings and paragraphs — no Simple.css margins */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  color: var(--text);
}

/* Lists — remove bullets, restore spacing only where app CSS needs it */
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

abbr[title] {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
}

/* Tables — Simple.css sets bold headers; app uses its own classes */
th {
  font-weight: normal;
}

small {
  font-size: inherit;
}

sub,
sup {
  position: relative;
  font-size: 0.75em;
  line-height: 0;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}
sup {
  top: -0.5em;
}

img,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

/* Inline SVGs — prevent line breaks (browsers default to display: inline-block) */
svg {
  display: inline;
  vertical-align: middle;
}

figure {
  margin: 0;
}

details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
hr {
  height: 0;
  color: var(--border);
  background-color: var(--border);
  border: 0;
}

@import "simulation.css";
@import "backoffice.css";
@import "llm_response.css";
@import "bug_report.css";

/* Apple System Colors — Light & Dark Theme */
:root {
  color-scheme: light;
  --font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* System Colors */
  --system-blue: #007aff;
  --system-green: #299a45;
  --system-green-light: #5ef383;
  --system-green-dark: #1b692e;

  --system-indigo: #5856d6;
  --system-orange: #ff9500;
  --system-pink: #ff2d55;
  --system-purple: #af52de;
  --system-red: #ff3b30;
  --system-teal: #30b0c7;
  --system-yellow: #ffcc00;

  /* Grays */
  --system-gray: #8e8e93;
  --system-gray-2: #aeaeb2;
  --system-gray-3: #c7c7cc;
  --system-gray-4: #d1d1d6;
  --system-gray-5: #e5e5ea;
  --system-gray-6: #f2f2f7;

  /* Radius */
  --radius-sf: 10px;
  --radius-card: 12px;
  --radius-button: 8px;

  /* App semantic tokens mapped to Apple system colors */
  --bg: #ffffff;
  --background: var(--bg);
  --surface: #f2f2f7;
  --surface-2: #ffffff;
  --text: #000000;
  --text-light: #3c3c43e6;
  --text-secondary: #555555;
  --text-muted: #3c3c434d;
  --text-tertiary: #8e8e93;
  --border: #c7c7cc;
  --border-soft: #d1d1d6;
  --border-light: #e5e5ea;
  --accent: var(--system-blue);
  --accent-bg: #f2f2f7;
  --accent-on: #ffffff;

  --ping-info-bg: var(--surface);
  --ping-info-border: var(--border-light);
  --ping-info-text: var(--text);
  --ping-error-text: var(--system-red);
  --ping-error-border: color-mix(in srgb, var(--system-red) 60%, transparent);
  --ping-danger-bg: #fff0f0;
  --ping-user-bubble-bg: #d9f0ff;
  --ping-user-bubble-text: #083a57;
  --ping-ai-bubble-bg: rgb(from var(--system-green) r g b / 0.65);
  --ping-ai-bubble-text: #1d1d1f;

  --ping-posture-beneficial-bg: #e9f9ee;
  --ping-posture-beneficial-fg: #1f7a3f;
  --ping-posture-beneficial-border: #8fd5a5;
  --ping-posture-detrimental-bg: #fdecec;
  --ping-posture-detrimental-fg: #a02323;
  --ping-posture-detrimental-border: #efb0b0;
  --ping-badge-override-bg: #ffedd5;
  --ping-badge-override-fg: #7a3412;
  --ping-badge-override-border: #fed7aa;
  --ping-feedback-banner-bg: #fef3c7;
  --ping-feedback-banner-fg: #92400e;
  --ping-feedback-banner-border: #fcd34d;
  --ping-feedback-switch-bg: #f59e0b;
  --ping-feedback-switch-border: #d97706;
  --ping-feedback-accent: #fde68a;
  --ping-chart-bg: color-mix(in srgb, rgb(255, 255, 255) 55%, transparent);
  --ping-override-dialog-backdrop: color-mix(
    in srgb,
    rgb(17, 24, 39) 45%,
    transparent
  );

  /* Typography tokens */
  --tracking-display: -0.015em;

  /* Space scale (4px grid × n) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Font size scale */
  --font-xs: 0.75rem; /* 12px */
  --font-sm: 0.875rem; /* 14px */
  --font-base: 1rem; /* 16px */
  --font-lg: 1.125rem; /* 18px */
  --font-xl: 1.25rem; /* 20px */
  --font-2xl: 1.5rem; /* 24px */
  --font-3xl: 2rem; /* 32px */
  --font-4xl: 2.5rem; /* 40px */

  /* Motion tokens — Apple-style deceleration curve */
  --motion-fast: 150ms;
  --motion-base: 220ms;
  --motion-slow: 400ms;
  --ease-standard: cubic-bezier(0.28, 0, 0.22, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --background: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #ffffff;
  --text-light: #ebebf599;
  --text-secondary: #98989d;
  --text-muted: #ebebf54d;
  --text-tertiary: #6e6e73;
  --border: #48484a;
  --border-soft: #3a3a3c;
  --border-light: #2c2c2e;
  --accent: #0a84ff;
  --accent-bg: #1c1c1e;
  --accent-on: #ffffff;

  --ping-error-text: #ff453a;
  --ping-error-border: #ff453a;
  --ping-danger-bg: #3a1a1a;
  --ping-user-bubble-bg: #264357;
  --ping-user-bubble-text: #d9f0ff;
  --ping-ai-bubble-bg: rgb(from var(--system-green) r g b / 0.65);
  --ping-ai-bubble-text: #f0f0f0;

  --ping-posture-beneficial-bg: #1f3d2a;
  --ping-posture-beneficial-fg: #b8f0c8;
  --ping-posture-beneficial-border: #3f8b58;
  --ping-posture-detrimental-bg: #4d2626;
  --ping-posture-detrimental-fg: #ffc8c8;
  --ping-posture-detrimental-border: #9b4d4d;
  --ping-badge-override-bg: color-mix(
    in srgb,
    rgb(124, 45, 18) 35%,
    transparent
  );
  --ping-badge-override-fg: #fed7aa;
  --ping-badge-override-border: color-mix(
    in srgb,
    rgb(234, 88, 12) 55%,
    transparent
  );
  --ping-feedback-banner-bg: #3d3520;
  --ping-feedback-banner-fg: #fbbf24;
  --ping-feedback-banner-border: #92400e;
  --ping-feedback-switch-bg: #b45309;
  --ping-feedback-switch-border: #f59e0b;
  --ping-feedback-accent: color-mix(
    in srgb,
    rgb(253, 230, 138) 18%,
    transparent
  );
  --ping-chart-bg: color-mix(in srgb, rgb(20, 20, 20) 50%, transparent);
  --ping-override-dialog-backdrop: color-mix(
    in srgb,
    rgb(0, 0, 0) 60%,
    transparent
  );
}

/* ── Skin system: [data-skin="apple"] duplicates :root tokens ────
 * Enables future alternate skins (e.g. Material, Fluent) via the
 * same `data-skin` attribute toggled by skin_controller.
 */
[data-skin="apple"] {
  color-scheme: light;
  --font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --system-blue: #007aff;
  --system-green: #299a45;
  --system-green-light: #5ef383;
  --system-green-dark: #1b692e;
  --system-indigo: #5856d6;
  --system-orange: #ff9500;
  --system-pink: #ff2d55;
  --system-purple: #af52de;
  --system-red: #ff3b30;
  --system-teal: #30b0c7;
  --system-yellow: #ffcc00;
  --system-gray: #8e8e93;
  --system-gray-2: #aeaeb2;
  --system-gray-3: #c7c7cc;
  --system-gray-4: #d1d1d6;
  --system-gray-5: #e5e5ea;
  --system-gray-6: #f2f2f7;
  --radius-sf: 10px;
  --radius-card: 12px;
  --radius-button: 8px;
  --bg: #ffffff;
  --background: var(--bg);
  --surface: #f2f2f7;
  --surface-2: #ffffff;
  --text: #000000;
  --text-light: #3c3c43e6;
  --text-secondary: #555555;
  --text-muted: #3c3c434d;
  --text-tertiary: #8e8e93;
  --border: #c7c7cc;
  --border-soft: #d1d1d6;
  --border-light: #e5e5ea;
  --accent: var(--system-blue);
  --accent-bg: #f2f2f7;
  --accent-on: #ffffff;
  --ping-info-bg: var(--surface);
  --ping-info-border: var(--border-light);
  --ping-info-text: var(--text);
  --ping-error-text: var(--system-red);
  --ping-error-border: color-mix(in srgb, var(--system-red) 60%, transparent);
  --ping-danger-bg: #fff0f0;
  --ping-user-bubble-bg: #d9f0ff;
  --ping-user-bubble-text: #083a57;
  --ping-ai-bubble-bg: rgb(from var(--system-green) r g b / 0.65);
  --ping-ai-bubble-text: #1d1d1f;
  --ping-posture-beneficial-bg: #e9f9ee;
  --ping-posture-beneficial-fg: #1f7a3f;
  --ping-posture-beneficial-border: #8fd5a5;
  --ping-posture-detrimental-bg: #fdecec;
  --ping-posture-detrimental-fg: #a02323;
  --ping-posture-detrimental-border: #efb0b0;
  --ping-badge-override-bg: #ffedd5;
  --ping-badge-override-fg: #7a3412;
  --ping-badge-override-border: #fed7aa;
  --ping-feedback-banner-bg: #fef3c7;
  --ping-feedback-banner-fg: #92400e;
  --ping-feedback-banner-border: #fcd34d;
  --ping-feedback-switch-bg: #f59e0b;
  --ping-feedback-switch-border: #d97706;
  --ping-feedback-accent: #fde68a;
  --ping-chart-bg: color-mix(in srgb, rgb(255, 255, 255) 55%, transparent);
  --ping-override-dialog-backdrop: color-mix(
    in srgb,
    rgb(17, 24, 39) 45%,
    transparent
  );
  --tracking-display: -0.015em;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --font-xs: 0.75rem;
  --font-sm: 0.875rem;
  --font-base: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 2rem;
  --font-4xl: 2.5rem;
  --motion-fast: 150ms;
  --motion-base: 220ms;
  --motion-slow: 400ms;
  --ease-standard: cubic-bezier(0.28, 0, 0.22, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-skin="apple"][data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --background: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #ffffff;
  --text-light: #ebebf599;
  --text-secondary: #98989d;
  --text-muted: #ebebf54d;
  --text-tertiary: #6e6e73;
  --border: #48484a;
  --border-soft: #3a3a3c;
  --border-light: #2c2c2e;
  --accent: #0a84ff;
  --accent-bg: #1c1c1e;
  --accent-on: #ffffff;
  --ping-error-text: #ff453a;
  --ping-error-border: #ff453a;
  --ping-danger-bg: #3a1a1a;
  --ping-user-bubble-bg: #264357;
  --ping-user-bubble-text: #d9f0ff;
  --ping-ai-bubble-bg: rgb(from var(--system-green) r g b / 0.65);
  --ping-ai-bubble-text: #f0f0f0;
  --ping-posture-beneficial-bg: #1f3d2a;
  --ping-posture-beneficial-fg: #b8f0c8;
  --ping-posture-beneficial-border: #3f8b58;
  --ping-posture-detrimental-bg: #4d2626;
  --ping-posture-detrimental-fg: #ffc8c8;
  --ping-posture-detrimental-border: #9b4d4d;
  --ping-badge-override-bg: color-mix(
    in srgb,
    rgb(124, 45, 18) 35%,
    transparent
  );
  --ping-badge-override-fg: #fed7aa;
  --ping-badge-override-border: color-mix(
    in srgb,
    rgb(234, 88, 12) 55%,
    transparent
  );
  --ping-feedback-banner-bg: #3d3520;
  --ping-feedback-banner-fg: #fbbf24;
  --ping-feedback-banner-border: #92400e;
  --ping-feedback-switch-bg: #b45309;
  --ping-feedback-switch-border: #f59e0b;
  --ping-feedback-accent: color-mix(
    in srgb,
    rgb(253, 230, 138) 18%,
    transparent
  );
  --ping-chart-bg: color-mix(in srgb, rgb(20, 20, 20) 50%, transparent);
  --ping-override-dialog-backdrop: color-mix(
    in srgb,
    rgb(0, 0, 0) 60%,
    transparent
  );
}

/* ── Page structure (replaces Simple.css container) ────────────── */
body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Content flow — paragraph and list margins (replacing Simple.css defaults) */
p,
ul:not(.site-nav-links):not(.no-margin),
ol:not(.no-margin) {
  margin: 0 0 1rem;
}
ul:not(.site-nav-links):not(.no-margin) > li,
ol:not(.no-margin) > li {
  margin-left: 1.25rem;
}
ul:not(.site-nav-links):not(.no-margin) {
  list-style: disc;
}
ol:not(.no-margin) {
  list-style: decimal;
}

/* Base link behavior (Simple.css provided blue underlined links) */
a {
  color: var(--accent);
  text-decoration: underline;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Base heading sizes (Simple.css defaults) */
h1 {
  font-size: 2rem;
  margin: 0 0 0.75rem;
  font-weight: 700;
  color: var(--text);
}
h2 {
  font-size: 1.6rem;
  margin: 0 0 0.6rem;
  font-weight: 600;
  color: var(--text);
}
h3 {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--text);
}
h4 {
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
  font-weight: 500;
  color: var(--text);
}
h5 {
  font-size: 1rem;
  margin: 0 0 0.3rem;
  font-weight: 500;
  color: var(--text);
}
h6 {
  font-size: 0.9rem;
  margin: 0 0 0.3rem;
  font-weight: 500;
  color: var(--text);
}

/* ── Table base styles (replacing Simple.css defaults) ─────────── */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

td,
th {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
  vertical-align: baseline;
}

th {
  background: var(--accent-bg);
  font-weight: 600;
}

tr:nth-child(even) {
  background: color-mix(in srgb, var(--accent-bg) 50%, transparent);
}

/* ── Form element baselines ──────────────────────────────────────── */
textarea,
select,
input {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  padding: 0.5em;
}

@import "components/_button.css";
@import "components/_auth.css";

/* Pending approval hero */
.hero-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 16rem);
  padding: 2rem 1rem;
}

.hero-card {
  text-align: center;
  max-width: 480px;
}

.hero-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.hero-card p {
  font-size: 1.0625rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  line-height: 1.6;
}

.hero-card .button {
  margin-top: 1.5rem;
}

/* ── Home page ──────────────────────────────────────────────────── */
.home-guest {
  padding: 4rem 0;
}

.home-hero {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 5rem;
}

.home-hero__title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 1rem;
  color: var(--text);
}

.home-hero__sub {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 2rem;
}

.home-hero__sub p {
  margin: 0 0 1rem;
}

.home-hero__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-button);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--motion-fast) var(--ease-out);
}

.home-cta--primary {
  background: var(--accent);
  color: var(--bg);
}

.home-cta--primary:hover {
  opacity: 0.9;
}

.home-cta--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.home-cta--secondary:hover {
  opacity: 0.85;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 720px;
  margin: 0 auto;
}

.home-feature {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
}

.home-feature svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
  margin-bottom: 1rem;
}

.home-feature h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.home-feature p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

/* Authenticated home */
.home-authenticated {
  padding: 3rem 0;
}

.home-welcome {
  margin-bottom: 2rem;
}

.home-welcome h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.home-welcome__sub {
  color: var(--muted);
  margin: 0;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.home-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  transition:
    border-color var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out);
}

.home-action-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 15%, transparent);
}

.home-action-card svg {
  color: var(--accent);
}

/* ── Inline code + pre blocks (Simple.css defaults) ─────────────── */
code {
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sf);
  padding: 1rem;
  overflow-x: auto;
}

/* ── Quick test form grid ───────────────────────────────────────── */

/* Target the wrapper div containing the label and textarea */
.quick-test-form-grid div:has(> label) {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Aligns the label tab to the left */
  margin-bottom: 1.2rem;
}

/* Style the label as a rounded tab */
.quick-test-form-grid div > label {
  background-color: var(--accent-bg); /* Matches header/footer background */
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;

  /* Top rounded corners only */
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;

  /* Optional: Border styling to cleanly blend into the textarea */
  border: 1px solid var(--border);
  border-bottom: none; /* Keeps it open to flow into the box below */

  /* Subtle adjustment to eliminate any hairline gaps */
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

/* Ensure the textarea drops cleanly below the tab */
.quick-test-form-grid div > label + br {
  display: none; /* Hides the <br> tag so Flexbox can do its job perfectly */
}

/* Fluid, Auto-Expanding Textarea */
.quick-test-form-grid div > textarea {
  margin-top: 0;
  border: 1px solid var(--border);
  border-top-left-radius: 0;
  position: relative;
  z-index: 0;

  /* Responsiveness fixes */
  width: 100%; /* Force it to span 100% of its parent div */
  max-width: 100%; /* Hard limit to prevent it from bursting past the screen */
  box-sizing: border-box; /* Includes padding/border within the 100% width math */

  /* NATIVE AUTO-EXPANSION (No JavaScript Required!) */
  field-sizing: content;

  /* Fallback: Allow user to still manually drag-resize vertically if they want */
  resize: vertical;
}

/* ==========================================================================
   5. UNIFIED CHECKBOX BOXES
   ========================================================================== */

/* Target the label when it acts as a wrapper for a checkbox */
div > label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem; /* Spacing between the checkbox square and the text */

  background-color: var(--accent-bg); /* Matches header/footer background */
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1rem;

  /* Fully enclosed rounded box */
  border: 1px solid var(--border);
  border-radius: 4px;

  cursor: pointer;
  user-select: none; /* Prevents accidental text highlighting on double click */
  transition:
    background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}

/* Subtle hover effect so the user knows the whole box is clickable */
div > label:has(input[type="checkbox"]):hover {
  background-color: color-mix(in srgb, rgb(0, 0, 0) 4%, transparent);
  border-color: var(--text);
}

[data-theme="dark"] div > label:has(input[type="checkbox"]):hover {
  background-color: color-mix(in srgb, rgb(255, 255, 255) 5%, transparent);
}

/* Clean up the native checkbox alignment inside the box */
div > label input[type="checkbox"] {
  margin: 0;
  width: 1rem;
  height: 1rem;
  vertical-align: middle;
  cursor: pointer;
}

@import "components/_chat.css";

/* ==========================================================================
    7. SIMULATION HEADER - ENHANCED CARD STYLES
   ========================================================================== */

.simulation-header {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px color-mix(in srgb, rgb(0, 0, 0) 4%, transparent);
  transition: box-shadow var(--motion-base) var(--ease-out);
}

.simulation-header:hover {
  box-shadow: 0 4px 16px color-mix(in srgb, rgb(0, 0, 0) 8%, transparent);
}

.simulation-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.simulation-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--accent);
}

.simulation-title-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: var(--tracking-display);
}

.simulation-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.simulation-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem;
  background: color-mix(in srgb, rgb(0, 0, 0) 2%, transparent);
  border-radius: 8px;
  transition: background var(--motion-fast) var(--ease-out);
}

.simulation-detail-item:hover {
  background: color-mix(in srgb, rgb(0, 0, 0) 4%, transparent);
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  color: var(--text);
}

.detail-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Dark mode adjustments for header */
[data-theme="dark"] .simulation-detail-item {
  background: color-mix(in srgb, rgb(255, 255, 255) 3%, transparent);
}

[data-theme="dark"] .simulation-detail-item:hover {
  background: color-mix(in srgb, rgb(255, 255, 255) 6%, transparent);
}

[data-theme="dark"] .simulation-header:hover {
  box-shadow: 0 4px 20px color-mix(in srgb, rgb(0, 0, 0) 30%, transparent);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .simulation-header {
    padding: 1rem 1.25rem;
  }

  .simulation-details-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .simulation-title-text {
    font-size: 1.2rem;
  }

  .simulation-icon {
    width: 1.6rem;
    height: 1.6rem;
  }
}

.sequence-heading {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  opacity: 0.9;
}

/* ── Password strength indicator ─────────────────────────────────── */
.ps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.ps-track {
  flex: 1;
  height: 4px;
  background: var(--border-soft);
  border-radius: 2px;
  overflow: hidden;
}

.ps-bar {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition:
    width var(--motion-base) var(--ease-out),
    background var(--motion-fast) var(--ease-out);
}

.ps-bar--weak {
  background: var(--system-red);
}
.ps-bar--fair {
  background: var(--system-orange);
}
.ps-bar--good {
  background: var(--system-yellow);
}
.ps-bar--strong {
  background: var(--system-green);
}

.ps-label {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 3rem;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ps-bar--weak + .ps-label {
  color: var(--system-red);
}
.ps-bar--fair + .ps-label {
  color: var(--system-orange);
}
.ps-bar--good + .ps-label {
  color: #9a7a00;
}
.ps-bar--strong + .ps-label {
  color: var(--system-green);
}

/* ── Step indicator (password reset flow) ────────────────────────── */
.step-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}

.step-indicator__step {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.step-indicator__step--active {
  color: var(--text);
  font-weight: 600;
}

.step-indicator__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--border-soft);
  color: var(--muted);
}

.step-indicator__step--active .step-indicator__dot {
  background: var(--accent);
  color: var(--bg);
}

.step-indicator__dot--done {
  background: var(--system-green);
  color: var(--accent-on);
}

.step-indicator__connector {
  width: 1.5rem;
  height: 1px;
  background: var(--border);
}

/* ── Hero card refinements ───────────────────────────────────────── */
.hero-card__icon {
  display: block;
  margin: 0 auto 1.5rem;
}

.hero-card__lead {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

.hero-card__note {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

/* ── Static page card (about, contact) ────────────────────────────── */
.page-card {
  max-width: 600px;
  margin: 3rem auto;
  padding: 2rem;
}

.page-card__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.page-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  text-align: center;
}

.page-card__link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-card__link:hover {
  color: var(--accent-hover);
}

.page-text {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.page-text:last-child {
  margin-bottom: 0;
}

/* ── Dashboard stats grid ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

@import "components/_flash.css";

@import "components/_nav.css";
@import "components/_footer.css";

/* ── Simulation index (Phase 3.1) ─────────────────────────────────── */
.sim-index {
  padding: 1.5rem 0 3rem;
}

.sim-index__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.sim-index__title {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sim-index__actions {
  display: flex;
  gap: 0.5rem;
}

.sim-index__btn {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-button);
  font-size: 0.85rem;
  font-weight: 510;
  text-decoration: none;
  transition:
    background-color var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
  cursor: pointer;
  line-height: 1;
}

.sim-index__btn:hover {
  text-decoration: none;
}

.sim-index__btn:active {
  transform: scale(0.97);
}

.sim-index__btn--primary {
  background: var(--accent);
  color: var(--accent-on);
}

.sim-index__btn--primary:hover {
  background: var(--accent-hover);
}

.sim-index__btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.sim-index__btn--secondary:hover {
  background: var(--border);
}

/* Filter bar */
.sim-index__filter {
  margin-bottom: 1.25rem;
}

.sim-index__filter-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sf);
  padding: 0.5rem 0.75rem;
  transition: border-color var(--motion-fast) var(--ease-out);
}

.sim-index__filter-inner:focus-within {
  border-color: var(--accent);
}

.sim-index__filter-icon {
  flex-shrink: 0;
  color: var(--muted);
  width: 16px;
  height: 16px;
}

.sim-index__filter-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.sim-index__filter-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sim-index__filter-input::placeholder {
  color: var(--muted);
}

@media (max-width: 480px) {
  .sim-index__filter-input::placeholder {
    color: transparent;
  }
}

.sim-index__filter-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--motion-fast) var(--ease-out);
  padding: 0;
  line-height: 1;
}

.sim-index__filter-clear:hover {
  background: var(--muted);
  color: var(--bg);
}

/* Sort controls */
.sim-index__sort {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.sim-index__sort-select {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sf);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color var(--motion-fast) var(--ease-out);
}

.sim-index__sort-select:focus-visible {
  border-color: var(--accent);
}

.sim-index__sort-direction {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sf);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition:
    background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}

.sim-index__sort-direction:hover {
  background: var(--surface);
  border-color: var(--muted);
}

.sim-index__sort-direction:focus-visible {
  border-color: var(--accent);
  outline: none;
}

/* Card grid */
.sim-index__grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .sim-index__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .sim-index__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Single simulation card */
.sim-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  transition:
    box-shadow var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
  cursor: pointer;
}

/* Allow cards to shrink inside CSS Grid columns to prevent horizontal overflow */
.sim-card,
.sim-index__grid > * {
  min-width: 0;
  max-width: 100%;
}

.sim-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px color-mix(in srgb, rgb(0, 0, 0) 6%, transparent);
  text-decoration: none;
  transform: translateY(-1px);
}

.sim-card:active {
  transform: scale(0.98);
}

.sim-card[hidden] {
  display: none;
}

.sim-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.sim-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-card__chevron {
  flex-shrink: 0;
  color: var(--muted);
  margin-top: 0.2rem;
  transition: transform var(--motion-fast) var(--ease-out);
}

.sim-card:hover .sim-card__chevron {
  color: var(--accent);
  transform: translateX(2px);
}

.sim-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
  min-width: 0;
}

.sim-card__detail {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
}

.sim-card__detail svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--muted);
}

.sim-card__detail span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-card__detail--muted {
  color: var(--muted);
  font-size: 0.75rem;
}

.sim-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-soft);
}

.sim-card__date {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.sim-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-weight: 510;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent), transparent 88%);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Empty state */
.sim-index__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px dashed var(--border);
}

.sim-index__empty-icon {
  color: var(--muted);
  margin-bottom: 1rem;
  opacity: 0.6;
}

.sim-index__empty-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.sim-index__empty-desc {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: 320px;
}

/* ── Load More ──────────────────────────────────────────────── */
.sim-index__load-more {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 1rem 0 2rem;
}

.load-more__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sf);
  font-size: 0.875rem;
  font-weight: 510;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}

.load-more__btn:hover {
  background: var(--border-soft);
}

.load-more__btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.load-more__spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: load-more-spin 0.6s linear infinite;
}

@keyframes load-more-spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-dots span {
  animation: loading-dot 1s steps(1) infinite;
  opacity: 0;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}
.loading-dots span:nth-child(2) {
  animation-delay: 0.33s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0.66s;
}

@keyframes loading-dot {
  50% {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .sim-index__load-more {
    padding: 0.75rem 0 1.5rem;
  }
}

/* ── Page Card (structured content pages) ────────────────────── */
.page-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.page-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  margin: 0 0 0.5rem;
}

.page-card hr {
  margin: 1.25rem 0;
}

.page-card--danger {
  border-color: var(--ping-error-border);
  background: var(--ping-danger-bg);
}

.page-card--danger strong {
  color: var(--ping-error-text);
}

/* ── Beta Banner ──────────────────────────────────────────────── */
.beta-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 2.5rem;
  background: var(--ping-danger-bg);
  border-bottom: 1px solid var(--ping-error-border);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
  position: relative;
}

.beta-banner__text {
  flex: 1;
}

.beta-banner__text strong {
  color: var(--ping-error-text);
}

.beta-banner__link {
  color: var(--ping-error-text);
  text-decoration: underline;
  font-weight: 600;
}

.beta-banner__link:hover {
  text-decoration: none;
}

.beta-banner__close {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.125rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.beta-banner__close:hover {
  opacity: 1;
}

/* ── Impersonation Banner ────────────────────────────────────── */
.impersonation-banner {
  background: var(--accent-warning, #f59e0b);
  color: #1a1a1a;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.impersonation-banner__btn {
  background: #1a1a1a;
  color: #fff;
  border: none;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
}

.impersonation-banner__btn:hover {
  opacity: 0.9;
}

/* ── General Feedback Thread ─────────────────────────────────── */
.gf-thread {
  border: 1px solid var(--border);
  border-radius: var(--radius-sf);
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: var(--bg);
}

/* ── GF Thread Pagination ─────────────────────────────────── */
.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 0 0.25rem;
  font-size: 0.875rem;
}
.pagination-nav--top {
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--border, #e0e0e0);
  margin-bottom: 0.75rem;
  justify-content: center;
}
.pagination-info {
  color: var(--text-muted, #888);
}
.pagination-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.pagination-link:hover {
  text-decoration: underline;
}
.pagination-link--recent {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ── Tech Download Link ─────────────────────────────────── */
.tech-download-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
}
.tech-download-link:hover {
  text-decoration: underline;
}

@import "components/_form.css";
@import "components/_cards.css";

@import "components/_steps.css";

/* ── Utilities (no-Tailwind helpers) ─────────────────────────────── */
.icon-inline {
  vertical-align: middle;
  margin-right: 4px;
}
.icon-inline--gap {
  vertical-align: middle;
  margin-right: 6px;
}
.hidden {
  display: none;
}
.text-error {
  color: var(--ping-error-text);
}
.icon-inline--after {
  vertical-align: middle;
  margin-left: 2px;
}
.pointer-events-none {
  pointer-events: none;
}
.w-25 {
  width: 25%;
}
.w-40 {
  width: 40%;
}
.w-50 {
  width: 50%;
}
.mt-2 {
  margin-top: 0.5rem;
}
.flex-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.muted-text {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Design color reference table ─────────────────────────────────── */
.color-table {
  width: 100%;
  border-collapse: collapse;
}
.color-table th {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #ddd;
}
.color-table td {
  padding: 8px;
  vertical-align: middle;
}
.color-swatch {
  display: inline-block;
  width: 56px;
  height: 28px;
  vertical-align: middle;
  border: 1px solid #ccc;
}
.color-swatch--dark {
  border-color: #333;
}
.color-code {
  margin-left: 8px;
  vertical-align: middle;
  font-family: monospace;
}
.mono-cell {
  padding: 8px;
  vertical-align: middle;
  font-family: monospace;
}
