/*
 * KoinOS Control Centre.
 *
 * The chrome is ported from the project's own "Tenant Onboarding" design:
 * same header bar, same step cards, same eyebrow-and-question headings, same
 * field grid, same footer nav. The design carried its values as inline styles
 * inside an x-dc template; they are lifted into classes here so the markup
 * stays readable.
 *
 * What is NOT ported: the icon pack, the web font, the i18n stack and the
 * KoinBooks modules. This surface creates tenants, so it loads nothing from
 * anywhere else. A control plane that fetches from another origin has handed
 * that origin the ability to create tenants.
 *
 * Also absent: the prototype's "Prototype data - not for real records" badge.
 * These records are real.
 */
:root {
  --ink: #12352a;
  --ink-soft: #5b6f64;
  --field: #d4ddd7;
  --rule: #e0ddd0;
  --page: #071b14;
  --panel: #fff;
  --pos: #1f6b46;
  --sel: #e5f2e9;
  --gold: #e3bf71;
  --gold-deep: #d5ae5b;
  --bad: #8a1c1c;
  --warn: #7a5200;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(circle at 85% 10%, rgba(227, 191, 113, .14), transparent 28%),
    radial-gradient(circle at 8% 88%, rgba(38, 123, 83, .22), transparent 34%),
    var(--page);
  color: var(--ink);
  font: 14px/1.55 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.page { min-height: 100vh; display: flex; flex-direction: column; padding: 22px; }

/* ── header ───────────────────────────────────────────────────────────────── */

.bar {
  max-width: 1440px; width: 100%; margin: 0 auto 14px;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 32px;
  background: #0d3024; color: #fff;
  border: 1px solid rgba(255, 255, 255, .09); border-radius: 17px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
}
.mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--gold); color: #0b1a13;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
}
.bar .titles { flex: 1; min-width: 0; }
.bar b { font-size: 15px; font-weight: 800; }
.bar small { display: block; font-size: 12px; color: #b9c9c0; }
.bar .who { font-size: 12.5px; color: #b9c9c0; text-align: right; line-height: 1.4; }
.bar .exit {
  font-size: 12.5px; font-weight: 700; color: #c7d5cc;
  background: rgba(244, 241, 233, .1); border: 1px solid rgba(227, 191, 113, .4);
  border-radius: 999px; padding: 8px 14px; min-height: 38px; cursor: pointer;
}

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

.shell {
  flex: 1; max-width: 1440px; width: 100%; margin: 0 auto;
  display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: stretch;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 24px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .32);
}
.shell.solo { grid-template-columns: minmax(0, 1fr); }
.aside { position: relative; overflow: hidden; background: #0b2119; color: #fff; padding: 32px 26px; }
.aside:after {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  left: -130px; bottom: -110px; pointer-events: none;
  background: radial-gradient(circle, rgba(227, 191, 113, .14), transparent 68%);
}
.aside h2 {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 22px;
}
.main { padding: 36px 44px; overflow: auto; background: linear-gradient(145deg, #faf9f4 0%, #f2efe6 100%); }
.content { max-width: 720px; }

@media (max-width: 880px) {
  .page { padding: 0; }
  .bar { margin: 0; border-radius: 0; padding: 14px 18px; flex-wrap: wrap; }
  .shell { display: block; border-radius: 0; }
  .aside { padding: 18px; }
  .rail { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .main { padding: 28px 20px; }
}

/* ── the step rail ────────────────────────────────────────────────────────── */

.rail { display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.rail .step {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 12px; border-radius: 10px; background: transparent;
  border: 0; width: 100%; text-align: left; font: inherit; color: inherit;
  opacity: .82; cursor: default;
  transition: background .16s ease, transform .16s ease;
}
.rail .dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: rgba(255, 255, 255, .12); color: #a9bcb1;
}
.rail .label { font-size: 13.5px; font-weight: 600; color: #a9bcb1; }
.rail .step.done { opacity: 1; cursor: pointer; }
.rail .step.done:hover { background: rgba(255, 255, 255, .05); }
.rail .step.done .dot { background: var(--pos); color: #fff; }
.rail .step.done .label { color: #fff; }
.rail .step.now { opacity: 1; background: rgba(227, 191, 113, .14); }
.rail .step.now .dot { background: var(--gold); color: #0b1a13; }
.rail .step.now .label { color: #fff; }

/* ── step body ────────────────────────────────────────────────────────────── */

.step-in { animation: step-in .32s ease-out both; }
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pos); }
h1 { margin: 8px 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.lead { margin: 0 0 24px; font-size: 14px; color: var(--ink-soft); line-height: 1.6; max-width: 62ch; }
p { margin: .4rem 0; }
.muted { color: var(--ink-soft); }

/* align-items:start, so a field carrying a hint does not stretch and throw
   its neighbours' inputs out of line. */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: start; }
.fields .wide { grid-column: 1 / -1; }
label.f { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: #30453b; }
label.f input, label.f select, label.f textarea {
  padding: 12px 14px; border: 1px solid var(--field); border-radius: 10px;
  /* NOT `font: inherit`. The label is 700, and inheriting it renders every
     value and placeholder bold, which the design does not do. */
  font-family: inherit; font-size: 14px; font-weight: 400;
  color: var(--ink); background: #fff; width: 100%;
}
label.f input::placeholder { font-weight: 400; color: #9aa89f; }
label.f input:focus, label.f select:focus { outline: none; border-color: var(--pos); box-shadow: 0 0 0 4px rgba(31, 107, 70, .12); }
/* The hint sits below the input and out of the grid's height calculation, so
   it cannot shift the row. */
label.f small { font-size: 11.5px; font-weight: 400; color: #8a978d; line-height: 1.45; }
label.check { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: #30453b; }
label.check input { width: 17px; height: 17px; accent-color: var(--pos); }
.lang label.def input { width: auto; height: auto; }

.card { background: #fff; border: 1px solid #e4e0d3; border-radius: 14px; padding: 16px 18px; }
.card + .card { margin-top: 10px; }
.card > :first-child { margin-top: 0; }
details.extra { margin-top: 20px; border-top: 1px solid var(--rule); padding-top: 14px; }
details.extra summary { cursor: pointer; font-size: 13px; font-weight: 700; color: #30453b; }
details.extra .fields { margin-top: 14px; }

/* ── the language picker ──────────────────────────────────────────────────── */

.langs { border: 1px solid #e4e0d3; border-radius: 14px; background: #fff; max-height: 340px; overflow-y: auto; }
.lang { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid #f0efe7; }
.lang:last-child { border-bottom: 0; }
.lang input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--pos); }
.lang .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-soft); }
.lang .def { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.lang .def input { accent-color: var(--gold-deep); }

/* ── footer nav ───────────────────────────────────────────────────────────── */

.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule);
}
.nav .right { display: flex; gap: 10px; align-items: center; }
button {
  font: inherit; cursor: pointer; border: 0; border-radius: 11px;
  padding: 13px 26px; font-size: 14px; font-weight: 800;
  color: #fff; background: var(--pos);
  display: inline-flex; align-items: center; gap: 9px;
  transition: filter .16s ease, transform .16s ease, box-shadow .16s ease;
}
button:not(:disabled):hover { transform: translateY(-1px); filter: saturate(1.06); box-shadow: 0 8px 20px rgba(10, 49, 36, .12); }
button.ghost { color: var(--ink-soft); background: #fff; border: 1px solid var(--field); font-size: 13.5px; font-weight: 700; padding: 12px 22px; }
button.gold { color: #0b1a13; background: linear-gradient(135deg, var(--gold), var(--gold-deep)); }
button.small { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; font-weight: 700; }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── tables, pills, notices ───────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eceadf; vertical-align: top; }
tr:last-child th, tr:last-child td { border-bottom: 0; }
th { color: var(--ink-soft); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--field); }
.pill.good { color: var(--pos); background: var(--sel); border-color: #cbe5d6; }
.pill.warn { color: var(--warn); background: #fbf3e0; border-color: #ecdcb4; }

.notice { margin-top: 20px; padding: 13px 16px; border-radius: 11px; border: 1px solid var(--field); background: #fff; font-size: 13.5px; }
.notice.bad { color: var(--bad); border-color: #e6c6c6; background: #fdf5f5; }
.notice.good { color: var(--pos); border-color: #cbe5d6; background: var(--sel); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice .code { font-family: ui-monospace, monospace; font-size: 12px; opacity: .85; margin: 4px 0 0; }

.foot { max-width: 1440px; width: 100%; margin: 14px auto 0; font-size: 12px; color: #6f8e80; }
.foot [hidden] { display: none; }

/* ── sign-in, which has no shell ──────────────────────────────────────────── */

.signin { max-width: 440px; margin: 7vh auto; }
.signin h1 { color: #f4f1e9; }
.signin .lead { color: #9dbcae; }
.signin .card { padding: 26px 28px; }
