/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --card-bg: #1a1a24;
  --card-border: #2a2a3a;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --accent: #5b8def;
  --accent-hover: #4a7de0;
  --red: #e74c3c;
  --green: #2ecc71;
  --yellow: #f1c40f;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.page { max-width: 960px; margin: 0 auto; padding: 24px; }

/* ── Login ── */
.login-card {
  max-width: 360px;
  margin: 120px auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.header h1 { font-size: 20px; font-weight: 700; }

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

/* ── Summary Cards ── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.summary-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.summary-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Instance Card ── */
.instance-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s;
}

.instance-card:hover { border-color: var(--accent); }

.instance-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.instance-name { font-weight: 600; font-size: 15px; }

.instance-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}

.instance-status.online { background: rgba(46,204,113,.15); color: var(--green); }
.instance-status.offline { background: rgba(231,76,60,.15); color: var(--red); }

.instance-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.instance-meta span { display: flex; align-items: center; gap: 4px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

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

.modal-header h2 { font-size: 18px; font-weight: 600; }

/* ── Table ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--card-border);
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.table tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}

.tag-green { background: rgba(46,204,113,.15); color: var(--green); }
.tag-red { background: rgba(231,76,60,.15); color: var(--red); }
.tag-yellow { background: rgba(241,196,15,.15); color: var(--yellow); }
.tag-gray { background: rgba(136,136,160,.15); color: var(--text-muted); }

/* ── Form ── */
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.form-input:focus { border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  padding: 8px 16px;
  transition: opacity .15s;
}

.btn:hover { opacity: .85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}

.btn-sm { font-size: 12px; padding: 6px 12px; }

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-error { color: var(--red); font-size: 13px; }
.text-sm { font-size: 13px; }
