/* OHB Reimagined — Design system
   Brand: OHB. Palette and fonts taken from public site.
   Tone: provocative-but-defensible. Editorial-meets-fintech.
*/

/* Fonts loaded via <link> in HTML head for faster loading */

:root {
  /* Brand — simplified to teal + copper + neutrals.
     Charcoal & navy are kept only as deep variants of ink. */
  --brand-teal: #1b4149;
  --brand-teal-deep: #123039;
  --brand-teal-soft: #2a5e68;
  --brand-copper: #eaa07a;
  --brand-copper-soft: #f4c7ad;
  --brand-copper-deep: #c87f5c;
  --brand-black: #1a1a1a;
  --brand-charcoal: #1a1a1a;  /* alias → ink */
  --brand-navy: #1b4149;      /* alias → teal — citizen surfaces stay teal */

  /* Neutrals (warm-leaning) */
  --bg: #f5f3f0;
  --paper: #ffffff;
  --paper-soft: #faf7f3;
  --paper-warm: #f0ebe4;
  --ink: #1a1a1a;
  --ink-soft: #3d3a36;
  --muted: #6b6662;
  --muted-soft: #98928b;
  --hairline: #e3ddd4;
  --hairline-soft: #ebe6dd;

  /* Semantic — admin uses only these + neutrals */
  --ok: #1b4149;
  --ok-bg: #e8f1ec;
  --warn: #9c6011;
  --warn-bg: #f6ecd9;
  --bad: #8c2a23;
  --bad-bg: #f4e3df;
  --info-bg: #eef0ee;
  --info: #1a1a1a;

  /* Type */
  --font-sans: "Geist", "Segoe UI", "Segoe UI Arabic", Tahoma, sans-serif;
  --font-serif: "Geist", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(20, 30, 28, 0.06);
  --shadow-md: 0 6px 24px rgba(20, 30, 28, 0.06), 0 1px 3px rgba(20, 30, 28, 0.04);
  --shadow-lg: 0 24px 60px rgba(20, 30, 28, 0.12);
}

[data-theme="dark"] {
  --bg: #14171a;
  --paper: #1a1e22;
  --paper-soft: #1f2429;
  --paper-warm: #20262c;
  --ink: #f4f1ec;
  --ink-soft: #d8d3cb;
  --muted: #9b9690;
  --muted-soft: #6e6964;
  --hairline: #2a3036;
  --hairline-soft: #232830;
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-soft); }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; background: none; border: 0; padding: 0; }

a { color: inherit; text-decoration: none; }

/* ─── App shell ─────────────────────────────────────────── */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding-top: 93px; /* disclaimer (29px) + shell-top (64px) */
}

.disclaimer-banner {
  position: fixed;
  top: 0;
  left: 0; right: 0;
  z-index: 51;
  background: var(--brand-teal);
  color: rgba(255,255,255,0.75);
  font-size: 11px;
  text-align: center;
  padding: 6px 24px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.disclaimer-banner strong {
  color: rgba(255,255,255,0.9);
  font-weight: 600;
}

.shell-top {
  position: fixed;
  top: 27px;
  left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  height: 60px;
  background: var(--brand-black);
  border-top: 1px solid var(--brand-teal);
  border-bottom: 1px solid rgba(234, 160, 122, 0.18);
  color: #fff;
}

.shell-top-left { display: flex; align-items: center; gap: 28px; }
.shell-top-right { display: flex; align-items: center; gap: 12px; }

.brand-lockup {
  display: flex; align-items: center; gap: 12px;
  padding-right: 24px;
  border-right: 1px solid rgba(255,255,255,0.12);
  height: 36px;
}
.brand-lockup img { height: 22px; width: auto; display: block; }
.brand-lockup-name {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1;
  color: rgba(255,255,255,0.88);
  letter-spacing: 0.02em;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px;
}
.mode-switch button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.mode-switch button:hover { color: #fff; }
.mode-switch button.active {
  color: var(--brand-black);
  background: var(--brand-copper);
}

.shell-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.82);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.shell-pill button { color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.shell-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-copper); }

.persona-pill {
  display: inline-flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 6px 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.persona-pill .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-copper);
  color: var(--brand-black);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}

/* ─── Generic utilities ─────────────────────────────────── */

.h1, .h2, .h3 { margin: 0; color: var(--ink); }
.h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(40px, 5.5vw, 64px); line-height: 1.02; letter-spacing: -0.01em; }
.h2 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.06; letter-spacing: -0.005em; }
.h3 { font-family: var(--font-serif); font-weight: 400; font-size: 24px; line-height: 1.15; }
.title { font-weight: 600; font-size: 18px; letter-spacing: -0.005em; }
.label-eyebrow {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted);
}
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.text-12 { font-size: 12px; }
.text-13 { font-size: 13px; }
.text-14 { font-size: 14px; }

/* Card */
.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-pad-sm { padding: 14px; }
.card-pad-lg { padding: 28px; }

.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Pill / badge */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--paper-warm);
  color: var(--ink);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(27, 65, 73, 0.18); }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(180, 83, 9, 0.22); }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: rgba(163, 48, 40, 0.22); }
.pill.copper { background: rgba(234,160,122,0.18); color: var(--brand-copper-deep); border-color: rgba(234,160,122,0.4); }
.pill.navy { background: var(--info-bg); color: var(--info); border-color: rgba(28,27,59,0.18); }
.pill.ghost { background: transparent; }
.pill.solid-teal { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }
.pill.solid-dark { background: var(--brand-black); color: #fff; border-color: var(--brand-black); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  background: var(--ink); color: #fff;
  border: 1px solid var(--ink);
  transition: transform .12s, background .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.copper { background: var(--brand-copper); color: var(--brand-black); border-color: var(--brand-copper); }
.btn.teal { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn.ghost:hover { background: var(--paper-warm); }
.btn.light { background: #fff; color: var(--ink); border-color: var(--hairline); }
.btn.dark-on-light { background: var(--ink); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 14.5px; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.icon-only { width: 36px; padding: 0; }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(27, 65, 73, 0.1);
}
.textarea { height: auto; padding: 12px; min-height: 72px; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }

/* Status dots */
.statusdot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
}
.statusdot.ok { background: #2f8a5b; }
.statusdot.warn { background: #d97a26; }
.statusdot.bad { background: #c53b2c; }

/* Hairline divider */
.hr { height: 1px; background: var(--hairline); width: 100%; margin: 0; }

/* Page surface — used inside each mode */
.surface { width: 100%; min-height: calc(100vh - 64px); }

/* Striped placeholder pattern */
.stripes {
  background:
    repeating-linear-gradient(135deg, rgba(27,65,73,.07) 0 8px, transparent 8px 16px),
    var(--paper-soft);
}

/* "Showcase" mark — used to highlight novel pitch moments */
[data-showcase] { position: relative; }
[data-showcase]::before {
  content: attr(data-showcase);
  position: absolute; top: -10px; left: 16px;
  background: var(--brand-copper); color: var(--brand-black);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase;
}

/* RTL helpers (applied at the mode level when language is "ar") */
[dir="rtl"] .row { direction: rtl; }
[dir="rtl"] .arrow-flip { transform: scaleX(-1); }

/* mode root padding */
.mode-wrap { padding: 28px 32px 60px; max-width: 1480px; margin: 0 auto; }

/* Specific stages used across the app, defined per-mode in their own scopes */

/* ─── Responsive breakpoints ────────────────────────────── */

@media (max-width: 1280px) {
  .mode-wrap { padding: 24px 24px 60px; }
  .shell-top { padding: 0 16px; gap: 12px; }
  .brand-lockup { padding-right: 16px; gap: 8px; }
  .mode-switch button { padding: 6px 10px; font-size: 12px; gap: 6px; }
}

@media (max-width: 1024px) {
  .mode-wrap { padding: 20px 16px 60px; }

  /* Shell — hide persona pill label on smaller screens */
  .shell-top { gap: 8px; }
  .mode-switch button { padding: 6px 8px; }
  .brand-lockup-name { display: none; }

  /* Utility grids collapse */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Journey rail — scrollable on medium screens */
  .journey-track { grid-template-columns: repeat(4, 1fr); }

  /* Unit minis */
  .unit-mini-row { grid-template-columns: repeat(2, 1fr); }

  /* Browse: stack detail panel below */
  .browse-layout { grid-template-columns: 1fr; }
  .unit-detail { position: static; }

  /* Eligibility */
  .elig-grid { grid-template-columns: 1fr; }

  /* Admin layout */
  .admin-mode { grid-template-columns: 200px 1fr; }
  .admin-tiles { grid-template-columns: repeat(2, 1fr); }
  .admin-case-body { grid-template-columns: 1fr; }
  .admin-case-right { position: static; }

  /* Finance banks */
  .bank-grid { grid-template-columns: repeat(2, 1fr); }

  /* Programs */
  .program-grid { grid-template-columns: repeat(2, 1fr); }
  .integ-grid { grid-template-columns: repeat(2, 1fr); }

  /* Mobile pitch */
  .mobile-pitch { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 768px) {
  .mode-wrap { padding: 16px 12px 60px; }

  /* Shell */
  .shell-top { padding: 0 12px; height: 52px; }
  .shell-pill { display: none; }
  .mode-switch { gap: 0; }
  .mode-switch button { padding: 5px 8px; font-size: 11.5px; }

  /* Utility grids */
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  /* Hero */
  .hero { padding: 32px 24px 28px; min-height: 380px; }
  .hero-decision { grid-template-columns: 1fr; gap: 16px; }
  .hd-meta { flex-direction: row; flex-wrap: wrap; gap: 12px; }

  /* Journey — horizontal scroll */
  .journey-track {
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  /* Unit minis */
  .unit-mini-row { grid-template-columns: 1fr 1fr; }

  /* Admin */
  .admin-mode { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-tiles { grid-template-columns: repeat(2, 1fr); }
  .admin-page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cmd-bar { width: 100%; }

  /* Case table — make scrollable */
  .case-table { overflow-x: auto; }
  .case-table-row {
    grid-template-columns: 28px 80px 1fr 1fr 0.8fr 24px;
    min-width: 600px;
  }
  /* Hide less critical columns on small screens */
  .case-table-row > *:nth-child(6),
  .case-table-row > *:nth-child(7),
  .case-table-row > *:nth-child(8) { display: none; }

  /* Finance */
  .bank-grid { grid-template-columns: 1fr; }

  /* Programs */
  .program-grid { grid-template-columns: 1fr; }
  .integ-grid { grid-template-columns: 1fr 1fr; }

  /* Mobile pitch */
  .mobile-pitch { grid-template-columns: 1fr; }
  .mobile-pitch-feats { grid-template-columns: 1fr; }

  /* Eligibility */
  .elig-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .elig-summary { text-align: left; }

  /* Citizen subnav — horizontal scroll */
  .citizen-subnav { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 16px; -webkit-overflow-scrolling: touch; }

  /* Browse filters */
  .browse-filters { flex-direction: column; align-items: stretch; }
  .filter-search { min-width: 0; }
  .filter-budget input[type=range] { width: 80px; }
  .browse-grid { grid-template-columns: 1fr; }

  /* Browse layout stacks fully */
  .browse-layout { grid-template-columns: 1fr; }

  /* Admin case body */
  .admin-case-body { grid-template-columns: 1fr; }
}

/* ─── Subtle entrance animations ─────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Shell */
.shell-top        { animation: fadeIn .35s ease both; }
.disclaimer-banner { animation: fadeIn .25s ease both; }

/* Mode surfaces */
.surface > * { animation: fadeUp .35s ease both; }

/* Studio */
.studio-head      { animation: fadeUp .3s ease both; }
.studio-inspector { animation: fadeUp .35s .05s ease both; }
.studio-pipeline  { animation: fadeUp .35s .1s ease both; }
.studio-tab-bar   { animation: fadeIn .25s ease both; }

/* Pipeline cards */
.pipe-node        { animation: fadeUp .3s ease both; }
.pipeline-source-card,
.pipeline-output-card { animation: fadeUp .3s ease both; }

/* Inspector panels */
.inspector-section { animation: fadeUp .3s ease both; }

/* Admin / citizen cards */
.card, .case-card, .prop-card { animation: fadeUp .3s ease both; }

/* Onboarding */
.onb-step-shell   { animation: fadeUp .35s ease both; }
.onb-welcome-art  { animation: fadeIn .5s ease both; }
.onb-welcome-text { animation: fadeUp .4s .1s ease both; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
