/* =========================================================================
   OD & CC Tools — layout + components. Tokens from tokens.css.
   Direction: "Console" (finalized) — flat, hairline, dense, sharp.
   ========================================================================= */
* { box-sizing: border-box; }
html { color-scheme: dark; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-1);
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--brand-ring); color: var(--fg-1); }
a { color: inherit; }
h1,h2,h3,h4,p { margin: 0; }

/* Console signature: faint engineering grid on the app canvas */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background:
    repeating-linear-gradient(0deg,  rgba(255,255,255,0.015) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 40px),
    var(--bg-1);
}

/* Unauthenticated shell (signin) — no sidebar, centered content */
.app-plain {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.content--center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-0);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px var(--s5);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.brandmark {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--brand-2);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
  position: relative;
}
.brandmark span {
  font-weight: var(--fw-black);
  font-size: 19px;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.02em;
}
.brandmark::after {           /* small signal tick — modern detail */
  content: "";
  position: absolute;
  right: -1px; bottom: -1px;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--brand);
  border: 1.5px solid var(--bg-0);
}
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar__brand-name { font-weight: var(--fw-bold); color: var(--fg-1); font-size: 14px; letter-spacing: 0; }
.sidebar__brand-sub  { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); margin-top: 3px; }

.nav-group { padding: var(--s4) var(--s3) var(--s2); }
.nav-group__label {
  font-size: 10.5px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 var(--s3) var(--s2);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px var(--s3);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  border: 0;
  background: transparent;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__item svg { width: 17px; height: 17px; flex: none; color: var(--fg-3); transition: color var(--dur-fast) var(--ease); }
.nav__item:hover { background: var(--bg-3); color: var(--fg-1); }
.nav__item:hover svg { color: var(--fg-2); }
.nav__item.is-active {
  background: var(--bg-3);
  color: var(--fg-1);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.nav__item.is-active svg { color: var(--brand); }
.nav__lock { margin-left: auto; color: var(--fg-muted); display: inline-flex; }
.nav__lock svg { width: 13px; height: 13px; }

.sidebar__foot {
  margin-top: auto;
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-dot { display: inline-flex; align-items: center; gap: 6px; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }

/* ---------- Main column ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s4);
  min-height: var(--topbar-h);
  padding: 0 var(--s8);
  background: color-mix(in srgb, var(--bg-1) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__page { display: flex; flex-direction: column; line-height: 1.1; }
.topbar__crumb { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); letter-spacing: 0.02em; }
.topbar__title { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--fg-1); margin-top: 2px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--s5); }

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.env-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }

.user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-left: var(--s5);
  border-left: 1px solid var(--line);
}
.user__meta { text-align: right; line-height: 1.25; }
.user__name { font-size: 13px; font-weight: var(--fw-semi); color: var(--fg-1); }
.user__mail { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }
.avatar {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-weight: var(--fw-bold);
  font-size: 13px;
  color: var(--fg-1);
  flex: none;
}

/* ---------- Banners ---------- */
.audit-strip {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px var(--s8);
  background: var(--audit-bg);
  border-bottom: 1px solid #a52a2a;
  color: #fbd5d5;
  font-size: 13px;
  line-height: 1.45;
}
.audit-strip svg { width: 17px; height: 17px; flex: none; color: #fca5a5; margin-top: 1px; }
.audit-strip strong { color: #fff; font-weight: var(--fw-bold); }
.audit-strip .sub { font-size: 12px; opacity: 0.85; }
.audit-strip .host { margin-left: auto; font-family: var(--font-mono); font-size: 11px; opacity: 0.7; white-space: nowrap; }

/* ---------- Content ---------- */
.content { padding: var(--s8) var(--s8) 64px; flex: 1; }
.wrap { max-width: var(--content-max); margin: 0 auto; }

.section { margin-bottom: var(--section-gap); }
.section__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: var(--s4); }
.section__head h2 {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: 0;
  text-transform: lowercase;
}
.section__head h2::before { content: "> "; color: var(--brand); }
.section__head .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.section__rule { height: 1px; background: var(--line); flex: 1; align-self: center; }

/* ---------- Card ---------- */
.card {
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  padding: var(--card-pad);
  position: relative;
}
.card__title { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--fg-1); }
.card__sub { color: var(--fg-3); font-size: 13px; margin-top: 4px; }
.card__head { margin-bottom: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }

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

/* ---------- Stat tiles (Console: flat, 2px top rule, mono labels) ---------- */
.stat {
  background: var(--card-bg);
  border: var(--card-border);
  border-top: 2px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--card-shadow);
  padding: var(--s5);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat__top { display: flex; align-items: center; justify-content: space-between; }
.stat__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-3);
}
.stat__ic { width: 32px; height: 32px; border-radius: 2px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); color: var(--fg-2); }
.stat__ic svg { width: 16px; height: 16px; }
.stat__val { font-size: 30px; font-weight: var(--fw-bold); color: var(--fg-1); font-family: var(--font-mono); line-height: 1; letter-spacing: -0.01em; }
.stat__val--sm { font-size: 18px; line-height: 1.2; }
.stat__delta { font-size: 12px; color: var(--fg-3); }
.stat__delta b { font-family: var(--font-mono); }
.stat__delta .up { color: var(--success); }
.stat__delta .dn { color: var(--error); }

/* ---------- Buttons (Console: flat, no lift) ---------- */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--brand-ink);
  background: var(--brand-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--brand-3); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--brand-ring); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--ghost { background: var(--bg-3); color: var(--fg-1); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--bg-2); border-color: var(--brand); color: var(--fg-1); }
.btn--quiet { background: transparent; color: var(--fg-2); border-color: var(--line-strong); }
.btn--quiet:hover { background: var(--bg-3); color: var(--fg-1); }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--s4); }
.field__label { font-size: 13px; font-weight: var(--fw-semi); color: var(--fg-2); }
.field__hint { font-size: 12px; color: var(--fg-3); }
.input {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 13px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg-1);
  outline: 0;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--fg-muted); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.input--mono { font-family: var(--font-mono); font-size: 13px; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--fg-3); }
.input-icon .input { padding-left: 38px; }

/* file inputs */
.input[type="file"] { padding: 8px 13px; cursor: pointer; }
.input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 12px;
  font-weight: var(--fw-semi);
  color: var(--fg-1);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 5px 11px;
  margin-right: 12px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.input[type="file"]::file-selector-button:hover { background: var(--bg-2); }

/* ---------- Checkbox rows ----------
   Real <input type="checkbox"> elements drive the visual state via :checked
   (the input is visually hidden but still posts with the form). */
.checks { display: grid; gap: 8px; }
.check {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.check:hover { background: var(--bg-3); }
.check__input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}
.check__box {
  width: 18px; height: 18px; border-radius: 2px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-0);
  display: grid; place-items: center; flex: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(0.6); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.check__input:checked ~ .check__box { background: var(--brand-2); border-color: var(--brand-2); }
.check__input:checked ~ .check__box svg { opacity: 1; transform: scale(1); }
.check__input:focus-visible ~ .check__box { box-shadow: 0 0 0 3px var(--brand-ring); }
.check__name { font-size: 14px; color: var(--fg-1); font-weight: var(--fw-semi); }
.check__desc { font-size: 12px; color: var(--fg-3); margin-left: auto; font-family: var(--font-mono); }
/* nested sub-option (e.g. location duplicate-handling select) */
.check-suboption { margin: 4px 0 8px 30px; }

/* Segmented */
.seg {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.seg button {
  font-family: inherit; font-size: 13px; font-weight: var(--fw-semi);
  padding: 7px 15px; border: 0; background: transparent;
  color: var(--fg-3); border-radius: calc(var(--r-sm) - 2px); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg button:hover { color: var(--fg-1); }
.seg button.is-active { background: var(--brand-2); color: var(--brand-ink); }

/* ---------- Table ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 11px; font-weight: var(--fw-bold); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--fg-3); text-align: left;
  padding: 11px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.table td { font-size: 13px; color: var(--fg-2); padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover td { background: var(--bg-3); }
.table .mono { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); }
.table .strong { color: var(--fg-1); font-weight: var(--fw-semi); }

/* ---------- Status tokens / badges (dot + tinted chip, mono label) ---------- */
.tok {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  padding: 3px 9px; border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tok--ok   { color: var(--success); background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.tok--warn { color: var(--warning); background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.tok--err  { color: var(--error);   background: var(--error-bg);   border-color: color-mix(in srgb, var(--error) 28%, transparent); }
.tok--info { color: var(--info);     background: var(--info-bg);    border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.tok--mute { color: var(--fg-3);     background: var(--bg-3);       border-color: var(--line); }

/* ---------- Inline banners ---------- */
.inbn {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5; border: 1px solid transparent;
}
.inbn svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.inbn b, .inbn strong { color: var(--fg-1); }
.inbn--ok   { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: #bdeed6; }
.inbn--ok svg { color: var(--success); }
.inbn--warn { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: #f6dca6; }
.inbn--warn svg { color: var(--warning); }
.inbn--err  { background: var(--error-bg); border-color: color-mix(in srgb, var(--error) 35%, transparent); color: #f6c4c2; }
.inbn--err svg { color: var(--error); }

/* ---------- Log viewer ---------- */
.log {
  background: #110d09;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--fg-2);
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.log--tall { max-height: none; height: calc(80vh - 120px); }
.log .t { color: var(--fg-muted); }
.log .ok { color: var(--success); }
.log .er { color: var(--error); }
.log .wk { color: var(--warning); }
.log .in { color: var(--info); }
.log::-webkit-scrollbar { width: 9px; }
.log::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

/* ---------- Footer (security notice — every environment) ---------- */
.footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--footer-bg);
  color: #fde9c8;
  border-top: 3px solid var(--footer-bd);
  padding: 12px var(--s8);
  font-size: 13px;
  display: flex; align-items: center; gap: 11px; line-height: 1.45;
}
.footer svg { width: 17px; height: 17px; flex: none; color: var(--warning); }
.footer strong { color: #fff6e6; font-weight: var(--fw-bold); }

/* ---------- App-specific ---------- */
/* GoLive check disables the form until cleared */
form.disabled-form .checks,
form.disabled-form .btn-row,
form.disabled-form .check-suboption,
form.disabled-form input[type="file"] {
  opacity: 0.4;
  pointer-events: none;
}

/* utility */
.muted { color: var(--fg-3); }
.mono { font-family: var(--font-mono); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr 1fr; }
}
