:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa4b2;
  --accent: #4c8bf5;
  --accent-2: #3a6fd0;
  --ok: #34c759;
  --warn: #ffb020;
  --err: #ff5c5c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 8px; font-size: 13px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 96px; font-family: ui-monospace, monospace; }
button {
  background: var(--accent); color: #fff; border: none; padding: 10px 16px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
button:hover { background: var(--accent-2); }
button.secondary { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
button.ghost { background: transparent; color: var(--muted); }
button.danger { background: transparent; border: 1px solid var(--err); color: var(--err); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Auth screen */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.auth-card button { width: 100%; padding: 11px; }
.auth-toggle { text-align: center; margin-top: 16px; color: var(--muted); font-size: 13px; }
.auth-toggle a { cursor: pointer; }

/* App shell */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--panel); }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; cursor: pointer; }
.topbar .user { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
main { max-width: 1000px; margin: 0 auto; padding: 28px 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 20px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumb a { cursor: pointer; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; }
.card h3 { margin: 0; padding: 14px 18px; font-size: 14px; border-bottom: 1px solid var(--border); }
.card .body { padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
.server-row { cursor: pointer; }
.server-row:hover td { background: var(--panel-2); }

code, .mono { font-family: ui-monospace, monospace; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.err { color: var(--err); border-color: var(--err); }
.empty { color: var(--muted); padding: 10px 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 10px 12px; font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.codebox { background: #0b0d11; border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; color: #cfe3ff; }
.logbox { background: #0b0d11; border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; max-height: 320px; overflow: auto; color: #b9c2d0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 24px; z-index: 50; }
.modal { width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.modal h3 { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; }
.modal .body { padding: 20px; }
.modal .foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; font-size: 13px; opacity: 0; transform: translateY(8px); transition: all .2s; pointer-events: none; z-index: 100; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-color: var(--err); color: #ffd7d7; }
