:root {
  color-scheme: light;
  --ink: #141714;
  --muted: #626860;
  --paper: #f4f6f1;
  --surface: #ffffff;
  --line: #d8ddd5;
  --green: #29724d;
  --green-soft: #e2f0e8;
  --amber: #b66b17;
  --red: #af3f35;
  --yellow: #e6be58;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 4vw;
  background: rgba(20, 23, 20, 0.96);
  color: #fff;
  border-bottom: 1px solid #30362f;
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 4px;
  font-weight: 850;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd1ca;
  font-size: 0.82rem;
}

.account-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 110px;
  color: #cbd1ca;
  font-size: 0.76rem;
}

.account-menu form { margin: 0; }
.topbar-icon, .dialog-close, .message button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.topbar-icon:hover { background: #303630; }
.topbar-icon img { width: 17px; height: 17px; filter: invert(85%); }

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 4px;
  background: #272c27;
  border: 1px solid #373e37;
  border-radius: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  background: transparent;
  color: #bfc6be;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.tab-button img {
  width: 15px;
  height: 15px;
  filter: invert(82%);
}

.tab-button:hover { color: #fff; }
.tab-button.active { background: #fff; color: var(--ink); }
.tab-button.active img { filter: none; }
.tab-button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.live-dot, .status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #8a9188;
}

.topbar-status.online .live-dot,
.server-card.online .status-dot { background: #4dcc7d; }

.topbar-status.degraded .live-dot { background: var(--yellow); }
.server-card.starting .status-dot { background: var(--yellow); }
.server-card.offline .status-dot { background: var(--red); }

main {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

.tab-panel[hidden] { display: none; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.72fr);
  gap: 7vw;
  align-items: end;
  min-height: 340px;
  padding: 72px 0 58px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

h1, h2, h3, p { letter-spacing: 0; }

h1 {
  margin: 0;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  line-height: 0.94;
  font-weight: 850;
}

.intro-copy {
  max-width: 590px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.host-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--ink);
}

.host-facts div { padding: 18px 12px 4px 0; }
.host-facts dt, .server-stats dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.host-facts dd {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 750;
}

.servers, .map-section { padding: 64px 0; }
.map-section { border-top: 1px solid var(--line); }

.map-section.tab-panel { min-height: calc(100vh - 64px); border-top: 0; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.08;
}

.updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.server-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.server-detail-actions { display: flex; align-items: center; gap: 10px; }
.refresh-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.refresh-button:hover { border-color: var(--green); color: var(--green); }
.refresh-button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.refresh-button:disabled { cursor: wait; opacity: 0.55; }
.refresh-button img { width: 19px; height: 19px; }
.refresh-button.refreshing img { animation: refresh-spin 700ms linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }

.server-card {
  display: grid;
  grid-template-columns: 1.1fr auto 1.25fr;
  gap: 32px;
  align-items: center;
  padding: 28px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(24, 31, 24, 0.045);
}

.server-card > * { min-width: 0; }

.server-card.accent-amber { border-left-color: var(--amber); }
.server-card.accent-blue { border-left-color: #3978a8; }
.server-card.accent-red { border-left-color: var(--red); }
.app-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.device-facts dd { overflow-wrap: anywhere; }

.server-identity {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.server-number {
  padding-top: 4px;
  color: var(--muted);
  font: 700 0.72rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.server-identity h3 {
  margin: 0;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.server-identity p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.server-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 78px;
  font-size: 0.82rem;
}

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

.server-stats div { min-width: 0; }
.server-stats dd {
  overflow: hidden;
  margin: 6px 0 0;
  font-size: 0.86rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-list { display: grid; gap: 8px; }

.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 12px 12px 12px 15px;
  background: #eef1eb;
  border-radius: 4px;
}

.address-row > div { min-width: 0; }
.address-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.66rem;
}

code {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button, .icon-link {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.copy-button:hover, .icon-link:hover { border-color: var(--green); }
.copy-button:focus-visible, .icon-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.copy-button img, .icon-link img { width: 17px; height: 17px; }

.server-card > .address-row,
.server-card > .address-list { grid-column: 1 / -1; }

.map-heading { margin-bottom: 20px; }
.map-frame {
  height: min(72vh, 720px);
  min-height: 460px;
  overflow: hidden;
  background: #242924;
  border: 1px solid #242924;
  border-radius: 6px;
}

.map-frame iframe { width: 100%; height: 100%; border: 0; }

.system-panel { min-height: calc(100vh - 64px); padding: 66px 0 80px; }
.apps-panel { min-height: calc(100vh - 64px); padding: 66px 0 80px; }
.studio-panel { min-height: calc(100vh - 64px); padding: 66px 0 80px; }
.accounts-panel { min-height: calc(100vh - 64px); padding: 66px 0 80px; }
.panel-title { padding-bottom: 52px; border-bottom: 1px solid var(--line); }
.panel-title h1 { font-size: clamp(2.8rem, 7vw, 5.4rem); }
.system-section { padding: 56px 0; border-bottom: 1px solid var(--line); }

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

.metric {
  min-height: 138px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metric dt, .container-card dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.metric dd {
  margin: 14px 0 5px;
  font-size: 1.55rem;
  font-weight: 800;
}

.metric span {
  color: var(--muted);
  font-size: 0.72rem;
}

.container-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.container-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.container-heading,
.container-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.container-heading h3 { margin: 0; font-size: 1.05rem; }
.container-heading strong { color: var(--muted); font-size: 0.75rem; }
.container-card.online .status-dot { background: #4dcc7d; }
.container-card.offline .status-dot { background: var(--red); }
.container-card dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.container-card dl div { min-width: 0; }
.container-card dd {
  overflow: hidden;
  margin: 7px 0 0;
  font-size: 0.86rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 50px;
  border-bottom: 0;
}

.compact-heading { margin-bottom: 18px; }
.compact-heading h2 { font-size: 1.55rem; }
.detail-list { border-top: 1px solid var(--ink); }
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.detail-row > div { display: grid; gap: 5px; }
.detail-row span { color: var(--muted); }
.detail-row .service-state { color: var(--green); font-weight: 750; text-transform: capitalize; }
.detail-row .service-state.failed { color: var(--red); }
.private-service-state { display: flex !important; grid-auto-flow: column; align-items: center; gap: 9px !important; }
.private-service-state .status-label { font-size: 0.78rem; }
.private-service-state .latency { min-width: 54px; text-align: right; font-size: 0.72rem; }
.private-service-row.online .status-dot { background: #4dcc7d; }
.private-service-row.offline .status-dot { background: var(--red); }

.empty-state {
  display: grid;
  gap: 6px;
  min-height: 120px;
  place-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #b8bfb5;
  border-radius: 6px;
}
.empty-state strong { color: var(--ink); }
.empty-state span { font-size: 0.78rem; }

.accounts-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.primary-button, .secondary-button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
}

.primary-button { background: var(--ink); color: #fff; }
.secondary-button { background: var(--surface); color: var(--ink); border-color: var(--line); }
.danger-button { background: #fff; color: var(--red); border-color: #d9aaa5; }
.primary-button:hover { background: #2c322c; }
.danger-button:hover { background: #f8e9e7; border-color: var(--red); }
.primary-button img { width: 16px; height: 16px; filter: invert(1); }
.primary-button:focus-visible, .secondary-button:focus-visible, .danger-button:focus-visible, .topbar-icon:focus-visible, .dialog-close:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.account-list { margin-top: 38px; border-top: 1px solid var(--ink); }
.account-row {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1fr) minmax(130px, 0.55fr) 90px 38px;
  gap: 18px;
  align-items: center;
  min-height: 82px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.account-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  background: var(--green-soft);
  color: var(--green);
  border-radius: 4px;
  font-weight: 850;
}

.account-identity { display: grid; gap: 4px; min-width: 0; }
.account-identity strong, .account-identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity span { color: var(--muted); font-size: 0.74rem; }
.role-badge { color: var(--muted); font-size: 0.78rem; }
.account-state { color: var(--green); font-size: 0.75rem; font-weight: 750; }
.account-state.disabled { color: var(--red); }

.account-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.account-dialog::backdrop { background: rgba(15, 18, 15, 0.68); backdrop-filter: blur(3px); }
.account-dialog form { padding: 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.dialog-heading h2 { font-size: 1.65rem; }
.dialog-close { background: var(--surface); border: 1px solid var(--line); }
.dialog-close img, .message button img { width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid > label:not(.toggle-row) { display: grid; gap: 7px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.full-field { grid-column: 1 / -1; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid #c9cec6;
  border-radius: 4px;
  font: inherit;
  font-size: 0.86rem;
}

textarea { min-height: 86px; padding: 11px 12px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(230, 190, 88, 0.55); border-color: var(--ink); }
.permission-fieldset { margin: 2px 0 0; padding: 0; border: 0; border-top: 1px solid var(--ink); }
.permission-fieldset legend { padding: 0 10px 0 0; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.service-assignment-fieldset { display: grid; gap: 18px; }
.service-assignment-help { margin: 2px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.service-access-group { display: grid; gap: 8px; }
.service-access-group > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.service-access-group > header strong { font-size: 0.78rem; }
.service-access-group > header span { color: var(--green); font-size: 0.66rem; font-weight: 750; }
.service-access-group.permission-off > header span { color: var(--muted); }
.service-access-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.service-access-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.service-access-row:nth-child(odd) { border-right: 1px solid var(--line); }
.service-access-row > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.service-access-row > span { display: grid; gap: 3px; min-width: 0; }
.service-access-row strong, .service-access-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-access-row strong { font-size: 0.76rem; }
.service-access-row small { color: var(--muted); font-size: 0.65rem; }
.service-access-row i { display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid var(--line-strong); border-radius: 4px; }
.service-access-row input:checked + span + i { background: var(--green); border-color: var(--green); }
.service-access-row input:checked + span + i::after { content: ""; width: 8px; height: 4px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translateY(-1px); }
.service-access-row:has(input:focus-visible) { outline: 3px solid var(--yellow); outline-offset: -3px; }
.service-access-group.permission-off .service-access-row { background: var(--surface-muted); }
.service-assignment-empty { margin: 0; color: var(--muted); font-size: 0.72rem; }
.toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.toggle-row > span { display: grid; gap: 4px; }
.toggle-row strong { font-size: 0.82rem; }
.toggle-row small { color: var(--muted); font-size: 0.7rem; }
.toggle-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-row i {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  background: #aeb5ac;
  border-radius: 11px;
  transition: background 140ms ease;
}

.toggle-row i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  content: "";
  transition: transform 140ms ease;
}

.toggle-row input:checked + i { background: var(--green); }
.toggle-row input:checked + i::after { transform: translateX(16px); }
.toggle-row input:focus-visible + i { outline: 3px solid var(--yellow); outline-offset: 2px; }
.active-toggle { margin-top: 2px; padding: 0 4px; border-top: 1px solid var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }
.account-edit-actions { display: grid; grid-template-columns: auto minmax(16px, 1fr) auto auto; align-items: center; }
.account-edit-actions [data-delete-account][hidden] { display: none; }

.studio-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.studio-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 40px;
  padding: 42px 0 58px;
  border-bottom: 1px solid var(--line);
}

.service-rail {
  display: grid;
  align-content: start;
  gap: 6px;
}

.service-choice {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.service-choice:hover { background: #e9ede6; }
.service-choice.active { background: var(--surface); border-color: var(--line); }
.service-choice > span:last-child { display: grid; gap: 4px; min-width: 0; }
.service-choice strong, .service-choice small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-choice strong { font-size: 0.82rem; }
.service-choice small { color: var(--muted); font-size: 0.68rem; }
.service-choice.online .status-dot { background: #4dcc7d; }
.service-choice.starting .status-dot { background: var(--yellow); }
.service-choice.offline .status-dot { background: var(--red); }

.studio-workspace { min-width: 0; }
.service-workspace[hidden] { display: none; }
.workspace-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  min-height: 94px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}
.workspace-heading h2 { font-size: 2rem; }
.workspace-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 0.78rem; }
.workspace-state { display: flex; align-items: center; gap: 8px; padding-top: 5px; font-size: 0.78rem; }
.workspace-state.online .status-dot { background: #4dcc7d; }
.workspace-state.starting .status-dot { background: var(--yellow); }
.workspace-state.offline .status-dot { background: var(--red); }

.server-link-card { cursor: pointer; transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease; }
.server-link-card:hover { border-color: #aeb7aa; box-shadow: 0 14px 34px rgba(20, 23, 20, 0.08); transform: translateY(-1px); }
.server-link-card:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.server-open-label {
  display: inline-block;
  margin-top: 11px;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.server-detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.server-tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0 0;
  padding: 4px;
  background: #e7ebe4;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.server-tabs::-webkit-scrollbar { display: none; }
.server-tabs button {
  flex: 0 0 auto;
  min-width: 94px;
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
}
.server-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 23, 20, 0.1); }
.server-tabs button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.server-view { min-width: 0; }

.server-connections {
  display: grid;
  grid-template-columns: minmax(170px, 0.45fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.server-connections h3, .server-map-heading h3 { margin: 3px 0 0; font-size: 1.1rem; }
.server-connections .address-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.server-connections .address-row { min-width: 0; }

.server-map-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 30px 0 18px; }
.server-map-frame { height: min(72vh, 760px); min-height: 520px; }

.critical-notice {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding: 14px 16px;
  background: #f7eee0;
  border-left: 4px solid var(--amber);
  font-size: 0.76rem;
}
.critical-notice span { color: var(--muted); }

.readonly-notice {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding: 14px 16px;
  background: #e5eee8;
  border-left: 4px solid var(--green);
  font-size: 0.76rem;
}
.readonly-notice span { color: var(--muted); }

.apps-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}
.app-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.app-actions a { text-decoration: none; }
.app-actions button { font: inherit; }
.app-card > .address-list { grid-column: 1 / -1; }

.integration-dialog { width: min(720px, calc(100vw - 32px)); }
.server-add-kind { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.server-add-panel.form-grid { display: grid; }
.server-add-panel[hidden] { display: none; }
.import-server-panel { display: grid; gap: 18px; }
.import-server-panel > label { display: grid; gap: 7px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.import-picker-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.import-picker-heading label { display: grid; gap: 7px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.import-candidate-detail { display: grid; gap: 5px; padding: 13px 14px; background: var(--surface-soft); border-left: 3px solid var(--green); }
.import-candidate-detail strong { font-size: 0.78rem; }
.import-candidate-detail span { overflow-wrap: anywhere; color: var(--muted); font-size: 0.7rem; }
.integration-kind {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: #e7ebe4;
  border-radius: 6px;
}
.integration-kind button {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
}
.integration-kind button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 23, 20, 0.1); }
.integration-kind button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.integration-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.integration-fields > label { display: grid; gap: 7px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.integration-fields > label small { color: var(--muted); font-size: 0.62rem; font-weight: 600; }
.integration-container-note { display: block; padding: 12px 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 0.7rem; }
.integration-container-note p { margin: 0; }
.integration-container-fields { padding-top: 18px; border-top: 1px solid var(--line); }
.integration-safety { margin: 22px 0 0; padding: 12px 14px; color: var(--muted); background: #e9ede6; border-left: 3px solid var(--green); font-size: 0.74rem; }
.integration-actions { display: grid; grid-template-columns: auto 1fr auto auto; }

.tool-section { padding: 30px 0; border-bottom: 1px solid var(--line); }
.tool-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.tool-heading h3 { margin: 0; font-size: 1.1rem; }
.tool-heading > span { color: var(--muted); font-size: 0.7rem; }
.safe-backup-label { display: block; margin-top: 5px; color: var(--muted); font-size: 0.72rem; font-weight: 500; }
.action-strip { display: flex; flex-wrap: wrap; gap: 9px; }

.performance-heading { align-items: center; }
.range-control {
  display: inline-flex;
  padding: 3px;
  background: #e6eae3;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.range-control button {
  min-width: 42px;
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 750;
}
.range-control button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 23, 20, 0.1); }
.range-control button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.performance-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 0 18px;
  padding: 14px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.performance-summary div { min-width: 0; padding-right: 12px; }
.performance-summary dt { color: var(--muted); font-size: 0.66rem; }
.performance-summary dd { overflow: hidden; margin: 7px 0 0; font-size: 0.9rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chart-grid figure {
  min-width: 0;
  margin: 0;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.chart-grid figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.chart-grid figcaption strong { font-size: 0.78rem; }
.chart-grid figcaption span { color: var(--muted); font-size: 0.64rem; }
.chart-grid canvas { display: block; width: 100%; aspect-ratio: 2.25 / 1; }
.chart-status { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 0.7rem; }

.command-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.player-form { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: 9px; }
.tool-result { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 0.74rem; }
.command-output, .log-viewer {
  overflow: auto;
  margin: 10px 0 0;
  padding: 14px;
  background: #171b17;
  color: #d9dfd7;
  border: 1px solid #2e352e;
  border-radius: 4px;
  font: 0.74rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.command-output { min-height: 58px; max-height: 180px; }
.log-viewer { height: 300px; white-space: pre; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.settings-grid label, .confirm-field { display: grid; gap: 7px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.settings-grid .wide-field { grid-column: 1 / -1; }
.settings-group-title { grid-column: 1 / -1; margin: 10px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.78rem; }
.settings-group-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.service-config-form { display: grid; gap: 18px; }
.config-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.config-toggles .toggle-row { padding: 16px 0; }
.config-toggles .toggle-row + .toggle-row { padding-left: 18px; border-left: 1px solid var(--line); }
.manage-view { padding-top: 28px; }
.manage-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--ink); }
.manage-intro h3 { margin: 3px 0 7px; font-size: 1.35rem; }
.manage-intro p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.55; }
.service-id-badge { display: grid; justify-items: end; gap: 5px; flex: 0 0 auto; }
.service-id-badge span { color: var(--muted); font-size: 0.62rem; font-weight: 800; text-transform: uppercase; }
.service-id-badge code { padding: 6px 9px; background: #e7ebe4; border: 1px solid var(--line); border-radius: 3px; font-size: 0.72rem; }
.manage-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.7fr); gap: 18px; align-items: start; padding-top: 20px; }
.manage-main { display: grid; gap: 18px; min-width: 0; }
.manage-panel { min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.manage-panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.manage-panel-heading h4, .delete-panel h4, .protected-panel h4 { margin: 3px 0 0; font-size: 1rem; }
.manage-panel-heading > span { color: var(--muted); font-size: 0.66rem; }
.website-preview { display: grid; grid-template-columns: auto minmax(0, 1fr) 10px; gap: 14px; align-items: center; min-height: 82px; margin: 18px 0; padding: 14px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.preview-number { color: var(--green); font-size: 0.58rem; font-weight: 850; }
.website-preview > div { display: grid; gap: 5px; min-width: 0; }
.website-preview strong, .website-preview > div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.website-preview strong { font-size: 1rem; }
.website-preview > div span { color: var(--muted); font-size: 0.7rem; }
.website-preview .status-dot { background: #4dcc7d; }
.manage-fields { display: grid; gap: 15px; }
.manage-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 0.7rem; font-weight: 750; }
.manage-fields small { color: var(--muted); font-size: 0.64rem; font-weight: 500; }
.manage-options-heading { margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--ink); }
.manage-save-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.manage-save-row > span { max-width: 360px; color: var(--muted); font-size: 0.67rem; line-height: 1.45; }
.network-form { gap: 20px; }
.network-port-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.network-port-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 0.7rem; font-weight: 750; }
.network-port-grid label > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.network-port-grid b { padding: 3px 6px; color: var(--green); background: #e5eee8; border-radius: 3px; font-size: 0.56rem; }
.network-port-grid small { color: var(--muted); font-size: 0.64rem; font-weight: 500; }
.network-path { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); gap: 8px; align-items: center; padding: 14px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.network-path div { display: grid; gap: 4px; min-width: 0; }
.network-path div span { color: var(--muted); font-size: 0.6rem; font-weight: 750; text-transform: uppercase; }
.network-path div strong { overflow: hidden; font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }
.network-path i { color: var(--green); font-style: normal; font-weight: 900; text-align: center; }
.router-notice { display: grid; gap: 5px; padding: 12px 14px; background: #f7eee0; border-left: 3px solid var(--amber); }
.router-notice strong { font-size: 0.72rem; }
.router-notice span, .network-readonly { color: var(--muted); font-size: 0.67rem; line-height: 1.5; }
.network-readonly { margin: 0; }
.manage-sidebar { display: grid; gap: 18px; }
.technical-panel dl { display: grid; gap: 0; margin: 16px 0 12px; }
.technical-panel dl div { display: grid; gap: 4px; padding: 11px 0; border-top: 1px solid var(--line); }
.technical-panel dt { color: var(--muted); font-size: 0.62rem; font-weight: 750; text-transform: uppercase; }
.technical-panel dd { min-width: 0; margin: 0; }
.technical-panel code { display: block; overflow: hidden; color: var(--ink); font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
.technical-panel > p, .delete-panel p:last-child, .protected-panel p:last-child { margin: 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.delete-panel { display: grid; gap: 18px; border-color: #d9aaa5; border-top: 4px solid var(--red); }
.delete-panel .eyebrow { color: var(--red); }
.delete-panel .danger-button { width: 100%; }
.protected-panel { border-top: 4px solid var(--green); }
.checkbox-field { display: flex !important; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--green); }

.content-manager { padding-top: 28px; }
.content-heading { margin-bottom: 18px; }
.content-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 18px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.content-upload label, .content-toolbar label { display: grid; gap: 7px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.content-upload input[type="file"] { min-height: 44px; padding: 8px; background: #fff; }
.content-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 18px 0 12px; }
.content-toolbar label { width: min(420px, 100%); }
.content-toolbar > span { min-width: 82px; color: var(--muted); font-size: 0.7rem; text-align: right; }
.content-list { border-top: 1px solid var(--ink); }
.content-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px auto;
  gap: 16px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
}
.content-identity { display: grid; min-width: 0; gap: 5px; }
.content-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-identity span { color: var(--muted); font-size: 0.68rem; }
.content-state { font-size: 0.68rem; font-weight: 800; }
.content-state.enabled { color: var(--green); }
.content-state.disabled { color: var(--muted); }
.content-actions { display: flex; gap: 6px; }
.content-actions button { min-width: 76px; min-height: 36px; padding: 0 10px; font-size: 0.7rem; }
.content-note { margin: 14px 0 0; color: var(--muted); font-size: 0.7rem; }

.world-manager { padding-top: 28px; }
.world-slots { padding-bottom: 32px; }
.world-slot-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.world-slot { display: grid; gap: 14px; min-width: 0; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.world-slot.active { border-left: 4px solid var(--green); }
.world-slot-identity { display: grid; min-width: 0; gap: 7px; }
.world-slot-identity > span { color: var(--green); font-size: 0.64rem; font-weight: 800; text-transform: uppercase; }
.world-slot-identity > input { width: 100%; font-weight: 750; }
.world-slot-identity > small { min-height: 32px; color: var(--muted); font-size: 0.66rem; line-height: 1.45; }
.world-heading { margin-bottom: 18px; }
.world-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding: 14px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.world-active > div:first-child, .world-rollback-identity { display: grid; min-width: 0; gap: 6px; }
.world-active span, .world-rollback-identity span { color: var(--muted); font-size: 0.7rem; }
.world-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.world-actions .secondary-button, .world-actions .danger-button { min-height: 36px; padding: 0 11px; font-size: 0.7rem; text-decoration: none; }
.world-actions .disabled, .world-actions .busy { pointer-events: none; opacity: 0.5; }
.world-settings, .world-replace, .world-rollbacks { padding-top: 32px; }
.world-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.world-settings-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.world-settings-grid .wide-field { grid-column: 1 / -1; }
.world-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding-top: 4px;
}
.world-upload label { display: grid; gap: 7px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.world-upload input[type="file"] { min-height: 44px; padding: 8px; background: #fff; }
.world-rollback-list { border-top: 1px solid var(--ink); }
.world-rollback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
}

.backup-list { border-top: 1px solid var(--ink); }
.managed-backup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
}
.managed-backup strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.managed-backup span { color: var(--muted); }
.backup-identity { display: grid; min-width: 0; gap: 7px; }
.backup-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.backup-badge { width: fit-content; padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted) !important; font-size: 0.6rem; font-weight: 800; line-height: 1; text-transform: uppercase; }
.backup-badge.verified { border-color: #9ac6aa; color: var(--green) !important; }
.backup-badge.unverified { border-color: #ddb0aa; color: var(--red) !important; }
.backup-actions { display: flex; gap: 6px; }
.backup-actions .secondary-button, .backup-actions .danger-button { min-height: 34px; padding: 0 10px; font-size: 0.7rem; text-decoration: none; }
.backup-actions .disabled, .backup-actions [disabled] { cursor: not-allowed; opacity: 0.45; pointer-events: none; }
.backup-actions .busy { min-width: 82px; pointer-events: none; }
.retention-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 16px; color: var(--muted); font-size: 0.72rem; }
.retention-row select { width: 76px; }

.audit-section { padding: 54px 0 0; }
.history-heading { align-items: flex-end; }
.history-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.history-tabs button {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.history-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20, 23, 20, 0.08); }
.audit-list { border-top: 1px solid var(--ink); }
.audit-row {
  display: grid;
  grid-template-columns: 130px 110px minmax(0, 1fr) 76px;
  gap: 18px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
}
.audit-row time, .audit-row span { color: var(--muted); }
.audit-row b { color: var(--green); text-align: right; }
.audit-row b.failed { color: var(--red); }
.command-history-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 16px;
}
.command-history-toolbar label { display: grid; gap: 6px; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.command-history-list { border-top: 1px solid var(--ink); }
.command-history-row {
  display: grid;
  grid-template-columns: 150px 120px 100px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
}
.command-history-row time, .command-history-row span { color: var(--muted); }
.command-history-row code { min-width: 0; overflow-wrap: anywhere; white-space: normal; font-size: 0.73rem; }
.history-footer { display: flex; align-items: center; justify-content: space-between; min-height: 64px; color: var(--muted); font-size: 0.72rem; }
.csrf-source { display: none; }
.confirm-copy { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.confirm-field { margin-top: 20px; }
.form-status { min-height: 20px; margin: 18px 0 0; color: var(--muted); font-size: 0.76rem; }
.form-status.error { color: var(--red); }

.message-stack { position: fixed; top: 76px; right: 20px; z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100vw - 40px)); }
.message { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 13px 13px 16px; background: var(--ink); color: #fff; border-left: 4px solid var(--green); border-radius: 4px; box-shadow: 0 12px 32px rgba(0,0,0,.18); font-size: 0.8rem; opacity: 1; transform: translateY(0); transition: opacity 220ms ease, transform 220ms ease; }
.message.dismissing { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.message.error { border-left-color: var(--red); }
.message button img { filter: invert(1); }

@media (prefers-reduced-motion: reduce) {
  .message { transition-duration: 1ms; }
}

.login-page { background: var(--ink); }
.login-shell { display: grid; width: 100%; min-height: 100vh; place-items: center; padding: 24px; }
.login-panel { width: min(440px, 100%); padding: 34px; background: var(--paper); border-radius: 6px; }
.login-brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 68px; color: var(--ink); text-decoration: none; font-weight: 800; }
.login-panel h1 { font-size: clamp(2.8rem, 10vw, 4.4rem); }
.login-form { display: grid; gap: 10px; margin-top: 38px; }
.login-form label { margin-top: 6px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.login-form .primary-button { margin-top: 14px; }
.form-alert { margin: 20px 0 -16px; padding: 11px 13px; background: #f7e6e3; color: #7f2b25; border-left: 3px solid var(--red); font-size: 0.78rem; }

footer {
  display: flex;
  justify-content: space-between;
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: 28px 0 38px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  font-size: 0.82rem;
}

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

@media (min-width: 980px) {
  .server-card {
    grid-template-columns: 1.05fr 100px 1.25fr minmax(230px, 0.8fr);
  }
  .server-card > .address-row,
  .server-card > .address-list { grid-column: auto; }
}

@media (max-width: 760px) {
  .config-toggles, .world-slot-list { grid-template-columns: 1fr; }
  .config-toggles .toggle-row + .toggle-row { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .manage-layout { grid-template-columns: 1fr; }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 16px;
    min-height: 112px;
    padding: 10px 20px;
  }
  .tabs { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .tab-button { flex: 0 0 auto; padding: 0 10px; }
  .topbar-status { font-size: 0.75rem; }
  .intro { grid-template-columns: 1fr; gap: 44px; min-height: auto; padding: 54px 0 42px; }
  .host-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .server-card { grid-template-columns: 1fr auto; gap: 24px 16px; padding: 22px 18px; }
  .server-stats { grid-column: 1 / -1; }
  .server-card > .address-row,
  .server-card > .address-list { grid-column: 1 / -1; }
  .map-frame { min-height: 420px; height: 62vh; }
  .map-section.tab-panel, .apps-panel, .system-panel, .studio-panel, .accounts-panel { min-height: calc(100vh - 112px); }
  .system-panel { padding-top: 48px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .container-grid, .system-split { grid-template-columns: 1fr; }
  .container-card dl { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 20px; }
  .account-row { grid-template-columns: 44px minmax(0, 1fr) 38px; gap: 12px; }
  .role-badge, .account-state { grid-column: 2; }
  .account-row > .copy-button { grid-column: 3; grid-row: 1 / 4; }
  .studio-layout { grid-template-columns: 1fr; gap: 24px; }
  .service-rail { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .service-choice { flex: 0 0 190px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .audit-row { grid-template-columns: 100px minmax(0, 1fr) 70px; }
  .audit-row strong { display: none; }
  .command-history-row { grid-template-columns: 120px 100px minmax(0, 1fr); }
  .command-history-row span { display: none; }
  .server-map-frame { min-height: 440px; height: 65vh; }
}

@media (max-width: 470px) {
  main, footer { width: min(100% - 32px, 1180px); }
  .topbar-status span:last-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .host-facts { grid-template-columns: 1fr; }
  .host-facts div { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .host-facts dd { margin: 0; }
  .section-heading { align-items: flex-start; }
  .server-heading-actions { align-items: flex-end; flex-direction: column; gap: 9px; }
  .updated { text-align: right; }
  .server-card { grid-template-columns: minmax(0, 1fr); }
  .server-state,
  .server-stats,
  .server-card > .address-row,
  .server-card > .address-list { grid-column: 1; }
  .server-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .address-row { max-width: 100%; }
  code { font-size: 0.76rem; }
  .map-frame { min-height: 360px; }
  .tab-button span { font-size: 0.7rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 116px; }
  .container-card dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-menu > span { display: none; }
  .account-menu { min-width: 34px; }
  .accounts-title { align-items: flex-start; }
  .command-button { width: 42px; padding: 0; }
  .command-button span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .service-access-list { grid-template-columns: 1fr; }
  .service-access-row:nth-child(odd) { border-right: 0; }
  .full-field { grid-column: 1; }
  .account-dialog form { padding: 22px 18px; }
  .studio-title { align-items: flex-start; }
  .server-detail-nav { align-items: stretch; }
  .workspace-heading { align-items: flex-start; }
  .server-tabs { width: 100%; }
  .server-tabs button { flex: 1 0 88px; min-width: 88px; }
  .server-connections { grid-template-columns: 1fr; gap: 16px; }
  .server-connections .address-list { grid-template-columns: 1fr; }
  .server-map-frame { min-height: 360px; height: 58vh; }
  .critical-notice, .readonly-notice { grid-template-columns: 1fr; gap: 5px; }
  .apps-title { align-items: flex-start; }
  .integration-kind { grid-template-columns: 1fr; }
  .integration-fields { grid-template-columns: 1fr; }
  .integration-actions { grid-template-columns: 1fr 1fr; }
  .integration-actions span { display: none; }
  .integration-actions .danger-button { grid-column: 1 / -1; }
  .app-actions { justify-content: flex-start; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .wide-field { grid-column: 1; }
  .manage-intro, .manage-save-row { align-items: stretch; flex-direction: column; }
  .service-id-badge { justify-items: start; }
  .manage-save-row .primary-button { width: 100%; }
  .network-port-grid { grid-template-columns: 1fr; }
  .network-path { grid-template-columns: 1fr; }
  .network-path i { transform: rotate(90deg); }
  .command-form { grid-template-columns: 1fr; }
  .command-form button { width: 100%; }
  .player-form { grid-template-columns: 1fr; }
  .content-upload { grid-template-columns: 1fr; }
  .content-upload button { width: 100%; }
  .content-toolbar { align-items: stretch; flex-direction: column; }
  .content-toolbar > span { text-align: left; }
  .content-item { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 0; }
  .content-actions { grid-column: 1 / -1; }
  .world-active, .world-rollback { grid-template-columns: 1fr; padding: 12px 0; }
  .world-settings-grid, .world-upload { grid-template-columns: 1fr; }
  .world-settings-grid .wide-field { grid-column: 1; }
  .world-upload button { width: 100%; }
  .world-actions { width: 100%; }
  .world-actions > * { flex: 1 1 110px; text-align: center; }
  .performance-heading { align-items: flex-start; flex-direction: column; }
  .performance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .managed-backup { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 0; }
  .managed-backup > span { display: none; }
  .backup-actions { grid-column: 1 / -1; }
  .retention-row { justify-content: flex-start; flex-wrap: wrap; }
  .audit-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .audit-row time { display: none; }
  .history-heading { align-items: stretch; }
  .history-tabs { width: 100%; }
  .command-history-toolbar { grid-template-columns: 1fr; }
  .command-history-row { grid-template-columns: 100px minmax(0, 1fr); padding: 9px 0; }
  .command-history-row time { display: none; }
  .login-panel { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
.service-access-item + .service-access-item { border-top: 1px solid var(--line); }
.service-access-item .service-access-row { border-bottom: 0; }
.server-access-options { padding: 0 16px 16px 48px; }
.server-access-options > label { display: grid; gap: 6px; max-width: 300px; }
.server-access-options select { width: 100%; }
.server-tab-permissions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-top: 14px; }
.server-tab-permissions > span { grid-column: 1 / -1; color: var(--muted); font-size: .82rem; font-weight: 700; }
.server-tab-permissions label { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
@media (max-width: 640px) { .server-tab-permissions { grid-template-columns: 1fr; } }
.access-pending-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--page); }
.access-pending { width: min(560px, 100%); border-top: 4px solid var(--green); padding: 40px 0; }
.access-pending h1 { margin: 8px 0 12px; font-size: clamp(2rem, 8vw, 4rem); line-height: .96; }
.access-pending p:not(.eyebrow) { color: var(--muted); font-size: 1.05rem; line-height: 1.6; max-width: 48ch; }
.access-pending form { margin-top: 28px; }
