@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/admin/assets/PlusJakartaSans-400.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/admin/assets/PlusJakartaSans-500.ttf") format("truetype");
  font-weight: 500;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/admin/assets/PlusJakartaSans-600.ttf") format("truetype");
  font-weight: 600;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/admin/assets/CormorantGaramond-700.ttf") format("truetype");
  font-weight: 700;
}

:root {
  --forest: #2d5a27;
  --forest-dark: #1b3d18;
  --forest-light: #4a7c44;
  --terracotta: #d47a4a;
  --terracotta-dark: #a65830;
  --paper: #fdfbf7;
  --surface: #ffffff;
  --surface-soft: #f5f2ed;
  --surface-warm: #f0eae2;
  --ink: #1a1c19;
  --ink-soft: #444941;
  --ink-muted: #777d75;
  --line: #dedfd8;
  --line-strong: #c8ccc3;
  --success: #2f7d32;
  --warning: #a85b12;
  --danger: #c12f2f;
  --info: #1b6f8f;
  --sidebar-width: 252px;
  --header-height: 86px;
  --shadow: 0 10px 30px rgba(27, 61, 24, 0.08);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

.button.is-busy::after {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.15;
}

.is-hidden {
  display: none !important;
}

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

.mobile-only {
  display: none !important;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--forest-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.brand-logo {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.brand-logo img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.auth-page {
  display: flex;
  min-height: 100vh;
  justify-content: center;
  background: var(--paper);
}

.auth-panel {
  display: flex;
  width: min(100%, 560px);
  min-height: 100vh;
  padding: 42px clamp(28px, 6vw, 64px);
  flex-direction: column;
  justify-content: center;
}

.auth-brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 12px;
  margin-bottom: 70px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 28px;
  font-weight: 700;
}

.auth-heading {
  max-width: 470px;
  margin-bottom: 32px;
}

.auth-heading h1 {
  margin-bottom: 12px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 48px;
  font-weight: 700;
}

.auth-heading > p:last-child {
  max-width: 430px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.form-stack {
  display: grid;
  max-width: 430px;
  gap: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span:first-child {
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.compact-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.compact-field select:focus {
  border-color: var(--forest-light);
  box-shadow: 0 0 0 3px rgba(74, 124, 68, 0.12);
}

.field small {
  color: var(--ink-muted);
  font-size: 9px;
}

.file-field input[type="file"] {
  padding: 5px;
  color: var(--ink-muted);
  font-size: 10px;
}

.file-field input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.input-shell {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.input-shell:focus-within {
  border-color: var(--forest-light);
  box-shadow: 0 0 0 3px rgba(74, 124, 68, 0.12);
}

.input-shell > svg {
  width: 17px;
  color: var(--ink-muted);
}

.input-shell input {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.input-shell .input-action {
  width: 32px;
  height: 32px;
  margin-right: -7px;
}

.form-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 12px;
}

.auth-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 52px;
  color: var(--ink-muted);
  font-size: 11px;
}

.button,
.icon-button {
  display: inline-flex;
  border: 0;
  align-items: center;
  justify-content: center;
}

.button {
  min-height: 42px;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-wide {
  width: 100%;
}

.button-primary {
  background: var(--forest);
  color: white;
}

.button-primary:hover {
  background: var(--forest-dark);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button-secondary:hover,
.button-quiet:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.button-quiet {
  background: transparent;
}

.button-danger {
  background: var(--danger);
  color: white;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.danger-action {
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  padding: 24px 16px 16px;
  border-right: 1px solid var(--line);
  flex-direction: column;
  background: #f8f6f1;
}

.sidebar-head {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 28px;
}

.sidebar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.sidebar-brand > span:last-child {
  display: grid;
}

.sidebar-brand strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 23px;
  line-height: 1;
}

.sidebar-brand small {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 10px;
}

.nav-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  margin: 0 10px 8px;
  color: var(--ink-muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-label-spaced {
  margin-top: 22px;
}

.nav-link {
  display: flex;
  width: 100%;
  min-height: 40px;
  margin-bottom: 3px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  align-items: center;
  gap: 11px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  color: var(--ink-muted);
}

.nav-link:hover {
  background: var(--surface-warm);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--forest);
  color: white;
}

.nav-link.is-active svg {
  color: white;
}

.nav-health {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--line-strong);
}

.nav-health.is-up {
  background: #69b36a;
}

.nav-health.is-down {
  background: var(--danger);
}

.nav-count {
  min-width: 21px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 10px;
  background: #f5d8d2;
  color: #8e2d23;
  font-size: 10px;
  text-align: center;
}

.sidebar-session {
  display: flex;
  min-width: 0;
  padding: 14px 4px 0;
  border-top: 1px solid var(--line);
  align-items: center;
  gap: 10px;
}

.user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  place-items: center;
  background: var(--surface-warm);
  color: var(--forest-dark);
  font-size: 11px;
  font-weight: 600;
}

.session-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.session-copy strong,
.session-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-copy strong {
  font-size: 11px;
}

.session-copy small {
  color: var(--ink-muted);
  font-size: 9px;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 clamp(24px, 4vw, 58px) 58px;
}

.workspace-header {
  position: sticky;
  z-index: 12;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  padding: 18px 0 15px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(253, 251, 247, 0.96);
}

.workspace-title {
  min-width: 0;
}

.workspace-title h1 {
  margin-bottom: 2px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 29px;
}

.workspace-title > p:last-child {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 11px;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.system-state {
  display: inline-flex;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.status-ok {
  background: var(--success);
}

.status-neutral {
  background: var(--line-strong);
}

.status-warning {
  background: var(--warning);
}

.status-danger {
  background: var(--danger);
}

.system-state.is-up .status-dot {
  background: var(--success);
}

.system-state.is-down .status-dot {
  background: var(--danger);
}

.view-panel {
  padding-top: 28px;
}

.view-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-actions {
  justify-content: space-between;
  margin-bottom: 18px;
}

.toolbar {
  min-width: 0;
}

.compact-field {
  display: block;
  min-width: 174px;
}

.compact-field.grow {
  width: min(360px, 44vw);
}

.compact-field .input-shell {
  min-height: 42px;
}

.compact-field select {
  min-height: 42px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.segmented button {
  display: inline-flex;
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: 5px;
  align-items: center;
  gap: 7px;
  background: transparent;
  font-size: 11px;
}

.segmented button svg {
  width: 15px;
}

.segmented button.is-active {
  background: var(--forest);
  color: white;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.metric {
  min-height: 132px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-muted);
}

.metric-head svg {
  width: 18px;
  color: var(--forest-light);
}

.metric-value {
  display: block;
  margin: 19px 0 4px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.metric-value-text {
  overflow-wrap: anywhere;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 19px;
  line-height: 1.25;
}

.metric-foot {
  color: var(--ink-muted);
  font-size: 10px;
}

.deployment-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.deployment-state {
  display: grid;
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  background: var(--surface);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.deployment-state.is-ready {
  border-left-color: var(--success);
}

.deployment-state > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.deployment-state > div > span,
.deployment-state small {
  color: var(--ink-muted);
  font-size: 10px;
}

.deployment-state strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.amount {
  white-space: nowrap;
  font-weight: 700;
}

.amount-positive {
  color: var(--success);
}

.amount-negative {
  color: var(--danger);
}

.compact-table table {
  font-size: 10px;
}

.section-block {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  margin-bottom: 14px;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin-bottom: 3px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 24px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 11px;
}

.section-actions,
.artifact-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.section-actions {
  justify-content: flex-end;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.status-strip {
  display: grid;
  padding: 0;
  border-top: 1px solid var(--line);
}

.status-row {
  display: grid;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  grid-template-columns: minmax(140px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.status-row strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.status-row small {
  color: var(--ink-muted);
  font-size: 10px;
}

.status-value {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.storage-usage {
  display: grid;
  padding-top: 16px;
  gap: 8px;
}

.storage-usage > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-soft);
  font-size: 11px;
}

.storage-usage small {
  overflow-wrap: anywhere;
  color: var(--ink-muted);
  font-size: 9px;
}

.storage-track {
  overflow: hidden;
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: var(--surface-warm);
}

.storage-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
}

.chart-panel {
  min-height: 240px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.bars {
  display: flex;
  height: 170px;
  padding-top: 14px;
  align-items: end;
  gap: 9px;
}

.bar-item {
  display: flex;
  min-width: 0;
  height: 100%;
  flex: 1;
  align-items: end;
  justify-content: center;
}

.bar {
  position: relative;
  width: min(30px, 74%);
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--forest-light);
}

.bar span {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  color: var(--ink-muted);
  font-size: 9px;
  transform: translateX(-50%);
}

.chart-labels {
  display: flex;
  gap: 9px;
  border-top: 1px solid var(--line);
}

.chart-labels span {
  min-width: 0;
  padding-top: 8px;
  flex: 1;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
}

.data-surface {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.data-surface table {
  width: 100%;
  border-collapse: collapse;
}

.data-surface th,
.data-surface td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-surface th {
  background: #faf9f6;
  color: var(--ink-muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.data-surface td {
  font-size: 11px;
}

.data-surface tbody tr:last-child td {
  border-bottom: 0;
}

.data-surface tbody tr:hover {
  background: #fcfbf8;
}

.quality-grid,
.distribution-grid,
.export-grid {
  display: grid;
  gap: 14px;
}

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

.quality-card,
.distribution-panel,
.export-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.quality-card {
  min-height: 205px;
  padding: 18px;
}

.quality-head,
.distribution-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quality-head {
  justify-content: flex-start;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.quality-card > strong {
  display: block;
  margin-top: 18px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 32px;
  line-height: 1;
}

.quality-card > small {
  display: block;
  min-height: 16px;
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 9px;
}

.quality-card > p {
  margin: 13px 0 0;
  color: var(--ink-muted);
  font-size: 10px;
}

.quality-track {
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-soft);
}

.quality-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest-light);
}

.quality-warning .state-icon,
.quality-warning > strong {
  color: var(--warning);
}

.quality-success .state-icon,
.quality-success > strong {
  color: var(--success);
}

.distribution-panel {
  padding: 17px;
}

.distribution-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.distribution-head > span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
}

.distribution-head svg {
  width: 17px;
  color: var(--forest-light);
}

.distribution-head > strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 24px;
}

.distribution-list {
  display: grid;
  margin-top: 12px;
  gap: 12px;
}

.distribution-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
}

.distribution-row .quality-track {
  margin-top: 6px;
}

.muted-copy {
  margin: 0;
  color: var(--ink-muted);
  font-size: 10px;
}

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

.export-item {
  display: grid;
  min-height: 112px;
  padding: 16px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.export-item strong {
  display: block;
  font-size: 12px;
}

.export-item p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 9px;
}

.primary-cell {
  display: grid;
  gap: 2px;
}

.primary-cell strong {
  font-size: 11px;
}

.primary-cell small {
  color: var(--ink-muted);
  font-size: 9px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.row-actions .icon-button {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.row-actions svg {
  width: 15px;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 4px;
  align-items: center;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 600;
}

.badge-success {
  background: #e5f1e4;
  color: #235f26;
}

.badge-warning {
  background: #f7ead9;
  color: #8d4c0f;
}

.badge-danger {
  background: #f7dfdc;
  color: #9c2929;
}

.badge-info {
  background: #e0eff3;
  color: #155b73;
}

.join-code {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--forest-dark);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.badge-neutral {
  background: #ecece7;
  color: #50554e;
}

.progress-track {
  width: 92px;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-warm);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest-light);
}

.health-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination {
  display: flex;
  min-height: 54px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pagination > span {
  color: var(--ink-muted);
  font-size: 10px;
}

.pagination-actions {
  display: flex;
  gap: 5px;
}

.pagination-actions .icon-button {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.empty-state,
.error-state,
.loading-state {
  display: grid;
  min-height: 260px;
  padding: 32px;
  place-items: center;
  text-align: center;
}

.state-content {
  max-width: 390px;
}

.state-icon {
  display: inline-grid;
  width: 48px;
  height: 48px;
  margin-bottom: 15px;
  border-radius: 50%;
  place-items: center;
  background: var(--surface-warm);
  color: var(--forest);
}

.state-icon svg {
  width: 22px;
}

.state-content h3 {
  margin-bottom: 5px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 21px;
}

.state-content p {
  margin-bottom: 15px;
  color: var(--ink-muted);
  font-size: 11px;
}

.loading-lines {
  display: grid;
  width: min(420px, 80%);
  gap: 9px;
}

.loading-lines span {
  height: 11px;
  border-radius: 3px;
  background: var(--surface-warm);
  animation: pulse 1.2s ease-in-out infinite;
}

.loading-lines span:nth-child(2) {
  width: 76%;
}

.loading-lines span:nth-child(3) {
  width: 58%;
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

.map-panel {
  position: relative;
  min-height: 570px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe9d9;
}

.map-canvas {
  width: 100%;
  min-height: 570px;
}

.map-summary {
  position: absolute;
  z-index: 500;
  top: 14px;
  right: 14px;
  max-width: 250px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  font-size: 10px;
}

.map-summary strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 5px;
}

.leaflet-popup-content {
  min-width: 170px;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 11px;
}

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

.tool-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tool-panel h2 {
  margin-bottom: 5px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
}

.tool-panel > p {
  margin-bottom: 20px;
  color: var(--ink-muted);
  font-size: 11px;
}

.tool-form {
  display: grid;
  gap: 15px;
}

.toggle-row {
  display: flex;
  min-height: 50px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-copy {
  display: grid;
}

.toggle-copy strong {
  font-size: 11px;
}

.toggle-copy small {
  color: var(--ink-muted);
  font-size: 9px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--line-strong);
  transition: 0.18s ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: 0.18s ease;
}

.switch input:checked + span {
  background: var(--forest);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-item {
  min-height: 82px;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-muted);
  font-size: 9px;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.detail-section {
  margin-top: 24px;
}

.detail-section .section-heading {
  margin-bottom: 10px;
}

.detail-section .section-heading h3 {
  margin-bottom: 2px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 20px;
}

.detail-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.detail-table table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 10px;
}

.detail-table th {
  background: #faf9f6;
  color: var(--ink-muted);
  font-size: 8px;
  text-transform: uppercase;
}

.detail-table tr:last-child td {
  border-bottom: 0;
}

.detail-table td strong,
.detail-table td small {
  display: block;
}

.detail-table td small {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 8px;
}

.detail-copy {
  margin: 0;
  padding: 14px;
  border-left: 3px solid var(--forest-light);
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 11px;
  white-space: pre-wrap;
}

.code-block {
  max-height: 260px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #20251f;
  color: #f4f6f1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.import-preview {
  display: grid;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(47, 125, 50, 0.28);
  border-radius: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: rgba(47, 125, 50, 0.06);
}

.import-preview > div {
  min-width: 0;
}

.import-preview span,
.import-preview strong,
.import-preview code {
  display: block;
}

.import-preview span {
  margin-bottom: 3px;
  color: var(--ink-muted);
  font-size: 8px;
  text-transform: uppercase;
}

.import-preview strong,
.import-preview code {
  overflow-wrap: anywhere;
  font-size: 10px;
}

.dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(21, 35, 20, 0.25);
}

.dialog::backdrop {
  background: rgba(26, 28, 25, 0.48);
}

.dialog > form,
.dialog > div:not(.dialog-head) {
  margin: 0;
}

.dialog form,
.dialog > .dialog-head,
.dialog > #detailContent {
  padding-right: 24px;
  padding-left: 24px;
}

.dialog form {
  padding-top: 22px;
  padding-bottom: 22px;
}

.dialog > .dialog-head {
  padding-top: 22px;
}

.dialog > #detailContent {
  padding-bottom: 24px;
}

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

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

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-head h2 {
  margin-bottom: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 26px;
}

.dialog-intro {
  max-width: 540px;
  margin: 12px 0 20px;
  color: var(--ink-muted);
  font-size: 11px;
}

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

.field-span-2 {
  grid-column: span 2;
}

.dialog-actions {
  display: flex;
  margin-top: 22px;
  justify-content: flex-end;
  gap: 8px;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(370px, calc(100vw - 32px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--forest);
  border-radius: 6px;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease-out;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast svg {
  width: 18px;
  flex: 0 0 18px;
}

.toast span {
  min-width: 0;
  flex: 1;
  font-size: 11px;
}

.toast-close {
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  pointer-events: auto;
}

.toast-close:hover {
  background: var(--surface-warm);
  color: var(--ink);
}

.toast-close svg {
  width: 15px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(41, 98, 66, 0.28);
  outline-offset: 2px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .deployment-strip {
    grid-template-columns: 1fr;
  }

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

  .quality-grid > :last-child,
  .distribution-grid > :last-child {
    grid-column: span 2;
  }

  .data-surface {
    overflow-x: auto;
  }

  .data-surface table {
    min-width: 780px;
  }
}

@media (max-width: 860px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .auth-panel {
    width: 100%;
    max-width: 620px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 32px 28px;
  }

  .auth-brand {
    margin-bottom: 54px;
  }

  .auth-heading h1 {
    font-size: 42px;
  }

  .form-stack {
    max-width: none;
  }

  .sidebar {
    width: min(292px, 86vw);
    box-shadow: 16px 0 50px rgba(26, 28, 25, 0.2);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 18;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(26, 28, 25, 0.42);
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.is-open {
    visibility: visible;
    opacity: 1;
  }

  .workspace {
    margin-left: 0;
    padding: 0 22px 42px;
  }

  .workspace-header {
    min-height: 78px;
    gap: 12px;
  }

  .workspace-title {
    flex: 1;
  }

  .workspace-title > p:last-child,
  .system-state {
    display: none;
  }

  .operations-grid,
  .dual-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .quality-grid,
  .distribution-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .quality-grid > :last-child,
  .distribution-grid > :last-child {
    grid-column: auto;
  }

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

  .view-actions > .button,
  .view-actions > .segmented {
    align-self: flex-start;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .compact-field.grow {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .auth-panel {
    padding: 24px 20px;
    justify-content: flex-start;
  }

  .auth-brand {
    margin-bottom: 46px;
  }

  .auth-heading h1 {
    font-size: 37px;
  }

  .auth-footer {
    margin-top: 38px;
  }

  .workspace {
    padding: 0 14px 36px;
  }

  .workspace-header {
    min-height: 72px;
  }

  .workspace-title h1 {
    max-width: 170px;
    overflow: hidden;
    font-size: 23px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-title .eyebrow {
    display: none;
  }

  .workspace-actions {
    gap: 2px;
  }

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

  .metric {
    min-height: 116px;
    padding: 13px;
  }

  .metric-head span {
    font-size: 9px;
  }

  .metric-value {
    font-size: 28px;
  }

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

  .deployment-state > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .toolbar .compact-field {
    min-width: 0;
  }

  .toolbar .compact-field.grow {
    grid-column: 1 / -1;
  }

  .toolbar .button span {
    display: none;
  }

  .data-surface {
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
  }

  .data-surface table,
  .data-surface thead,
  .data-surface tbody,
  .data-surface tr,
  .data-surface td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .data-surface thead {
    display: none;
  }

  .data-surface tbody {
    display: grid;
    gap: 9px;
  }

  .data-surface tr {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .data-surface td {
    display: flex;
    min-height: 32px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    text-align: right;
  }

  .data-surface td::before {
    color: var(--ink-muted);
    content: attr(data-label);
    font-size: 9px;
    text-align: left;
    text-transform: uppercase;
  }

  .data-surface td:first-child {
    display: block;
    padding-top: 0;
    text-align: left;
  }

  .data-surface td:first-child::before {
    display: none;
  }

  .data-surface td:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .pagination {
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .map-panel,
  .map-canvas {
    min-height: 480px;
  }

  .map-summary {
    right: 8px;
    bottom: 8px;
    top: auto;
    left: 8px;
    max-width: none;
  }

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

  .field-span-2 {
    grid-column: auto;
  }

  .import-preview {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

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

  .dialog form,
  .dialog > .dialog-head,
  .dialog > #detailContent {
    padding-right: 18px;
    padding-left: 18px;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .sidebar,
  .workspace-header,
  .view-actions,
  .section-actions,
  .row-actions,
  .pagination,
  .toast-region,
  dialog {
    display: none !important;
  }

  .workspace {
    margin: 0;
    padding: 0;
  }

  .view-panel {
    padding: 0;
  }

  .data-surface {
    overflow: visible;
    border: 1px solid #bbb;
  }
}
