/* ==========================================================================
   Migrationforce - site styles
   One stylesheet for every page: the public site, the account pages and the
   app (workspace, pipelines, studio, connections). Pages add a few lines of
   their own in {% block extra_head %} but build on the tokens and components
   below - no page brings its own colors.
   ========================================================================== */

/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-italic.ac3e6cdbce96.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-600-normal.196e3cbc5fee.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-700-normal.c277d7b83f8a.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.79936b18df9f.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-500-normal.b1c8a895f5fd.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  /* graphite base, one teal accent */
  --bg:          #101416;
  --surface:     #161b1e;
  --surface-2:   #1c2226;
  --surface-3:   #232a2f;
  --line:        #2a3237;
  --line-strong: #3b464c;
  --ink:         #e9ece8;
  --ink-2:       #c4cbc7;
  --muted:       #8f9a96;

  --accent:      #3ec4b0;
  --accent-hi:   #6fdcc9;
  --accent-ink:  #052420;
  --accent-wash: rgba(62, 196, 176, .12);
  --accent-line: rgba(62, 196, 176, .45);

  --ok:          #7fd18e;
  --ok-wash:     rgba(127, 209, 142, .12);
  --warn:        #e9b65c;
  --warn-wash:   rgba(233, 182, 92, .10);
  --warn-line:   rgba(233, 182, 92, .45);
  --danger:      #f07c70;
  --danger-wash: rgba(240, 124, 112, .11);
  --danger-line: rgba(240, 124, 112, .45);
  --info:        #86aef2;
  --info-wash:   rgba(134, 174, 242, .12);

  --hover:       rgba(233, 236, 232, .06);

  --font:  "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-sm:  4px;
  --r:     6px;
  --r-lg:  10px;
  --radius: var(--r-lg);   /* kept for templates that still use it */
  --shadow: 0 12px 32px rgba(0, 0, 0, .38);
  --header-h: 3.75rem;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern";
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; }
ul { list-style: none; }
code, kbd, samp { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: rgba(62, 196, 176, .3); }

h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
h2 { font-size: 1.2rem; font-weight: 600; letter-spacing: -.005em; line-height: 1.3; margin-top: 2rem; margin-bottom: .7rem; }
h3 { font-size: 1.02rem; font-weight: 600; line-height: 1.35; }
p  { color: var(--ink-2); }

.icon { width: 1.05em; height: 1.05em; flex: none; display: inline-block; vertical-align: -.16em; }

/* ---------- Header ---------- */
header.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: rgba(16, 20, 22, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: 1.08rem; font-weight: 600; letter-spacing: -.01em; color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 1.45rem; height: 1.45rem; }
.brand-mark .src { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.brand-mark .dst { fill: var(--accent); }

nav.site-nav { display: flex; align-items: center; gap: .15rem; }
nav.site-nav > a, .menu-trigger {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--ink-2); font: 500 .92rem/1 var(--font);
  padding: .55rem .75rem; border-radius: var(--r);
  background: none; border: none; cursor: pointer;
  transition: color .12s ease, background-color .12s ease;
}
nav.site-nav > a:hover, .menu-trigger:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
nav.site-nav > a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
nav.site-nav > a.nav-cta {
  margin-left: .4rem; color: var(--accent-ink); background: var(--accent); font-weight: 600;
}
nav.site-nav > a.nav-cta:hover { background: var(--accent-hi); }

/* user / language menu */
.menu { position: relative; }
.menu-trigger .icon:last-child { width: .85em; height: .85em; opacity: .7; }
.menu-list {
  position: absolute; top: calc(100% + .4rem); right: 0; min-width: 12rem; z-index: 100;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: .3rem;
}
.menu-list[hidden] { display: none; }
.menu-list li + li.sep { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .55rem .7rem; border-radius: var(--r);
  color: var(--ink); background: none; border: none; text-align: left;
  font: 400 .92rem/1.2 var(--font); cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover { background: var(--hover); text-decoration: none; }
.menu-list button[aria-current="true"] { color: var(--accent-hi); }
.menu-list form { margin: 0; }
.menu-list .menu-label { padding: .45rem .7rem .2rem; font-size: .78rem; color: var(--muted); }

.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; border-radius: var(--r);
  background: none; border: 1px solid var(--line); color: var(--ink); cursor: pointer;
}
.nav-toggle .icon { width: 1.25rem; height: 1.25rem; }

@media (max-width: 60rem) {
  .nav-toggle { display: inline-flex; }
  nav.site-nav {
    position: absolute; top: calc(var(--header-h) - 1px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .5rem clamp(1rem, 3vw, 2rem) 1rem;
    display: none;
  }
  nav.site-nav.open { display: flex; }
  nav.site-nav > a, .menu-trigger { padding: .8rem .4rem; width: 100%; }
  nav.site-nav > a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--accent); padding-left: .8rem; }
  nav.site-nav > a.nav-cta { margin: .6rem 0 0; justify-content: center; }
  .menu-list { position: static; box-shadow: none; margin: 0 0 .4rem; }
}

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; }
.container { max-width: 72rem; margin: 0 auto; padding: 2.25rem clamp(1rem, 3vw, 2rem) 3rem; }
.container.narrow { max-width: 46rem; }
.container > .alert:first-child { margin-bottom: 1.5rem; }

.page-head { margin-bottom: 1.75rem; }
.page-head h1 + p, .page-head .lead { margin-top: .5rem; max-width: 38rem; color: var(--ink-2); }
/* page head with an action on the right */
.page-head.with-action { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-end; justify-content: space-between; }

footer.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .86rem;
  padding: 1.4rem 0;
}
.site-footer .inner {
  max-width: 72rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem);
  display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; align-items: center; justify-content: space-between;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font: 600 .94rem/1.2 var(--font);
  padding: .62rem 1.15rem; border-radius: var(--r);
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hi); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--hover); border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--accent-hi); padding-left: .4rem; padding-right: .4rem; }
.btn-ghost:hover { background: var(--accent-wash); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-wash); }
.btn-small { padding: .38rem .75rem; font-size: .85rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Cards, badges, alerts ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.25rem 1.4rem;
}
.card.error  { border-color: var(--danger-line); }
.card.notice { border-color: var(--line-strong); }

.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: var(--r-sm);
  font-size: .78rem; font-weight: 600; line-height: 1.4;
}
.badge.ok        { background: var(--ok-wash);     color: var(--ok); }
.badge.failed    { background: var(--danger-wash); color: var(--danger); }
.badge.running   { background: var(--info-wash);   color: var(--info); }
.badge.pending,
.badge.cancelled { background: var(--hover);       color: var(--muted); }
.badge.skipped,
.badge.interrupted,
.badge.stopping,
.badge.warn      { background: var(--warn-wash);   color: var(--warn); }

.alert {
  display: flex; gap: .6rem; align-items: flex-start;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: .7rem .9rem; font-size: .92rem; color: var(--ink-2); background: var(--surface-2);
}
.alert .icon { margin-top: .15rem; }
.alert.warn  { background: var(--warn-wash);   border-color: var(--warn-line);   color: var(--warn); }
.alert.error { background: var(--danger-wash); border-color: var(--danger-line); color: var(--danger); }
.alert.ok    { background: var(--ok-wash);     border-color: rgba(127,209,142,.4); color: var(--ok); }
.alert.info  { background: var(--info-wash);   border-color: rgba(134,174,242,.4); color: var(--info); }

.messages { list-style: none; margin-bottom: 1rem; display: grid; gap: .4rem; }
.messages li {
  background: var(--ok-wash); border: 1px solid rgba(127,209,142,.4); color: var(--ok);
  padding: .6rem .9rem; border-radius: var(--r); font-size: .92rem;
}
.messages li.error   { background: var(--danger-wash); border-color: var(--danger-line); color: var(--danger); }
.messages li.warning { background: var(--warn-wash);   border-color: var(--warn-line);   color: var(--warn); }
.messages li.info    { background: var(--info-wash);   border-color: rgba(134,174,242,.4); color: var(--info); }

/* ---------- Chips, progress, pager ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink-2);
  border-radius: var(--r); padding: .22rem .65rem; font: 400 .84rem/1.4 var(--font);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); text-decoration: none; }
.chip.active { border-color: var(--accent-line); background: var(--accent-wash); color: var(--ink); }

.progress { height: .45rem; border-radius: 1rem; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 1rem; background: var(--accent); transition: width .4s ease; }
.pager { display: flex; gap: .8rem; align-items: center; margin-top: 1rem; }

details > summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
details > summary:hover { color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Tables ---------- */
table.data {
  border-collapse: separate; border-spacing: 0; width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  text-align: left; padding: .6rem .9rem;
  border-bottom: 1px solid var(--line); vertical-align: top; font-size: .92rem;
}
table.data th { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface-2); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: rgba(233, 236, 232, .025); }
table.data.middle td { vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* ---------- Form controls ---------- */
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number],
input[type=search], input[type=tel], input[type=date], input[type=datetime-local], textarea, select {
  width: 100%; padding: .6rem .75rem;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r); color: var(--ink); font: 400 .95rem/1.4 var(--font);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
}
input[aria-invalid="true"], .field.has-error input, .field.has-error textarea, .field.has-error select {
  border-color: var(--danger-line);
}
textarea { min-height: 7rem; resize: vertical; }
select option { background: var(--surface-2); color: var(--ink); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=file] { font: inherit; color: var(--muted); }
input[type=file]::file-selector-button {
  font: 500 .85rem/1.2 var(--font); color: var(--ink); background: var(--surface-3);
  border: 1px solid var(--line-strong); border-radius: var(--r); padding: .4rem .7rem; margin-right: .6rem; cursor: pointer;
}
::placeholder { color: var(--muted); opacity: .8; }
/* autofill must not turn fields light */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 100px var(--surface-2) inset;
  caret-color: var(--ink);
}

/* form layout - {% include "partials/form_field.html" with field=form.x %} */
.form { display: grid; gap: 1.05rem; }
.field { display: grid; gap: .38rem; }
.field > label, .field-label { font-size: .9rem; font-weight: 500; color: var(--ink); }
.field .help { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.field .help ul { list-style: disc; padding-left: 1.1rem; display: grid; gap: .1rem; }
.field.check { grid-template-columns: auto 1fr; align-items: start; column-gap: .55rem; }
.field.check > label { font-weight: 400; color: var(--ink-2); }
.errorlist { list-style: none; color: var(--danger); font-size: .85rem; display: grid; gap: .15rem; }
.form-errors { margin-bottom: .2rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: .3rem; }
.captcha-row { display: flex; gap: .6rem; align-items: center; }
.captcha-row img { border-radius: var(--r-sm); background: #fff; height: 2.6rem; width: auto; }
.captcha-row input { flex: 1; }

/* ---------- Account pages (login, signup, password reset ...) ---------- */
.auth {
  min-height: calc(100vh - var(--header-h) - 4.5rem);
  display: grid; place-items: center;
  padding: 2.5rem clamp(1rem, 3vw, 2rem) 3rem;
}
.auth-card {
  width: 100%; max-width: 25rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 2rem 1.9rem;
}
.auth-card.wide { max-width: 32rem; }
.auth-title { font-size: 1.4rem; font-weight: 600; letter-spacing: -.01em; }
.auth-lead { margin: .45rem 0 1.4rem; font-size: .94rem; color: var(--ink-2); }
.auth-title + .form { margin-top: 1.4rem; }
.auth-foot {
  margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
  font-size: .9rem; color: var(--muted); display: grid; gap: .35rem;
}
.auth-status { width: 2.4rem; height: 2.4rem; margin-bottom: 1rem; color: var(--accent); }
.auth-status .icon { width: 100%; height: 100%; }
.auth-status.warn { color: var(--warn); }
@media (max-width: 30rem) { .auth-card { padding: 1.5rem 1.2rem; border-radius: var(--r); } }

/* definition list for read-only facts (profile ...) */
dl.facts-list { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.4rem; font-size: .94rem; }
dl.facts-list dt { color: var(--muted); }
dl.facts-list dd { color: var(--ink); word-break: break-word; }

/* ---------- Long-form text (policies, profile copy) ---------- */
.prose { max-width: 38rem; color: var(--ink-2); }
.prose h1 { color: var(--ink); margin-bottom: 1rem; }
.prose h2 { color: var(--ink); margin: 2.2rem 0 .6rem; }
.prose h3 { color: var(--ink); margin: 1.6rem 0 .4rem; }
.prose p, .prose ul, .prose ol { margin: .7rem 0; line-height: 1.7; }
.prose ul { list-style: disc; padding-left: 1.3rem; }
.prose ol { padding-left: 1.3rem; }
.prose li { margin: .3rem 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: .18em; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); }
.mono  { font-family: var(--mono); }
pre.code {
  background: #0b0e10; border: 1px solid var(--line); color: #cfd7d3;
  padding: 1rem 1.2rem; border-radius: var(--r-lg);
  overflow-x: auto; font: 400 .82rem/1.6 var(--mono);
}
.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 1.6rem; text-align: center; color: var(--muted);
}
.empty p { color: var(--muted); }
.empty .btn { margin-top: .9rem; }

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