:root {
  --navy: #0f2942;
  --blue: #175d9c;
  --line: #dbe3ec;
  --soft: #f3f6f9;
  --text: #1f2a37;
}
body { background: var(--soft); color: var(--text); }
.public-body { background: var(--soft); }
.topbar { background: var(--navy); }
.brand-mark { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark img { width: 58px; height: 46px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px; }
.brand-mark span { font-weight: 800; }
.app-shell { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 245px; background: #fff; border-right: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.sidebar a { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 6px; }
.sidebar a:hover { background: var(--soft); color: var(--blue); }
.content { flex: 1; padding: 24px; max-width: 1500px; margin: 0 auto; width: 100%; }
.public-content { padding: 24px; max-width: 1360px; margin: 0 auto; width: 100%; }
.home-panel { min-height: calc(100vh - 150px); display: grid; place-content: center; gap: 26px; text-align: center; }
.home-panel h1 { font-size: clamp(2.1rem, 6vw, 4.5rem); font-weight: 800; color: var(--navy); }
.home-logo { width: min(520px, 82vw); height: auto; object-fit: contain; mix-blend-mode: multiply; }
.login-logo { width: min(260px, 72vw); height: auto; object-fit: contain; mix-blend-mode: multiply; }
.survey-logo { width: 118px; height: auto; object-fit: contain; mix-blend-mode: multiply; margin-bottom: 8px; }
.thanks-panel { min-height: calc(100vh - 150px); display: grid; place-content: center; gap: 18px; text-align: center; max-width: 760px; margin: 0 auto; }
.thanks-panel h1 { font-size: clamp(2rem, 5vw, 3.7rem); font-weight: 800; color: var(--navy); }
.thanks-panel p { font-size: 1.25rem; color: #4b5563; }
.thanks-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: #25a36f; color: #fff; font-size: 2.3rem; font-weight: 800; }
.home-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.eyebrow { color: var(--blue); text-transform: uppercase; font-weight: 700; font-size: .78rem; letter-spacing: 0; margin-bottom: 4px; }
.auth-box, .form-section, .factor-section, .chart-card, .admin-form, .kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.auth-box { max-width: 430px; margin: 8vh auto; }
.page-head, .survey-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.page-head h1, .survey-head h1, .auth-box h1 { color: var(--navy); font-weight: 800; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi span { display: block; color: #667085; font-size: .9rem; margin-bottom: 8px; }
.kpi strong { font-size: 1.2rem; color: var(--navy); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.chart-card { height: 360px; overflow: hidden; display: flex; flex-direction: column; }
.chart-card h2 { font-size: 1rem; color: var(--navy); margin-bottom: 14px; }
.chart-card canvas { width: 100% !important; height: 290px !important; max-height: 290px !important; flex: 1; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card.wide canvas { height: 285px !important; max-height: 285px !important; }
.survey-progress { width: min(420px, 36vw); height: 28px; background: #dbe3ec; flex: 1 1 320px; max-width: 460px; margin-right: auto; }
.survey-step { max-width: 920px; margin: 0 auto; }
.step-card h2 { color: var(--navy); font-size: 1.35rem; font-weight: 800; margin-bottom: 18px; }
.step-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800; margin-bottom: 12px; }
.step-actions, .submit-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 20px; }
.factor-section { margin-top: 18px; }
.factor-section h2 { font-size: 1.3rem; color: var(--navy); margin-bottom: 14px; }
.question-list { display: grid; gap: 12px; }
.question-card, .open-question-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.question-card { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.open-question-card { display: grid; gap: 12px; }
.question-text { display: flex; gap: 10px; line-height: 1.35; }
.question-text span { flex: 0 0 34px; height: 34px; display: grid; place-items: center; background: var(--soft); color: var(--blue); font-weight: 800; border-radius: 6px; }
.open-question-card textarea { resize: vertical; min-height: 76px; }
.answer-toggle { display: grid; grid-template-columns: 96px 96px; gap: 8px; }
.answer-toggle .btn { min-height: 48px; display: grid; place-items: center; font-weight: 700; }
.sticky-submit { position: sticky; bottom: 0; background: rgba(243,246,249,.94); padding: 14px 0; margin-top: 12px; }
.admin-grid { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 18px; }
.admin-form { align-self: start; }
.admin-form .form-label { margin-top: 10px; }
.catalog-actions { min-width: 360px; }
.catalog-actions > .btn { margin: 2px; }
.danger-box { border: 1px solid #f2b705; background: #fff9e6; border-radius: 6px; padding: 10px; max-width: 520px; }
.table-card { overflow: auto; }
.comments-table { max-height: 520px; overflow: auto; }
.word-list { display: flex; flex-wrap: wrap; gap: 8px; }
.word-list span { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.btn-primary { background: var(--blue); border-color: var(--blue); }

@media (max-width: 992px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .content { padding: 16px; }
  .filters, .kpi-grid, .chart-grid, .admin-grid { grid-template-columns: 1fr; }
  .page-head, .survey-head { align-items: stretch; flex-direction: column; }
  .survey-progress { width: 100%; max-width: none; flex-basis: auto; }
  .step-actions, .submit-actions { flex-direction: column; }
  .step-actions .btn, .submit-actions .btn { width: 100%; }
  .submit-actions .survey-progress { order: -1; }
  .chart-card { height: 330px; }
  .chart-card canvas, .chart-card.wide canvas { height: 260px !important; max-height: 260px !important; }
}
@media (max-width: 640px) {
  .brand-mark img { width: 48px; height: 40px; }
  .question-card { grid-template-columns: 1fr; }
  .answer-toggle { grid-template-columns: 1fr 1fr; }
  .home-actions .btn { width: 100%; }
  .content { padding: 12px; }
}
