:root {
  --bg: #0f1419;
  --surface: rgba(22, 28, 34, 0.9);
  --surface-strong: #192129;
  --line: rgba(175, 190, 204, 0.12);
  --text: #eef4fa;
  --muted: #98a8b8;
  --accent: #d06d3c;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(208, 109, 60, 0.18), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(45, 101, 134, 0.18), transparent 22rem),
    linear-gradient(180deg, #0d1217 0%, #131a21 100%);
  font-family: Cambria, Georgia, "Times New Roman", serif;
}

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

.editor-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(10, 14, 18, 0.96);
  color: #e8eef4;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-nav-toggle {
  display: none;
  padding: 0.65rem 0.85rem;
  align-self: start;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  color: #f8efe3;
}

.editor-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.editor-brand strong,
.editor-brand small {
  display: block;
}

.editor-brand small {
  color: rgba(232, 238, 244, 0.6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.editor-brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, #d39e57, #9f4f2f);
  color: white;
  font-weight: 700;
}

.editor-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.editor-subnav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.2rem 0 0.5rem 0.85rem;
  padding-left: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-subnav-title {
  color: rgba(232, 238, 244, 0.48);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.68rem;
  margin-bottom: 0.1rem;
}

.editor-subnav-link {
  padding: 0.45rem 0.6rem;
  border-radius: 0.7rem;
  color: rgba(232, 238, 244, 0.72);
  font-size: 0.92rem;
}

.editor-subnav-link:hover,
.editor-subnav-link.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.editor-nav-link {
  padding: 0.8rem 0.95rem;
  border-radius: 0.9rem;
  color: rgba(232, 238, 244, 0.82);
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.editor-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

.editor-nav-link.is-active {
  background: linear-gradient(135deg, rgba(208, 109, 60, 0.22), rgba(45, 101, 134, 0.28));
  color: #ffffff;
}

.editor-sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: rgba(232, 238, 244, 0.7);
  font-size: 0.92rem;
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: #63c26d;
  box-shadow: 0 0 0 0.25rem rgba(99, 194, 109, 0.14);
}

.editor-main {
  padding: 2rem;
}

.editor-topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.environment-switcher {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 12, 16, 0.72);
}

.environment-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.6rem;
  padding: 0.48rem 0.72rem;
  border-radius: 999px;
  font: 700 0.72rem/1 Arial, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.environment-flag.is-test {
  color: #bde8ff;
  background: rgba(38, 137, 190, 0.22);
  border: 1px solid rgba(79, 179, 232, 0.42);
}

.environment-flag.is-production {
  color: #fff0be;
  background: rgba(198, 113, 22, 0.3);
  border: 1px solid rgba(244, 166, 72, 0.6);
  box-shadow: 0 0 0 0.2rem rgba(208, 109, 60, 0.1);
}

.environment-switch-link {
  padding: 0.35rem 0.55rem;
  color: #d4e0ea;
  font: 600 0.78rem/1 Arial, sans-serif;
  white-space: nowrap;
}

.environment-switch-link:hover {
  color: white;
}

.editor-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-size: 0.78rem;
}

.page-title,
.hero-title {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.03;
}

.topbar-badge {
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #d8e3ed;
}

.hero-panel,
.placeholder-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.7fr);
  gap: 1.5rem;
  padding: 1.8rem;
}

.hero-panel.compact {
  grid-template-columns: 1fr;
}

.monster-loot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr));
  gap: 1.25rem;
}

.monster-loot-card,
.monster-loot-history {
  padding: 1.4rem;
}

.monster-loot-table select,
.monster-loot-table input {
  width: 100%;
  min-width: 7rem;
}

.monster-loot-table select {
  min-width: 15rem;
}

.loot-weight-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.loot-total {
  min-width: 5.5rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
}

.loot-total.is-valid {
  color: #86e28f;
  border-color: rgba(99, 194, 109, 0.55);
  background: rgba(99, 194, 109, 0.1);
}

.loot-total.is-invalid {
  color: #ff9e8f;
  border-color: rgba(220, 85, 65, 0.55);
  background: rgba(220, 85, 65, 0.1);
}

.monster-loot-actions {
  margin-top: 1rem;
  flex-wrap: wrap;
}

.loot-simulation {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.035);
}

.loot-simulation ul {
  columns: 2;
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.hero-copy {
  margin: 1rem 0 0;
  max-width: 48rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.hero-meta {
  display: grid;
  gap: 1rem;
}

.analytics-heading,
.analytics-panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: var(--shadow);
}

.analytics-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.analytics-kpi {
  min-width: 0;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: linear-gradient(155deg, rgba(29, 38, 47, 0.98), rgba(18, 25, 31, 0.98));
}

.analytics-kpi.is-revenue {
  border-color: rgba(99, 194, 109, 0.22);
  background: linear-gradient(155deg, rgba(29, 50, 42, 0.94), rgba(18, 28, 28, 0.98));
}

.analytics-kpi strong {
  display: block;
  margin: 0.45rem 0 0.25rem;
  overflow: hidden;
  color: #f6fbff;
  font: 700 clamp(1.45rem, 2.2vw, 2.2rem)/1 Arial, sans-serif;
  text-overflow: ellipsis;
}

.analytics-kpi small {
  color: var(--muted);
  font: 0.76rem/1.35 Arial, sans-serif;
}

.analytics-kpi small.is-positive {
  color: #86e28f;
}

.analytics-kpi small.is-negative {
  color: #ff9e8f;
}

.analytics-note {
  margin: -0.7rem 0 0;
  padding: 0 0.25rem;
  color: rgba(152, 168, 184, 0.78);
  font: 0.76rem/1.5 Arial, sans-serif;
}

.analytics-panel {
  min-width: 0;
  padding: 1.25rem;
}

.analytics-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.analytics-panel-header h3 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
}

.analytics-legend {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font: 0.76rem/1 Arial, sans-serif;
}

.analytics-legend i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.2rem;
  background: linear-gradient(180deg, #e79a67, #c76336);
}

.analytics-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.daily-chart {
  min-height: 16rem;
  display: grid;
  grid-template-columns: repeat(14, minmax(2.5rem, 1fr));
  gap: 0.55rem;
  align-items: end;
  overflow-x: auto;
  padding-top: 1rem;
}

.daily-column {
  min-width: 2.5rem;
  display: grid;
  grid-template-rows: 1rem 11rem auto auto;
  gap: 0.35rem;
  text-align: center;
}

.daily-value,
.daily-date,
.daily-column small {
  font: 0.7rem/1 Arial, sans-serif;
}

.daily-value {
  color: #dce9f2;
}

.daily-date,
.daily-column small {
  color: var(--muted);
}

.daily-bar-track {
  height: 11rem;
  display: flex;
  align-items: end;
  overflow: hidden;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.035);
}

.daily-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 0.5rem 0.5rem 0.2rem 0.2rem;
  background: linear-gradient(180deg, #e79a67, #a34e2e);
}

.analytics-bars {
  display: grid;
  gap: 0.85rem;
}

.analytics-bar-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  color: #dce6ef;
  font: 0.82rem/1.2 Arial, sans-serif;
}

.analytics-bar-track {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.analytics-bar-track span {
  display: block;
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b85b34, #e99662);
}

.analytics-bar-track.is-progression span {
  background: linear-gradient(90deg, #2d6586, #65acd5);
}

.analytics-empty {
  margin: 0;
  color: var(--muted);
}

.purchase-ledger {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.025);
}

.purchase-ledger summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: #e7eff6;
  font: 600 0.86rem/1.2 Arial, sans-serif;
  list-style: none;
}

.purchase-ledger summary::-webkit-details-marker {
  display: none;
}

.purchase-ledger summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(208, 109, 60, 0.16);
  color: #f4b58d;
}

.purchase-ledger[open] summary::before {
  content: "−";
}

.purchase-ledger summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
}

.purchase-ledger-content {
  padding: 0 1rem 1rem;
}

.purchase-table td,
.purchase-table th {
  white-space: nowrap;
}

.platform-pill {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(45, 101, 134, 0.18);
  color: #bde8ff;
  font: 600 0.72rem/1 Arial, sans-serif;
  text-transform: uppercase;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.health-signal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(99, 194, 109, 0.2);
  border-radius: 0.8rem;
  background: rgba(99, 194, 109, 0.06);
  color: #cae4ce;
}

.health-signal.has-warning {
  border-color: rgba(235, 173, 73, 0.35);
  background: rgba(235, 173, 73, 0.08);
  color: #f2d59d;
}

.health-signal.has-danger {
  border-color: rgba(220, 85, 65, 0.4);
  background: rgba(220, 85, 65, 0.09);
  color: #ffb0a4;
}

.health-signal span,
.health-time {
  font: 0.78rem/1.2 Arial, sans-serif;
}

.login-environment {
  float: right;
  margin: -0.55rem -0.55rem 1rem 1rem;
}

.metric-card {
  padding: 1.2rem;
  border-radius: 1.2rem;
  background: linear-gradient(180deg, rgba(28, 36, 44, 0.94), rgba(20, 27, 34, 0.98));
  border: 1px solid rgba(175, 190, 204, 0.12);
}

.metric-label {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.metric-value {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.4rem;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.system-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.system-group-header h3,
.systems-index-header h3 {
  margin: 0;
}

.systems-index-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1rem;
}

.systems-index-search {
  min-width: min(100%, 22rem);
}

.recent-systems {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recent-systems-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.recent-system-chip {
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(175, 190, 204, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #dce6ef;
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 220px;
  padding: 1.4rem;
  border-radius: 1.35rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(25, 33, 41, 0.95), rgba(20, 27, 34, 0.98));
  box-shadow: var(--shadow);
  transition: transform 130ms ease, border-color 130ms ease;
}

.section-card:hover {
  transform: translateY(-2px);
  border-color: rgba(159, 79, 47, 0.28);
}

.section-card-meta,
.hero-inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.section-card h3 {
  margin: 0;
  font-size: 1.45rem;
}

.section-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.section-tag {
  align-self: start;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(208, 109, 60, 0.16);
  color: #f4b58d;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-status,
.risk-pill {
  align-self: start;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #c4d1dc;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-link {
  margin-top: auto;
  color: var(--accent);
  font-weight: 600;
}

.placeholder-panel {
  padding: 1.5rem;
}

.page-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.placeholder-panel h3 {
  margin: 0 0 1rem;
}

.placeholder-list {
  display: grid;
  gap: 0.8rem;
}

.placeholder-item {
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: var(--surface-strong);
  border: 1px solid rgba(175, 190, 204, 0.1);
  color: var(--muted);
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.toolbar-form input,
.attachment-row input,
.attachment-row select {
  width: 100%;
  padding: 0.45rem 0.65rem;
  min-height: 2.2rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(175, 190, 204, 0.16);
  background: rgba(9, 13, 17, 0.72);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.2;
}

.field input::placeholder,
.field textarea::placeholder,
.toolbar-form input::placeholder {
  color: rgba(152, 168, 184, 0.72);
}

.field textarea {
  resize: vertical;
  min-height: 5.5rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.48rem 0.8rem;
  min-height: 2.2rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.1;
}

.primary-button {
  background: var(--accent);
  color: #fffaf4;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(175, 190, 204, 0.14);
  color: #e8f1f9;
}

.danger-button {
  background: #a1392a;
  color: #fff6f3;
}

.toolbar-form {
  display: flex;
  gap: 0.8rem;
}

.status-banner {
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
}

.status-banner.success {
  background: rgba(99, 194, 109, 0.12);
  color: #a6e0ae;
}

.status-banner.error {
  background: rgba(161, 57, 42, 0.12);
  color: #f0aaa0;
}

.field-error {
  color: #a1392a;
  font-size: 0.9rem;
}

.data-list {
  display: grid;
  gap: 0.8rem;
}

.data-row,
.data-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: var(--surface-strong);
  border: 1px solid rgba(175, 190, 204, 0.1);
}

.data-row:hover {
  border-color: rgba(208, 109, 60, 0.3);
}

.table-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(175, 190, 204, 0.1);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #cad6e1;
}

.table-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

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

.wide-left {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.command-output {
  margin: 0;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(6, 9, 12, 0.96);
  color: #d9e8f6;
  overflow-x: auto;
  white-space: pre-wrap;
}

.login-body {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-panel {
  width: min(100%, 520px);
  padding: 2rem;
  border-radius: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.google-login-button {
  width: 100%;
  min-height: 3.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(175, 190, 204, 0.22);
  border-radius: 0.7rem;
  background: #ffffff;
  color: #202124;
  cursor: pointer;
  font: 600 0.96rem Arial, sans-serif;
}

.google-login-button:hover {
  background: #f7f9fc;
}

.google-mark {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  color: #4285f4;
  font: 700 1.1rem Arial, sans-serif;
}

.systems-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 1.5rem;
}

.systems-sidebar {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow: auto;
}

.systems-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.workspace-toolbar .hero-inline-meta {
  margin-top: 0.8rem;
}

.systems-section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.entity-list,
.json-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.entity-link {
  display: block;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(175, 190, 204, 0.1);
  background: var(--surface-strong);
  color: var(--muted);
}

.entity-link.is-active,
.entity-link:hover {
  border-color: rgba(208, 109, 60, 0.3);
  color: var(--text);
}

.json-editor-card {
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgba(175, 190, 204, 0.1);
  background: var(--surface-strong);
}

.json-editor-card summary {
  cursor: pointer;
  font-weight: 600;
}

.json-editor-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.json-editor-actions.stacked {
  grid-template-columns: 1fr;
}

.json-editor-card textarea {
  min-height: 14rem;
  font-family: Consolas, "Courier New", monospace;
}

.structured-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem 0.75rem;
}

.structured-field {
  min-width: 0;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  min-height: 1rem;
  font-size: 0.76rem;
  line-height: 1.1;
}

.field-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.32rem;
  border-radius: 999px;
  background: rgba(208, 109, 60, 0.16);
  color: #f1bb97;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-badge.is-muted {
  background: rgba(255, 255, 255, 0.08);
  color: #c4d1dc;
}

.field-help {
  color: rgba(152, 168, 184, 0.9);
  line-height: 1.25;
  font-size: 0.73rem;
}

.json-preview-card {
  border-top: 1px solid rgba(175, 190, 204, 0.1);
  padding-top: 0.9rem;
}

.json-preview-card summary {
  cursor: pointer;
  color: #cad6e1;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.section-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.section-table th,
.section-table td {
  white-space: nowrap;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.section-table th {
  font-size: 0.72rem;
}

.section-table td {
  font-size: 0.86rem;
}

.row-editor-dialog {
  width: min(100%, 82rem);
  max-height: calc(100vh - 5rem);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.7rem;
  background: #343537;
  color: var(--text);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
}

.row-editor-dialog::backdrop {
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(4px);
}

.row-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #6e8998;
  color: #f4f8fb;
}

.row-editor-header h3 {
  margin: 0;
  font-size: 1.35rem;
}

.row-editor-form {
  padding: 0.9rem 1rem 1rem;
}

.row-editor-buttons {
  margin-top: 0.75rem;
  justify-content: flex-end;
}

.atavism-module-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.atavism-module-header {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  padding: 0 0 0.5rem;
}

.atavism-module-tab {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 14rem;
  padding: 0.9rem 1.1rem;
  border-radius: 1rem 1rem 0 0;
  background: #6e8998;
  color: #f4f8fb;
  box-shadow: inset 0 -3px 0 rgba(56, 164, 255, 0.8);
}

.atavism-module-tab span {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 248, 251, 0.75);
}

.atavism-module-tab strong {
  font-size: 1.15rem;
}

.atavism-module-status {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.atavism-module-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, rgba(112, 139, 153, 0.92), rgba(90, 116, 130, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.atavism-list-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.atavism-list-title {
  font-size: 1.9rem;
}

.atavism-list-copy {
  max-width: 42rem;
  color: rgba(240, 246, 250, 0.8);
}

.atavism-list-actions {
  display: flex;
  gap: 0.55rem;
  align-items: end;
}

.atavism-search-field {
  min-width: 18rem;
}

.atavism-list-panel {
  border-radius: 0.7rem;
  background: rgba(33, 36, 41, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.atavism-list-table th,
.atavism-list-table td {
  padding: 0.55rem 0.7rem;
}

.atavism-list-table tbody tr {
  cursor: pointer;
}

.atavism-list-table tbody tr:hover,
.atavism-list-table tbody tr.is-active {
  background: rgba(255, 255, 255, 0.05);
}

.atavism-id-cell {
  color: #d6e3ef;
  white-space: nowrap;
}

.atavism-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 10, 13, 0.72);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 2rem;
}

.atavism-modal {
  width: min(100%, 88rem);
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #343537;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
}

.atavism-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  background: #6e8998;
  color: #f4f8fb;
}

.atavism-modal-header h3 {
  margin: 0;
  font-size: 1.45rem;
}

.atavism-modal-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.atavism-modal-body {
  overflow: auto;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.atavism-modal-body .placeholder-panel {
  background: rgba(55, 59, 65, 0.94);
}

.atavism-modal-body .systems-section-header,
.atavism-modal-body .system-group-header {
  margin-bottom: 0.55rem;
}

.atavism-modal-body .system-group {
  gap: 0.65rem;
}

.placeholder-panel {
  padding: 1rem;
}

.section-status,
.risk-pill,
.section-tag {
  padding: 0.24rem 0.48rem;
  font-size: 0.66rem;
}

@media (max-width: 960px) {
  .editor-shell {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .editor-nav-toggle {
    display: inline-flex;
  }

  .editor-nav {
    display: none;
  }

  .editor-sidebar.is-open .editor-nav {
    display: flex;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

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

  .analytics-two-columns {
    grid-template-columns: 1fr;
  }

  .analytics-heading {
    flex-direction: column;
  }

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

  .systems-layout,
  .json-editor-actions {
    grid-template-columns: 1fr;
  }

  .systems-index-header {
    flex-direction: column;
    align-items: stretch;
  }

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

  .toolbar-form,
  .topbar-actions,
  .attachment-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .section-toolbar,
  .section-toolbar-actions,
  .row-editor-header {
    flex-direction: column;
    align-items: stretch;
  }

  .atavism-module-header,
  .atavism-list-toolbar,
  .atavism-list-actions,
  .atavism-module-status,
  .atavism-modal-header,
  .atavism-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .atavism-search-field {
    min-width: 0;
  }

  .atavism-modal-backdrop {
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  .editor-main {
    padding: 1rem;
  }

  .analytics-kpi-grid,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .environment-switcher {
    flex-direction: column;
    border-radius: 0.8rem;
  }
}
