body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #f6f7fb; color: #111; }
.topbar { display:flex; justify-content:space-between; align-items:center; padding:12px 18px; background:#fff; border-bottom:1px solid #e6e6e6; }
.brand { font-weight: 700; }
.topbar a { margin-left: 12px; text-decoration:none; color:#333; }
.container { padding: 18px; max-width: 1100px; margin: 0 auto; }

.card { background:#fff; border:1px solid #e6e6e6; border-radius:12px; padding: 14px; margin: 12px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.03); }
.grid2 { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.table { width:100%; border-collapse: collapse; background:#fff; border:1px solid #e6e6e6; border-radius:12px; overflow:hidden; }
.table th, .table td { padding: 10px; border-bottom:1px solid #eee; text-align:left; }
.table th { background:#fafafa; }

input, select, button { padding:10px; border-radius:8px; border:1px solid #ddd; width: 100%; box-sizing:border-box; margin: 6px 0 12px; font-family: inherit; font-size: inherit; }
button { cursor:pointer; background:#111; color:#fff; border: none; }
button:hover { opacity:0.9; }

/* Override global input width for checkboxes */
input[type="checkbox"],
input[type="radio"] {
  width: auto !important;
  margin: 0 !important;      /* remove extra margin */
  padding: 0 !important;
}

.btnlink { display:inline-block; padding:8px 10px; border:1px solid #ddd; border-radius:8px; text-decoration:none; color:#111; background:#fff; margin-right:8px; }
.btnlink:hover { background:#f3f3f3; }

.qmeta { font-size: 14px; color:#666; margin-bottom: 8px; }
.qtext { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.examples { font-size: 14px; color:#333; border-top:1px solid #eee; padding-top: 10px; }
.examples > div { margin: 6px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

.navrow { display:flex; gap: 10px; align-items: center; }
.navrow button { width: auto; padding: 10px 14px; margin: 0; }
.navrow a { width: auto; }
.navrow .btnlink { padding: 10px 14px; margin: 0; }

.cornerstat { position: relative; margin-top: 12px; text-align:right; font-weight:700; }
.flashwrap { margin: 10px 0; }
.flash { padding: 10px 12px; border-radius: 8px; margin: 8px 0; }
.flash.error { background:#ffe5e5; border:1px solid #ffb3b3; }
.flash.success { background:#e6ffed; border:1px solid #b7f2c5; }
.flash.info { background:#e7f1ff; border:1px solid #b9d7ff; }
.flash.nudge { background:#fff8e1; border:1px solid #ffe082; color:#7a5c00; }

.answerRow { display:flex; align-items:center; gap: 12px; margin-top: 12px; }
.answerRow .label { width: 110px; font-weight: 700; }
.buttons { display:flex; gap: 8px; flex-wrap: wrap; }
.buttons button { width: auto; padding: 10px 14px; background:#fff; color:#111; border:1px solid #ddd; }
.buttons button.active { background:#111; color:#fff; border-color:#111; }

.small { font-size: 13px; color:#666; margin-top: 10px; }

.results-table { display: flex; flex-direction: column; gap: 10px; }

.section-header {
  margin-top: 18px;
  padding: 10px 12px;
  font-weight: 800;
  background: #f2f4f7;
  border-radius: 10px;
}

.topic-header {
  margin-top: 8px;
  padding: 8px 12px;
  font-weight: 700;
  background: #fafafa;
  border-left: 4px solid #e5e7eb;
  border-radius: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: 2.2fr 2.2fr 1.2fr;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.rq-order { font-weight: 800; margin-bottom: 6px; }
.rq-text { line-height: 1.35; }

.spark {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  align-items: end;
  margin-bottom: 8px;
}

.spark-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.spark-bar {
  width: 100%;
  border-radius: 8px;
  background: #d1d5db;
  min-height: 2px;
}

.spark-label { font-size: 12px; color: #6b7280; border-radius: 4px; padding: 1px 5px; }
.spark-label-selected { background: var(--accent); color: #fff !important; }
.spark-count { font-size: 12px; font-weight: 700; }

.stats { display: flex; gap: 12px; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field-label { font-size: 12px; color: #6b7280; font-weight: 700; }
.candidate-select { padding: 6px 8px; }

.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.save-indicator { font-size: 12px; height: 16px; }

.rq-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;   /* important */
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.field.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: auto;              /* prevents full-width stretching */
  margin-top: 4px;
}

.field.checkbox input {
  margin: 0;
}

.rq-right .field.checkbox span {
  white-space: nowrap;
}

.rq-right {
  max-width: 260px;
}
.rq-right {
  background: #f9fafb;
  padding: 10px;
  border-radius: 8px;
}

/* Tight checkbox layout */
.rq-right .field.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;                  /* slightly tighter */
  width: auto;
}

/* =========================
   Enterprise Dashboard Theme (Green)
   Additive overrides only
   ========================= */

:root{
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;

  /* green accent */
  --accent: #15803d;          /* green-700 */
  --accent-hover: #166534;    /* green-800 */
  --accent-soft: #dcfce7;     /* green-100 */

  /* neutrals */
  --ink: #111827;             /* slate-900-ish */
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
}

/* Background + text */
body{
  background: var(--bg);
  color: var(--text);
}

/* Top bar: more "app" feel */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand{
  letter-spacing: 0.2px;
}

/* Cards: subtle premium shadow */
.card{
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* Tables */
.table{
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.table th{
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
}

/* Inputs: nicer focus ring without changing sizing rules */
input:focus, select:focus{
  outline: none;
  border-color: rgba(21, 128, 61, 0.55);
  box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.14);
}

/* Buttons: keep your sizing behavior, just modernize color */
button{
  background: var(--accent);
  color: #fff;
}
button:hover{
  opacity: 1;
  background: var(--accent-hover);
}

/* Secondary button class (optional to use in templates) */
.btn-secondary{
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
.btn-secondary:hover{
  background: #f1f5f9 !important;
}

.progress-wrap {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  margin: 10px 0 4px;
}
.progress-bar {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
}
.progress-label {
  display: block;
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 10px;
}

.navrow button:disabled{
  background: #fff !important;
  color: #aaa !important;
  border: 1px solid var(--border) !important;
  cursor: not-allowed;
  opacity: 1;
}

/* Your btnlink: make it look like "secondary" */
.btnlink{
  border-color: var(--border);
  background: #fff;
  color: var(--text);
}
.btnlink:hover{
  background: #f1f5f9;
}

/* Headings blocks in results */
.section-header{
  background: #eef2f7;
  border: 1px solid var(--border);
}
.topic-header{
  background: #f8fafc;
  border-left-color: var(--accent);
}

/* Results right panel: slightly clearer */
.rq-right{
  background: #f8fafc;
  border: 1px solid var(--border);
}

/* Spark bars: green instead of gray */
.spark-bar{
  background: #86efac; /* green-300 */
}

/* Active answer buttons: green highlight */
.buttons button.active{
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Muted helper (you already use .muted in templates sometimes) */
.muted{ color: var(--muted); }

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* Force a readable popup background — browsers otherwise inherit unpredictable
   defaults that can render option text nearly invisibly. */
select option {
  background-color: #ffffff;
  color: #0f172a;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form input {
  margin: 0;
}

.inline-form button {
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.cornerstat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.team-answer-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-answer-inline select {
  width: auto;          /* override global 100% */
  min-width: 70px;
}

/* Facilitator: nav + team answer on one line */
.navrow-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;        /* wraps nicely on narrow screens */
}

.navrow-inline .navrow {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.team-answer-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* Override the global select width:100% only for this control */
.team-answer-inline select {
  width: auto;
  min-width: 70px;
  margin: 0;              /* your global input/select margin can push layout */
}

.footer {
  margin-top: 40px;
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.8rem;
}

.btn-danger {
  background: #b91c1c;
  color: #fff;
  border: none;
}
.btn-danger:hover { opacity: 0.9; }

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.table-filter {
  flex: 0 0 auto;     /* prevent stretching */
}

.table-filter select {
  width: 260px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background-color: #fff;
  font-size: 14px;
}

/* Separator styling */
.stat-sep { color: #94a3b8; }

/* Avg/Median block spacing under Team Answer */
#avgMedWrap {
  text-align: right;
  margin-top: 6px;
}

/* Keep the responded stat right-aligned in the right card */
.cornerstat {
  text-align: right;
  font-weight: 700;
  margin-top: 12px;
}

/* Anonymous answer row: keep everything on one line */
.answerRow{
  display: flex;
  align-items: center;
  gap: 4px;              /* smaller space between label + buttons */
  flex-wrap: nowrap;     /* prevent wrapping into 2 lines */
}

/* Make the label take only the space it needs */
.answerRow .label{
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

/* Buttons container takes remaining space and stays one row */
.answerRow .buttons{
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  justify-content: space-between; /* spreads 5 buttons across */
}

/* Make each button a compact equal-width pill */
.answerRow .buttons button{
  flex: 1 1 0;
  min-width: 0;          /* important so flex can shrink */
  padding: 10px 0;       /* vertical comfort; no horizontal waste */
  border-radius: 10px;
}

.print-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap: 12px;
  margin: 8px 0 14px;
}

.print-actions button{
  padding: 10px 12px;
}

.print-table td, .print-table th{
  vertical-align: top;
}

.print-table tr{
  break-inside: avoid;         /* keep rows from splitting across pages */
  page-break-inside: avoid;
}

/* ── Progress Reporting ── */
.delta-chip { display: inline-block; padding: 1px 8px; border-radius: 12px; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.delta-up   { background: #dcfce7; color: #15803d; }
.delta-down { background: #fee2e2; color: #b91c1c; }
.delta-flat { background: #f1f5f9; color: #64748b; }

.spotlight-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.spotlight-item:last-child { border-bottom: none; }
.spotlight-text { flex: 1; }
.spotlight-scores { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

.progress-table { width: 100%; border-collapse: collapse; }
.progress-table th { text-align: left; padding: 6px; font-size: 0.85rem; color: #64748b; border-bottom: 2px solid var(--border); }
.progress-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
.progress-table tr:last-child td { border-bottom: none; }
.pt-section { font-weight: 700 !important; background: #f8fafc; padding: 8px 6px !important; font-size: 0.9rem !important; }
.pt-topic { color: var(--accent) !important; font-weight: 600 !important; font-size: 0.85rem !important; padding: 4px 6px 4px 16px !important; }
.learning-star { color: var(--accent); margin-right: 4px; }
.deep-dive-link { font-size: 0.75rem; font-weight: 500; margin-left: 10px; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 1px 6px; white-space: nowrap; text-decoration: none; }
.deep-dive-link:hover { background: var(--accent); color: #fff; }

.env-banner {
  background: #f59e0b;
  color: #000;
  text-align: center;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 6px 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media print{
  .topbar, .flashwrap, .print-actions, .btnlink { display:none !important; }
  .container{ max-width: none; padding: 0; }
  .card{ box-shadow:none; border: none; padding: 0; }
  .table th{ background: #fff !important; }
}