/* ==========================================================================
   Nav.ai — Design System v2 (Mintlify-inspired refinement)
   --------------------------------------------------------------------------
   Loaded AFTER all other stylesheets. Adopts the Do's/Don'ts and component
   patterns from DESIGN.md without changing the brand palette (deep navy
   #0b2e34 + lime accent #9be235 stay).

   Key shifts vs. v1:
   - Typography: General Sans for UI, Instrument Serif for H1-H2 display
   - Buttons: pill geometry (border-radius 9999px), keep 44px touch height
   - Sidebar active item: 3px navy left-border accent
   - New: alert containers (info / success / warning / error)
   - New: highlighted card (lime-tinted bg + navy border)
   - New: search input with icon (pill container)
   - Form focus: 3px navy halo ring (was outline-only)
   - Form helper / error text spec
   - Keyboard / code button (Geist Mono)
   - Pill badges with colored borders
   - Soft, navy-tinted hover shadows
   - Ghost button standardisation

   Revert: remove the <link> to this file from the HTML pages. The original
   styles in theme.css / styles.css / dashboard*.css / workspace.css are
   untouched.
   ========================================================================== */

/* Redefine the design system's font tokens so UI inherits General Sans,
   display headings use Instrument Serif, and application numbers / code
   references stay in Geist Mono. */
:root {
  --font-sans: 'General Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-body: 'General Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* Global font-family override — beats every legacy `font-family: Inter`
   declaration scattered through theme.css / styles.css / workspace.css
   without touching those files. H1-H2 and mono elements get their own
   dedicated brand faces below. */
html,
body,
button,
input,
select,
textarea,
h3, h4, h5, h6,
p, span, a, li, td, th, label, legend, figcaption,
.btn, .btn-primary, .btn-secondary, .btn-professional, .btn-pro-secondary,
.btn-pro-tertiary, .btn-pro-danger, .btn-danger, .btn-accent, .btn-icon,
.q-input, .q-label, .q-step-title, .q-step-subtitle, .q-step-meta,
.workspace-title h1, .workspace-app-number,
.sidebar-item, .stat-card, .alert, .badge, .status-badge,
.card-default, .card-highlighted {
  font-family: var(--font-sans) !important;
}

/* Display headings */
h1, h2,
.section-title,
.route-detail-content h2,
.landing-section-head h2,
.final-cta-title {
  font-family: var(--font-display) !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
}

/* Mono explicitly preserved */
code, pre, kbd, samp,
.mono, .font-mono,
.workspace-app-number,
.kbd, .btn-key {
  font-family: var(--font-mono, 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace) !important;
}

/* Keep letter spacing neutral so display type stays warm and readable. */
html { letter-spacing: 0 !important; }
body { letter-spacing: 0 !important; }
h1, h2, h3, h4, h5, h6 { letter-spacing: 0 !important; }
.workspace-title h1 { letter-spacing: 0 !important; }

/* -----  Scoped tokens  ----------------------------------------------------- */

:root {
  --v2-ink:                  #0b2e34;
  --v2-ink-hover:            #0a262c;
  --v2-ink-active:           #072024;
  --v2-stamp:                #115e59;
  --v2-lime:                 #9be235;
  --v2-lime-fixed:           #abff00;
  --v2-lime-tint:            rgba(155, 226, 53, 0.08);
  --v2-lime-tint-strong:     rgba(155, 226, 53, 0.16);

  --v2-text-primary:         #0f172a;
  --v2-text-muted:           #64748b;
  --v2-text-disabled:        #94a3b8;

  --v2-surface-low:          #fafafa;
  --v2-surface:              #f5f5f7;
  --v2-surface-high:         #f1f5f9;

  --v2-outline-variant:      #e2e8f0;
  --v2-outline:              #94a3b8;

  --v2-success:              #10b981;
  --v2-success-bg:           rgba(16, 185, 129, 0.08);
  --v2-warning:              #f59e0b;
  --v2-warning-bg:           rgba(245, 158, 11, 0.08);
  --v2-info:                 #3b82f6;
  --v2-info-bg:              rgba(59, 130, 246, 0.08);
  --v2-error:                #ef4444;
  --v2-error-bg:             rgba(239, 68, 68, 0.08);

  --v2-shadow-xs:            0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --v2-shadow-sm:            0 1px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --v2-shadow-md:            0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --v2-shadow-lg:            0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --v2-shadow-modal:         0 20px 50px -10px rgba(11, 46, 52, 0.30), 0 0 0 1px rgba(11, 46, 52, 0.05);
  --v2-shadow-focus-primary: 0 0 0 3px rgba(11, 46, 52, 0.18);
  --v2-shadow-focus-error:   0 0 0 3px rgba(239, 68, 68, 0.20);

  --v2-ease:                 cubic-bezier(0.4, 0, 0.2, 1);
  --v2-ease-bounce:          cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   1. Buttons — pill geometry, keep 44px touch height
   ==========================================================================
   Override every button class in the codebase that we found in the audit.
   Specificity: each override matches the original selector specificity
   (single class, sometimes with :hover/:active/:disabled), and design-v2.css
   loads last so the cascade picks ours.
   ========================================================================== */

.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-professional,
.btn-pro-secondary,
.btn-pro-tertiary,
.btn-pro-danger {
  border-radius: 9999px !important;
  height: 44px;
  padding: 10px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 200ms var(--v2-ease),
              box-shadow 200ms var(--v2-ease),
              border-color 200ms var(--v2-ease),
              color 200ms var(--v2-ease);
  cursor: pointer;
  border: 1px solid transparent;
}

/* Primary — solid navy, white text */
.btn-primary,
.btn-professional {
  background: var(--v2-ink);
  color: #fff;
  border-color: var(--v2-ink);
  box-shadow: var(--v2-shadow-xs);
}
.btn-primary:hover:not(:disabled),
.btn-professional:hover:not(:disabled) {
  background: var(--v2-ink-hover);
  border-color: var(--v2-ink-hover);
  box-shadow: var(--v2-shadow-sm);
}
.btn-primary:active:not(:disabled),
.btn-professional:active:not(:disabled) {
  background: var(--v2-ink-active);
  border-color: var(--v2-ink-active);
  box-shadow: var(--v2-shadow-xs);
}
.btn-primary:disabled,
.btn-professional:disabled {
  background: var(--v2-outline-variant);
  color: var(--v2-text-disabled);
  border-color: var(--v2-outline-variant);
  box-shadow: none;
  cursor: not-allowed;
}

/* Secondary — transparent, outlined */
.btn-secondary,
.btn-pro-secondary {
  background: transparent;
  color: var(--v2-text-primary);
  border-color: var(--v2-outline-variant);
  box-shadow: none;
}
.btn-secondary:hover:not(:disabled),
.btn-pro-secondary:hover:not(:disabled) {
  background: var(--v2-surface);
  border-color: var(--v2-text-muted);
  color: var(--v2-text-primary);
}
.btn-secondary:active:not(:disabled),
.btn-pro-secondary:active:not(:disabled) {
  background: var(--v2-surface-high);
  border-color: var(--v2-ink);
}
.btn-secondary:disabled,
.btn-pro-secondary:disabled {
  color: var(--v2-text-disabled);
  border-color: var(--v2-outline-variant);
  background: transparent;
  cursor: not-allowed;
}

/* Tertiary / ghost-ish */
.btn-pro-tertiary {
  background: transparent;
  color: var(--v2-text-primary);
  border-color: transparent;
  padding: 10px 16px;
}
.btn-pro-tertiary:hover:not(:disabled) {
  background: rgba(11, 46, 52, 0.06);
  color: var(--v2-ink);
}

/* Danger */
.btn-danger,
.btn-pro-danger {
  background: var(--v2-error);
  color: #fff;
  border-color: var(--v2-error);
}
.btn-danger:hover:not(:disabled),
.btn-pro-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: var(--v2-shadow-sm);
}

/* Accent — rationed lime CTA. Reserved for the singular hero action. */
.btn-accent {
  background: var(--v2-lime-fixed);
  color: var(--v2-ink);
  border-color: var(--v2-lime-fixed);
  border-radius: 9999px !important;
  height: 44px;
  padding: 10px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 200ms var(--v2-ease), box-shadow 200ms var(--v2-ease);
}
.btn-accent:hover:not(:disabled) {
  background: var(--v2-lime);
  box-shadow: var(--v2-shadow-sm);
}

/* Icon-only square button (the single exception to the pill rule) */
.btn-icon {
  border-radius: 8px !important;
  height: 40px;
  width: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--v2-outline-variant);
  color: var(--v2-text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 160ms var(--v2-ease), border-color 160ms var(--v2-ease);
}
.btn-icon:hover {
  background: var(--v2-surface);
  border-color: var(--v2-text-muted);
}

/* Keyboard / code button — Geist Mono inline reference */
.btn-key,
.kbd {
  font-family: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--v2-text-primary);
  border: 1px solid var(--v2-outline-variant);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  height: 24px;
}

/* Mobile — keep 44px height as a hard floor */
@media (max-width: 768px) {
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .btn-professional,
  .btn-pro-secondary,
  .btn-pro-tertiary,
  .btn-pro-danger,
  .btn-accent {
    min-height: 44px;
  }
}

/* ==========================================================================
   2. Pill badges with colored borders
   ========================================================================== */

.badge,
.status-badge,
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--v2-surface);
  color: var(--v2-text-primary);
  border: 1px solid var(--v2-outline-variant);
}

.badge.badge-brand,
.status-badge.badge-brand {
  background: rgba(11, 46, 52, 0.06);
  color: var(--v2-ink);
  border-color: var(--v2-ink);
}
.badge.badge-success,
.status-badge.badge-success,
.badge.success,
.status-badge.success {
  background: rgba(16, 185, 129, 0.12);
  color: #064e3b;
  border-color: var(--v2-success);
}
.badge.badge-warning,
.status-badge.badge-warning,
.badge.warning,
.status-badge.warning {
  background: #fef3c7;
  color: #78350f;
  border-color: var(--v2-warning);
}
.badge.badge-error,
.status-badge.badge-error,
.badge.error,
.status-badge.error {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: var(--v2-error);
}
.badge.badge-info,
.status-badge.badge-info,
.badge.info,
.status-badge.info {
  background: var(--v2-info-bg);
  color: #1e3a8a;
  border-color: var(--v2-info);
}

/* ==========================================================================
   3. Inputs — focus halo, refined hover, helper/error text
   ========================================================================== */

.q-input,
input[type="text"]:not(.search-input):not([class*="btn"]),
input[type="email"]:not(.search-input):not([class*="btn"]),
input[type="tel"]:not(.search-input):not([class*="btn"]),
input[type="number"]:not(.search-input):not([class*="btn"]),
input[type="date"]:not(.search-input):not([class*="btn"]),
input[type="password"]:not(.search-input):not([class*="btn"]),
input[type="url"]:not(.search-input):not([class*="btn"]),
select:not(.search-input):not([class*="btn"]),
textarea:not(.search-input):not([class*="btn"]) {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
  color: var(--v2-text-primary);
  background: var(--v2-surface);
  border: 1px solid var(--v2-outline-variant);
  border-radius: 8px;
  padding: 12px 14px;
  height: 44px;
  transition: border-color 150ms var(--v2-ease),
              box-shadow 150ms var(--v2-ease),
              background-color 150ms var(--v2-ease);
  outline: none;
}
textarea:not(.search-input):not([class*="btn"]) {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
}
.q-input:hover:not(:focus):not(:disabled),
input[type="text"]:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
input[type="email"]:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
input[type="tel"]:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
input[type="number"]:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
input[type="date"]:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
input[type="password"]:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
select:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]),
textarea:hover:not(:focus):not(:disabled):not(.search-input):not([class*="btn"]) {
  border-color: var(--v2-text-muted);
}
.q-input:focus,
input[type="text"]:focus:not(.search-input):not([class*="btn"]),
input[type="email"]:focus:not(.search-input):not([class*="btn"]),
input[type="tel"]:focus:not(.search-input):not([class*="btn"]),
input[type="number"]:focus:not(.search-input):not([class*="btn"]),
input[type="date"]:focus:not(.search-input):not([class*="btn"]),
input[type="password"]:focus:not(.search-input):not([class*="btn"]),
input[type="url"]:focus:not(.search-input):not([class*="btn"]),
select:focus:not(.search-input):not([class*="btn"]),
textarea:focus:not(.search-input):not([class*="btn"]) {
  border-color: var(--v2-ink);
  box-shadow: var(--v2-shadow-focus-primary);
  outline: none;
}
.q-input.error,
.q-input[aria-invalid="true"],
input[aria-invalid="true"]:not(.search-input):not([class*="btn"]),
select[aria-invalid="true"]:not(.search-input):not([class*="btn"]),
textarea[aria-invalid="true"]:not(.search-input):not([class*="btn"]) {
  border-color: var(--v2-error);
  box-shadow: var(--v2-shadow-focus-error);
}
.q-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--v2-text-disabled);
}
.q-input[readonly],
input[readonly]:not(.search-input):not([class*="btn"]),
textarea[readonly]:not(.search-input):not([class*="btn"]) {
  background: var(--v2-surface-low);
  color: var(--v2-text-muted);
  cursor: default;
}
.q-input:disabled,
input:disabled:not(.search-input):not([class*="btn"]),
select:disabled:not(.search-input):not([class*="btn"]),
textarea:disabled:not(.search-input):not([class*="btn"]) {
  background: var(--v2-surface-low);
  color: var(--v2-text-disabled);
  cursor: not-allowed;
}

/* Form helper + error text */
.form-helper,
.field-helper {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  color: var(--v2-text-muted);
  margin-top: 6px;
}
.form-error,
.field-error,
.q-error:not(:empty) {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  color: var(--v2-error);
  margin-top: 6px;
}

/* ==========================================================================
   4. Search input with icon — pill container
   ========================================================================== */

.search-bar,
.search-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--v2-surface-low);
  border: 1px solid var(--v2-outline-variant);
  border-radius: 9999px;
  padding: 0 16px;
  height: 44px;
  transition: border-color 150ms var(--v2-ease),
              box-shadow 150ms var(--v2-ease),
              background-color 150ms var(--v2-ease);
}
.search-bar:focus-within,
.search-container:focus-within {
  border-color: var(--v2-ink);
  box-shadow: var(--v2-shadow-focus-primary);
  background: #fff;
}
.search-bar svg,
.search-container svg,
.search-bar .search-icon,
.search-container .search-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--v2-text-muted);
}
.search-bar input,
.search-bar .search-input,
.search-container input,
.search-container .search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  color: var(--v2-text-primary);
  height: auto;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}
.search-bar input::placeholder,
.search-container input::placeholder {
  color: var(--v2-text-disabled);
}

/* ==========================================================================
   5. Alert containers (inline page-level callouts)
   ========================================================================== */

.alert,
.alert-info,
.alert-success,
.alert-warning,
.alert-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--v2-outline-variant);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  background: var(--v2-surface);
  color: var(--v2-text-primary);
}
.alert-info {
  background: var(--v2-info-bg);
  border-color: var(--v2-info);
  color: #1e3a8a;
}
.alert-success {
  background: var(--v2-success-bg);
  border-color: var(--v2-success);
  color: #064e3b;
}
.alert-warning {
  background: var(--v2-warning-bg);
  border-color: var(--v2-warning);
  color: #78350f;
}
.alert-error {
  background: var(--v2-error-bg);
  border-color: var(--v2-error);
  color: #7f1d1d;
}
.alert .alert-icon,
.alert-info .alert-icon,
.alert-success .alert-icon,
.alert-warning .alert-icon,
.alert-error .alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.alert-title {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 14px;
  line-height: 20px;
}

/* ==========================================================================
   6. Cards — highlighted variant (lime tint, navy border)
   ========================================================================== */

.card-highlighted,
.card-emphasised,
.highlighted-card {
  background: var(--v2-lime-tint);
  border: 1px solid var(--v2-ink);
  border-radius: 12px;
  padding: 24px;
  color: var(--v2-text-primary);
}

/* Default card hover micro-interaction (opt-in via .card-default class) */
.card-default {
  background: #fff;
  border: 1px solid var(--v2-outline-variant);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--v2-shadow-xs);
  transition: transform 200ms var(--v2-ease),
              box-shadow 200ms var(--v2-ease);
}
.card-default:hover {
  transform: translateY(-2px);
  box-shadow: var(--v2-shadow-md);
}

/* ==========================================================================
   7. Sidebar — navy left-border accent on active item
   ========================================================================== */

.sidebar-item {
  border-left: 3px solid transparent;
  border-radius: 8px;
  transition: background-color 160ms var(--v2-ease),
              color 160ms var(--v2-ease),
              border-color 160ms var(--v2-ease);
}
.sidebar-item:hover {
  background: var(--v2-surface);
  color: var(--v2-text-primary);
}
.sidebar-item.active {
  background: rgba(11, 46, 52, 0.06);
  color: var(--v2-ink);
  border-left: 3px solid var(--v2-ink);
  border-radius: 0 8px 8px 0;
}
.sidebar-item:focus-visible {
  outline: 2px solid var(--v2-ink);
  outline-offset: 2px;
}

/* ==========================================================================
   8. Tags / chip-style elements (re-shape any pre-existing pills)
   ========================================================================== */

.chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  background: var(--v2-surface);
  color: var(--v2-text-primary);
  border: 1px solid var(--v2-outline-variant);
}

/* ==========================================================================
   9. Focus rings — global
   ========================================================================== */

*:focus-visible {
  outline: 2px solid var(--v2-ink);
  outline-offset: 2px;
}

/* ==========================================================================
   10. Reduced motion — respect user preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .btn, .btn-primary, .btn-secondary, .btn-professional, .btn-pro-secondary,
  .btn-pro-tertiary, .btn-pro-danger, .btn-accent, .btn-icon,
  .sidebar-item, .card-default, .search-bar, .search-container,
  .q-input, input, select, textarea {
    transition: none !important;
  }
}
