:root {
  --bg: #0f1418;
  --bg-elevated: #161d23;
  --bg-card: #1b232a;
  --border: #2a343c;
  --text: #e5edf1;
  --text-muted: #8ea0ab;
  --accent: #4caf7d;
  --accent-strong: #3d9a6b;
  --danger: #d9534f;
  --danger-strong: #c0392b;
  --warn: #e0a63e;
  --info: #4a90d9;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9em;
}

.hint {
  color: var(--text-muted);
  font-size: 0.88em;
  margin-top: -6px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand h1 {
  font-size: 1.1rem;
  margin: 0;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.85em;
  color: var(--text-muted);
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.25);
  flex-shrink: 0;
}

.brand-dot.connected {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 175, 125, 0.25);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.85em;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.8em;
  margin-left: 4px;
}

.tab-btn.active .tab-badge {
  background: rgba(76, 175, 125, 0.2);
  color: var(--accent);
}

.layout {
  padding: 20px 24px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.user-badge {
  background: rgba(76, 175, 125, 0.15);
  color: var(--accent);
}

.subheading {
  margin: 20px 0 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.new-invite-banner {
  margin-top: 12px;
  background: rgba(76, 175, 125, 0.12);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.new-invite-banner .code {
  font-family: "Consolas", monospace;
  font-size: 1.1em;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.role-pill {
  font-size: 0.75em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.role-pill.role-admin {
  background: rgba(224, 166, 62, 0.2);
  color: var(--warn);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-header h2 {
  margin: 0;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-experimental {
  font-size: 0.65em;
  text-transform: uppercase;
  background: rgba(224, 166, 62, 0.2);
  color: var(--warn);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 12px;
}

.col-span-2 {
  grid-column: 1 / -1;
}

.form-grid label,
.modal label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85em;
  color: var(--text-muted);
}

.form-grid input,
.modal input,
.modal select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.95em;
}

.checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.checkbox input {
  width: auto;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-inline {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.form-inline input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: inherit;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 0.9em;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #06170e;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #2a0a08;
}

.btn-danger:hover {
  background: var(--danger-strong);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8em;
}

.error-text {
  color: var(--danger);
  font-size: 0.85em;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

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

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.actions-col {
  text-align: right;
  white-space: nowrap;
}

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

.uid-cell {
  font-family: "Consolas", monospace;
  font-size: 0.85em;
  color: var(--text-muted);
  cursor: pointer;
}

.raw-details {
  margin-top: 14px;
  font-size: 0.85em;
  color: var(--text-muted);
}

.raw-details pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}

.log-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  height: 220px;
  overflow-y: auto;
  font-family: "Consolas", monospace;
  font-size: 0.82em;
  line-height: 1.5;
}

.log-line {
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 3px 0;
}

.log-line .ts {
  color: var(--text-muted);
  margin-right: 6px;
}

.danger-text {
  color: var(--danger);
}

.quick-cmd-list {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.quick-cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.quick-cmd-row:last-child {
  border-bottom: none;
}

.quick-cmd-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.quick-cmd-info strong code {
  background: rgba(76, 175, 125, 0.12);
  color: var(--accent);
}

.quick-cmd-row[data-danger="true"] .quick-cmd-info strong code {
  background: rgba(217, 83, 79, 0.15);
  color: var(--danger);
}

.quick-cmd-info .muted,
.quick-cmd-info .danger-text {
  font-size: 0.82em;
}

.quick-cmd-row button {
  flex-shrink: 0;
}

.log-line.level-error { color: var(--danger); }
.log-line.level-warn { color: var(--warn); }
.log-line.level-action { color: var(--accent); }
.log-line.level-console { color: var(--info); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: 380px;
  max-width: 92vw;
}

.modal h3 {
  margin: 0 0 14px;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal .form-actions {
  justify-content: flex-end;
  margin-top: 6px;
}
