@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0f1417;
  --panel: #151b1f;
  --panel-raised: #1a2126;
  --border: #2a3238;
  --text: #e4e7e9;
  --text-dim: #8b959b;
  --ok: #4fae7c;
  --ok-dim: #2f4a3c;
  --warn: #d6a34e;
  --warn-dim: #4a3f28;
  --danger: #c4644b;
  --danger-dim: #4a2f28;
  --radius: 3px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
}

a { color: inherit; }

::selection { background: var(--ok-dim); }

button {
  font-family: var(--sans);
  cursor: pointer;
}

button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ok);
  outline-offset: 1px;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 360px;
}

.login-prompt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ok);
  margin-bottom: 18px;
}

.login-prompt::before { content: 'root@vpn-admin:~$ '; color: var(--text-dim); }

.login-box h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input, .field textarea {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s;
}

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

.btn-primary {
  background: var(--ok-dim);
  border-color: var(--ok);
  color: #d9f2e4;
  width: 100%;
}

.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-dim); }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 16px;
}

/* ---------- Dashboard shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
}

.topbar .brand strong { color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 14px; }

main {
  padding: 24px 28px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

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

.toolbar h2 { font-size: 16px; font-weight: 600; margin: 0; }

.summary {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}

.summary strong { color: var(--text); }

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

thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover { background: var(--panel); }

.device-name { color: var(--text-dim); font-family: var(--mono); font-size: 13px; }

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
}
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.danger { background: var(--danger); }
.status-dot.off { background: var(--text-dim); }

.time-left { font-family: var(--mono); font-size: 13px; }
.time-left.warn { color: var(--warn); }
.time-left.danger { color: var(--danger); }

.row-actions { display: flex; gap: 8px; }
.row-actions button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  padding: 2px 4px;
}
.row-actions button:hover { color: var(--text); }
.row-actions button.danger:hover { color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 9, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  padding: 24px;
}

.modal h3 { margin: 0 0 18px; font-size: 16px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.hidden { display: none !important; }

.hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.sub-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sub-link-row input {
  font-size: 12px;
}
