:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #eab308;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login {
  max-width: 360px;
  margin: 10vh auto;
  padding: 32px;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.login h1 { margin-top: 0; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
}
.sidebar h2 { font-size: 18px; margin: 0 8px 20px; }
.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 4px;
}
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--primary); color: white; }
.sidebar .logout {
  margin-top: 24px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

.content { padding: 24px 32px; overflow-y: auto; }
.content h1 { margin-top: 0; }

.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }

button, .btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: var(--primary-hover); }
button.secondary { background: var(--panel-2); }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--panel-2); font-size: 12px; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.online { background: var(--success); color: #052e16; }
.badge.offline { background: var(--danger); color: white; }
.badge.idle { background: var(--warning); color: #422006; }

.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h2 { margin-top: 0; }

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.alert.error { background: #7f1d1d; color: white; }
.alert.success { background: #14532d; color: white; }

.upload-progress {
  height: 8px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
}
.upload-progress > div {
  height: 100%;
  background: var(--primary);
  transition: width .2s;
}

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.copy-btn { font-size: 11px; padding: 2px 6px; }
