/* Nook admin — hand-written dark theme, no frameworks, no CDN. */
:root {
  --bg: #0e1013;
  --panel: #171a1f;
  --panel-2: #1e222a;
  --line: #2a2f38;
  --text: #e6e9ef;
  --muted: #8b94a3;
  --accent: #5b9cff;
  --danger: #ff6b6b;
  --ok: #4ec9a0;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.topbar nav { display: flex; gap: 16px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); padding: 4px 0; }
.topbar nav a.active { color: var(--text); border-bottom: 2px solid var(--accent); }
.topbar .logout { margin-left: auto; }

main { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }

h1 { font-size: 22px; margin: 8px 0 20px; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 600; }

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

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }

.form .row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.form .row.setting > label:first-child { flex: 1; min-width: 260px; }

input[type=text], input[type=password], select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  min-width: 180px;
}
textarea { width: 100%; font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
/* A setting that carries instructions grows past one line, so its row stops
   centring the "clear" box against a field whose height is no longer known. */
.form .row.setting { align-items: flex-start; }
.form .row.setting > label:first-child .hint { max-width: 70ch; line-height: 1.45; }

label.check { flex-direction: row; align-items: center; gap: 7px; color: var(--text); font-size: 14px; }
label.check em { color: var(--muted); font-style: normal; font-size: 12px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
legend { color: var(--muted); font-size: 12px; padding: 0 6px; }

button {
  background: var(--accent);
  color: #08101f;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.small { padding: 5px 10px; font-size: 13px; }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 400; }
button.link:hover { color: var(--text); }
.inline { display: inline; }

.tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 9px;
  vertical-align: middle;
}
.tag.pin { color: var(--ok); border-color: var(--ok); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: .12em; }

dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 14px; }
dt { color: var(--muted); }
dl.meta { margin-bottom: 14px; }

.hint { color: var(--muted); font-size: 13px; }
ul.plain { margin: 0; padding-left: 18px; }

.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: rgba(78, 201, 160, .12); color: var(--ok); border: 1px solid rgba(78, 201, 160, .35); }
.flash.err { background: rgba(255, 107, 107, .12); color: var(--danger); border: 1px solid rgba(255, 107, 107, .35); }

.logs {
  background: #0a0c0f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  max-height: 65vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.login { width: min(360px, 92vw); }
.login h1 { margin-top: 0; }
.login label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.login input { width: 100%; }
.login button { width: 100%; }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 0 40px; }

/* Streaming dashboard and torrent list. */
button.link.danger { color: var(--danger); border: 0; }
button.link.danger:hover { filter: brightness(1.2); }
table form { display: inline; margin: 0; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
/* Dashboard sources card. */
table.sources td { vertical-align: top; }
table.sources td.test-cell { white-space: nowrap; text-align: right; }
.test-result { margin-top: 6px; white-space: normal; max-width: 260px; }
.test-result.ok { color: var(--ok); }
.test-result.err { color: var(--danger); }

/* Screen time: week navigation and the per-day usage bars. */
.weeknav { display: flex; gap: 16px; font-size: 13px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
ul.bars { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
ul.bars li { display: grid; grid-template-columns: 110px 1fr 160px; align-items: center; gap: 12px; }
.bar-label { color: var(--muted); font-size: 12px; line-height: 1.3; }
.bar-track { background: rgba(255, 255, 255, .06); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--ok); border-radius: 6px; }
.bar-fill.over { background: var(--danger); }
.bar-value { color: var(--muted); font-size: 12px; text-align: right; }
td.actions { white-space: nowrap; text-align: right; }

/* Usage bar widths. The admin Content-Security-Policy forbids inline
   styles, so the template picks one of these steps instead of writing a
   style attribute. */
.bar-fill.w0 { width: 0%; }
.bar-fill.w5 { width: 5%; }
.bar-fill.w10 { width: 10%; }
.bar-fill.w15 { width: 15%; }
.bar-fill.w20 { width: 20%; }
.bar-fill.w25 { width: 25%; }
.bar-fill.w30 { width: 30%; }
.bar-fill.w35 { width: 35%; }
.bar-fill.w40 { width: 40%; }
.bar-fill.w45 { width: 45%; }
.bar-fill.w50 { width: 50%; }
.bar-fill.w55 { width: 55%; }
.bar-fill.w60 { width: 60%; }
.bar-fill.w65 { width: 65%; }
.bar-fill.w70 { width: 70%; }
.bar-fill.w75 { width: 75%; }
.bar-fill.w80 { width: 80%; }
.bar-fill.w85 { width: 85%; }
.bar-fill.w90 { width: 90%; }
.bar-fill.w95 { width: 95%; }
.bar-fill.w100 { width: 100%; }
