:root {
  --portal-orange: #FF8800;
  --portal-focus: #8b3c00;
  --portal-ink: #272b32;
  --portal-muted: #585e67;
  --portal-line: #dedfe3;
  --portal-selected: #fff0e5;
  --portal-paper: #f7f8fa;
  --portal-sidebar-width: 246px;
  --portal-header-height: 86px;
  background: var(--portal-paper);
  color: var(--portal-ink);
  font-size: 15px;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: white;
  border-bottom: 1px solid var(--portal-line);
  box-shadow: 0 2px 12px #212b3614;
}

.portal-header::before,
.portal-header::after {
  position: absolute;
  bottom: 0;
  background: var(--portal-orange);
  pointer-events: none;
  content: '';
}

.portal-header::before {
  left: 0;
  width: var(--portal-sidebar-width);
  height: 11px;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.portal-header::after {
  right: 0;
  width: 64px;
  height: 27px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.portal-header-inner {
  display: flex;
  align-items: center;
  min-height: calc(var(--portal-header-height) - 1px);
  gap: 18px;
  padding: 10px 46px 10px 26px;
}

.portal-header .brand {
  position: relative;
  flex: 0 0 auto;
  width: 130px;
  height: 69px;
  overflow: hidden;
}

.portal-header .brand-logo {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 100px;
  height: auto;
  transform: translateY(-50%);
}

.portal-title {
  flex: 1;
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid var(--portal-line);
  line-height: 1.2;
}

.portal-title strong {
  display: block;
  font-size: clamp(21px, 2.6vw, 29px);
  color: var(--portal-orange);
  letter-spacing: -.035em;
}

.portal-title span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
}

.portal-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}

.portal-tools form {
  margin: 0;
}

.portal-account {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.portal-header .portal-menu-toggle {
  display: none;
}

.portal-public-nav a,
.portal-sidebar a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.portal-public-nav a:hover,
.portal-public-nav [aria-current="page"],
.portal-sidebar a:hover,
.portal-sidebar [aria-current="page"] {
  color: var(--portal-orange);
  background: var(--portal-selected);
}

.portal-sidebar {
  position: fixed;
  inset: var(--portal-header-height) auto 0 0;
  width: var(--portal-sidebar-width);
  padding: 16px 10px;
  background: white;
  border-right: 1px solid var(--portal-line);
  overflow: auto;
}

.portal-sidebar a[aria-current="page"] {
  box-shadow: inset 3px 0 var(--portal-orange);
}

.portal-sidebar section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--portal-line);
}

.portal-sidebar h2 {
  margin: 0 12px 5px;
  font-size: 12px;
  color: var(--portal-muted);
  font-weight: 700;
}

.portal-signed-in .portal-content {
  margin-left: var(--portal-sidebar-width);
}

.portal-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--portal-muted);
  font-size: 12px;
  margin-bottom: 14px;
}

.portal-breadcrumb strong {
  color: var(--portal-ink);
}

main {
  max-width: 1480px;
  padding: 26px clamp(16px, 3vw, 38px) 36px;
  min-height: calc(100vh - 155px);
}

.heading.portal-intro {
  margin-bottom: 17px;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background: linear-gradient(115deg, white 65%, #fff1e6);
}

.portal-intro h1 {
  margin-bottom: 7px;
  color: var(--portal-orange);
  font-size: clamp(25px, 3.2vw, 38px);
}

.portal-intro p {
  margin: 0;
  color: var(--portal-muted);
}

.survey-layout {
  grid-template-columns: minmax(175px, 1fr) minmax(0, 3fr);
  gap: 16px;
}

.purpose {
  padding: 17px;
  background: white;
  border: 1px solid var(--portal-line);
  border-left: 3px solid var(--portal-orange);
  border-radius: 8px;
}

.purpose h2 { font-size: 17px; margin: 0; }
.purpose p { margin: 8px 0 0; }

.card,
.stats > div {
  border-color: var(--portal-line);
  border-radius: 8px;
  padding: clamp(15px, 2vw, 23px);
}

.card h2 {
  font-size: 20px;
  color: var(--portal-orange);
}

.stats {
  gap: 12px;
  margin-bottom: 16px;
}

.stats > div { border-top-color: var(--portal-orange); }
.color-0 { background: var(--portal-orange); }
.legend .color-0 { border: 1px solid var(--portal-focus); }

.stats strong {
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.button {
  background: var(--portal-orange);
  border-color: var(--portal-orange);
  color: var(--portal-ink);
  min-height: 40px;
}

.button:hover {
  background: #e67800;
  border-color: #e67800;
}

.button.light:hover {
  background: var(--portal-selected);
  color: var(--portal-orange);
}

.button.danger:hover {
  background: #8a231e;
  color: white;
}

:focus-visible {
  outline: 3px solid var(--portal-focus) !important;
  outline-offset: 3px;
}

.portal-skip {
  position: absolute;
  top: 5px;
  left: 10px;
  z-index: 10;
  padding: 8px 12px;
  background: white;
  color: var(--portal-ink);
  transform: translateY(-130%);
}

.portal-skip:focus { transform: none; }
#main-content { scroll-margin-top: calc(var(--portal-header-height) + 12px); }
.update-panel { max-width: 780px; margin: 0 0 14px; }
.update-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.update-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.update-panel input[type="file"] { max-width: 100%; font-size: 14px; }

@media (max-width: 1000px) {
  .survey-layout { grid-template-columns: 1fr; }
  .purpose { display: block; }
}

@media (max-width: 900px) {
  .portal-signed-in .portal-content { margin-left: 0; }
  .portal-header-inner { gap: 9px; padding-inline: 16px; }
  .portal-header::before, .portal-header::after { display: none; }
  .portal-title { padding-left: 10px; }
  .portal-account { display: none; }
  .portal-sidebar {
    position: static;
    width: 100%;
    padding: 7px 12px 12px;
    border: 0;
    border-top: 1px solid var(--portal-line);
    max-height: 60vh;
  }
  .has-portal-menu .portal-sidebar { display: none; }
  .has-portal-menu .portal-menu-toggle { display: inline-flex; }
  .has-portal-menu.is-open .portal-sidebar { display: block; }
}

@media (max-width: 560px) {
  .portal-header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 0;
    padding: 8px 12px;
    row-gap: 5px;
  }
  .portal-header .brand { width: 67px; height: 46px; }
  .portal-header .brand-logo { width: 67px; left: 0; }
  .portal-title { grid-column: 2 / -1; }
  .portal-title strong { font-size: clamp(17px, 4.4vw, 21px); }
  .portal-title span { display: none; }
  .portal-tools, .portal-public-nav { margin-right: auto; }
  .portal-tools { grid-column: 1 / -1; width: 100%; }
  .portal-tools form { margin-left: auto; }
  .portal-public-nav { grid-column: 1 / 3; }
  .portal-login { grid-column: 3; }
  .portal-header .button { padding: 6px 10px; font-size: 13px; }
  .portal-signed-in main { padding-top: 16px; }
  .purpose { padding: 12px 14px; }
  .card { padding: 15px; }
}

@media print {
  .portal-header, .portal-skip, .portal-breadcrumb, footer { display: none; }
  .portal-signed-in .portal-content { margin: 0; }
  main { padding: 0; min-height: 0; }
}
