/*
  IorDesk design system — "Verified Trade"
  Modern, trust-first, low-friction. One confident petrol-teal accent for
  actions — deliberately not the generic B2B/fintech indigo-blue everyone
  else uses, and grounded in the subject (shipping, ports, maritime trade)
  rather than borrowed from an unrelated category. A distinct, more
  yellow-leaning green is reserved only for "verified" / success, kept far
  enough from the teal primary that the two never get confused. Manrope
  carries headings and body so the page never switches voice; IBM Plex
  Mono is used narrowly, only where digits need to line up (prices,
  reference codes).
*/

:root {
  --font-display: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* ---- light ---- */
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-muted: #f3f5f9;
  --color-border: #e4e8ef;
  --color-border-strong: #cbd3e0;

  --color-text: #3b4457;
  --color-text-muted: #707c8f;
  --color-heading: #111827;

  --color-primary: #0e6b74;
  --color-primary-hover: #094f56;
  --color-primary-soft: #e2f2f2;
  --color-primary-ink: #ffffff;

  --color-success: #2f9455;
  --color-success-soft: #e5f5e9;
  --color-warning: #b8790a;
  --color-warning-soft: #fcf1dc;
  --color-danger: #c23b32;
  --color-danger-soft: #fbeae8;
  --color-info: #3d5a80;
  --color-info-soft: #e7eef6;

  --shadow-xs: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-sm: 0 8px 20px rgba(17, 24, 39, .07);
  --shadow-md: 0 20px 45px rgba(17, 24, 39, .10);

  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1.1rem;
  --radius-pill: 999px;

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  --container: 1160px;
  --sidebar: 256px;
  --header-height: 72px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0b0f17;
    --color-surface: #121a27;
    --color-surface-muted: #19212f;
    --color-border: #262f40;
    --color-border-strong: #38445a;

    --color-text: #c7cedA;
    --color-text-muted: #8a93a6;
    --color-heading: #f5f7fa;

    --color-primary: #3fb0b8;
    --color-primary-hover: #55c2c9;
    --color-primary-soft: #123234;
    --color-primary-ink: #0b0f17;

    --color-success: #4fbe7a;
    --color-success-soft: #163b1f;
    --color-warning: #e0aa4a;
    --color-warning-soft: #3a2c10;
    --color-danger: #e2766d;
    --color-danger-soft: #3a1815;
    --color-info: #86a6ce;
    --color-info-soft: #1c2734;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-sm: 0 8px 20px rgba(0, 0, 0, .4);
    --shadow-md: 0 20px 45px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  --color-bg: #0b0f17;
  --color-surface: #121a27;
  --color-surface-muted: #19212f;
  --color-border: #262f40;
  --color-border-strong: #38445a;
  --color-text: #c7cedA;
  --color-text-muted: #8a93a6;
  --color-heading: #f5f7fa;
  --color-primary: #3fb0b8;
  --color-primary-hover: #55c2c9;
  --color-primary-soft: #123234;
  --color-primary-ink: #0b0f17;
  --color-success: #4fbe7a;
  --color-success-soft: #163b1f;
  --color-warning: #e0aa4a;
  --color-warning-soft: #3a2c10;
  --color-danger: #e2766d;
  --color-danger-soft: #3a1815;
  --color-info: #86a6ce;
  --color-info-soft: #1c2734;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, .4);
  --shadow-md: 0 20px 45px rgba(0, 0, 0, .5);
}

:root[data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-muted: #f3f5f9;
  --color-border: #e4e8ef;
  --color-border-strong: #cbd3e0;
  --color-text: #3b4457;
  --color-text-muted: #707c8f;
  --color-heading: #111827;
  --color-primary: #0e6b74;
  --color-primary-hover: #094f56;
  --color-primary-soft: #e2f2f2;
  --color-primary-ink: #ffffff;
  --color-success: #2f9455;
  --color-success-soft: #e5f5e9;
  --color-warning: #b8790a;
  --color-warning-soft: #fcf1dc;
  --color-danger: #c23b32;
  --color-danger-soft: #fbeae8;
  --color-info: #3d5a80;
  --color-info-soft: #e7eef6;
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-sm: 0 8px 20px rgba(17, 24, 39, .07);
  --shadow-md: 0 20px 45px rgba(17, 24, 39, .10);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-heading);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.02em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 4.2vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); }
h3 { font-size: 1.1rem; font-weight: 700; }
p { color: var(--color-text-muted); max-width: 62ch; }
p.lede { font-size: 1.08rem; max-width: 52ch; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Layout utilities — for one-off spacing/alignment tweaks that don't
   deserve their own composition class. Reach for these instead of an
   inline style; reach for a named composition class in components.css
   instead of these if the pattern repeats more than once or two. */
.mt-6 { margin-top: var(--space-6); }
.mb-6 { margin-bottom: var(--space-6); }
.span-2 { grid-column: span 2; }
.items-end { align-items: flex-end; }
.is-hidden { visibility: hidden; }

.container { width: min(calc(100% - 2rem), var(--container)); margin-inline: auto; }

.section { padding-block: var(--space-16); }
.section--tight { padding-block: var(--space-10); }
.section--surface { background: var(--color-surface-muted); }

.stack { display: flex; flex-direction: column; }
.stack--2 { gap: var(--space-2); }
.stack--3 { gap: var(--space-3); }
.stack--4 { gap: var(--space-4); }
.stack--6 { gap: var(--space-6); }
.stack--8 { gap: var(--space-8); }

.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.card {
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.card--interactive { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.card--interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--color-border-strong); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--color-primary);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.muted { color: var(--color-text-muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 46px;
  padding: .7rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }

.btn--primary { color: var(--color-primary-ink); background: var(--color-primary); }
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--secondary { color: var(--color-heading); background: var(--color-surface); border-color: var(--color-border-strong); }
.btn--secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn--ghost { color: var(--color-text-muted); background: transparent; }
.btn--ghost:hover { color: var(--color-heading); background: var(--color-surface-muted); }

.btn--danger { color: var(--color-danger); background: var(--color-danger-soft); }

.btn--sm { min-height: 38px; padding: .45rem .9rem; font-size: .86rem; }
.btn--block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .32rem .68rem;
  border-radius: var(--radius-pill);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge--success { color: var(--color-success); background: var(--color-success-soft); }
.badge--warning { color: var(--color-warning); background: var(--color-warning-soft); }
.badge--info { color: var(--color-info); background: var(--color-info-soft); }
.badge--danger { color: var(--color-danger); background: var(--color-danger-soft); }
.badge--neutral { color: var(--color-text-muted); background: var(--color-surface-muted); }

.docket {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.icon-box {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-primary);
  background: var(--color-primary-soft);
  flex: 0 0 auto;
}
.icon-box svg { width: 22px; height: 22px; }

.field { display: grid; gap: .45rem; }
.field label { color: var(--color-heading); font-size: .88rem; font-weight: 700; }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: .75rem .9rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--color-primary); }
.textarea { min-height: 120px; resize: vertical; }

.divider { height: 1px; background: var(--color-border); }

.field-error { display: block; color: var(--color-danger); font-size: .85rem; }
.center { display: grid; place-items: center; }

.progress { height: 6px; overflow: hidden; background: var(--color-surface-muted); border-radius: var(--radius-pill); }
.progress > span { display: block; height: 100%; background: var(--color-primary); border-radius: inherit; }

/* ---- public header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
}
.site-header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--color-heading); }
.brand__mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-primary-ink);
  background: var(--color-primary);
  font-weight: 800;
  font-size: .8rem;
}
/*
  Real logo lockup, replacing .brand__mark's placeholder square. Two
  <img> variants (navy-on-transparent / white-on-transparent) ship
  together and CSS picks which is visible — never swapped via JS.
  Ordinary contexts (the auth-shell login card) follow the page theme
  directly: navy on a light surface, white on a dark one. The sidebar is
  the one exception — its background is intentionally `--color-heading`,
  which itself flips light/dark opposite the rest of the page (a dark
  navy sidebar in light mode, a near-white one in dark mode), so the
  sidebar's logo swap runs in the opposite direction from every other
  context. Mirrors both the media-query and manual `data-theme` paths
  the rest of this file already supports.
*/
.brand__logo { height: 28px; width: auto; display: block; }
.brand__logo--white { display: none; }

@media (prefers-color-scheme: dark) {
  .brand__logo--navy { display: none; }
  .brand__logo--white { display: block; }
  .sidebar .brand__logo--navy { display: block; }
  .sidebar .brand__logo--white { display: none; }
}
:root[data-theme="dark"] .brand__logo--navy { display: none; }
:root[data-theme="dark"] .brand__logo--white { display: block; }
:root[data-theme="dark"] .sidebar .brand__logo--navy { display: block; }
:root[data-theme="dark"] .sidebar .brand__logo--white { display: none; }

.sidebar .brand__logo--navy { display: none; }
.sidebar .brand__logo--white { display: block; }
:root[data-theme="light"] .sidebar .brand__logo--navy { display: none; }
:root[data-theme="light"] .sidebar .brand__logo--white { display: block; }
.site-nav { display: flex; gap: var(--space-6); color: var(--color-text-muted); font-weight: 600; font-size: .92rem; }
.site-nav a:hover { color: var(--color-heading); }

.hero { padding-block: var(--space-20); }
.hero__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--space-12); align-items: start; }
.hero__panel { padding: var(--space-6); }

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: start;
}
.step__number {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 800;
  font-size: .9rem;
}

/* ---- authenticated shell ---- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: var(--space-5); background: var(--color-heading); color: color-mix(in srgb, var(--color-bg) 75%, white); }
.sidebar .brand { color: var(--color-bg); margin-bottom: var(--space-8); }
.sidebar .brand__mark { background: var(--color-primary); }
.sidebar-nav { display: grid; gap: .3rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem .8rem;
  border-radius: var(--radius-md);
  color: color-mix(in srgb, var(--color-bg) 55%, transparent);
  font-weight: 600; font-size: .92rem;
}
.sidebar-nav a:hover { color: var(--color-bg); background: rgba(255,255,255,.05); }
.sidebar-nav a[aria-current="page"] { color: var(--color-bg); background: rgba(255,255,255,.09); }
.app-main { min-width: 0; }
.app-topbar {
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--space-8);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.app-content { padding: var(--space-8); }
.page-head { display: flex; justify-content: space-between; gap: var(--space-6); align-items: flex-start; margin-bottom: var(--space-8); }
.page-head h1 { font-size: 1.85rem; margin-bottom: .35rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.kpi-card { padding: var(--space-5); }
.kpi-card__value { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; color: var(--color-heading); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { color: var(--color-text-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }

.checkpoints { display: grid; gap: 0; }
.checkpoint { position: relative; display: grid; grid-template-columns: 20px 1fr; gap: var(--space-3); padding-bottom: var(--space-5); }
.checkpoint::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--color-border); }
.checkpoint:last-child::before { display: none; }
.checkpoint__dot { width: 20px; height: 20px; border-radius: 50%; background: var(--color-border-strong); }
.checkpoint__dot--pending { background: var(--color-surface-muted); border: 2px solid var(--color-border-strong); }
.checkpoint__dot--done { background: var(--color-success); }

.empty-state { padding: var(--space-12); text-align: center; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface); }
.empty-state h3 { margin-bottom: .5rem; }

/* ---- auth shell: login / MFA / setup screens ---- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-8);
  background: var(--color-surface-muted);
}
.auth-shell__panel { width: 100%; max-width: 420px; padding: var(--space-8); }
.auth-shell__brand { justify-content: center; margin-bottom: var(--space-6); }
.auth-shell__title { text-align: center; margin-bottom: var(--space-2); }
.auth-shell__lede { text-align: center; margin-bottom: var(--space-6); }
.auth-shell__footer { margin-top: var(--space-6); text-align: center; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-block: var(--space-6); }
.recovery-codes code { font-family: var(--font-mono); font-size: .95rem; padding: var(--space-3); background: var(--color-surface-muted); border-radius: var(--radius-sm); text-align: center; }

@media (max-width: 980px) {
  .grid--4, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero__grid { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

@media (max-width: 640px) {
  .section { padding-block: var(--space-12); }
  .grid--2, .grid--3, .grid--4, .kpi-grid { grid-template-columns: 1fr; }
  .site-header__inner { gap: var(--space-3); }
  .site-header .btn--secondary { display: none; }
  .hero { padding-block: var(--space-12); }
  .app-topbar, .app-content { padding-inline: var(--space-4); }
  .page-head { flex-direction: column; }
  .auth-shell { padding: var(--space-4); }
  .auth-shell__panel { padding: var(--space-6); }
  .recovery-codes { grid-template-columns: 1fr; }
}
