:root {
  --bg: #14061f;
  --panel: rgba(43, 10, 72, 0.92);
  --panel-2: rgba(88, 17, 135, 0.88);
  --line: rgba(255, 213, 105, 0.26);
  --text: #fff4da;
  --muted: #d2b7f3;
  --accent: #ffb22c;
  --accent-2: #31d17d;
  --danger: #ff7a78;
  --shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(137, 51, 207, 0.48), transparent 30%),
    linear-gradient(180deg, #2f0a58 0%, #170623 38%, #11041a 100%);
}

.admin-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 32px 22px 54px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px 30px;
  background: linear-gradient(135deg, rgba(89, 18, 137, 0.98), rgba(48, 8, 80, 0.96));
}

.eyebrow {
  margin: 0 0 6px;
  color: #ffd978;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 700px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ghost-link,
.button-like,
.primary-btn,
select,
input,
textarea {
  font: inherit;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 214, 122, 0.28);
  background: rgba(20, 4, 31, 0.22);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.panel {
  background: linear-gradient(180deg, var(--panel), rgba(27, 7, 42, 0.96));
}

.auth-panel,
.toolbar {
  margin-top: 22px;
  padding: 24px;
}

.auth-panel h2,
.toolbar h2,
.panel-head h3 {
  margin: 0 0 6px;
}

.auth-panel p,
.meta-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 214, 122, 0.16);
  border-radius: 14px;
  background: rgba(14, 4, 21, 0.78);
  color: var(--text);
}

input,
select {
  min-height: 48px;
  padding: 0 14px;
}

code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  color: #ffe19b;
}

.primary-btn {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #2fcf69, #148c43);
  color: #f5ffe9;
  font-weight: 800;
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.dashboard.hidden,
.hidden {
  display: none !important;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

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

.summary-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(98, 20, 151, 0.96), rgba(45, 9, 72, 0.96));
}

.summary-card .label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-card .value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 900;
}

.summary-card .sub {
  margin-top: 8px;
  color: #ffdb9b;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

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

.lower-grid {
  grid-template-columns: 1.35fr 0.65fr;
}

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

.chart-panel,
.recent-panel,
.day-panel,
.config-summary-panel,
.config-panel,
.param-panel,
.notes-panel {
  padding: 22px;
}

.inline-field {
  min-width: 220px;
}

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

.detail-card {
  padding: 18px 18px 16px;
  border: 1px solid rgba(255, 214, 122, 0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(97, 21, 151, 0.95), rgba(46, 9, 72, 0.95));
}

.detail-card.positive {
  border-color: rgba(49, 209, 125, 0.28);
  box-shadow: inset 0 0 0 1px rgba(49, 209, 125, 0.08);
}

.detail-card.negative {
  border-color: rgba(255, 122, 120, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 122, 120, 0.08);
}

.detail-card .label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-card .value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
  word-break: break-word;
}

.detail-card .sub {
  margin-top: 8px;
  color: #ffdb9b;
  font-size: 13px;
  line-height: 1.35;
}

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

.daily-chart {
  display: flex;
  align-items: end;
  gap: 10px;
  min-height: 280px;
  padding: 12px 8px 0;
  overflow-x: auto;
  justify-content: flex-start;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(255, 214, 122, 0.07), rgba(255, 214, 122, 0.02));
  box-shadow: inset 0 -1px 0 rgba(255, 214, 122, 0.12);
}

.bar-col {
  flex: 0 0 var(--bar-col-width, 76px);
  min-width: var(--bar-col-width, 76px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: end;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  appearance: none;
}

.bar-col.selected .bar {
  box-shadow:
    0 0 0 2px rgba(255, 244, 218, 0.22),
    0 0 22px rgba(255, 178, 44, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.bar-col.selected .bar-label,
.bar-col.selected .bar-value {
  color: #fff2bf;
}

.bar {
  width: min(52px, 70%);
  min-height: 6px;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, #ffc64b, #ff7a1b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.bar.neg {
  background: linear-gradient(180deg, #ff9e98, #dc3434);
}

.bar-label,
.bar-value {
  font-size: 12px;
  text-align: center;
}

.bar-value {
  color: #ffd978;
}

.table-wrap {
  overflow: auto;
  max-height: 480px;
}

.param-groups {
  display: grid;
  gap: 16px;
}

.param-group {
  border: 1px solid rgba(255, 214, 122, 0.12);
  border-radius: 20px;
  background: rgba(22, 5, 35, 0.46);
  overflow: hidden;
}

.param-group summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 800;
}

.param-group summary::-webkit-details-marker {
  display: none;
}

.param-group[open] summary {
  border-bottom: 1px solid rgba(255, 214, 122, 0.1);
}

.param-group-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

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

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

.param-table td:nth-child(1),
.param-table th:nth-child(1) {
  min-width: 220px;
}

.param-table td:nth-child(2),
.param-table th:nth-child(2) {
  min-width: 220px;
}

.param-table td:nth-child(3),
.param-table th:nth-child(3) {
  min-width: 260px;
  white-space: normal;
}

.impact-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.impact-chip.high {
  background: rgba(255, 122, 120, 0.16);
  color: #ffd0cf;
}

.impact-chip.medium {
  background: rgba(255, 178, 44, 0.16);
  color: #ffe1a9;
}

.impact-chip.low {
  background: rgba(49, 209, 125, 0.16);
  color: #c7ffe0;
}

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

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 214, 122, 0.12);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: rgba(40, 8, 63, 0.98);
  color: #ffd978;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 178, 44, 0.16);
  color: #ffe3a7;
  font-size: 12px;
}

.pill.free {
  background: rgba(49, 209, 125, 0.16);
  color: #b9ffd8;
}

.pill.link {
  background: rgba(255, 122, 120, 0.16);
  color: #ffc0c0;
}

textarea {
  min-height: 560px;
  padding: 18px;
  resize: vertical;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.45;
}

/* ── Visual Config ── */
.vc-section {
  border: 1px solid rgba(255, 214, 122, 0.12);
  border-radius: 20px;
  background: rgba(22, 5, 35, 0.46);
  margin-bottom: 14px;
  overflow: hidden;
}
.vc-section summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; cursor: pointer; list-style: none;
  font-weight: 800; color: var(--text); font-size: 15px;
}
.vc-section summary::-webkit-details-marker { display: none; }
.vc-section[open] summary { border-bottom: 1px solid rgba(255, 214, 122, 0.10); }
.vc-section .vc-tag { color: var(--muted); font-size: 12px; font-weight: 400; }
.vc-body { padding: 14px 18px 18px; display: grid; gap: 14px; }
.vc-row {
  display: grid; grid-template-columns: 200px 1fr 70px; gap: 12px; align-items: center;
}
.vc-row.wide { grid-template-columns: 200px 1fr; }
.vc-label { font-size: 13px; color: var(--muted); line-height: 1.3; }
.vc-label strong { color: var(--text); display: block; font-size: 14px; margin-bottom: 2px; }
.vc-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 3px; background: rgba(255,255,255,0.10); outline: none;
}
.vc-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: linear-gradient(180deg, #ffc64b, #ff7a1b);
  cursor: pointer; border: 2px solid rgba(255,255,255,0.3);
}
.vc-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(180deg, #ffc64b, #ff7a1b);
  cursor: pointer; border: 2px solid rgba(255,255,255,0.3);
}
.vc-num {
  width: 70px; min-height: 36px; padding: 0 8px; text-align: center;
  border: 1px solid rgba(255,214,122,0.16); border-radius: 10px;
  background: rgba(14,4,21,0.78); color: var(--text); font-size: 14px;
}
.vc-wmap { display: flex; flex-wrap: wrap; gap: 8px; }
.vc-wmap-item {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 10px;
  background: rgba(98,20,151,0.4); font-size: 13px;
}
.vc-wmap-item span { color: var(--muted); }
.vc-wmap-item input {
  width: 50px; min-height: 30px; padding: 0 6px; text-align: center;
  border: 1px solid rgba(255,214,122,0.12); border-radius: 8px;
  background: rgba(14,4,21,0.78); color: var(--text); font-size: 13px;
}
.vc-impact {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.vc-impact.high { background: #ff7a78; }
.vc-impact.mid { background: #ffb22c; }
.vc-impact.low { background: #31d17d; }

.notes-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  max-width: min(92vw, 420px);
  padding: 14px 18px;
  border: 1px solid rgba(255, 214, 122, 0.22);
  border-radius: 16px;
  background: rgba(21, 5, 31, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(255, 122, 120, 0.38);
  color: #ffd7d7;
}

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

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

@media (max-width: 720px) {
  .admin-shell {
    padding: 18px 14px 34px;
  }

  .hero,
  .toolbar,
  .auth-form {
    display: block;
  }

  .hero-actions,
  .toolbar-actions {
    margin-top: 14px;
    flex-wrap: wrap;
  }

  .auth-form {
    margin-top: 16px;
  }

  .auth-form label,
  .auth-form button {
    margin-top: 12px;
  }

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

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

  .hero h1 {
    font-size: 32px;
  }
}
