:root {
  --bg: #eef7f7;
  --bg-deep: #dff2f1;
  --panel: rgba(248, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(62, 129, 125, 0.18);
  --line-strong: rgba(44, 125, 120, 0.28);
  --text: #0e2428;
  --muted: #58757a;
  --accent: #0b9f95;
  --accent-2: #0e7dc2;
  --accent-soft: rgba(11, 159, 149, 0.1);
  --glow: rgba(38, 215, 196, 0.24);
  --a: #d64444;
  --b: #f0a014;
  --c: #3986ff;
  --shadow: 0 24px 70px rgba(18, 67, 76, 0.12);
  --shadow-soft: 0 12px 30px rgba(22, 94, 105, 0.08);
  --radius: 22px;
  --radius-sm: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(8, 181, 169, 0.16), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(70, 119, 255, 0.14), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(11, 159, 149, 0.08), transparent 22%),
    linear-gradient(180deg, #f6fbfb 0%, #ecf7f7 38%, #e6f3f4 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(rgba(15, 111, 118, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 111, 118, 0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.15));
}

body::after {
  background:
    radial-gradient(circle at 18% 18%, rgba(30, 196, 182, 0.15), transparent 18%),
    radial-gradient(circle at 78% 12%, rgba(71, 126, 255, 0.14), transparent 20%),
    radial-gradient(circle at 80% 78%, rgba(9, 159, 149, 0.12), transparent 18%);
  animation: driftGlow 16s ease-in-out infinite alternate;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  color: var(--accent);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

.field-label {
  display: block;
  margin: 4px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.required-mark {
  color: var(--a);
  margin-left: 4px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(71, 129, 136, 0.18);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  transition: 180ms ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(11, 159, 149, 0.45);
  box-shadow:
    0 0 0 4px rgba(11, 159, 149, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.ghost-btn,
.save-btn {
  border-radius: 999px;
  cursor: pointer;
  transition: 180ms ease;
}

.ghost-btn {
  border: 1px solid rgba(11, 159, 149, 0.18);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  padding: 12px 16px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.ghost-btn:hover,
.save-btn:hover {
  transform: translateY(-1px);
}

.save-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: 0;
  padding: 13px 16px;
  font-weight: 800;
  box-shadow: 0 14px 26px rgba(11, 159, 149, 0.18);
}

.save-btn:hover {
  box-shadow: 0 18px 30px rgba(11, 159, 149, 0.22);
}

.auth-shell,
.app-shell {
  position: relative;
  z-index: 1;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 420px);
  gap: 18px;
  padding: 20px;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(233, 251, 250, 0.7)),
    linear-gradient(120deg, rgba(11, 159, 149, 0.08), rgba(14, 125, 194, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-copy,
.login-form {
  border-radius: 24px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.66);
}

.login-copy {
  display: grid;
  align-content: center;
  gap: 14px;
}

.login-hint {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(246, 255, 255, 0.78);
}

.login-hint strong {
  display: block;
  margin-bottom: 8px;
}

.login-hint p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 10px;
  align-content: center;
}

.login-form h2 {
  margin: 0 0 10px;
  font-size: 24px;
}

.login-message {
  min-height: 22px;
  margin: 0;
  font-size: 13px;
  color: var(--a);
}

.app-shell {
  min-height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 18px;
  padding: 24px 26px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(233, 251, 250, 0.7)),
    linear-gradient(120deg, rgba(11, 159, 149, 0.08), rgba(14, 125, 194, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -120px;
  top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(38, 215, 196, 0.22), transparent 62%);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  z-index: 1;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(11, 159, 149, 0.18);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  color: var(--muted);
}

.summary-grid,
.stage-board,
.management-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stage-board {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.management-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.owner-workbench-section {
  margin-bottom: 16px;
}

.admin-section {
  margin-bottom: 16px;
}

.workbench-head {
  margin-bottom: 12px;
}

.owner-workbench {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.admin-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(71, 129, 136, 0.12);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(242, 251, 251, 0.94);
  font-size: 12px;
  color: var(--muted);
}

.admin-input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(71, 129, 136, 0.16);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.admin-check-cell {
  text-align: center;
}

.small-btn {
  padding: 8px 12px;
  font-size: 12px;
}

.metric-card,
.stage-card,
.management-card,
.owner-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(244, 255, 255, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
}

.metric-card::before,
.stage-card::before,
.management-card::before,
.owner-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(11, 159, 149, 0.24), rgba(14, 125, 194, 0.12), rgba(255, 255, 255, 0.22));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.metric-card h3,
.stage-card h3,
.management-card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong,
.stage-card strong,
.management-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.metric-card small,
.stage-card small,
.management-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.management-card ul,
.owner-card ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.management-card li,
.owner-card li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.7);
}

.management-card li strong,
.owner-card li strong {
  display: block;
  font-size: 14px;
  margin: 0 0 4px;
}

.management-card li span,
.owner-card li span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.owner-card h3 {
  margin: 0;
  font-size: 18px;
}

.owner-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background:
    linear-gradient(180deg, rgba(249, 255, 255, 0.82), rgba(240, 251, 251, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  border-radius: 28px;
  overflow: hidden;
  min-height: 0;
  backdrop-filter: blur(18px);
  position: relative;
}

.sidebar {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0;
  background:
    linear-gradient(180deg, rgba(247, 255, 255, 0.86), rgba(239, 251, 250, 0.76));
}

.filters-section {
  border-right: 1px solid rgba(71, 129, 136, 0.12);
  min-width: 0;
  position: relative;
  background:
    linear-gradient(180deg, rgba(250, 255, 255, 0.72), rgba(240, 251, 250, 0.82));
}

.institution-section {
  min-width: 0;
  background:
    radial-gradient(circle at top right, rgba(11, 159, 149, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(246, 253, 253, 0.76));
}

.filters-section .form-stack {
  position: sticky;
  top: 18px;
}

.institution-section .section-head {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -18px -18px 14px;
  padding: 18px 18px 14px;
  background:
    linear-gradient(180deg, rgba(244, 253, 253, 0.96), rgba(244, 253, 253, 0.88)),
    rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(71, 129, 136, 0.1);
}

.institution-top-slice {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.slice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.slice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.top-slice-card {
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 20px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 255, 255, 0.8));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: 180ms ease;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-slice-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(14, 93, 106, 0.1);
}

.top-slice-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.top-slice-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.top-slice-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.top-slice-actions {
  margin-top: 4px;
}

.locate-btn {
  width: 100%;
  justify-content: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.panel-section {
  padding: 18px 18px 0;
}

.panel-section:last-child {
  padding-bottom: 18px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.filter-block {
  display: grid;
  gap: 8px;
}

.view-mode-banner {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(11, 159, 149, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(239, 252, 251, 0.76));
  box-shadow: var(--shadow-soft);
}

.view-mode-banner.hidden {
  display: none !important;
}

.view-mode-copy strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.view-mode-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.filter-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scroll-group {
  max-height: 154px;
  overflow: auto;
  padding-right: 4px;
}

.filter-check {
  position: relative;
}

.filter-check input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.filter-check span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(71, 129, 136, 0.16);
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  color: var(--muted);
  transition: 180ms ease;
}

.filter-check input:checked + span {
  border-color: rgba(11, 159, 149, 0.4);
  background: rgba(11, 159, 149, 0.12);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(11, 159, 149, 0.12);
}

.institution-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-content: start;
  gap: 12px;
  max-height: 620px;
  overflow: auto;
  padding-bottom: 10px;
  padding-right: 4px;
}

.institution-card {
  border: 1px solid rgba(71, 129, 136, 0.16);
  border-radius: 20px;
  padding: 15px 15px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(245, 255, 255, 0.72));
  cursor: pointer;
  transition: 180ms ease;
  min-height: 176px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.institution-card:hover {
  transform: translateY(-1px);
  border-color: rgba(11, 159, 149, 0.3);
  box-shadow: 0 14px 30px rgba(14, 93, 106, 0.08);
}

.institution-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -48px;
  bottom: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 159, 149, 0.1), transparent 72%);
  pointer-events: none;
}

.institution-card.active {
  border-color: rgba(11, 159, 149, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(11, 159, 149, 0.22),
    0 18px 32px rgba(11, 159, 149, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(232, 255, 252, 0.82));
}

.institution-card.grade-a-priority,
.top-slice-card.grade-a-priority {
  border-color: rgba(214, 68, 68, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 247, 0.84));
  box-shadow:
    inset 0 0 0 1px rgba(214, 68, 68, 0.08),
    0 16px 30px rgba(214, 68, 68, 0.08);
}

.institution-card.grade-a-priority::before,
.top-slice-card.grade-a-priority::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 20px 0 0 20px;
  background: linear-gradient(180deg, rgba(214, 68, 68, 0.95), rgba(255, 143, 143, 0.72));
}

.institution-card.overdue-card {
  border-color: rgba(214, 68, 68, 0.32);
  box-shadow: inset 0 0 0 1px rgba(214, 68, 68, 0.16);
}

.institution-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.4;
  max-width: 92%;
}

.visit-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.visit-progress.prominent {
  margin-top: 2px;
}

.visit-progress span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.visit-progress-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(223, 238, 238, 0.9);
  border: 1px solid rgba(71, 129, 136, 0.08);
  box-shadow: inset 0 1px 2px rgba(11, 71, 72, 0.06);
}

.visit-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(14, 125, 194, 0.18);
}

.mini-timeline {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 14px;
  background: rgba(244, 252, 252, 0.82);
  border: 1px solid rgba(71, 129, 136, 0.08);
}

.mini-timeline span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.activity-timeline {
  border-style: dashed;
}

.overdue-text {
  color: var(--a) !important;
  font-weight: 700;
}

.today-text {
  color: #986100 !important;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(226, 241, 241, 0.88);
  border: 1px solid rgba(71, 129, 136, 0.08);
  font-size: 12px;
  color: #42646a;
}

.chip.grade-a {
  background: rgba(214, 68, 68, 0.12);
  color: var(--a);
}

.chip.grade-b {
  background: rgba(240, 160, 20, 0.16);
  color: #986100;
}

.chip.grade-c {
  background: rgba(57, 134, 255, 0.14);
  color: var(--c);
}

.chip.overdue {
  background: rgba(214, 68, 68, 0.14);
  color: var(--a);
  border: 1px solid rgba(214, 68, 68, 0.18);
}

.chip.today {
  background: rgba(240, 160, 20, 0.16);
  color: #986100;
}

.chip.next-touch {
  background: rgba(57, 134, 255, 0.12);
  color: #265ccb;
}

.map-panel {
  display: flex;
  flex-direction: column;
  order: 1;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 14px currentColor;
}

.dot-a { background: var(--a); color: var(--a); }
.dot-b { background: var(--b); color: var(--b); }
.dot-c { background: var(--c); color: var(--c); }

#map {
  flex: 1;
  min-height: 680px;
  margin: 14px 18px 12px;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(71, 129, 136, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.52),
    0 12px 26px rgba(14, 93, 106, 0.08);
}

.map-footer {
  padding: 0 18px 18px;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  order: 3;
}

.sidebar {
  order: 2;
}

.detail-empty,
.detail-content {
  height: 100%;
  overflow: auto;
  padding: 22px;
}

.detail-empty {
  display: grid;
  align-content: start;
  gap: 10px;
}

.detail-empty p {
  color: var(--muted);
  line-height: 1.7;
}

.detail-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.detail-subhead {
  margin-top: 8px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-grid > .detail-card:last-child {
  grid-column: 1 / -1;
}

.detail-card {
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 20px;
  padding: 16px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 255, 255, 0.76));
  box-shadow: var(--shadow-soft);
}

.detail-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-card dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.detail-card dt {
  color: var(--muted);
  font-size: 13px;
}

.detail-card dd {
  margin: 0;
  line-height: 1.6;
}

.funnel-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.funnel-step {
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 18px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.funnel-step h4 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.funnel-step strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1;
}

.funnel-step small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.lab-workbench {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.lab-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.lab-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.lab-roster {
  display: grid;
  gap: 10px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.lab-card {
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: 180ms ease;
}

.lab-card:hover {
  transform: translateY(-1px);
  border-color: rgba(11, 159, 149, 0.3);
}

.lab-card.active {
  border-color: rgba(11, 159, 149, 0.4);
  box-shadow:
    inset 0 0 0 1px rgba(11, 159, 149, 0.2),
    0 10px 22px rgba(11, 159, 149, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(233, 255, 252, 0.78));
}

.lab-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.45;
}

.lab-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.lab-inspector {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.inspector-card {
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
}

.inspector-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.inspector-subtitle {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.progress-form {
  display: grid;
  gap: 10px;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.field-note.error-text {
  color: var(--a);
  font-weight: 700;
}

.lead-list {
  display: grid;
  gap: 10px;
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.lead-item {
  border: 1px solid rgba(71, 129, 136, 0.14);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.76);
}

.lead-item h4 {
  margin: 10px 0 8px;
  font-size: 14px;
  line-height: 1.5;
}

.lead-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.lead-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lead-year {
  background: rgba(11, 159, 149, 0.12);
  color: var(--accent);
}

.mobile-toolbar {
  display: none;
}

.mobile-toolbar {
  gap: 8px;
  margin-bottom: 14px;
}

.mobile-nav-btn {
  flex: 1;
}

.compact-group {
  max-height: 128px;
  overflow: auto;
  padding-right: 4px;
}

.inspector-card a,
.lead-item a {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 700;
}

.inspector-card a:hover,
.lead-item a:hover {
  text-decoration: underline;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 18px 36px rgba(14, 93, 106, 0.16);
}

.leaflet-popup-content {
  font-family: inherit;
  line-height: 1.5;
}

@keyframes driftGlow {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(0, 10px, 0) scale(1.04);
  }
}

@media (max-width: 1520px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stage-board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 1240px) {
  .owner-workbench {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .filters-section {
    border-right: 0;
    border-bottom: 1px solid rgba(71, 129, 136, 0.12);
  }

  .filters-section .form-stack,
  .institution-section .section-head {
    position: static;
  }

  .institution-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    max-height: 520px;
  }

  .slice-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 980px) {
  .auth-shell,
  .app-shell {
    padding: 14px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  h1 {
    font-size: 30px;
  }

  .summary-grid,
  .stage-board,
  .management-grid,
  .owner-workbench,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .mobile-toolbar {
    display: flex;
    position: sticky;
    top: 10px;
    z-index: 12;
  }

  #map {
    min-height: 420px;
  }

  .funnel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lab-workbench {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid > .detail-card:last-child {
    grid-column: auto;
  }

  .institution-list {
    grid-template-columns: 1fr;
    max-height: 400px;
  }

  .slice-grid {
    grid-template-columns: 1fr;
  }

  .lab-roster,
  .lead-list {
    max-height: 320px;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-actions {
    width: 100%;
  }

  .topbar-actions > * {
    width: 100%;
    justify-content: center;
  }

  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .session-badge {
    max-width: none;
    justify-content: center;
  }

  .panel-section,
  .detail-empty,
  .detail-content {
    padding-left: 14px;
    padding-right: 14px;
  }

  #map {
    min-height: 340px;
    margin-left: 14px;
    margin-right: 14px;
  }

  .map-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .detail-card dl {
    grid-template-columns: 1fr;
  }

  .funnel-grid {
    grid-template-columns: 1fr;
  }

  .checkbox-group {
    gap: 6px;
  }

  .filter-check span,
  .chip {
    font-size: 11px;
  }
}
