:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-raised: #fbfcfe;
  --line: #dbe3ee;
  --line-soft: #edf1f6;
  --text: #172033;
  --text-soft: #40516a;
  --muted: #748197;
  --primary: #0b8f70;
  --primary-dark: #08795f;
  --primary-soft: #e8f6f1;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --warn: #a16207;
  --warn-soft: #fff6dc;
  --danger: #d92d46;
  --danger-dark: #b4233a;
  --danger-soft: #fff1f3;
  --focus: rgba(37, 99, 235, 0.2);
  --shadow: 0 16px 34px rgba(16, 24, 40, 0.08);
  --shadow-modal: 0 22px 70px rgba(16, 24, 40, 0.22);
  --admin-sidebar-width: 195px;
  --admin-page-padding-x: 24px;
  --admin-gap: 14px;
  --table-min-width: 760px;
  --table-compact-min-width: 560px;
  --z-toast: 30;
  --z-modal: 50;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

body.is-authenticated .auth-screen {
  display: none;
}

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

.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--admin-sidebar-width) minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
}

.sidebar {
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 14px;
}

.nav-group {
  display: grid;
  gap: 5px;
  padding-top: 18px;
}

.sidebar > .nav-group:first-child {
  padding-top: 0;
}

.nav-label {
  margin: 0 8px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  padding: 0 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
}

.nav-item:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.nav-item.is-active {
  border-color: rgba(11, 143, 112, 0.24);
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 6px;
  background: #eef3f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.nav-item.is-active .nav-key {
  background: var(--primary);
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 22px var(--admin-page-padding-x) 32px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  margin-bottom: 16px;
}

.crumb {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.2;
  font-weight: 900;
}

.topbar p,
.panel__head p,
.admin-panel__head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.topbar__actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: var(--surface-raised);
  border-color: #c9d3df;
}

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

.button:focus-visible,
.nav-item:focus-visible,
.language-tab:focus-visible,
.control:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

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

.button--danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button--danger:hover {
  border-color: var(--danger-dark);
  background: var(--danger-dark);
}

.button--wide {
  width: 100%;
}

.button:disabled,
.control:disabled,
.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.nav-item:disabled {
  color: var(--muted);
}

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

.status-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
}

.status-item__label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.status-item strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.admin-page {
  display: grid;
  gap: var(--admin-gap);
}

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

.summary-grid--characters {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.summary-card,
.panel,
.side-panel,
.admin-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.summary-card {
  min-width: 0;
  padding: 14px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.summary-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.admin-workspace {
  display: grid;
  gap: var(--admin-gap);
  align-items: start;
}

.admin-workspace--split {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
}

.admin-workspace--split-wide {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
}

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

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: start;
}

.content-grid--wide {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.panel {
  overflow: hidden;
}

.admin-panel,
.panel {
  overflow: hidden;
}

.panel__head,
.admin-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 12px 14px;
}

.panel__head > div,
.admin-panel__head > div {
  min-width: 0;
}

.panel__head h2,
.admin-panel__head h2 {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
}

.admin-panel__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.panel__body {
  padding: 14px;
}

.admin-detail-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.form-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.form-section__title {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.admin-action-box {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(11, 143, 112, 0.2);
  border-radius: 8px;
  background: #f7fffb;
  padding: 12px;
}

.admin-action-box--danger {
  border-color: rgba(217, 45, 70, 0.22);
  background: var(--danger-soft);
}

.admin-action-box__title {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.admin-action-box__text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.admin-action-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 12px 14px;
}

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

.settings-column {
  display: grid;
  gap: 14px;
}

.section-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.key-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  padding: 12px;
}

.key-box p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.control {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  outline: none;
  font-size: 13px;
  font-weight: 750;
}

.control--textarea {
  min-height: 74px;
  padding: 10px;
  resize: vertical;
  line-height: 1.5;
}

.control:focus {
  border-color: rgba(11, 143, 112, 0.7);
  box-shadow: 0 0 0 3px rgba(11, 143, 112, 0.12);
}

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

.toolbar,
.admin-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  background: #fcfdff;
}

.toolbar > *,
.admin-toolbar > * {
  min-width: 0;
}

.admin-toolbar--dense {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}

.admin-toolbar--commercial {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}

.toolbar--dense {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}

.admin-toolbar--dense .field,
.admin-toolbar--commercial .field,
.toolbar--dense .field {
  flex: 0 1 190px;
}

.admin-toolbar--dense .field:has(input[type="search"]),
.admin-toolbar--commercial .field:has(input[type="search"]),
.toolbar--dense .field:has(input[type="search"]) {
  flex: 1 1 280px;
}

.admin-toolbar--dense .button,
.admin-toolbar--commercial .button,
.toolbar--dense .button {
  align-self: flex-end;
  flex: 0 0 auto;
  min-height: 38px;
  min-width: 84px;
}

.table-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.table-primary-text {
  color: var(--text);
  font-weight: 900;
}

.toolbar--calls {
  grid-template-columns: minmax(130px, 150px) minmax(150px, 180px) minmax(220px, 1fr);
}

.language-editor {
  display: grid;
  gap: 8px;
}

.language-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.language-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text-soft);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.language-tab span,
.language-tab small {
  display: block;
}

.language-tab span {
  font-size: 13px;
  font-weight: 900;
}

.language-tab small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.language-tab.is-selected {
  border-color: rgba(11, 143, 112, 0.7);
  box-shadow: 0 0 0 3px rgba(11, 143, 112, 0.1);
}

.language-tab.is-incomplete small {
  color: #b45309;
}

.language-tab.is-complete small {
  color: #047857;
}

.language-editor p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.side-panel {
  padding: 14px;
}

.side-panel__title {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.config-readout {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.config-readout div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}

.config-readout div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.config-readout dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.config-readout dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
  overflow-wrap: anywhere;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 12px 14px;
}

.save-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag--ok {
  background: var(--primary-soft);
  color: var(--primary);
}

.tag--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag--muted {
  background: #eef3f7;
  color: var(--muted);
}

.priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 24px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.priority--p0 {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority--p1 {
  background: var(--warn-soft);
  color: var(--warn);
}

.task-list {
  display: grid;
  gap: 0;
}

.task-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row strong {
  display: block;
  font-size: 13px;
}

.task-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-wrap--compact {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: var(--table-min-width);
  border-collapse: collapse;
}

.table-wrap--compact table {
  min-width: var(--table-compact-min-width);
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  color: var(--text-soft);
  font-weight: 650;
  white-space: nowrap;
}

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

tr.is-selected td {
  background: var(--primary-soft);
}

.avatar-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.avatar-mark--image {
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.character-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.character-cell strong,
.character-cell span {
  display: block;
}

.character-cell span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.character-recent {
  max-width: 320px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
}

.character-preview {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  padding: 12px;
}

.character-preview__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--primary);
  background-position: center;
  background-size: cover;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
}

.character-preview__avatar.has-image {
  border: 1px solid var(--line);
  background-color: var(--surface-raised);
}

.character-preview__body {
  min-width: 0;
}

.character-preview__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.character-preview__topline strong {
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.character-preview p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.character-preview blockquote {
  margin: 9px 0 0;
  border-left: 3px solid rgba(11, 143, 112, 0.26);
  color: var(--text-soft);
  padding-left: 10px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.module-empty {
  display: grid;
  gap: 14px;
}

.module-empty__intro {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.module-empty__intro h2 {
  font-size: 18px;
}

.module-empty__intro p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.definition-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.definition-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.definition-card strong {
  display: block;
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.35;
}

.system-status-banner {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.system-status-banner strong {
  font-size: 14px;
  font-weight: 900;
}

.system-status-banner span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.system-status-banner--ok {
  border-color: rgba(11, 143, 112, 0.26);
  background: rgba(11, 143, 112, 0.08);
  color: var(--primary);
}

.system-status-banner--warn,
.system-status-banner--loading {
  border-color: rgba(161, 98, 7, 0.25);
  background: var(--warn-soft);
  color: var(--warn);
}

.system-status-banner--danger {
  border-color: rgba(217, 45, 70, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

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

.deployment-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.deployment-card__label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.deployment-card > strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.deployment-card dl {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.deployment-card dl div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.deployment-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.deployment-card dd {
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.inline-alert {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text-soft);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.inline-alert:not(:empty) {
  display: block;
}

.inline-alert--danger {
  border-color: rgba(217, 45, 70, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.inline-alert--warn {
  border-color: rgba(161, 98, 7, 0.25);
  background: var(--warn-soft);
  color: var(--warn);
}

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

.subtle-id {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.call-detail-body {
  display: grid;
  gap: 14px;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-readout {
  display: grid;
  gap: 8px;
  margin: 0;
}

.detail-readout div {
  display: grid;
  grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}

.detail-readout div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-readout dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.detail-readout dd {
  min-width: 0;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.event-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
}

.event-row strong,
.event-row span {
  display: block;
}

.event-row strong {
  color: var(--text);
  font-size: 12px;
}

.event-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.json-block {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  padding: 16px;
  font-size: 13px;
  font-weight: 750;
}

.empty-state--danger {
  border-color: rgba(217, 45, 70, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state--compact {
  padding: 10px;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--z-toast);
  max-width: min(440px, calc(100vw - 40px));
  border: 1px solid rgba(11, 143, 112, 0.22);
  border-radius: 8px;
  background: #f7fffb;
  color: var(--primary);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 850;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast--danger {
  border-color: rgba(217, 45, 70, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 10);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.36);
  padding: 24px;
}

.modal-backdrop.is-visible {
  display: flex;
}

.modal {
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.modal__body {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding: 18px;
}

.modal__body h2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 900;
}

.modal__body p {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
}

.modal__meta {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 12px 18px;
}

.overlay-node-host[hidden] {
  display: none;
}

body.has-edit-overlay {
  overflow: hidden;
}

.edit-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 24px;
}

.edit-overlay-backdrop.is-visible {
  display: flex;
}

.edit-overlay {
  width: min(1080px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity 160ms ease, transform 160ms ease;
}

.edit-overlay-backdrop.is-visible .edit-overlay {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.edit-overlay__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--surface-raised));
  padding: 18px 20px;
}

.edit-overlay__head h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 950;
}

.edit-overlay__head p {
  max-width: 760px;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.edit-overlay__head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.edit-overlay__body {
  overflow: auto;
  padding: 18px;
}

.edit-overlay__body > .admin-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.edit-overlay__body > .admin-panel > .admin-panel__head {
  display: none;
}

.edit-overlay__body > .admin-panel > .panel__body,
.edit-overlay__body > .admin-panel > .admin-action-footer {
  padding-right: 0;
  padding-left: 0;
}

.edit-overlay__body > .admin-panel > .admin-action-footer {
  position: sticky;
  bottom: -18px;
  z-index: 1;
  margin: 18px -18px -18px;
  padding: 14px 18px;
}

.edit-overlay .detail-section + .detail-section,
.edit-overlay .detail-section + .admin-action-box,
.edit-overlay .admin-action-box + .detail-section {
  margin-top: 18px;
}

.edit-overlay .admin-action-box {
  margin-top: 0;
}

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

  .content-grid,
  .content-grid--wide,
  .model-layout,
  .admin-workspace--split,
  .admin-workspace--split-wide {
    grid-template-columns: 1fr;
  }

  .toolbar--dense,
  .admin-toolbar--dense,
  .admin-toolbar--commercial {
    gap: 8px;
  }
}

@media (max-width: 820px) {
  :root {
    --admin-page-padding-x: 16px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    max-width: 100vw;
    position: static;
    height: auto;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    overscroll-behavior-x: contain;
  }

  .nav-group {
    display: flex;
    gap: 8px;
    padding-top: 0;
  }

  .nav-label {
    display: none;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    min-height: 38px;
    white-space: nowrap;
  }

  .main {
    padding: 16px;
  }

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

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

  .topbar__actions,
  .form-footer,
  .admin-action-footer,
  .key-box {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip,
  .summary-grid,
  .deployment-grid,
  .definition-grid,
  .form-grid,
  .language-tabs,
  .toolbar,
  .toolbar--dense,
  .toolbar--calls,
  .admin-toolbar,
  .admin-toolbar--dense,
  .admin-toolbar--commercial {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar__actions .button,
  .form-footer .button,
  .admin-action-footer .button,
  .toolbar .button,
  .admin-toolbar .button,
  .modal__footer .button,
  .edit-overlay__head-actions .button {
    width: 100%;
  }

  .panel__head .button,
  .admin-panel__head .button,
  .table-wrap .button {
    width: auto;
  }

  .modal__footer {
    flex-direction: column-reverse;
  }

  .edit-overlay-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .edit-overlay {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .edit-overlay__head {
    flex-direction: column;
    padding: 16px;
  }

  .edit-overlay__head-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .edit-overlay__body {
    padding: 14px;
  }

  .edit-overlay__body > .admin-panel > .admin-action-footer {
    bottom: -14px;
    margin: 14px -14px -14px;
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  :root {
    --admin-page-padding-x: 12px;
    --table-min-width: 700px;
    --table-compact-min-width: 520px;
  }

  .auth-screen {
    padding: 14px;
  }

  .auth-card {
    padding: 20px;
  }

  .sidebar {
    padding: 10px 12px;
  }

  .nav-item {
    min-height: 36px;
    padding: 0 9px;
    font-size: 13px;
  }

  .nav-key {
    width: 24px;
    height: 21px;
  }

  .main {
    padding-top: 16px;
  }

  h1 {
    font-size: 22px;
  }

  .summary-card strong {
    font-size: 20px;
  }

  .panel__head,
  .panel__body,
  .toolbar {
    padding: 12px;
  }

  th,
  td {
    padding: 10px 12px;
  }

  .detail-readout div,
  .config-readout div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .config-readout dd {
    text-align: left;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }
}
