/* The dashboard's whole appearance. One file, because there is not enough of it
   to be worth splitting, and a single request beats three. */

:root {
  --bg: #0d1117;
  --bg-raised: #151b24;
  --bg-sunken: #0a0e14;
  --border: #232c39;
  --border-strong: #2f3b4c;
  --text: #e4e9f0;
  --text-dim: #93a1b5;
  --text-faint: #64748b;
  --accent: #4da3ff;
  --accent-dim: #1e3a5f;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------------ brand */

.brand { display: flex; align-items: baseline; gap: 7px; }
.brand-mark {
  font-weight: 700; letter-spacing: .5px; color: var(--accent);
  background: var(--accent-dim); padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 13px;
}
.brand-name { font-weight: 600; letter-spacing: .2px; }

/* ------------------------------------------------------------------ login */

.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1000px 500px at 50% -10%, #16243a 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 14px; padding: 32px;
  display: flex; flex-direction: column; gap: 16px;
}
.login-card .brand { justify-content: center; margin-bottom: 4px; }
.login-hint { margin: 0; color: var(--text-dim); font-size: 13px; text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }

/* ------------------------------------------------------------------ inputs */

input[type=text], input[type=password], input[type=number], select, textarea {
  background: var(--bg-sunken); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 9px 11px; font: inherit; font-size: 14px; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77,163,255,.15);
}
input::placeholder { color: var(--text-faint); }

.btn {
  border: 1px solid var(--border-strong); background: var(--bg-raised); color: var(--text);
  padding: 9px 15px; border-radius: var(--radius-sm); font: inherit; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: #1c2431; border-color: #3b4a5f; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn.primary:hover { background: #6bb3ff; border-color: #6bb3ff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: #4a2622; }
.btn.danger:hover { background: #2a1614; border-color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.error { color: var(--bad); font-size: 13px; margin: 0; min-height: 18px; }

/* ----------------------------------------------------------------- topbar */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: var(--bg-raised); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.stats { display: flex; gap: 20px; margin-left: 8px; flex: 1; overflow: hidden; }
.stat { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--text-dim); }
.stat b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang { width: auto; padding: 6px 8px; font-size: 13px; }

/* ----------------------------------------------------------------- layout */

.layout { display: grid; grid-template-columns: 280px 1fr; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

/* The sidebar is a column so the build stamp can sit at its foot rather than
   trailing whatever number of segments happens to be above it. */
.sidebar {
  border-right: 1px solid var(--border); padding: 16px;
  min-height: calc(100vh - 56px);
  display: flex; flex-direction: column;
}
.sidebar .segment-list { flex: 1; }

.build-info {
  margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px; line-height: 1.7;
  color: var(--text-faint); user-select: text;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sidebar-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); margin: 0; }

.segment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.segment-list button {
  width: 100%; text-align: left; background: transparent; border: 1px solid transparent;
  color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px;
}
.segment-list button:hover { background: var(--bg-raised); }
.segment-list button.active { background: var(--accent-dim); border-color: #2c547f; }
.segment-list .seg-name { font-weight: 600; font-size: 14px; }
.segment-list .seg-meta { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.badge-pending {
  display: inline-block; background: var(--warn); color: #1b1400; font-size: 11px;
  font-weight: 700; border-radius: 20px; padding: 1px 7px; margin-left: 6px;
}

.content { padding: 24px; min-width: 0; }
.empty { color: var(--text-dim); text-align: center; padding: 60px 20px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 18px; }
.card-body p { margin: 0 0 10px; color: var(--text-dim); font-size: 14px; }
.card-body p:last-child { margin-bottom: 0; }

.segment-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.segment-header h1 { margin: 0 0 6px; font-size: 22px; }
.segment-header .sub { color: var(--text-dim); font-family: var(--mono); font-size: 13px; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ----------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-faint); font-weight: 600; padding: 10px 18px; border-bottom: 1px solid var(--border);
}
td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.pending-row { background: rgba(210,153,34,.06); }
.mono { font-family: var(--mono); font-size: 13px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.online { background: var(--ok); box-shadow: 0 0 6px rgba(63,185,80,.6); }
.dot.offline { background: var(--text-faint); }
.dot.pending { background: var(--warn); }
.dot.blocked { background: var(--bad); }
.state-label { color: var(--text-dim); font-size: 13px; }

/* ---------------------------------------------------------------- invites */

.invite-code {
  font-family: var(--mono); font-size: 15px; letter-spacing: 1px;
  background: var(--bg-sunken); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 6px 10px; display: inline-block;
}
.invite-code.spent { opacity: .45; text-decoration: line-through; }

.join-steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.join-steps li { counter-increment: step; position: relative; padding: 0 0 14px 34px; }
.join-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent-dim);
  color: var(--accent); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.join-steps code {
  display: block; font-family: var(--mono); font-size: 13px; margin-top: 6px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 11px; overflow-x: auto; white-space: pre;
}

/* ------------------------------------------------------------------- help */

/* The help page is a document, so it is set for reading: a measure that does
   not run the width of a wide monitor, and generous space between sections. */
.help { max-width: 860px; }
.help h2 {
  font-size: 20px; margin: 34px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.help h2:first-child { margin-top: 0; }
.help h3 { font-size: 16px; margin: 22px 0 8px; color: var(--text); }
.help p { margin: 0 0 12px; color: var(--text-dim); }
.help ul, .help ol { margin: 0 0 14px; padding-left: 22px; color: var(--text-dim); }
.help li { margin-bottom: 7px; }
.help strong { color: var(--text); font-weight: 600; }
.help code {
  font-family: var(--mono); font-size: 13px; color: var(--text);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
}
.help pre {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 15px;
  overflow-x: auto; margin: 0 0 14px;
}
.help pre code { background: none; border: none; padding: 0; line-height: 1.65; }

.help-steps { counter-reset: hstep; list-style: none; padding: 0; }
.help-steps li { counter-increment: hstep; position: relative; padding-left: 32px; margin-bottom: 11px; }
.help-steps li::before {
  content: counter(hstep); position: absolute; left: 0; top: 1px;
  width: 21px; height: 21px; border-radius: 50%; background: var(--accent-dim);
  color: var(--accent); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.help-table { margin: 0 0 16px; font-size: 14px; }
.help-table td, .help-table th { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.help-table td:first-child { width: 34%; color: var(--text-dim); }
.help-table th { color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; padding-top: 16px; }

.download-list { list-style: none; padding: 0; margin: 0 0 16px; }
.download-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 15px; margin-bottom: 8px;
}
.download-list a { color: var(--accent); text-decoration: none; font-weight: 600; font-family: var(--mono); font-size: 14px; }
.download-list a:hover { text-decoration: underline; }
.download-meta { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.help-empty { color: var(--text-faint); font-size: 14px; }

/* ----------------------------------------------------------------- modals */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3,6,11,.72);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: 14px; width: 100%; max-width: 440px; padding: 24px;
}
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--text-dim); }
.modal .hint { font-size: 12px; color: var(--text-faint); margin: -8px 0 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.checkbox { flex-direction: row !important; align-items: center; gap: 9px !important; }
.checkbox input { width: auto; }

/* ----------------------------------------------------------------- toasts */

.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: 11px 15px; font-size: 14px; max-width: 380px;
  animation: slide-in .18s ease-out;
}
.toast.bad { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--ok); }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }
