:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #222c39;
  --border: #2d3a4a;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #3b82f6;
  --accent-h: #2f6fd6;
  --green: #2ea043;
  --red: #d1453b;
  --amber: #d29922;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

/* Login */
#login-view {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { margin: 0; }
.login-card p { margin: 0 0 8px; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
label.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

input, select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 14px;
  width: 100%;
}
input[type="checkbox"] { width: auto; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}
button:hover { background: var(--accent-h); }
button.secondary { background: var(--panel-2); border: 1px solid var(--border); }
button.secondary:hover { background: var(--border); }
button.danger { background: var(--red); }
button.tiny { padding: 5px 9px; font-size: 12px; }

/* Main */
#main-view { max-width: 1200px; margin: 0 auto; padding: 24px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.topbar h1 { margin: 0; }
.topbar-actions { display: flex; gap: 10px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
tr.disabled td { opacity: .55; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: rgba(46,160,67,.15); color: #4ac26b; }
.badge.bad { background: rgba(209,69,59,.15); color: #f0726a; }
.badge.warn { background: rgba(210,153,34,.15); color: #e3b341; }
.badge.neutral { background: var(--panel-2); color: var(--muted); }

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

code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.error { color: #f0726a; font-size: 13px; min-height: 16px; white-space: pre-wrap; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal { width: 520px; max-width: 94vw; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; }
#site-form { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.scheme-field { width: 110px; flex: none; }
.port-field { width: 100px; flex: none; }
.host-field { flex: 1; }
.body-field { width: 130px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Flash */
.flash {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  white-space: pre-wrap;
}
.flash.ok { background: rgba(46,160,67,.15); color: #4ac26b; border: 1px solid rgba(46,160,67,.3); }
.flash.err { background: rgba(209,69,59,.15); color: #f0726a; border: 1px solid rgba(209,69,59,.3); }

.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
