/*
  Placeholder brand styling - swap the tokens below for real KITH brand assets
  (logo, exact palette, typeface) once supplied. See PRD §6 "Pre-build dependencies".
*/
:root {
  --ink: #111111;
  --paper: #ffffff;
  --page-bg: #f5f4f2;
  --muted: #6b6b6b;
  --line: #e3e1dd;
  --line-soft: #ececea;
  --accent: #111111;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --ok: #147a3d;
  --ok-bg: #e5f5ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 8px 24px rgba(17, 17, 17, 0.06);
}

body {
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
}

a {
  color: var(--accent);
}

/* ---- Public site ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  background: var(--paper);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.site-header .site-logo {
  height: 32px;
  width: auto;
  display: block;
  justify-self: center;
}

.site-header-end {
  justify-self: end;
}

.language-switcher .dropdown-menu {
  min-width: 9rem;
}
.language-switcher form {
  margin: 0;
}
.language-switcher .dropdown-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}

.landing {
  max-width: 640px;
  margin: 72px auto;
  padding: 0 24px;
}
.landing h1 {
  font-size: 1.6rem;
  margin-bottom: 12px;
}
.landing p {
  color: var(--muted);
  line-height: 1.6;
}

.form-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 96px;
}
.form-shell > h1 {
  font-size: 1.55rem;
  margin-bottom: 4px;
}
.form-shell > p.text-muted {
  margin-bottom: 32px;
}

.material-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.material-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.material-tab.complete {
  border-color: var(--ok);
  color: var(--ok);
}
.material-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.material-tab-check {
  font-weight: 700;
}
.material-tab.review-tab {
  border-style: dashed;
}
.material-tab.review-tab.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.fds-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 32px;
  margin-top: 24px;
}
.fds-section:first-of-type {
  margin-top: 0;
}

.fds-section h2 {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4.5px;
  color: var(--muted);
}
.form-label.required::after {
  content: " *";
  color: var(--danger);
}

.form-control,
.form-select {
  border-radius: 6px;
  border-color: var(--line);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}
.form-control::placeholder {
  font-size: 0.8rem; /* 20% smaller than the input's own (1rem) text */
}

.form-text {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Two problems, one fix. (1) Labels of different lengths wrap to 1 or 2 lines,
   which otherwise leaves inputs in the same row starting at different Y
   positions - reserve a fixed height for every label (enough for 2 lines) and
   bottom-align the label text within it, so a 1-line label sits flush against
   its input exactly like a 2-line label's second line would, and every input
   in the form starts at the same offset regardless of its own label's length.
   (2) Different control types (a single input vs. a radio-button group) are
   different heights, which would otherwise leave inputs ending at different Y
   positions even with (1) solved - stretch each column to the row's full
   height and pin whatever follows the label (input, select, radio group,
   plaintext value) to the bottom, so every field's bottom edge - input,
   select, or otherwise - lines up on the same pixel across the row. */
.fds-section .row > [class*="col-"] {
  display: flex;
  flex-direction: column;
}
.fds-section .row > [class*="col-"] > .form-label {
  display: flex;
  align-items: flex-start;
  /* Fixed, not min - a 1-line label must reserve the exact same box as a
     2-line one (deterministic line-height * 2 lines), or a row mixing 1- and
     2-line labels ends up with labels sitting in boxes of different heights.
     Top-aligned (not bottom): if a label's real rendered height ever exceeds
     this reservation by a hair in some browser's font metrics, the overflow
     spills below the box - into the already-flexible gap before the input -
     instead of spilling above it and inflating the row's own registered
     height, which is what made some rows visibly taller than others. */
  line-height: 1.5;
  height: 2.7rem;
}
/* Applied by fds-form.js when NO label in a row actually wraps to 2 lines -
   the 2-line reservation above is only needed to match a wrapped sibling, so
   a row where everything is single-line shrinks to exactly one line's height
   instead of leaving the same gap a wrapped label would have needed. */
.fds-section .row.labels-tight > [class*="col-"] > .form-label {
  height: 1.35rem;
}
.fds-section .row > [class*="col-"] > .form-label + * {
  margin-top: auto;
}
/* Bootstrap's own .form-check carries a trailing margin-bottom (0.125rem) that
   a plain .form-control/.form-select doesn't - left in place it's just enough
   to leave a radio-group field's bottom edge a hair below its row-mates. */
.fds-section .row > [class*="col-"] > .form-check:last-of-type {
  margin-bottom: 0;
}

.content-rows-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fafaf9;
}

.content-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 8px;
}
.content-row .remove-content-row {
  display: flex;
  align-items: center;
  justify-content: center;
}
.content-row:last-child {
  margin-bottom: 0;
}
.content-row .form-control {
  flex: 1;
}
.content-row input[name$=".Percent"] {
  max-width: 110px;
  flex: none;
}

.content-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.content-sum-badge {
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: #ececea;
  font-variant-numeric: tabular-nums;
}
.content-sum-badge.ok { background: var(--ok-bg); color: var(--ok); }
.content-sum-badge.bad { background: var(--danger-bg); color: var(--danger); }

.lead-time-total-box {
  background: #fafaf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lead-time-total-box .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.lead-time-total-box .value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.invalid-feedback-block:empty {
  /* An empty inline span still reserves line-height "strut" space from its own
     font metrics even with no text - enough to nudge a field with a validation
     span a few px lower than a field with no span at all (or vice versa) in
     the bottom-alignment flex trick above. Collapsing it to nothing when empty
     (jQuery Validate fills it with text on error, at which point :empty no
     longer matches) keeps every field's reserved height identical regardless
     of whether that field happens to have a validation span in the markup. */
  display: none;
}
.invalid-feedback-block {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* reCAPTCHA v3 has no checkbox - Google's terms allow hiding its floating badge
   as long as the required attribution text is shown on the page instead. */
.grecaptcha-badge {
  visibility: hidden;
}

/* ---- Admin ---- */
.admin-body {
  background: #f7f7f7;
}
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  min-height: 100vh;
  background: var(--ink);
  color: #fff;
  padding: 24px 0;
}
.admin-brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 12px;
  text-align: center;
}
.admin-logo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
}
.admin-logo-chip .site-logo {
  height: 20px;
  width: auto;
  display: block;
}
.admin-brand-subtitle {
  display: block;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 10px;
}

.link-cell code {
  word-break: break-all;
}
.link-cell .copy-link-btn {
  flex: none;
  white-space: nowrap;
}
.admin-sidebar .nav-link {
  color: rgba(255,255,255,0.75);
  padding: 10px 20px;
}
.admin-sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.admin-main {
  min-width: 0;
}
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
}
.admin-content {
  padding: 28px;
}

.materials-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.material-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ececea;
  font-size: 0.85rem;
}
.remove-material-chip {
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.remove-material-chip:hover {
  color: var(--danger);
}

.material-progress {
  min-width: 140px;
}
.material-progress .progress {
  height: 6px;
  margin: 4px 0;
}
