/* Styles for the platform.
 *
 * One file, no framework, no build step. Written to be read and edited by
 * hand: colours are named at the top, and everything else is grouped by what
 * it styles rather than alphabetically.
 */

:root {
  --ink:        #1b2430;
  --ink-soft:   #5b6b7c;
  --ink-faint:  #8c9aa8;
  --line:       #dde3ea;
  --line-soft:  #eef2f6;
  --paper:      #ffffff;
  --paper-dim:  #f7f9fb;
  --accent:     #1d5a86;
  --accent-dim: #e8f1f8;
  --ok:         #1d7a4c;
  --ok-dim:     #e6f4ec;
  --bad:        #a8342a;
  --bad-dim:    #fbecea;
  --warn:       #a8650c;
  --warn-dim:   #fdf3e6;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper-dim);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.brand span { color: var(--ink-faint); font-weight: 400; }

.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 6px 11px;
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}
.topbar nav a:hover { background: var(--paper-dim); color: var(--ink); }

.logout { display: flex; align-items: center; gap: 10px; }
.who { color: var(--ink-faint); font-size: 13px; }

button.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

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

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.3px; }
h2 { font-size: 16px; margin: 28px 0 12px; letter-spacing: -0.1px; }
h3 { font-size: 14px; margin: 20px 0 8px; }
.lede { color: var(--ink-soft); margin: 0 0 20px; }

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

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat .label {
  color: var(--ink-faint);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat .value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.stat .note { color: var(--ink-soft); font-size: 12.5px; }

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

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */

label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }

input[type=text], input[type=password], input[type=url], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

textarea { resize: vertical; line-height: 1.5; }

.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 160px; }

button, input[type=submit] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 8px 15px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
button:hover { background: #17496c; }
button.ghost {
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
button.ghost:hover { background: var(--paper-dim); color: var(--ink); }
button.danger { background: var(--bad); }
button.danger:hover { background: #8d2a22; }
button.small { padding: 5px 10px; font-size: 13px; }

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

/* ---------- messages ---------- */

.flash, .error, .note {
  padding: 10px 14px;
  border-radius: 8px;
  margin: 0 0 16px;
  font-size: 14px;
}
.flash { background: var(--ok-dim); color: var(--ok); }
.error { background: var(--bad-dim); color: var(--bad); }
.note  { background: var(--warn-dim); color: var(--warn); }

/* ---------- status pills ---------- */

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.pill.ok      { background: var(--ok-dim);   color: var(--ok); }
.pill.bad     { background: var(--bad-dim);  color: var(--bad); }
.pill.pending { background: var(--warn-dim); color: var(--warn); }
.pill.muted   { background: var(--line-soft); color: var(--ink-soft); }

/* ---------- code and output ---------- */

pre, code, .mono { font-family: var(--mono); }

pre {
  background: #1c2531;
  color: #e6edf3;
  padding: 14px 16px;
  border-radius: 9px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
pre.light {
  background: var(--paper-dim);
  color: var(--ink);
  border: 1px solid var(--line);
}

.editor {
  width: 100%;
  min-height: 420px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  tab-size: 4;
}

/* ---------- file list ---------- */

.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  border-bottom: 1px solid var(--line-soft);
}
.file-list li:hover { background: var(--paper-dim); }
.file-list li.active { background: var(--accent-dim); }
.file-list a { text-decoration: none; flex: 1; }
.file-list .size { color: var(--ink-faint); font-size: 12.5px; }
.file-list .bin { color: var(--ink-faint); font-size: 12px; font-style: italic; }

/* ---------- workspace split ---------- */

.split { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

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

.centered {
  max-width: 380px;
  margin: 8vh auto;
}
.centered h1 { text-align: center; }
.centered .lede { text-align: center; }

/* ---------- misc ---------- */

.empty {
  color: var(--ink-faint);
  font-size: 14px;
  padding: 18px 0;
  text-align: center;
}
.muted { color: var(--ink-soft); font-size: 13px; }
.bar {
  height: 6px;
  background: var(--line-soft);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.bar span { display: block; height: 100%; background: var(--accent); }
.bar span.high { background: var(--bad); }
