:root {
  color-scheme: light;
  --ink: #24212a;
  --muted: #605965;
  --accent: #b6173d;
  --accent-dark: #931032;
  --pink: #fef0f3;
  --line: #e6dfe5;
  --surface: #fff;
  --background: #f7f5f7;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
  font-size: 16px;
  line-height: 1.55;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.26; letter-spacing: -.025em; }
h1 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); }
h2 { font-size: clamp(1.18rem, 2vw, 1.55rem); }
h3 { font-size: 1.05rem; }
a { color: var(--accent-dark); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button, input, select, textarea, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #5d47be; outline-offset: 3px; }
#step-heading:focus { outline: none; }
.masthead { border-top: 4px solid var(--accent); border-bottom: 1px solid var(--line); background: white; }
.header-inner { width: min(1210px, 100% - 44px); margin: auto; display: flex; gap: 17px; align-items: center; min-height: 72px; }
.header-inner img { object-fit: contain; object-position: left; flex: 0 0 auto; }
.header-title { border-left: 1px solid var(--line); padding-left: 16px; font-weight: 650; }
.header-year, #logout { margin-left: auto; }
.header-year { font-size: .85rem; font-weight: 750; letter-spacing: .11em; color: var(--accent-dark); }
.page { width: min(1170px, 100% - 44px); margin: clamp(24px, 5vw, 72px) auto 0; }
.survey-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(250px, 1fr); gap: 24px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 28px #30233709; min-width: 0; }
.survey-panel { padding: clamp(22px, 4.5vw, 52px); border-top: 5px solid var(--accent); }
.intro { margin-bottom: 28px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.intro h1 { letter-spacing: -.032em; font-size: clamp(1.6rem, 3.4vw, 2.5rem); font-weight: 800; }
.intro p, .state p { margin-top: 15px; color: var(--muted); }
.state { display: grid; justify-items: start; }
.state button { margin-top: 26px; }
.loading { padding: 30px; color: var(--muted); }
.section-label { margin-bottom: 11px; color: var(--accent-dark); font-weight: 700; }
.office-grid, .rating-grid { display: grid; gap: 10px; margin: 20px 0 8px; }
.office-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rating-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { position: relative; display: flex; align-items: center; gap: 9px; border: 1px solid #dcd4db; border-radius: 12px; padding: 13px; background: #fff; cursor: pointer; }
.choice:hover, .check:hover { border-color: var(--accent); background: #fef8fa; }
.choice:has(:checked) { border-color: var(--accent); background: var(--pink); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--accent); }
input[type=radio], input[type=checkbox] { inline-size: 19px; block-size: 19px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.office { min-height: 60px; font-weight: 740; }
.rating { align-items: flex-start; flex-direction: column; min-height: 106px; }
.rating input { position: absolute; top: 14px; right: 12px; }
.rating-number { font-size: 1.4rem; line-height: 1; font-weight: 800; }
.reason-question { margin: 18px 0 13px; font-weight: 700; }
.reason-box { background: #fff6f8; border: 1px solid #e9cad3; padding: 16px; margin: 16px 0 0; border-radius: 12px; min-width: 0; }
.reason-box legend { max-width: 100%; color: var(--accent-dark); font-weight: 750; padding: 0 5px; }
.reason-options { display: grid; gap: 6px; }
.check { display: flex; align-items: start; gap: 10px; min-height: 44px; padding: 9px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.check input { margin-top: 3px; }
.field { display: grid; gap: 6px; margin-top: 12px; font-weight: 650; }
.field textarea, .field input { font-weight: 400; }
input:not([type=radio],[type=checkbox]), textarea, select {
  width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #d9d1d8; border-radius: 9px;
  background: white; color: var(--ink); min-height: 44px;
}
textarea { resize: vertical; }
.field-error { color: #a01332; font-weight: 650; margin-top: 8px; }
.field-error:empty { display: none; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.primary, .secondary, .danger { min-height: 44px; border: 1px solid transparent; border-radius: 9px; padding: 9px 17px; font-weight: 750; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { color: var(--ink); border-color: #d9d1d8; background: white; }
.secondary:hover { background: #f5f0f4; }
.danger { background: #fff5f5; color: #a5112a; border-color: #f0ccd5; }
button:disabled { opacity: .65; cursor: wait; }
.progress-panel { border-radius: 18px; border: 1px solid #e6d5de; background: #faf3f6; padding: 24px; }
.progress-panel h2 { font-size: 1.1rem; }
.progress-value { color: var(--muted); font-size: .95rem; margin: 9px 0 4px; }
progress { border: 0; border-radius: 6px; width: 100%; height: 8px; background: #e9dce2; overflow: hidden; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #e9dce2; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.progress-panel ol { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 4px; }
.progress-panel li { display: flex; gap: 9px; align-items: start; font-size: .95rem; color: var(--muted); padding: 6px 3px; line-height: 1.35; }
.progress-panel li span { display: inline-grid; place-items: center; flex: 0 0 22px; height: 22px; border-radius: 50%; font-size: .8rem; font-weight: 700; background: #eee4e9; }
.progress-panel li.current { color: var(--accent-dark); font-weight: 750; }
.progress-panel li.current span { color: white; background: var(--accent); }
.progress-panel li.done span { color: #235544; background: #dbede4; }
.deadline { border-top: 1px solid #eadbe3; margin-top: 13px; padding-top: 12px; font-size: .9rem; color: var(--muted); }
.deadline strong { display: block; color: var(--ink); }
.trap { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
.site-footer { width: min(1170px, 100% - 44px); margin: 24px auto; color: var(--muted); font-size: .9rem; }
.stack { display: grid; gap: 10px; justify-items: start; }
.stack > .field { width: 100%; }
.admin-page { width: min(1240px, 100% - 40px); margin: 34px auto 65px; }
.login { max-width: 475px; margin: 7vh auto; padding: clamp(22px, 4vw, 40px); border-top: 5px solid var(--accent); }
.login p { margin: 11px 0; }
.admin-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.admin-hero p { color: var(--muted); margin-top: 6px; }
.dashboard-section { padding: clamp(16px, 2.7vw, 28px); margin-top: 16px; }
.dashboard-section h2 + p { margin-top: 8px; }
.navigation { display: flex; gap: 7px; overflow-x: auto; padding: 5px 4px 9px; }
.navigation button { white-space: nowrap; }
.navigation button[aria-current] { color: white; background: var(--accent); border-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters .field { min-width: 135px; }
.cards { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; }
.metric { border: 1px solid var(--line); border-radius: 12px; background: white; padding: 13px 16px; color: var(--muted); font-size: .92rem; }
.metric strong { display: block; font-size: 1.65rem; line-height: 1.12; margin-bottom: 4px; color: var(--ink); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { padding: 18px; margin-top: 12px; }
.chart-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chart-card header button { font-size: .85rem; padding: 5px 10px; min-height: 36px; }
.chart-card .field { margin-bottom: 10px; }
.chart-area { position: relative; height: 270px; }
.chart-area.tall { height: 340px; }
.table-wrap { overflow: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .93rem; }
th, td { padding: 8px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8f2f5; color: #413841; }
.heat td:not(:first-child) { text-align: center; min-width: 68px; }
.heat-low { background: #f8dfe3; color: #871c30; }
.heat-mid { background: #fff1cc; color: #724a00; }
.heat-high { background: #dff1e7; color: #1e593d; }
.warning { border-left: 4px solid #b2700c; background: #fff6e4; color: #6c4402; padding: 10px 13px; margin-top: 12px; }
.muted { color: var(--muted); }
.pre-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.item-list { padding-left: 1.35em; }
.item-list li + li { margin-top: 7px; }
details { padding: 10px 0; border-bottom: 1px solid var(--line); }
summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.login .actions, .dashboard-section .actions { margin-top: 14px; }
.inline-form { display: grid; gap: 10px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-form .check { margin-top: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
dialog { max-width: min(480px, 100% - 24px); border: 1px solid var(--line); border-radius: 15px; padding: 24px; }
dialog::backdrop { background: #2215217a; }
@media (max-width: 860px) {
  .survey-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .progress-panel { grid-row: 1; padding: 10px 16px; }
  .progress-panel h2, .progress-panel ol, .progress-panel .deadline { display: none; }
  .progress-value { margin: 0; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
  .header-inner, .page, .site-footer, .admin-page { width: calc(100% - 24px); }
  .header-inner { gap: 10px; min-height: 60px; }
  .header-inner img { width: 76px; height: 38px; }
  .header-title { padding-left: 8px; font-size: .92rem; }
  .header-year { display: none; }
  .page { margin-top: 14px; }
  .survey-panel { padding: 16px; }
  .office-grid { gap: 7px; }
  .office { gap: 6px; padding-inline: 8px; }
  .rating-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions button { flex: 1 1 auto; }
  .admin-page { margin-top: 20px; }
  .admin-hero { flex-direction: column; }
  .form-columns { grid-template-columns: 1fr; gap: 0; }
}
