/* Shared application shell: intentionally loaded after page-specific CSS. */
:root {
  --brand-950: #071f36;
  --brand-900: #0b2d4d;
  --brand-800: #10466f;
  --brand-600: #147e9f;
  --brand-500: #1596b5;
  --accent: #e87828;
  --canvas: #eef3f6;
  --surface: #ffffff;
  --surface-soft: #f6f9fb;
  --ink: #102a43;
  --muted: #62788b;
  --line: #d3dfe7;
  --focus: #147e9f;
  --danger: #b33636;
  --success: #19704b;
  --shadow: 0 16px 36px rgba(16, 42, 67, .12);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: Aptos, "Segoe UI", sans-serif;
  line-height: 1.45;
  background:
    radial-gradient(circle at 88% -10%, rgba(21, 150, 181, .24), transparent 28rem),
    linear-gradient(180deg, var(--brand-950) 0, var(--brand-900) 12.5rem, var(--canvas) 12.5rem, var(--canvas) 100%);
}

button, input, select, textarea { font: inherit; }

.page {
  max-width: 1600px;
  padding: 16px clamp(14px, 2.5vw, 34px) 32px;
}

.topbar,
.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  color: #dce9f1;
}

.top-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 4px 0 9px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  font-size: 12px;
}

.top-actions span {
  margin-right: auto;
  font-weight: 650;
  letter-spacing: .01em;
}

.top-actions a,
.topbar .btn,
.topbar a.btn {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(222, 238, 246, .32);
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: #f6fbfe;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.top-actions a:hover,
.topbar .btn:hover,
.topbar a.btn:hover {
  border-color: rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .16);
  transform: translateY(-1px);
}

.app-nav-root {
  position: relative;
}

.topbar .app-nav-root {
  position: relative;
  margin-left: auto;
  justify-content: flex-end;
}

.app-nav-toggle {
  display: inline-grid;
  width: 40px;
  height: 36px;
  place-content: center;
  gap: 4px;
  padding: 0;
  border: 1px solid rgba(222, 238, 246, .48);
  border-radius: 7px;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
}

.app-nav-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform .16s ease, opacity .16s ease;
}

.is-menu-open .app-nav-toggle { background: rgba(255, 255, 255, .18); }
.is-menu-open .app-nav-toggle span:first-child { transform: translateY(6px) rotate(45deg); }
.is-menu-open .app-nav-toggle span:nth-child(2) { opacity: 0; }
.is-menu-open .app-nav-toggle span:last-child { transform: translateY(-6px) rotate(-45deg); }

.app-nav-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: min(300px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid rgba(194, 218, 229, .88);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(5, 31, 54, .28);
}

.is-menu-open .app-nav-menu { display: grid; gap: 3px; }

.app-nav-menu a,
.top-actions .app-nav-menu a,
.topbar .app-nav-menu .btn,
.topbar .app-nav-menu a.btn {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-900);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  box-shadow: none;
}

.app-nav-menu a:hover,
.top-actions .app-nav-menu a:hover,
.topbar .app-nav-menu .btn:hover,
.topbar .app-nav-menu a.btn:hover {
  border: 0;
  background: #e9f4f7;
  color: var(--brand-800);
  transform: none;
}

.brand,
.title,
.topbar .title {
  color: #fff;
  font-family: Bahnschrift, Aptos, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: .015em;
}

.brand {
  text-align: left;
  font-size: clamp(17px, 2vw, 22px);
  margin: 0 0 16px;
}

.title,
.topbar .title {
  font-size: clamp(24px, 2.7vw, 31px);
  line-height: 1.13;
  margin: 0 0 20px;
}

.topbar .title { margin: 0; }

.panel,
.card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel { padding: clamp(16px, 2.2vw, 24px); }
.card { box-shadow: 0 8px 22px rgba(16, 42, 67, .08); }
.admin-card { box-shadow: none; }

.panel h1, .panel h2, .panel h3, .card h1, .card h2, .card h3, .admin-card h2 {
  font-family: Bahnschrift, Aptos, "Segoe UI", sans-serif;
  color: var(--brand-900);
  letter-spacing: .01em;
}

/* Filled forms: superproject selector, form list and selected form. */
.overview-layout {
  grid-template-columns: minmax(270px, .55fr) minmax(470px, 1.15fr) minmax(390px, 1.35fr) !important;
  gap: 12px;
}

.overview-middle {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(16, 42, 67, .08);
  overflow: hidden;
}

.overview-column-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--brand-900);
  font-family: Bahnschrift, Aptos, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.overview-column-hint { color: var(--muted); font-family: Aptos, "Segoe UI", sans-serif; font-size: 11px; font-weight: 600; }
.overview-filters-slot { padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.overview-filters-slot .mobile-filters { margin: 0; }
.overview-filters-slot .mobile-filters > summary { display: none; }
.overview-filters-slot .filters-grid { margin-bottom: 8px !important; }
.overview-filters-slot .selector-label { color: var(--brand-900); }
.overview-filters-slot .left-search { margin-bottom: 10px; }
.overview-filters-slot .left-search-meta { color: var(--muted); }
.overview-filters-slot .left-search-meta.error { color: var(--danger); }
.overview-filters-slot .left-search-results { max-height: 240px; overflow: auto; }
.superproject-project-panels { padding: 10px; }
.superproject-project-panel { display: grid; gap: 8px; }
.superproject-project-panel[hidden] { display: none; }
.superproject-project-panel .project-group { margin: 0; }
.overview-left .superproject-group { margin-bottom: 7px; border: 0; background: transparent; overflow: visible; }
.overview-left .superproject-group-body { display: none; }
.superproject-source-label { display: none; }
.overview-left .superproject-group.is-superproject-option-hidden { display: none; }

.superproject-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 34px 8px 10px;
  border: 1px solid rgba(206, 228, 239, .5);
  border-radius: 7px;
  background: #fff;
  color: var(--brand-900);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.superproject-select:focus { outline: 3px solid rgba(86, 196, 221, .28); border-color: #67c4db; }
.overview-left { position: static; max-height: none; overflow: visible; }
.overview-left .group-wrap { overflow: visible; }

.superproject-choice {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #b9cbe6;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--brand-900);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
  text-align: left;
  cursor: pointer;
}

.superproject-choice:hover { border-color: var(--brand-500); background: #e4f4f7; }
.superproject-choice.is-active { border-color: var(--brand-600); background: var(--brand-800); color: #fff; }

.overview-middle .project-group > summary { padding: 10px 12px; }
.overview-middle .project-group-body { padding: 8px; }

.overview-right .report-card .card-head {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(260px, auto);
  align-items: start;
  gap: 10px 14px;
  padding: 12px 14px;
}

.overview-right .report-card .head-main { min-width: 210px; }
.overview-right .report-card .project-line { line-height: 1.25; margin-bottom: 5px; }
.overview-right .report-card .meta-line { line-height: 1.35; }
.overview-right .report-card .card-head > div:last-child {
  display: flex !important;
  max-width: 390px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center !important;
}

.overview-right .report-card .card-body { padding: 12px 14px; }
.overview-right .report-card .grid { gap: 12px 20px; }

/* Make every saved-form snapshot and file section use the same accordion rhythm. */
.overview-right .report-card .section-collapse {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.overview-right .report-card details.section-collapse > summary.section-title {
  min-height: 46px;
  margin: 0;
  padding: 12px 20px;
  color: var(--brand-900);
}

.overview-right .report-card .section-collapse > .section-content {
  padding: 0 20px 14px;
}

.overview-right .report-card .section-collapse:not([open]) > .section-content { display: none; }
.overview-right .report-card .section-content > .value {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid #dce6eb;
  border-radius: 8px;
  background: var(--surface-soft);
}
.overview-right .report-card .section-content .file-items { gap: 10px; }
.overview-right .report-card .section-content .thumbs { margin: 0; }
.overview-right .report-card .thumbs { align-items: start; }
.overview-right .report-card .file-item { min-height: 58px; padding: 9px 14px; }
.overview-right .report-card .file-item > div { min-width: 0; }

/* Desktop overview: keep the application shell fixed and scroll only the form list. */
@media (min-width: 1021px) {
  html:has(.shortcomings-overview-page),
  body.shortcomings-overview-page {
    height: 100%;
    overflow: hidden;
  }

  body.shortcomings-overview-page .page {
    display: flex;
    height: 100dvh;
    flex-direction: column;
    overflow: hidden;
  }

  body.shortcomings-overview-page .overview-layout {
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
    align-items: stretch;
  }

  body.shortcomings-overview-page .overview-left,
  body.shortcomings-overview-page .overview-middle,
  body.shortcomings-overview-page .overview-right {
    min-height: 0;
  }

  body.shortcomings-overview-page .overview-middle {
    display: flex;
    flex-direction: column;
  }

  body.shortcomings-overview-page .superproject-project-panels {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  body.shortcomings-overview-page .overview-right {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 1240px) {
  .overview-layout { grid-template-columns: minmax(230px, .48fr) minmax(390px, 1.08fr) minmax(360px, 1fr) !important; }
  .superproject-choice { white-space: normal; }
}

@media (max-width: 1020px) {
  .overview-layout { grid-template-columns: minmax(230px, .7fr) minmax(0, 1.3fr) !important; }
  .overview-right { grid-column: 1 / -1; }
  .overview-right .report-card .card-head { grid-template-columns: minmax(220px, 1fr) minmax(280px, auto); }
}

.label,
.field label,
.small-check,
.custom-form-label {
  color: var(--brand-900);
  font-weight: 700;
}

.input,
.select,
.textarea,
.role-select,
.edit-input,
.edit-select {
  border: 1px solid #b9cbd7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(16, 42, 67, .03);
}

.input:focus,
.select:focus,
.textarea:focus,
.role-select:focus,
.edit-input:focus,
.edit-select:focus {
  outline: 3px solid rgba(20, 126, 159, .18);
  border-color: var(--focus);
}

.btn,
.card-btn,
.save-btn {
  min-height: 36px;
  border: 1px solid var(--brand-600);
  border-radius: 7px;
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
  letter-spacing: .005em;
  box-shadow: 0 2px 0 rgba(6, 48, 71, .18);
  transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.btn:hover:not(:disabled),
.card-btn:hover:not(:disabled),
.save-btn:hover:not(:disabled) {
  background: var(--brand-800);
  border-color: var(--brand-800);
  box-shadow: 0 4px 10px rgba(16, 70, 111, .18);
  transform: translateY(-1px);
}

.btn.secondary,
.secondary,
.card-btn.secondary,
.save-btn {
  border-color: #b8cad5;
  background: #fff;
  color: var(--brand-900);
  box-shadow: none;
}

.btn.danger,
.card-btn.danger,
.danger {
  border-color: #dfaaaa;
  background: #fff7f6;
  color: var(--danger);
}

.btn.danger:hover:not(:disabled),
.card-btn.danger:hover:not(:disabled),
.danger:hover:not(:disabled) {
  background: #ffe9e7;
  border-color: #ce7772;
}

.hint,
.status-msg,
.rcp-status,
.summary,
.form-list-meta { color: var(--muted); }

.field { margin-bottom: 13px; }
.admin-layout, .editor-grid, .form-list, .cards { gap: 12px; }
.admin-card { padding: 14px; }
.card-head, .card-body { padding: 12px; }

.upload-box,
.rcp-box,
.ccp-box,
.custom-form-signature,
.field-row {
  border-color: #cbdbe3;
  background: var(--surface-soft);
}

table th,
.mini-table th,
.rcp-table th,
.ccp-table th {
  background: #edf5f7;
  color: var(--brand-900);
}

table td,
table th,
.mini-table td,
.mini-table th,
.rcp-table td,
.rcp-table th,
.ccp-table td,
.ccp-table th { border-color: #dce6eb; }

.status-dot { box-shadow: 0 0 0 3px rgba(16, 42, 67, .06); }
.dot-yes { background: #1976ae; }
.dot-approved { background: #218454; }
.dot-hold { background: #d78516; }
.dot-no { background: #c23f3d; }

.message.info { background: #eaf7fa; border-color: #b9dde5; color: #0d5d75; }
.message.error, .status-msg.error { color: var(--danger); }
.status-msg.success { color: var(--success); }

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 100% -8%, rgba(21, 150, 181, .25), transparent 20rem),
      linear-gradient(180deg, var(--brand-950) 0, var(--brand-900) 10rem, var(--canvas) 10rem, var(--canvas) 100%);
  }

  .page { padding: 12px 12px 22px; }
  .topbar { align-items: flex-start; margin-bottom: 14px; }
  .topbar .title { font-size: 25px; max-width: 52%; }
  .top-actions {
    flex-wrap: wrap;
    padding-bottom: 12px;
  }
  .top-actions span { display: block; max-width: calc(100% - 52px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-nav-toggle { width: 44px; height: 40px; }
  .brand { margin-bottom: 18px; }
  .title { margin-bottom: 13px; }
  .panel { padding: 14px; border-radius: 12px; }
  .card, .admin-card { border-radius: 12px; }
  .btn, .card-btn, .save-btn { min-height: 44px; }
  .input, .select, .textarea, .role-select, .edit-input, .edit-select { font-size: 16px; min-height: 44px; }
  .actions:not(.top-actions), .admin-toolbar { gap: 8px; }
  .overview-layout { grid-template-columns: 1fr !important; }
  .overview-right { grid-column: auto; }
  .overview-left { position: static; max-height: none; }
  .overview-column-head { padding: 10px 12px; }
  .overview-right .report-card .card-head { grid-template-columns: 1fr; }
  .overview-right .report-card .card-head > div:last-child { max-width: none; justify-content: flex-start; }
  .overview-right .report-card .section-collapse { margin-inline: 0; }
  .overview-right .report-card details.section-collapse > summary.section-title { padding-inline: 16px; }
  .overview-right .report-card .section-collapse > .section-content { padding-inline: 16px; }
}

@media (max-width: 480px) {
  .page { padding: 10px 10px 18px; }
  .topbar { gap: 8px; }
  .topbar .title { font-size: 22px; }
  .panel { padding: 12px; }
  .btn, .card-btn, .save-btn { width: 100%; }
  .topbar .btn, .topbar a.btn { width: auto; }
}
