:root {
  --bg: #008080;
  --panel: #c0c0c0;
  --panel-dark: #9f9f9f;
  --line-dark: #404040;
  --line-light: #ffffff;
  --text: #111111;
  --blue: #000080;
  --danger: #992222;
  --ok: #0b6b2a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Tahoma", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, input, textarea { font: inherit; }

.shell { min-height: 100vh; padding: 12px; overflow-x: hidden; }

.topbar,
.card,
.tab,
.path-chip,
.status-pill,
.motd-preview,
.player-card,
.market-card,
.file-tile,
.console-box,
textarea,
input,
iframe,
.ban-card,
.side-info-card,
.player-sidebox {
  border-top: 2px solid var(--line-light);
  border-left: 2px solid var(--line-light);
  border-right: 2px solid var(--line-dark);
  border-bottom: 2px solid var(--line-dark);
}

.topbar {
  background: var(--panel);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.topbar-main { min-width: 0; flex: 1; }
.topbar-side { display: grid; gap: 8px; justify-items: end; }
.topbar-actions { margin-top: 8px; justify-content: flex-end; }

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  color: var(--blue);
}

.subtitle, .server-path, .label, small, .muted { color: #333; }
.server-path { margin-top: 4px; word-break: break-all; }

.status-pill {
  background: #e8e8e8;
  min-width: 112px;
  text-align: center;
  padding: 8px 10px;
  font-weight: 700;
}

.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 12px 0;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.tab, button {
  background: var(--panel);
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.tab.is-active {
  background: #e7e7e7;
  color: var(--blue);
  font-weight: 700;
}

main { display: grid; gap: 12px; }
.panel { display: none; }
.panel.is-active { display: grid; gap: 12px; }

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

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
  align-items: start;
}

.overview-console-card { grid-column: 1 / -1; }

.card {
  background: var(--panel);
  padding: 12px;
}

.card strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

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

.section-head.wrap, .toolbar.compact { flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 20px; }

input, textarea {
  width: 100%;
  background: #fff;
  padding: 8px 10px;
}

.console-box {
  background: #040404;
  color: #70f570;
  padding: 8px;
  height: 180px;
  margin: 10px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "Consolas", monospace;
  font-size: 12px;
}

.ports-grid,
.players-grid,
.market-grid,
.bans-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.players-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 12px;
}

.right-sidebar { display: grid; gap: 12px; align-content: start; }

.port-card,
.player-card,
.market-card,
.ban-card {
  background: #dfdfdf;
  padding: 10px;
}

.player-card .actions,
.ban-card .actions,
.port-actions,
.market-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.player-card h3,
.market-card h3,
.ban-card h3 { margin: 0 0 6px; }

.player-sidebox,
.side-info-card {
  background: #d9d9d9;
}

.side-info-grid,
.player-side-lines {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.side-info-grid div,
.player-side-lines div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.player-side-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
}

.path-chip {
  background: #fff;
  padding: 7px 10px;
}

.file-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.file-tile {
  background: #dfdfdf;
  padding: 10px;
  text-align: center;
}

.file-icon { font-size: 26px; margin-bottom: 8px; }
.file-name { word-break: break-word; }

.editor-card textarea { min-height: 420px; }

.market-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
}

.market-head img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  background: #fff;
}

.map-panel iframe {
  width: 100%;
  min-height: 70vh;
  background: #fff;
}

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

.settings-grid .wide { grid-column: 1 / -1; }

.settings-grid label,
.settings-grid > div {
  display: grid;
  gap: 6px;
}

.motd-preview {
  background: #fff;
  min-height: 80px;
  padding: 10px;
}

.danger { color: #fff; background: var(--danger); }
.ok-badge { color: #0c550c; font-weight: 700; }

@media (max-width: 980px) {
  .cards,
  .overview-grid,
  .players-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; }
  .topbar-side { width: 100%; justify-items: stretch; }
  .toolbar.compact > * { flex: 1 1 100%; }
  .console-box { height: 150px; }
  .editor-card textarea { min-height: 260px; }
}
