:root {
  --bg: #edf3fb;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --ink: #102a43;
  --muted: #5c6f82;
  --line: #d5e3f0;
  --accent: #0f4c81;
  --accent-2: #1f9d8f;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(15, 76, 129, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(98, 182, 203, 0.22), transparent 34%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

button,
input,
textarea {
  font: inherit;
}

.shell-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 20px 22px 0 22px;
}

.shell-brand h1 {
  margin: 0;
  font-size: 30px;
}

.module-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.module-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #c2d8ef;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.module-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  min-height: calc(100vh - 110px);
  padding: 18px 22px 22px 22px;
  gap: 18px;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  background: #0d2239;
  color: #f8fbff;
  box-shadow: var(--shadow);
}

.sidebar-head h1,
.main-toolbar h2,
.section-head h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: #8fb5da;
}

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

.admin-sidebar .hint {
  color: #b8cfe6;
}

.small {
  font-size: 13px;
}

.panel-card {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.admin-sidebar .panel-card {
  background: rgba(255, 255, 255, 0.96);
}

.grow {
  flex: 1;
  min-height: 260px;
}

.inline-row,
.toolbar-actions,
.form-grid {
  display: flex;
  gap: 10px;
}

.inline-row {
  align-items: center;
}

.form-grid {
  margin-bottom: 18px;
}

.form-grid label {
  flex: 1;
}

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

input,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #bfd1e2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover,
.back-link:hover {
  filter: brightness(1.05);
}

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

button.secondary {
  background: #eef5ff;
  border-color: #c1d7ef;
  color: var(--accent);
}

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

.back-link {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  color: #eef6ff;
}

.areas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--accent);
  font-weight: 700;
}

.area-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 430px);
  overflow: auto;
}

.area-item {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  border-color: #dce8f3;
  background: #f8fbff;
  color: var(--ink);
}

.area-item.active {
  background: linear-gradient(135deg, #0f4c81, #1f7a8c);
  color: #fff;
  border-color: transparent;
}

.area-item-text {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
}

.area-item small {
  opacity: 0.8;
}

.admin-main {
  padding: 22px;
}

.main-toolbar,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.main-toolbar {
  margin-bottom: 18px;
}

.compact {
  flex-wrap: wrap;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(540px, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.turbine-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

.turbine-table th,
.turbine-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e4eef7;
  vertical-align: top;
}

.turbine-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5faff;
  text-align: left;
  font-size: 13px;
}

.turbine-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.row-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e2efff;
  color: var(--accent);
  font-weight: 700;
}

.icon-btn {
  min-width: 40px;
  padding: 8px 10px;
}

.json-editor {
  min-height: 560px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #08131f;
  color: #d9ecff;
  border-color: #1f3650;
}

.status {
  min-height: 24px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--accent);
}

.status.error {
  color: var(--danger);
}

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

@media (max-width: 980px) {
  .shell-header,
  .admin-layout {
    display: block;
  }

  .shell-header {
    padding-top: 16px;
  }

  .form-grid,
  .main-toolbar,
  .section-head,
  .toolbar-actions,
  .inline-row {
    flex-direction: column;
  }

  .area-list {
    max-height: none;
  }

  .admin-main {
    padding: 16px;
  }
}
