:root {
  color-scheme: light;
  --primary: #006a60;
  --on-primary: #ffffff;
  --surface: #fbfdf9;
  --surface-container: #eef3ef;
  --on-surface: #191c1b;
  --muted: #3f4946;
  --outline: #bec9c5;
  --ok: #0b6b3a;
  --warn: #8a5200;
  --error: #ba1a1a;
  --tonal: #cce8e1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: Arial, Helvetica, sans-serif;
}

button, input, a { font: inherit; }

button, .button-link {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  border: 0;
  border-radius: 16px;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

button.secondary, .button-link.secondary {
  background: var(--tonal);
  color: #05201c;
}

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

.md-surface {
  background: var(--surface-container);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--outline);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #9ff2e4;
  color: #00201c;
  font-weight: 800;
}

h1, h2, h3 { margin: 0; }

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.panel, .server-panel, .stat {
  border: 1px solid var(--outline);
  border-radius: 18px;
  padding: 16px;
}

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

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

.stats, .server-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat span, .server-info span, .info span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
}

.server-info div {
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
}

.server-info strong, .info strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.box-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--outline);
  border-left: 3px solid var(--outline);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
}

.box-card.is-online { border-left-color: var(--ok); }
.box-card.is-new { border-color: var(--warn); }

.box-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.box-head > div {
  min-width: 0;
}

.box-head h3 {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 18px;
}

.status {
  align-self: flex-start;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 14px;
}

.status.online {
  background: #c4f7d6;
  color: #003916;
}

.status.offline {
  background: #e4e7e4;
  color: var(--muted);
}

.rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 6px;
}

input {
  min-height: 34px;
  border: 1px solid var(--outline);
  border-radius: 4px;
  background: var(--surface);
  padding: 0 12px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-card {
  display: grid;
  gap: 12px;
  width: min(100%, 360px);
  border: 1px solid var(--outline);
  border-radius: 18px;
  padding: 22px;
}

.login-card .app-icon {
  width: 44px;
  height: 44px;
}

.login-card p {
  margin: -4px 0 4px;
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.settings-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-form input {
  width: 100%;
  color: var(--on-surface);
  font-size: 13px;
  font-weight: 400;
}

.settings-form input[readonly] {
  background: #e4e7e4;
  color: var(--muted);
}

.login-card input {
  width: 100%;
  color: var(--on-surface);
  font-size: 14px;
  font-weight: 400;
}

.login-error {
  border: 1px solid #ffb4ab;
  border-radius: 8px;
  background: #ffdad6;
  color: #410002;
  padding: 9px 10px;
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--outline);
  padding-top: 4px;
}

.info div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  border-bottom: 1px solid rgba(190, 201, 197, 0.55);
  padding: 3px 0;
}

.info div:last-child {
  border-bottom: 0;
}

.info span {
  white-space: nowrap;
}

.info strong {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  border: 1px dashed var(--outline);
  border-radius: 12px;
  color: var(--muted);
  padding: 18px;
}

pre {
  min-height: 110px;
  margin: 0;
  overflow: auto;
  border-radius: 12px;
  background: #101f1b;
  color: #d8fff3;
  padding: 14px;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 16px; }
  .layout { padding: 14px; }
  .stats, .server-info, .rename-form, .settings-form { grid-template-columns: 1fr; }
  .top-actions { width: 100%; }
  .top-actions button, .top-actions .button-link { flex: 1; }
}
