:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #657267;
  --line: #d8dfd8;
  --paper: #f8faf5;
  --panel: #ffffff;
  --stone: #36433d;
  --grass: #2f7d4e;
  --grass-dark: #1f5d39;
  --water: #2d6f9f;
  --amber: #b56b1f;
  --red: #b43a33;
  --shadow: 0 18px 45px rgba(32, 43, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(47, 125, 78, 0.12), transparent 320px),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

button:hover {
  border-color: #aebbae;
  background: #f5f8f2;
}

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

button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(45, 111, 159, 0.24);
  outline-offset: 2px;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(28px, 6vw, 52px);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 18px;
}

.status-pill {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  box-shadow: 0 8px 22px rgba(32, 43, 36, 0.08);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.status-pill.online .status-dot {
  background: var(--grass);
}

.status-pill.offline .status-dot {
  background: var(--red);
}

.hero-panel,
.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 152px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 20px;
  overflow: hidden;
}

.hero-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.server-block {
  width: 96px;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 3px solid #27332d;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.server-block span:nth-child(1) { background: #3c8f52; }
.server-block span:nth-child(2) { background: #4b9b5e; }
.server-block span:nth-child(3) { background: #7b664e; }
.server-block span:nth-child(4) { background: #5b4937; }

.address {
  font-size: clamp(26px, 7vw, 54px);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.hint,
.field-help,
.metric-note,
.info-list small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hint {
  max-width: 720px;
  margin: 8px 0 0;
}

.field-help {
  font-weight: 600;
}

.metric-note {
  display: block;
  margin-top: 8px;
  font-weight: 700;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary {
  background: var(--grass);
  color: #fff;
  border-color: var(--grass-dark);
}

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

.danger {
  background: #fff;
  color: var(--red);
  border-color: #e4b9b6;
}

.danger:hover {
  background: #fff4f3;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  min-width: 86px;
  background: transparent;
  box-shadow: none;
}

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

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.activity-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric {
  min-height: 118px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric strong {
  font-size: clamp(24px, 4vw, 36px);
  overflow-wrap: anywhere;
}

.metric .label + strong {
  margin-top: auto;
}

.panel {
  padding: 18px;
}

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

.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 14px;
}

.info-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 16px 0 0;
}

.info-list div {
  min-width: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.info-list dd {
  margin: 5px 0 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.info-list small {
  display: block;
  margin-top: 4px;
}

.improvement-panel {
  margin-top: 14px;
}

.activity-events-panel {
  margin-top: 14px;
}

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

.upgrade-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf8;
  min-height: 132px;
  padding: 14px;
}

.upgrade-grid strong {
  display: block;
  font-size: 16px;
}

.upgrade-grid p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 0;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 800;
  background: #edf1ea;
  color: var(--stone);
  margin-right: 4px;
}

.tag.online {
  background: #e1f1e7;
  color: var(--grass-dark);
}

.tag.danger-tag {
  background: #fde7e4;
  color: var(--red);
}

.tag.blue {
  background: #e4eff7;
  color: var(--water);
}

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

.stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

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

.select-row,
.console-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.quick-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

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

.settings-save {
  align-self: end;
}

.log-panel {
  padding-bottom: 0;
}

pre {
  min-height: 440px;
  max-height: 62vh;
  margin: 14px -18px 0;
  overflow: auto;
  background: #111814;
  color: #d9eadf;
  padding: 18px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  background: var(--stone);
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: 160ms ease;
}

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

@media (max-width: 900px) {
  .topbar,
  .hero-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .metric-grid,
  .activity-summary,
  .admin-grid,
  .settings-grid,
  .info-list,
  .upgrade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero-main {
    align-items: flex-start;
  }

  .server-block {
    width: 68px;
  }

  .actions button {
    flex: 1 1 120px;
  }

  .metric-grid,
  .activity-summary,
  .admin-grid,
  .settings-grid,
  .info-list,
  .upgrade-grid,
  .button-grid,
  .select-row,
  .console-form {
    grid-template-columns: 1fr;
  }
}
