:root {
  color-scheme: light;
  --ink: #10264a;
  --ink-soft: #4f5f78;
  --line: #d8e0ea;
  --panel: #ffffff;
  --canvas: #f6f8fb;
  --national: #fff3be;
  --national-line: #e2ba39;
  --region: #edf0f3;
  --region-line: #aeb8c4;
  --unit: #dff1ff;
  --unit-line: #7ab8df;
  --red: #d71f27;
  --gold: #f2b629;
  --blue: #063a9b;
  --light-blue: #9dd4ff;
  --black: #15191f;
  --white: #ffffff;
  --shadow: 0 14px 35px rgba(16, 38, 74, 0.14);
  --small-shadow: 0 7px 20px rgba(16, 38, 74, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fdfefe 0%, #edf4fb 100%);
  font-family: Arial, Helvetica, sans-serif;
}

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

button,
.file-button {
  min-height: 38px;
  border: 1px solid #bfccdb;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button:hover,
.file-button:hover {
  border-color: #6e87aa;
  box-shadow: 0 6px 14px rgba(16, 38, 74, 0.12);
}

button:active,
.file-button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.file-button:focus-visible {
  outline: 3px solid rgba(0, 92, 185, 0.22);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(176, 190, 207, 0.75);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

.brand h1,
.brand p,
.selection-header h2,
.selection-header p,
.dialog-head h2,
.eyebrow {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.1;
}

.brand p {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 13px;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(11, 92, 169, 0.24);
  border-radius: 999px;
  color: #0b5ca9;
  background: #eef6ff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.version-badge.is-live {
  border-color: rgba(16, 38, 74, 0.22);
  color: var(--ink);
  background: #f7f9fc;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
}

.brand-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar button,
.file-button {
  padding: 0 12px;
  white-space: nowrap;
}

.search-box {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  border: 1px solid #bfccdb;
  border-radius: 6px;
  background: #ffffff;
}

.search-box span {
  color: var(--ink-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.search-box input {
  width: 150px;
  min-height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
}

.zoom-controls {
  display: grid;
  grid-template-columns: 38px 58px 38px;
  align-items: center;
  border: 1px solid #bfccdb;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
}

.zoom-controls .icon-button {
  border: 0;
  border-radius: 0;
  min-height: 36px;
  box-shadow: none;
}

.zoom-controls output {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}

.icon-button {
  width: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.toggle-button.is-on {
  border-color: #0b5ca9;
  color: #ffffff;
  background: #0b5ca9;
}

.quiet-button {
  color: #6b2441;
  background: #fff7fa;
  border-color: #ecc5d3;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  padding: 14px;
}

.chart-pane,
.side-panel,
.request-panel {
  min-height: calc(100vh - 88px);
  border: 1px solid rgba(188, 202, 219, 0.95);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--small-shadow);
}

.chart-pane {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(16, 38, 74, 0.14);
}

.swatch.national {
  background: var(--national);
}

.swatch.region {
  background: var(--region);
}

.swatch.unit {
  background: var(--unit);
}

.chart-summary {
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
}

.chart-viewport {
  flex: 1;
  overflow: auto;
  background:
    linear-gradient(rgba(16, 38, 74, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 38, 74, 0.04) 1px, transparent 1px),
    var(--canvas);
  background-size: 36px 36px;
}

.list-panel {
  position: absolute;
  top: 49px;
  bottom: 0;
  left: 0;
  z-index: 12;
  width: min(460px, calc(100% - 20px));
  display: none;
  overflow: auto;
  padding: 14px;
  border-right: 1px solid rgba(188, 202, 219, 0.95);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 12px 0 30px rgba(16, 38, 74, 0.12);
}

.list-view .list-panel {
  display: block;
}

.list-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.list-panel-head h2,
.list-panel-head p {
  margin: 0;
}

.list-panel-head h2 {
  font-size: 18px;
  line-height: 1.15;
}

.list-panel-head span {
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.command-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.command-list:not(.root) {
  margin-left: 17px;
  padding-left: 17px;
  border-left: 2px solid #c8d2df;
}

.command-item {
  position: relative;
  margin: 0 0 8px;
}

.command-list:not(.root) > .command-item::before {
  content: "";
  position: absolute;
  top: 21px;
  left: -17px;
  width: 16px;
  border-top: 2px solid #c8d2df;
}

.list-card {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  padding: 6px 9px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  text-align: left;
  box-shadow: none;
}

.list-card:hover {
  box-shadow: 0 5px 14px rgba(16, 38, 74, 0.1);
}

.list-card.is-selected {
  border-color: #0b5ca9;
  background: #f3f8ff;
}

.list-card.is-match {
  border-width: 4px;
  padding: 3px 6px 3px 3px;
}

.list-card.is-vacant {
  color: #7b8492;
}

.list-lanyard {
  min-height: 32px;
  border: 1px solid rgba(16, 38, 74, 0.16);
  border-radius: 999px;
}

.list-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 2px;
}

.list-copy strong,
.list-copy span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-copy strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
}

.list-copy span {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.15;
}

.list-card.is-vacant .list-copy strong,
.list-card.is-vacant .list-copy span {
  color: #7b8492;
}

.chart-scale {
  position: relative;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 28px 36px 48px;
  transform-origin: top left;
}

.org-tree {
  position: relative;
  z-index: 5;
  display: inline-flex;
  justify-content: flex-start;
  width: max-content;
  min-width: 100%;
}

.group-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.group-box {
  position: absolute;
  border: 2px dashed;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.group-box.type-national {
  z-index: 1;
  border-color: rgba(214, 169, 22, 0.74);
  background: rgba(255, 243, 190, 0.34);
}

.group-box.type-region {
  z-index: 2;
  border-color: rgba(255, 255, 255, 0.95);
  background: rgba(237, 240, 243, 0.48);
}

.group-box.type-unit {
  z-index: 3;
  border-color: rgba(84, 174, 232, 0.76);
  background: rgba(223, 241, 255, 0.48);
}

.group-summary {
  position: absolute;
  top: 10px;
  left: 12px;
  max-width: min(360px, calc(100% - 24px));
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: rgba(16, 38, 74, 0.92);
}

.group-image {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(16, 38, 74, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.group-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-name {
  margin: 0;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.group-meta {
  margin: 2px 0 0;
  color: rgba(79, 95, 120, 0.88);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.tree-list {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 26px 0 0;
  margin: 0;
  list-style: none;
}

.tree-list.root {
  padding-top: 0;
}

.tree-item {
  position: relative;
  display: flex;
  min-width: 320px;
  flex-direction: column;
  align-items: center;
  padding: 20px 8px 0;
}

.tree-list.root > .tree-item {
  padding-top: 0;
}

.tree-list:not(.root)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 26px;
  border-left: 2px solid #bac7d5;
}

.tree-list:not(.root) > .tree-item::before,
.tree-list:not(.root) > .tree-item::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: 20px;
  border-top: 2px solid #bac7d5;
}

.tree-list:not(.root) > .tree-item::before {
  right: 50%;
}

.tree-list:not(.root) > .tree-item::after {
  left: 50%;
}

.tree-list:not(.root) > .tree-item:only-child::before,
.tree-list:not(.root) > .tree-item:only-child::after {
  display: none;
}

.tree-list:not(.root) > .tree-item:first-child::before,
.tree-list:not(.root) > .tree-item:last-child::after {
  border-top: 0;
}

.tree-list:not(.root) > .tree-item > .node-shell::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 50%;
  height: 20px;
  border-left: 2px solid #bac7d5;
}

.node-shell {
  position: relative;
}

.position-card {
  position: relative;
  width: 312px;
  height: 304px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--card-line, rgba(16, 38, 74, 0.17));
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--small-shadow);
  overflow: hidden;
}

.compact-view .org-tree .position-card {
  width: 244px;
  height: 132px;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 10px;
}

.compact-view .org-tree .card-media {
  display: none;
}

.compact-view .org-tree .appointment-subtitle {
  font-size: 11px;
}

.compact-view .org-tree .appointment {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.15;
}

.compact-view .org-tree .person-name {
  font-size: 12px;
}

.compact-view .org-tree .tree-item {
  min-width: 252px;
}

.position-card.level-national {
  --card-line: rgba(226, 186, 57, 0.62);
  background: var(--national);
  border-color: var(--card-line);
}

.position-card.level-region {
  --card-line: rgba(174, 184, 196, 0.82);
  background: var(--region);
  border-color: var(--card-line);
}

.position-card.level-unit {
  --card-line: rgba(122, 184, 223, 0.78);
  background: var(--unit);
  border-color: var(--card-line);
}

.position-card.is-selected {
  outline: 3px solid rgba(0, 92, 185, 0.34);
  outline-offset: 3px;
}

.request-mode .position-card {
  cursor: crosshair;
}

.position-card.is-request-target {
  outline: 6px solid rgba(11, 92, 169, 0.56);
  outline-offset: 4px;
}

.position-card.is-match {
  outline: 7px solid var(--card-line, rgba(16, 38, 74, 0.38));
  outline-offset: 3px;
  box-shadow: var(--small-shadow);
}

.position-card.is-vacant {
  border-color: var(--card-line, rgba(16, 38, 74, 0.17));
  color: #7b8492;
  box-shadow: 0 5px 14px rgba(16, 38, 74, 0.08);
}

.lanyard-strip {
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(16, 38, 74, 0.18);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.5);
}

.card-main {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
}

.portrait {
  width: 100%;
  height: 136px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(16, 38, 74, 0.18);
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-copy {
  min-width: 0;
}

.appointment-subtitle {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.18;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-name {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.position-card.is-vacant .appointment-subtitle,
.position-card.is-vacant .appointment,
.position-card.is-vacant .person-name {
  color: #7b8492;
}

.position-card.is-vacant .portrait {
  color: #8d96a3;
  background: rgba(255, 255, 255, 0.55);
}

.position-card.is-vacant .rank-slide {
  opacity: 0.58;
}

.card-media {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: stretch;
  gap: 10px;
  min-height: 136px;
}

.rank-slide {
  width: 58px;
  height: 136px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid rgba(16, 38, 74, 0.22);
  background: #0d1015;
  overflow: hidden;
}

.rank-slide.is-empty {
  background: #0d1015;
}

.rank-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.rank-svg {
  width: 64px;
  height: 30px;
}

.vacancy-icon {
  position: relative;
  width: 58px;
  height: 58px;
}

.vacancy-icon::before,
.vacancy-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 7px;
  border-radius: 999px;
  background: #8d96a3;
  transform-origin: center;
}

.vacancy-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.vacancy-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.card-actions {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.admin-mode .card-actions {
  display: grid;
}

.card-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.side-panel,
.request-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.request-panel {
  padding: 16px;
  overflow: auto;
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.panel-tabs button {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #f7f9fc;
  box-shadow: none;
}

.panel-tabs button:last-child {
  border-right: 0;
}

.panel-tabs .is-active {
  color: #ffffff;
  background: var(--ink);
}

.panel-section {
  display: none;
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.panel-section.is-active {
  display: block;
}

.selection-header,
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.selection-header h2,
.dialog-head h2 {
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.eyebrow {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.editor-form {
  display: grid;
  gap: 12px;
}

.editor-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.editor-form .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.editor-form .checkbox-label input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: #0b5ca9;
}

.editor-form label > span,
.upload-tile span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.editor-form input,
.editor-form select,
.editor-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #bfccdb;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
}

.editor-form textarea {
  resize: vertical;
}

.media-grid,
.contact-grid,
.action-grid {
  display: grid;
  gap: 10px;
}

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

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

.contact-grid label:last-child {
  grid-column: 1 / -1;
}

.upload-tile {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #9fb0c4;
  border-radius: 8px;
  background: #f8fbff;
}

.upload-tile input {
  min-height: auto;
  padding: 0;
  border: 0;
  font-size: 12px;
}

.action-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.action-grid button {
  padding: 0 10px;
}

.request-instruction {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.request-form[hidden] {
  display: none;
}

.request-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.request-status.is-success {
  color: #17633a;
}

.request-status.is-error {
  color: #b32632;
}

.requests-list {
  display: grid;
  gap: 10px;
}

.request-item {
  border: 1px solid var(--line);
  border-left: 4px solid #bfccdb;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.request-item.status-pending {
  border-left-color: #0b5ca9;
}

.request-item.status-approved {
  border-left-color: #17633a;
}

.request-item.status-denied {
  border-left-color: #b32632;
}

.request-head {
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: #f8fbff;
  box-shadow: none;
  text-align: left;
}

.request-head strong,
.request-head small {
  display: block;
}

.request-head strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.request-head small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.2;
}

.request-status-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: #eaf1f8;
  font-size: 11px;
  font-weight: 700;
}

.request-review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
}

.request-column {
  min-width: 0;
  padding: 8px;
  border: 1px solid #e0e7ef;
  border-radius: 6px;
  background: #ffffff;
}

.request-column p {
  margin: 0 0 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.request-column dl,
.request-column div,
.request-column dt,
.request-column dd {
  margin: 0;
  min-width: 0;
}

.request-column dl {
  display: grid;
  gap: 6px;
}

.request-column div {
  display: grid;
  gap: 1px;
}

.request-column dt {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.request-column dd {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.request-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 10px 10px;
}

.approve-button {
  color: #ffffff;
  border-color: #17633a;
  background: #17633a;
}

.request-note {
  margin: 0;
  padding: 0 10px 10px;
  color: #b32632;
  font-size: 12px;
}

.danger-button {
  color: #ffffff;
  border-color: #9c1b26;
  background: #b32632;
}

.danger-button:hover {
  border-color: #74121a;
}

.contact-dialog {
  width: min(940px, calc(100vw - 28px));
  border: 1px solid rgba(16, 38, 74, 0.22);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.contact-dialog::backdrop {
  background: rgba(16, 38, 74, 0.42);
}

.admin-dialog {
  width: min(420px, calc(100vw - 28px));
}

.export-dialog {
  width: min(820px, calc(100vw - 28px));
}

.export-note {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

#exportDataOutput {
  width: 100%;
  min-height: 320px;
  border: 1px solid #bfccdb;
  border-radius: 6px;
  padding: 10px;
  color: #172033;
  background: #f7f9fc;
  font: 12px/1.45 Consolas, "Courier New", monospace;
  resize: vertical;
}

.export-actions {
  margin-top: 12px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 5px;
}

.admin-form label > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.admin-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #bfccdb;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
}

.admin-error {
  min-height: 18px;
  margin: 0;
  color: #b32632;
  font-size: 13px;
  font-weight: 700;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-body {
  display: grid;
  gap: 10px;
}

.dialog-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dialog-card-wrap {
  display: flex;
  justify-content: center;
}

.dialog-card-wrap .position-card {
  box-shadow: none;
}

.dialog-card-wrap .card-actions {
  display: none;
}

.dialog-fields {
  display: grid;
  gap: 2px;
}

.dialog-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.dialog-row strong {
  color: var(--ink-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.dialog-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 36px;
  color: var(--ink-soft);
  text-align: center;
}

body:not(.admin-mode) .side-panel {
  display: none;
}

body:not(.request-mode) .request-panel,
body.admin-mode .request-panel {
  display: none;
}

body:not(.admin-mode) .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.request-mode:not(.admin-mode) .workspace {
  grid-template-columns: minmax(0, 1fr) 380px;
}

body:not(.admin-mode) .chart-pane {
  min-height: calc(100vh - 88px);
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

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

  .side-panel,
  .request-panel {
    min-height: 560px;
  }

  body:not(.admin-mode) .side-panel {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar,
  .workspace {
    padding: 10px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-box,
  .zoom-controls {
    grid-column: 1 / -1;
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .chart-head,
  .media-grid,
  .contact-grid,
  .action-grid,
  .request-review-grid,
  .dialog-layout,
  .dialog-row {
    grid-template-columns: 1fr;
  }

  .chart-head {
    display: grid;
  }

  .chart-summary {
    white-space: normal;
  }

  .chart-scale {
    min-width: 100%;
    padding: 20px 18px 36px;
  }
}
