/* ==========================================================================
   MineServe Headless WebUI Stylesheet (Material Design 3)
   All color values, font faces, and base M3 primitives live in
   mineserve-m3-tokens.css. Zero raw hex literals in this file.
   ========================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--md-sys-typescale-font-mono);
  font-variant-numeric: tabular-nums;
}

.ms-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.ms-icon--sm {
  width: 15px;
  height: 15px;
}

.ms-icon--lg {
  width: 24px;
  height: 24px;
}

.ms-icon--tertiary {
  color: var(--md-sys-color-tertiary);
}

.ms-icon--primary {
  color: var(--md-sys-color-primary);
}

.ms-icon--error {
  color: var(--md-sys-color-error);
}

/* ==========================================================================
   Buttons & Inputs (Material Design 3)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: var(--md-sys-shape-medium);
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.1px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-highest);
}

.btn-danger {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--md-sys-shape-small);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--md-sys-shape-small);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.btn-icon-outlined {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-medium);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-icon-outlined:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-color: var(--md-sys-color-outline);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-medium);
  color: var(--md-sys-color-on-surface);
  padding: 8px 12px;
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="search"],
select {
  height: 40px;
  min-height: 40px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--md-sys-color-on-surface-variant) 50%),
    linear-gradient(135deg, var(--md-sys-color-on-surface-variant) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--md-sys-color-primary);
}

input[type="file"] {
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-medium);
  padding: 5px 8px;
  font-size: 12px;
  font-family: var(--md-sys-typescale-font-sans);
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: none;
  border-radius: var(--md-sys-shape-small);
  padding: 6px 12px;
  margin-right: 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--md-sys-typescale-font-sans);
  cursor: pointer;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.span-2 {
  grid-column: span 2;
}

.ram-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ram-slider-value {
  font-family: var(--md-sys-typescale-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.ram-range {
  width: 100%;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
  margin: 4px 0;
  height: 6px;
}

.ram-slider-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  flex-wrap: wrap;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--md-sys-color-primary);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 8px;
}

.error-banner {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border: none;
  padding: 10px 14px;
  border-radius: var(--md-sys-shape-medium);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}

.m3-callout {
  margin: 10px 0;
  padding: 14px;
  border-radius: var(--md-sys-shape-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: none;
}

.m3-callout-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--md-sys-color-on-primary-container);
  margin-bottom: 4px;
}

.m3-callout .player-sub {
  color: var(--md-sys-color-on-primary-container);
  opacity: 0.9;
}

/* ==========================================================================
   Login View
   ========================================================================== */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--md-sys-color-surface);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--md-sys-color-surface-container);
  border: none;
  border-radius: 24px;
  padding: 28px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrap input {
  padding-right: 42px;
}

.password-toggle-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--md-sys-shape-small);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.password-toggle-btn:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--md-sys-shape-large);
  object-fit: cover;
  margin-bottom: 10px;
}

.brand-logo-slot {
  width: 34px;
  height: 34px;
  border-radius: var(--md-sys-shape-small);
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
}

/* ==========================================================================
   Desktop-Parity App Shell & 280px Navigation Drawer
   ========================================================================== */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--md-sys-color-surface);
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  width: 280px;
  height: 100vh;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  border: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  color: var(--md-sys-color-on-surface);
}

.version-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--md-sys-shape-small);
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
}

.system-info {
  font-size: 12px;
  line-height: 16px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 10px;
}

.sidebar-actions .btn-primary {
  flex: 1;
  height: 44px;
  border-radius: var(--md-sys-shape-medium);
}

.server-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.server-item {
  padding: 10px 14px;
  border-radius: var(--md-sys-shape-large);
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.server-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.server-item.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.server-item-text {
  min-width: 0;
  flex: 1;
}

.server-item-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-item-sub {
  font-family: var(--md-sys-typescale-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  line-height: 16px;
  color: var(--md-sys-color-on-surface-variant);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-item.active .server-item-sub {
  color: var(--md-sys-color-on-secondary-container);
  opacity: 0.8;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--md-sys-color-outline);
}

.dot.RUNNING {
  background: var(--ms-color-brand-seed);
}

.dot.STARTING,
.dot.STOPPING,
.dot.STANDBY {
  background: var(--md-sys-color-warning);
}

.dot.ERROR {
  background: var(--md-sys-color-error);
}

.sidebar-footer {
  border-top: 1px solid var(--md-sys-color-outline-variant-divider);
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.drawer-nav-item {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: var(--md-sys-shape-medium);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.drawer-nav-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.drawer-nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.drawer-nav-item-left svg {
  color: var(--md-sys-color-on-surface-variant);
}

.drawer-nav-item--cloud .drawer-nav-item-left svg {
  color: var(--md-sys-color-tertiary);
}

.account-profile-wrap {
  position: relative;
  margin-top: 6px;
}

.account-profile-chip {
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--md-sys-shape-medium);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-font-sans);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.account-profile-chip:hover {
  background: var(--md-sys-color-surface-container-high);
}

.account-profile-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.role-badge {
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--md-sys-shape-small);
  border: none;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.role-badge.OWNER {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-on-warning-container);
}

.role-badge.ADMIN {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}

.role-badge.MODERATOR {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.role-badge.VIEWER {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
}

.account-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  border: none;
  border-radius: var(--md-sys-shape-large);
  padding: 8px;
  box-shadow: var(--ms-elevation-popover);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popover-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  padding: 4px 8px 2px;
}

.theme-pill-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 2px 4px 6px;
}

.theme-pill-btn {
  border: none;
  border-radius: var(--md-sys-shape-small);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-pill-btn:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.theme-pill-btn.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.popover-divider {
  height: 1px;
  background: var(--md-sys-color-outline-variant-divider);
  margin: 2px 4px;
}

.popover-menu-item {
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--md-sys-shape-small);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.popover-menu-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.popover-menu-item--danger {
  color: var(--md-sys-color-error);
}

/* ==========================================================================
   Main Content, Unified Desktop Header & Telemetry Tiles
   ========================================================================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--md-sys-color-surface);
}

.topbar {
  padding: 16px 20px 10px;
  background: var(--md-sys-color-surface);
  border: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-main-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-title-row h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  color: var(--md-sys-color-on-surface);
}

.server-meta-line {
  font-size: 12px;
  line-height: 16px;
  color: var(--md-sys-color-on-surface-variant);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-small);
  border: none;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
}

.status-badge.RUNNING {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.status-badge.STARTING,
.status-badge.STOPPING,
.status-badge.STANDBY {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-on-warning-container);
}

.status-badge.ERROR {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.connection-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.net-chip-btn {
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}

.net-chip-btn:hover {
  filter: brightness(1.08);
}

.connection-note {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  flex-shrink: 0;
}

.metric-card {
  background: var(--md-sys-color-surface-container);
  border: none;
  border-radius: var(--md-sys-shape-medium);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--md-sys-color-on-surface-variant);
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.4px;
  color: var(--md-sys-color-on-surface-variant);
}

.metric-value {
  font-family: var(--md-sys-typescale-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-progress-track {
  width: 100%;
  height: 4px;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-surface-container-highest);
  overflow: hidden;
}

.metric-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-primary);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.metric-progress-fill.warning {
  background: var(--md-sys-color-warning);
}

.metric-progress-fill.error {
  background: var(--md-sys-color-error);
}

/* ==========================================================================
   Empty State & 6-Tab SecondaryTabRow
   ========================================================================== */

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--md-sys-shape-large);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.empty-state p {
  margin: 0 0 18px;
  max-width: 380px;
}

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 20px 16px;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.tabs-bar {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--md-sys-color-outline-variant-divider);
  overflow-x: auto;
  flex-shrink: 0;
  margin: 0 -20px;
  padding: 0 20px;
}

.tab-btn {
  flex: 1 0 auto;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--md-sys-color-on-surface-variant);
  padding: 12px 16px;
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-low);
}

.tab-btn.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
}

.tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.tab-panel.active {
  display: flex;
}

.subtab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.subtab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.subtab-panel.active {
  display: flex;
}

/* ==========================================================================
   Console Tab (Terminal Viewport + Quick Chips + Command Input)
   ========================================================================== */

.console-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.console-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.console-output {
  width: 100%;
  flex: 1;
  min-height: 300px;
  overflow-y: auto;
  background: var(--ms-console-bg);
  color: var(--ms-console-fg);
  border: none;
  border-radius: var(--md-sys-shape-medium);
  padding: 14px;
  font-family: var(--md-sys-typescale-font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.console-quick-chip {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border: none;
  border-radius: var(--md-sys-shape-small);
  padding: 6px 12px;
  font-family: var(--md-sys-typescale-font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.console-quick-chip:hover {
  background: var(--md-sys-color-secondary-container);
}

.console-input-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.console-input-bar input {
  flex: 1;
  background: var(--ms-console-bg);
  color: var(--ms-console-fg);
  font-family: var(--md-sys-typescale-font-mono);
}

/* ==========================================================================
   Files, Settings, Players, Performance & Live Map
   ========================================================================== */

.files-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.files-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.files-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.files-layout.editing {
  grid-template-columns: 1fr 1.2fr;
}

.files-list {
  background: var(--md-sys-color-surface-container);
  border: none;
  border-radius: var(--md-sys-shape-large);
  overflow-y: auto;
  max-height: 56vh;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant-divider);
  font-size: 13px;
  gap: 8px;
}

.file-row:last-child {
  border-bottom: none;
}

.file-name-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  text-align: left;
  font-family: var(--md-sys-typescale-font-mono);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.file-name-btn:hover {
  color: var(--md-sys-color-primary);
}

.file-meta {
  font-family: var(--md-sys-typescale-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-editor-pane {
  background: var(--md-sys-color-surface-container);
  border: none;
  border-radius: var(--md-sys-shape-large);
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.editor-actions {
  display: flex;
  gap: 6px;
}

.file-editor-pane textarea {
  flex: 1;
  min-height: 320px;
  background: var(--ms-console-bg);
  color: var(--ms-console-fg);
  border: none;
  font-family: var(--md-sys-typescale-font-mono);
  font-size: 12px;
  resize: vertical;
}

.settings-layout,
.players-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.panel-card {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  border: none;
  border-radius: var(--md-sys-shape-large);
  padding: 16px;
}

.panel-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.panel-card--featured {
  background: var(--md-sys-color-surface-container-high);
}

.settings-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.inline-form input {
  flex: 1;
  min-width: 110px;
}

.inline-form select {
  width: auto;
}

.player-list {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-medium);
}

.player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--md-sys-color-outline-variant-divider);
  font-size: 13px;
  gap: 8px;
}

.player-row:last-child {
  border-bottom: none;
}

.player-sub {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.player-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Modals, Progress, Toasts, Audit Log & Live Map
   ========================================================================== */

dialog.m3-dialog-native {
  border: none;
  border-radius: var(--md-sys-shape-extra-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  padding: 24px;
  width: min(600px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--ms-elevation-popover);
  margin: auto;
}

dialog.m3-dialog-native.m3-dialog--sm {
  width: min(440px, calc(100vw - 32px));
}

dialog.m3-dialog-native.m3-dialog--md {
  width: min(720px, calc(100vw - 32px));
}

dialog.m3-dialog-native.m3-dialog--lg {
  width: min(880px, calc(100vw - 32px));
}

dialog.m3-dialog-native.m3-dialog--xl {
  width: min(940px, calc(100vw - 32px));
}

dialog.m3-dialog-native::backdrop {
  background: var(--md-sys-color-scrim);
}

dialog.m3-dialog-native:not([open]) {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--md-sys-color-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border: none;
  border-radius: var(--md-sys-shape-extra-large);
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.eula-box {
  margin: 10px 0 14px;
}

.eula-box a {
  color: var(--md-sys-color-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.progress-box {
  background: var(--md-sys-color-surface-container);
  border: none;
  border-radius: var(--md-sys-shape-medium);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.progress-text-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--md-sys-color-primary);
  transition: width 0.25s ease;
}

.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  background: var(--md-sys-color-surface-container-highest);
  border: none;
  color: var(--md-sys-color-on-surface);
  padding: 11px 16px;
  border-radius: var(--md-sys-shape-medium);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--ms-elevation-popover);
}

.toast.success {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.toast.error {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.files-list.drag-over {
  outline: 2px dashed var(--md-sys-color-primary);
  background: var(--md-sys-color-surface-container-high);
}

.audit-filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.audit-table-wrap {
  flex: 1;
  overflow: auto;
  border-radius: var(--md-sys-shape-large);
  background: var(--md-sys-color-surface-container);
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: 13px;
}

.audit-table th,
.audit-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--md-sys-color-outline-variant-divider);
  vertical-align: top;
}

.audit-table tr:last-child td {
  border-bottom: none;
}

.audit-table th {
  position: sticky;
  top: 0;
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 1;
}

.livemap-frame {
  width: 100%;
  height: 60vh;
  border: none;
  border-radius: var(--md-sys-shape-large);
  background: var(--ms-console-bg);
  margin-top: 10px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-cpu {
  background: var(--md-sys-color-primary);
}

.legend-ram {
  background: var(--md-sys-color-tertiary);
}

.legend-tps {
  background: var(--md-sys-color-warning);
}

.perf-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chart-wrap {
  width: 100%;
  height: 220px;
  position: relative;
  background: var(--md-sys-color-surface-container-low);
  border: none;
  border-radius: var(--md-sys-shape-medium);
  overflow: hidden;
}

#perf-chart-canvas,
#perf-chart-cpu-canvas,
#perf-chart-mem-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Players Unified Roster & Filter Chips */
.player-quick-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.player-quick-bar input {
  flex: 1;
  min-width: 210px;
}

.filter-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.m3-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--md-sys-shape-small);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-typescale-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.m3-filter-chip:hover {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

.m3-filter-chip.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.player-avatar-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--md-sys-shape-small);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.player-avatar-badge--op {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-on-warning-container);
}

/* Content Split, Marketplace Cards & Drag-Drop Banner */
.content-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.marketplace-card {
  background: var(--md-sys-color-surface-container-low);
  border: none;
  border-radius: var(--md-sys-shape-large);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.files-drop-banner {
  border: 1px dashed var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-medium);
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 8px;
}

.files-drop-banner.drag-over {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

/* World Dimension Tiles */
.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dimension-size {
  font-family: var(--md-sys-typescale-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  margin: 4px 0;
}

/* 2-Step Creation Wizard */
.wizard-steps-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.wizard-step-pill {
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-small);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 600;
}

.wizard-step-pill.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.software-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.software-tile {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  border: none;
  border-radius: var(--md-sys-shape-large);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--md-sys-typescale-font-sans);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.software-tile:hover {
  background: var(--md-sys-color-surface-container-highest);
}

.software-tile.active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.software-tile-title {
  font-size: 14px;
  font-weight: 700;
}

.software-tile-desc {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.35;
}

.software-tile.active .software-tile-desc {
  color: var(--md-sys-color-on-primary-container);
  opacity: 0.9;
}

.quick-version-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quick-version-chip {
  border: none;
  border-radius: var(--md-sys-shape-small);
  padding: 5px 10px;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-typescale-font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.quick-version-chip.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* Supporters Heart Badge & Live Map Port Alignment */
.supporter-heart-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.livemap-port-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.livemap-port-group input[type="number"] {
  width: 96px;
  height: 32px;
  min-height: 32px;
  padding: 4px 10px;
}

.tunnel-accent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tunnel-accent-header h3 {
  margin: 0;
}

.conflict-banner {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-medium);
  border: none;
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Responsive Mobile Drawer (< 960px)
   ========================================================================== */

.mobile-only {
  display: none;
}

@media (max-width: 960px) {
  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--ms-elevation-popover);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--md-sys-color-scrim);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .perf-charts-grid,
  .content-split-grid,
  .dimensions-grid {
    grid-template-columns: 1fr;
  }

  .software-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .files-layout.editing {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 520px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
