/* Survey platform — admin portal.
   The palette is derived from what the product measures: the promoter /
   passive / detractor trio is the same everywhere a score appears, so a colour
   always means the same thing whether it's on a chart, a table cell or a badge. */

:root {
  --ink:        #16202A;
  --ink-soft:   #52636F;
  --ink-faint:  #8695A0;
  --petrol:     #12414F;
  --petrol-dim: #0D3340;
  --petrol-lit: #1C5C6E;
  --paper:      #FBFCFD;
  --surface:    #FFFFFF;
  --rule:       #DDE3E7;
  --rule-soft:  #EDF1F3;

  --promoter:   #2E7D5B;
  --passive:    #E8A33D;
  --detractor:  #C2453D;
  --promoter-wash:  #E8F2EC;
  --passive-wash:   #FBF1DF;
  --detractor-wash: #F7E7E5;

  --radius: 5px;
  --rail: 232px;
  --shadow-lift: 0 1px 2px rgba(22, 32, 42, .06), 0 8px 24px rgba(22, 32, 42, .08);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

a { color: var(--petrol-lit); text-decoration: none; }
a:hover { text-decoration: underline; }
a.support-email { color: var(--petrol); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
a.support-email:hover { color: var(--petrol-lit); }
:focus-visible { outline: 2px solid var(--petrol-lit); outline-offset: 2px; }

h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }

/* ---------- Shell ---------- */
:root {
  --rail-width: 264px;
  --rail-collapsed-width: 76px;
  --rail-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-width);
  flex: 0 0 var(--rail-width);
  background: linear-gradient(175deg, var(--petrol) 0%, var(--petrol-dim) 100%);
  color: var(--petrol-text, #CFDDE2);
  font-family: var(--rail-font);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  box-shadow: 2px 0 16px rgba(0,0,0,.12);
  transition: width .22s cubic-bezier(.4,0,.2,1), flex-basis .22s cubic-bezier(.4,0,.2,1);
}
.shell.is-collapsed .rail { width: var(--rail-collapsed-width); flex-basis: var(--rail-collapsed-width); }

.rail__brand {
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rail__brand-link { display: flex; align-items: center; justify-content: center; text-decoration: none; width: 100%; }
.rail__logo-box {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.rail__logo { max-height: 40px; max-width: 100%; display: block; margin: 0 auto; }
.rail__logo-fallback { font-weight: 700; font-size: .8rem; color: #fff; }
.rail__brand-text { font-size: .92rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail__brand-text strong { font-size: .88rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail__brand-text small { font-size: .68rem; opacity: .6; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell.is-collapsed .rail__brand-text { display: none; }
.shell.is-collapsed .rail__brand { justify-content: center; padding: 18px 10px 16px; }

.rail__collapse-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--petrol-text, #CFDDE2);
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, transform .22s ease;
}
.rail__collapse-btn:hover { background: rgba(255,255,255,.16); }
.rail__collapse-btn svg { width: 14px; height: 14px; transition: transform .22s ease; }
.shell.is-collapsed .rail__collapse-btn svg { transform: rotate(180deg); }

.rail__scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px; }
.rail__scroll::-webkit-scrollbar { width: 5px; }
.rail__scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.rail__group { padding: 6px 0; }
.rail__group + .rail__group { border-top: 1px solid rgba(255, 255, 255, 0.34); margin-top: 4px; padding-top: 10px; }
.rail__label {
  padding: 2px 12px 8px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--petrol-text, #6F97A3);
  opacity: .5;
  white-space: nowrap;
  overflow: hidden;
}
.shell.is-collapsed .rail__label { display: none; }

.rail a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 10px;
  color: var(--petrol-text, #CFDDE2);
  font-size: .875rem;
  font-weight: 450;
  text-decoration: none;
  transition: background-color .15s ease, opacity .15s ease;
  white-space: nowrap;
  overflow: hidden;
}
.rail__icon-chip {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  transition: background-color .15s ease;
}
.rail__icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; transition: opacity .15s ease; }
.rail a span:not(.rail__icon-chip) { overflow: hidden; text-overflow: ellipsis; }
.shell.is-collapsed .rail a { justify-content: center; padding: 8px; gap: 0; }
.shell.is-collapsed .rail a span:not(.rail__icon-chip) { display: none; }

.rail a:hover { background: color-mix(in srgb, var(--petrol-hover, #fff) 16%, transparent); }
.rail a:hover .rail__icon { opacity: 1; }

.rail a.is-active {
  background: color-mix(in srgb, var(--petrol-hover, #fff) 22%, transparent);
  font-weight: 600;
  color: #fff;
}
.rail a.is-active .rail__icon-chip { background: var(--petrol-lit); }
.rail a.is-active .rail__icon { opacity: 1; color: #fff; }

.rail__foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
}
.shell.is-collapsed .rail__foot { padding: 14px 10px; justify-content: center; }
.rail__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--petrol-lit);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.15);
}
.rail__foot-text { flex: 1; min-width: 0; font-size: .8rem; line-height: 1.3; color: var(--petrol-text, #CFDDE2); }
.rail__foot-text strong { display: block; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__foot-text span { opacity: .65; font-size: .74rem; }
.shell.is-collapsed .rail__foot-text { display: none; }
.rail__signout {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  color: var(--petrol-text, #9FBAC3);
  opacity: .75;
  transition: background-color .15s ease, opacity .15s ease;
}
.rail__signout:hover { background: rgba(255,255,255,.12); opacity: 1; }
.rail__signout button { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; }
.shell.is-collapsed .rail__signout { display: none; }

.main { flex: 1; min-width: 0; }

.topbar {
  padding: 18px 28px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: box-shadow .2s ease;
  min-height: 40px;   /* keeps height consistent even when the crumb row is absent */
}
.topbar.is-scrolled { box-shadow: 0 4px 16px rgba(0,0,0,.06); }

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted, #8a9299);
  margin-bottom: 14px;
  line-height: 1;
  min-height: 14px;
}
.crumbs__link { color: var(--muted, #8a9299); text-decoration: none; transition: color .15s ease; }
.crumbs__link:hover { color: var(--petrol); }
.crumbs__chevron { width: 12px; height: 12px; opacity: .45; flex-shrink: 0; }
.crumbs__current { color: var(--ink, #1a2b30); font-weight: 600; }

.topbar__row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar__title { display: flex; align-items: center; gap: 14px; }
.page-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--petrol) 10%, white);
  color: var(--petrol);
  border: 1px solid color-mix(in srgb, var(--petrol) 16%, white);
}
.page-icon svg { width: 19px; height: 19px; }
.topbar__title h1 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 650;
  letter-spacing: -.015em;
  color: var(--ink, #1a2b30);
  line-height: 1.25;
}
.topbar__meta { font-size: .82rem; color: var(--muted, #8a9299); margin-top: 1px; }
.topbar__meta:empty { display: none; }
.topbar__actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.content { padding: 28px 28px 64px; max-width: 1280px; }

@media (max-width: 640px) {
  .topbar { padding: 14px 16px 16px; }
  .page-icon { width: 34px; height: 34px; border-radius: 9px; }
  .page-icon svg { width: 16px; height: 16px; }
  .topbar__title h1 { font-size: 1.08rem; }
  .crumbs { font-size: .72rem; }
}
/* ---------- Instrument strip: the headline metrics ---------- */
.strip {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.strip__cell {
  flex: 1 1 150px;
  padding: 16px 20px;
  border-right: 1px solid var(--rule-soft);
}
.strip__cell:last-child { border-right: 0; }
.strip__value {
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.strip__label { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }
.strip__note { font-size: .76rem; color: var(--ink-faint); }
.value--promoter { color: var(--promoter); }
.value--passive { color: var(--passive); }
.value--detractor { color: var(--detractor); }
.value--muted { color: var(--ink-faint); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--rule);
}
.panel__head h2, .panel__head h3 { margin: 0; font-size: .98rem; }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }
.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: .8rem;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--rule-soft);
  white-space: nowrap;
}
.table td { padding: 11px 18px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #F7FAFB; }
.table .num { text-align: right; }
.table__empty { padding: 40px 18px; text-align: center; color: var(--ink-soft); }
.table-scroll { overflow-x: auto; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: .76rem;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--draft      { background: var(--rule-soft); color: var(--ink-soft); border-color: var(--rule); }
.badge--published  { background: var(--promoter-wash); color: var(--promoter); }
.badge--paused     { background: var(--passive-wash); color: #96631A; }
.badge--closed,
.badge--archived   { background: #EFF2F4; color: var(--ink-faint); }
.badge--completed  { background: var(--promoter-wash); color: var(--promoter); }
.badge--in_progress { background: #E6F0F3; color: var(--petrol-lit); }
.badge--screened_out,
.badge--quota_full { background: var(--passive-wash); color: #96631A; }
.badge--abandoned,
.badge--failed,
.badge--bounced    { background: var(--detractor-wash); color: var(--detractor); }
.badge--type       { background: #E6F0F3; color: var(--petrol); font-family: ui-monospace, monospace; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #F2F6F7; text-decoration: none; }
.btn--primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn--primary:hover { background: var(--petrol-dim); }
.btn--danger { color: var(--detractor); border-color: #E9C9C6; }
.btn--danger:hover { background: var(--detractor-wash); }
.btn--small { padding: 5px 11px; font-size: .82rem; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 5px; }
.field .hint { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], input[type=datetime-local], input[type=search],
select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--petrol-lit);
  outline: 2px solid rgba(28, 92, 110, .16);
  outline-offset: 0;
}
textarea { resize: vertical; min-height: 78px; }
input[type=color] { width: 46px; height: 34px; padding: 2px; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--surface); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 180px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.checkline input { width: auto; }

/* ---------- Toolbar / filters ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 190px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  font-size: .82rem;
  color: var(--ink-soft);
  background: var(--surface);
}
.chip.is-active { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.chip:hover { text-decoration: none; }

/* ---------- Flash ---------- */
.flashes { padding: 12px 28px 0; }
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin-bottom: 8px;
  font-size: .9rem;
}
.flash--success { background: var(--promoter-wash); border-color: var(--promoter); }
.flash--error   { background: var(--detractor-wash); border-color: var(--detractor); }
.flash--info    { background: #E6F0F3; border-color: var(--petrol-lit); }
.flash--warning { background: var(--passive-wash); border-color: var(--passive); }

/* ---------- Builder ---------- */
.builder { display: grid; grid-template-columns: 1fr 268px; gap: 20px; align-items: start; }
.page-block { margin-bottom: 18px; }
.page-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: #EFF4F5;
  border: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  font-size: .92rem;
}
.q-list { border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface); min-height: 54px; }
.q-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--surface);
}
.q-item:last-child { border-bottom: 0; }
.q-item.dragging { opacity: .4; }
.q-item.drag-over { border-top: 2px solid var(--petrol-lit); }
.q-handle {
  cursor: grab;
  color: var(--ink-faint);
  font-size: 1.05rem;
  line-height: 1.3;
  user-select: none;
  padding-top: 1px;
}
.q-body { flex: 1; min-width: 0; }
.q-title { font-weight: 500; }
.q-meta { font-size: .8rem; color: var(--ink-soft); display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center; margin-top: 3px; }
.q-code { font-family: ui-monospace, monospace; font-size: .78rem; color: var(--petrol-lit); }
.q-actions { display: flex; gap: 6px; flex-shrink: 0; }
.type-list { display: flex; flex-direction: column; gap: 3px; }
.type-btn {
  text-align: left;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  color: var(--ink);
}
.type-btn:hover { background: #EFF4F5; border-color: var(--rule); }
.type-group { font-size: .74rem; color: var(--ink-faint); padding: 9px 11px 3px; }

/* ---------- Charts (CSS-only, no JS dependency) ---------- */
.bar-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 62px; gap: 12px;
  align-items: center; margin-bottom: 9px; font-size: .88rem; }
.bar-track { background: var(--rule-soft); border-radius: 3px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--petrol-lit); border-radius: 3px; }
.bar-fill--promoter { background: var(--promoter); }
.bar-fill--passive { background: var(--passive); }
.bar-fill--detractor { background: var(--detractor); }
.bar-value { text-align: right; color: var(--ink-soft); font-size: .84rem; }

.nps-band { display: flex; height: 26px; border-radius: 3px; overflow: hidden;
  border: 1px solid var(--rule); }
.nps-band span { display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: .76rem; font-weight: 500; }
.nps-band .seg--detractor { background: var(--detractor); }
.nps-band .seg--passive { background: var(--passive); }
.nps-band .seg--promoter { background: var(--promoter); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 64px; }
.spark__bar { flex: 1; background: var(--petrol-lit); border-radius: 2px 2px 0 0; min-height: 2px; }
.spark__bar--muted { background: #BBCCD3; }

.matrix-cell { text-align: center; font-variant-numeric: tabular-nums; }
.heat-1 { background: #F4F8F6; } .heat-2 { background: #E4F0E9; }
.heat-3 { background: #CFE5D8; } .heat-4 { background: #B4D7C3; }
.heat-5 { background: #93C7AB; }

/* ---------- Misc ---------- */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; font-size: .88rem; }
.pagination a, .pagination span { padding: 5px 10px; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--surface); }
.pagination .is-current { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-soft); }
.empty h3 { color: var(--ink); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .84rem; }
.stack > * + * { margin-top: 14px; }
.inline-form { display: inline; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: ui-monospace, monospace; font-size: .82rem; }
details.disclosure summary { cursor: pointer; font-weight: 500; padding: 6px 0; }

/* ---------- Auth screens ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth__aside {
  background: var(--petrol);
  color: #DCE7EA;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth__aside h1 { color: #fff; font-size: 2rem; max-width: 15ch; }
.auth__aside p { max-width: 42ch; }
.auth-logo { max-height: 36px; margin-bottom: 16px; }
.auth__scale { display: flex; gap: 3px; margin-top: 28px; }
.auth__scale i {
  height: 7px;
  flex: 1;
  border-radius: 2px;
  display: block;
}
.auth__form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth__form form { width: 100%; max-width: 350px; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .builder { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 12px; padding-right: 12px; }
  /* The sidebar is a slide-in drawer on mobile — see "Mobile drawer" at the end. */
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  padding: 32px 20px;
  border: 2px dashed var(--rule);
  border-radius: 12px;
  background: var(--surface-2, #F7F9FA);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--petrol);
  background: rgba(18, 65, 79, .04);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone__icon {
  width: 40px; height: 40px;
  color: var(--petrol);
  opacity: .7;
}
.dropzone__title { font-weight: 600; font-size: .95rem; color: var(--ink, #1A2B30); }
.dropzone__hint { font-size: .8rem; color: var(--muted, #6B838A); }
.dropzone__filename {
  margin-top: 4px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--petrol);
  display: none;
}
.dropzone.has-file .dropzone__filename { display: block; }
.dropzone.has-file .dropzone__title { display: none; }
/* ===================================================================
   DASHBOARD — client look & feel
   Replace the existing "===================== Dashboard ====================="
   block at the end of your stylesheet with everything below.

   COLOUR RULE (deliberate, not decorative):
     The BRAND colour (--dash-brand, and its --dash-brand-dim/-soft
     shades) is reserved for the chart bars/segments and the small round
     brand mark only (generated at runtime by the tint() helper in
     dashboard.html) — that's where "colourful" earns its keep, on data.
     Heading/label TEXT (card titles, the headline number, the period
     label, category pills) is plain neutral ink (--ink / --ink-soft),
     same as every other heading on the site — deliberately NOT derived
     from the org's brand hue at all, so a dark-green brand (Skoda) or
     any other org doesn't still read as coloured text, just darker.
     Everything else — stat values, tile labels, table text and chart
     axis ticks — stays on that same neutral ink / grey scale.

   RESPONSIVENESS:
     Every grid child carries `min-width: 0`. Without it a grid item
     defaults to `min-width: auto`, refuses to shrink below its content,
     and a Chart.js canvas then pushes the whole page sideways. That was
     the horizontal-scroll bug.
   =================================================================== */

/* -------------------------------------------------------------------
   BRAND TOKENS — chart colours hang off these three lines.
   Nothing below hardcodes a brand colour, so Audi / Skoda / VW each
   render their charts in their own identity automatically.

   --dash-brand resolves in this order:
     1. --dash-brand-override  (set it if you ever want the dashboard
        to differ from the sidebar colour)
     2. --petrol               (what the Branding page writes from
        "Sidebar background" / primary_color)
     3. #12414F                (last-resort default)
   --dash-brand-dim / --dash-brand-soft follow the same org's
   --petrol-dim / --petrol-lit and are used only for the brand mark and
   interactive accents (select hover/focus) below — never for heading
   text, see the COLOUR RULE above.

   NOTE: if your base template injects the saved colours under different
   variable names, change ONLY the var() names on the next three lines —
   everything else follows automatically.
   ------------------------------------------------------------------- */
:root {
  --dash-brand:       var(--dash-brand-override, var(--petrol, #12414F));
  --dash-brand-dim:   var(--petrol-dim, #0D3340);
  --dash-brand-soft:  var(--petrol-lit, #1C5C6E);

  --dash-tray:       #F4F6F7;  /* grey card background — neutral, brand-agnostic */
  --dash-tile:       #FFFFFF;  /* white tile background */
  --dash-tile-rule:  #E6EBEE;
  --dash-label:      #8A959C;  /* small grey labels */
}

/* Canvas must never dictate layout width. */
.dash-card canvas { max-width: 100%; display: block; }

/* ---------- Headline strip ---------- */
.dash-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  margin-bottom: 20px;
}
.dash-headline__text { font-size: 1rem; min-width: 0; }
.dash-headline__label  { color: var(--ink-soft); margin-right: 4px; }
.dash-headline__period { font-weight: 700; color: var(--ink); margin-right: 4px; }
/* the one hero figure on the page — plain ink, not brand-coloured */
.dash-headline__value  { font-weight: 800; font-size: 1.22rem; color: var(--ink); }
.dash-headline__filters {
  display: flex;
  gap: 8px;
  /* flex-wrap: wrap; */
  align-items: center;
  padding: 4px;
  background: var(--dash-tray);
  border: 1px solid var(--dash-tile-rule);
  border-radius: 9px;
}
.dash-select {
  padding: 7px 12px;
  min-width: 124px;
  max-width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  font-size: .86rem;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.dash-select:hover:not(:disabled) { border-color: var(--dash-brand-soft); }
.dash-select:focus-visible {
  outline: none;
  border-color: var(--dash-brand-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dash-brand) 16%, transparent);
}
.dash-select:disabled { opacity: .65; cursor: not-allowed; }

/* ---------- Card shell (grey tray) ---------- */
.dash-card {
  min-width: 0;                 /* lets the card shrink inside a grid */
  background: var(--dash-tray);
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  padding: 16px 18px 18px;
}
.dash-card--kpi { margin-top: 20px; }

/* Card titles — plain ink, same weight/size treatment as any other
   section heading. Not derived from the brand colour (see COLOUR RULE). */
.dash-card__title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin: 0 0 4px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.dash-card__period { font-weight: 600; color: var(--ink-soft); }

/* Brand mark placeholder — swap for <img> once the org logo exists.
   Stays on the full-strength brand colour: it's a small filled badge,
   not body text, so the accent still reads cleanly here. */
.dash-card__mark {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--dash-brand);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
}

.dash-card__note { margin: 8px 0 14px; font-size: .85rem; color: var(--ink-soft); }
.dash-card__foot { margin: 14px 0 0; font-size: .79rem; color: var(--ink-faint); }

/* ---------- Two cards side by side ---------- */
.dash-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* minmax(0,…) = no overflow */
  gap: 20px;
}
.dash-grid-2 > * { min-width: 0; }
@media (max-width: 1180px) { .dash-grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Tiles left / chart right ---------- */
.dash-card__split {
  display: grid;
  grid-template-columns: minmax(0, 186px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 12px;
  align-items: stretch;
}
.dash-card__split > * { min-width: 0; }
@media (max-width: 860px) {
  .dash-card__split { grid-template-columns: minmax(0, 1fr); }
}

.dash-tiles { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* on narrow screens the four stats read better as a 2-up grid */
@media (max-width: 860px) {
  .dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

.dash-tile {
  min-width: 0;
  background: var(--dash-tile);
  border: 1px solid var(--dash-tile-rule);
  border-radius: 8px;
  padding: 11px 13px;
}
.dash-tile__label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--dash-label);
  line-height: 1.3;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}
/* stat values are plain ink — not brand-coloured */
.dash-tile__value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* ---------- Chart box ---------- */
.dash-chart-box {
  min-width: 0;
  background: var(--dash-tile);
  border: 1px solid var(--dash-tile-rule);
  border-radius: 8px;
  padding: 10px 10px 4px;
}
.dash-chart-wrap { position: relative; width: 100%; min-width: 0; height: 280px; }

/* Metrics charts are supporting detail, not the hero — they run shorter
   than the two headline charts at the top of the page. */
.dash-chart-wrap--short { height: 190px; }
.dash-chart-wrap--donut { height: 170px; }

/* doughnut beside its figure list */
.dash-chart-box--split {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 12px;
}
.dash-chart-box--split > * { min-width: 0; }

@media (max-width: 860px) {
  .dash-chart-wrap { height: 240px; }
  .dash-chart-wrap--short { height: 185px; }
  .dash-chart-box--split { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- KPI score tiles ---------- */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 178px), 1fr));
  gap: 12px;
}
.dash-kpi-grid > * { min-width: 0; }
.dash-kpi-grid--tight {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr));
}
.dash-kpi-grid--tight .dash-tile__value { font-size: 1.2rem; }

/* Smallest tile size — used for the seven-across volume strip so it reads
   as one quiet row of figures rather than seven competing cards. */
.dash-kpi-grid--mini {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 124px), 1fr));
  gap: 8px;
}
.dash-kpi-grid--mini .dash-tile { padding: 8px 10px; }
.dash-kpi-grid--mini .dash-tile__label { font-size: .69rem; margin-bottom: 1px; }
.dash-kpi-grid--mini .dash-tile__value { font-size: 1.02rem; }

/* ---------- Metrics sub-sections ---------- */
.dash-sub {
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .94rem;
  font-weight: 700;
}
.dash-sub:first-of-type { margin-top: 4px; }
.dash-subcard { min-width: 0; }
.dash-grid-2--metrics { margin-top: 4px; gap: 16px; align-items: start; }

/* The metrics card carries three sub-sections, so it needs a tighter
   internal rhythm than the single-purpose cards above it. */
.dash-metrics .dash-sub { margin: 16px 0 8px; font-size: .88rem; }
.dash-metrics .dash-kpi-grid { margin-bottom: 10px; }
.dash-metrics .dash-card__note { margin-bottom: 10px; }

/* Category pills */
.dash-cat {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
/* Volume = the brand's own category, so its PILL BACKGROUND wears a faint
   brand tint (still distinguishes it from the two fixed neutral
   categories below) — but its text stays plain ink, same as them, not
   the brand colour (see COLOUR RULE). */
.dash-cat--volume {
  background: color-mix(in srgb, var(--dash-brand) 12%, #fff);
  color: var(--ink);
}
.dash-cat--disposition { background: #EFF1F4; color: #414B59; }
.dash-cat--invitation  { background: #FBF1DF; color: #8A5A11; }

/* ---------- Compact figure list ---------- */
.dash-minilist {
  margin-top: 12px;
  min-width: 0;
  background: var(--dash-tile);
  border: 1px solid var(--dash-tile-rule);
  border-radius: 8px;
  overflow: hidden;
}
/* sits inside a chart box, so it drops its own frame and spacing */
.dash-minilist--flush {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.dash-minilist--flush .dash-minirow { padding: 5px 2px; font-size: .8rem; }

.dash-minirow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 13px;
  font-size: .84rem;
  border-bottom: 1px solid var(--rule-soft);
}
.dash-minirow:last-child { border-bottom: 0; }
.dash-minirow:hover { background: #F7FAFB; }
.dash-minirow span { color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.dash-minirow b {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ---------- Small-screen trims ---------- */
@media (max-width: 560px) {
  .dash-card { padding: 14px 13px 16px; border-radius: 10px; }
  .dash-headline { padding: 12px 14px; }
  .dash-headline__filters { width: 100%; }
  .dash-headline__filters .dash-select { flex: 1 1 120px; min-width: 0; }
  .dash-card__title { font-size: .95rem; }
  .dash-tile__value { font-size: 1.16rem; }
}

/* ---------- Sidebar brand switcher (ALL Admin) ---------- */
.rail__brand-switcher { position: relative; padding: 0 12px 10px; flex-shrink: 0; }
.rail__brand-switcher-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.rail__brand-switcher-btn strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.rail__brand-switcher-btn:hover { background: rgba(255,255,255,.14); }
.rail__brand-switcher-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 12px;
  right: 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow-lift);
  z-index: 40;
  overflow: hidden;
}
.rail__brand-switcher-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  text-align: left;
}
.rail__brand-switcher-option:hover { background: var(--rule-soft); }
.rail__brand-switcher-option.is-active { font-weight: 600; color: var(--petrol); }
.rail__brand-switcher-logo { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.shell.is-collapsed .rail__brand-switcher { display: none; }

/* ---------- Report tiles (Reports page) ---------- */
.report-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.report-tile {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-tile__title { font-weight: 600; font-size: .96rem; }
.report-tile__desc { font-size: .83rem; color: var(--ink-soft); flex: 1; }
.report-tile--soon { opacity: .6; }

/* =====================================================================
   COMPACT DENSITY (Oct 2026)
   At 100% browser zoom the portal now looks like it used to at ~85%:
   smaller base type, tighter paddings, slimmer sidebar, shorter rows.
   Everything below only overrides sizes defined earlier in this file.
   ===================================================================== */
html { font-size: 14px; }                 /* rem base: 16px -> 14px */
body { font-size: 13.5px; line-height: 1.5; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }

:root { --rail-width: 228px; --rail-collapsed-width: 64px; }
.rail__brand { padding: 14px 12px 12px; }
.rail__logo { max-height: 32px; }
.rail__scroll { padding: 8px 8px; }
.rail__group { padding: 4px 0; }
.rail__group + .rail__group { margin-top: 2px; padding-top: 7px; }
.rail__label { padding: 2px 10px 5px; font-size: .62rem; }
.rail a { gap: 9px; padding: 5px 8px; margin: 1px 0; border-radius: 8px; font-size: .86rem; }
.rail__icon-chip { width: 24px; height: 24px; border-radius: 7px; }
.rail__icon { width: 15px; height: 15px; }
.rail__foot { padding: 10px 12px; gap: 8px; }
.rail__avatar { width: 28px; height: 28px; font-size: .78rem; }
.shell.is-collapsed .rail a { padding: 6px; }

.page-icon { width: 32px; height: 32px; border-radius: 9px; }
.page-icon svg { width: 16px; height: 16px; }

.strip { margin-bottom: 16px; }
.strip__cell { padding: 11px 14px; }
.strip__value { font-size: 1.45rem; }
.strip__label { font-size: .78rem; }

.panel { margin-bottom: 14px; }
.panel__head { padding: 9px 14px; }
.panel__head h2, .panel__head h3 { font-size: .92rem; }
.panel__body { padding: 14px; }
.grid { gap: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.table { font-size: .88rem; }
.table th { padding: 7px 12px; font-size: .76rem; }
.table td { padding: 7px 12px; }
.table__empty { padding: 28px 14px; }

.badge { padding: 1px 8px; font-size: .74rem; }

.btn { padding: 6px 12px; gap: 6px; font-size: .86rem; }
.btn--small { padding: 4px 9px; font-size: .8rem; }

.field { margin-bottom: 11px; }
.field label { font-size: .84rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], input[type=datetime-local], input[type=search],
select, textarea { padding: 6px 9px; font-size: .9rem; }
.form-row { gap: 10px; }

.toolbar { gap: 8px; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar select { min-width: 160px; }
.chip { padding: 3px 10px; font-size: .8rem; }

.flash { padding: 8px 12px; font-size: .88rem; }
.pagination { margin-top: 12px; font-size: .84rem; }
.pagination a, .pagination span { padding: 4px 9px; }
.empty { padding: 32px 16px; }

.page-tabs { margin-bottom: 12px; }
.page-tab { padding: 8px 13px; font-size: .86rem; }

/* Dashboard */
.dash-headline { padding: 10px 14px; margin-bottom: 14px; }
.dash-card { padding: 12px 14px 14px; border-radius: 10px; }
.dash-card--kpi { margin-top: 14px; }
.dash-card__title { font-size: .95rem; }
.dash-grid-2 { gap: 14px; }
.dash-tile { padding: 8px 11px; }
.dash-tile__value { font-size: 1.12rem; }
.dash-chart-wrap { height: 240px; }
.dash-chart-wrap--short { height: 170px; }
.dash-select { padding: 5px 10px; font-size: .84rem; }

/* Reports */
.report-tiles { gap: 12px; }
.report-tile { padding: 12px 14px; border-radius: 9px; gap: 6px; }

/* =====================================================================
   MOBILE DRAWER + APP FEEL (Oct 2026)
   <= 900px: the sidebar slides in from the left over a dim backdrop
   (menu button in the header), always with labels; touch-sized rows.
   ===================================================================== */
.rail-backdrop { display: none; }
body.no-scroll { overflow: hidden; }

@media (max-width: 900px) {
  .shell { display: block; }
  .rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: min(84vw, 300px); height: 100vh; height: 100dvh;
    flex: none; flex-direction: column;
    transform: translateX(-105%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 8px 0 32px rgba(0,0,0,.25);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .shell.is-nav-open .rail { transform: translateX(0); }
  .rail-backdrop {
    display: block; position: fixed; inset: 0; z-index: 999;
    background: rgba(10, 18, 24, .45);
    -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
  }
  .rail-backdrop[hidden] { display: none; }

  /* drawer always shows the full menu (desktop collapse doesn't apply) */
  .rail__group, .rail__label { display: block; }
  .rail__foot { display: flex; }
  .rail a { padding: 10px 10px; font-size: .95rem; min-height: 44px; }
  .rail__icon-chip { width: 28px; height: 28px; }
  .rail__collapse-btn { width: 34px; height: 34px; }
  .rail__collapse-btn svg { transform: none; }
  .rail__brand { justify-content: space-between; }

  .main { min-height: 100vh; }

  /* touch-friendly controls; 16px inputs stop iOS from zooming in */
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=url], input[type=date], input[type=datetime-local], input[type=search],
  select, textarea { font-size: 16px; padding: 9px 11px; }
  .btn { padding: 9px 14px; font-size: .92rem; }
  .btn--small { padding: 7px 11px; }
  .toolbar input[type=search], .toolbar select { min-width: 0; width: 100%; }
  .toolbar form { width: 100%; }
  .toolbar form > * { flex: 1 1 140px; }

  /* cards feel native: rounder, edge-to-edge spacing */
  .panel, .report-tile, .dash-card { border-radius: 14px; }
  .panel__head { padding: 11px 14px; }
  .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }

  /* wide tables scroll sideways inside their card instead of the page */
  .content table.table, .content .panel table {
    display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .strip__cell { flex: 1 1 45%; }
  .strip__value { font-size: 1.25rem; }
}