/* SPDX-License-Identifier: Apache-2.0 — SORN GIT */
:root {
  --bg: #f7f8fa; --panel: #ffffff; --text: #1d2230; --muted: #5d6577; --line: #dfe3ea;
  --accent: #1f6feb; --accent-text: #ffffff; --ok: #1a7f37; --warn: #9a6700; --bad: #cf222e;
  --code-bg: #f0f2f5; --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --panel: #171b23; --text: #e6e9ef; --muted: #9aa3b5; --line: #2b313d;
    --accent: #4c8dff; --accent-text: #0b0e13; --ok: #3fb950; --warn: #d29922; --bad: #f85149; --code-bg: #10141b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
header.top {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
/* Brand title: "SORN" in black, "GIT" in green. In dark mode black would
   vanish, so "SORN" turns near-white and the green gets lighter. */
:root { --brand-1: #111111; --brand-2: #1a7f37; }
@media (prefers-color-scheme: dark) { :root { --brand-1: #f2f4f8; --brand-2: #3fb950; } }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: .6px; line-height: 1; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.brand .b1 { color: var(--brand-1); }
.brand .b2 { color: var(--brand-2); }
header.top nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
header.top form { margin: 0; }
main { max-width: 980px; margin: 24px auto; padding: 0 16px; }
main.narrow { max-width: 440px; margin-top: 8vh; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=search] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .button {
  display: inline-block; margin-top: 16px; padding: 9px 16px; border: 1px solid transparent; border-radius: 8px;
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer;
}
button.secondary, .button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: var(--bad); color: #fff; }
button.link { background: none; border: 0; padding: 0; margin: 0; color: var(--accent); font-weight: 400; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--line); }
.notice.error { border-color: var(--bad); color: var(--bad); }
.notice.ok { border-color: var(--ok); color: var(--ok); }
.notice.warn { border-color: var(--warn); color: var(--warn); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.repo-list li { list-style: none; padding: 12px 0; border-bottom: 1px solid var(--line); }
.repo-list { padding: 0; margin: 0; }
.clone { display: flex; gap: 6px; margin-top: 6px; }
.clone input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.clone button { margin: 0; padding: 6px 10px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-size: 16px; margin: 12px 0; }
.qr { background: #fff; padding: 10px; border-radius: 8px; display: inline-block; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
footer { text-align: center; color: var(--muted); font-size: 12px; margin: 30px 0; }
@media (max-width: 600px) {
  header.top { padding: 10px 12px; gap: 10px; }
  .brand { font-size: 19px; gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  .codes { grid-template-columns: 1fr; }
  th.hide-sm, td.hide-sm { display: none; }
}
.center { text-align: center; }
/* repository pages */
.repohead h1 { margin-bottom: 8px; }
/* Pill navigation: the header links and every tab row (Settings,
   Administration, repository tabs). Hover shows a faint tint of the accent;
   the current page gets a stronger tint and accent-colored text. */
:root {
  --pill-hover: color-mix(in srgb, var(--accent) 9%, transparent);
  --pill-on: color-mix(in srgb, var(--accent) 16%, transparent);
  --pill-on-text: color-mix(in srgb, var(--accent) 80%, var(--text));
}
.pills a, .tabs a, .pill-out {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  color: var(--muted); font-weight: 500; line-height: 1.4; text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.pills a:hover, .tabs a:hover { background: var(--pill-hover); color: var(--text); text-decoration: none; }
.pills a.on, .tabs a.on { background: var(--pill-on); color: var(--pill-on-text); font-weight: 600; }
.pills .avatar {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: -6px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.pill-out { background: none; border: 1px solid var(--line); margin: 0; font: inherit; font-weight: 500; cursor: pointer; }
.pill-out:hover { background: color-mix(in srgb, var(--bad) 9%, transparent); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); width: fit-content; max-width: 100%; }
@media (prefers-reduced-motion: reduce) { .pills a, .tabs a, .pill-out { transition: none; } }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.spacer { flex: 1; }
.right { float: right; }
.crumbs { word-break: break-all; }
.picker { position: relative; }
.picker summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.picker summary::-webkit-details-marker { display: none; }
.picker summary.button { margin: 0; }
.picker .menu { position: absolute; z-index: 5; top: 110%; left: 0; min-width: 220px; max-height: 320px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.clonebox .menu { left: auto; right: 0; }
.picker .menu.wide { width: min(420px, 90vw); padding: 12px; }
.picker .menu a { display: block; padding: 5px 8px; border-radius: 6px; }
.picker .menu a:hover { background: var(--code-bg); text-decoration: none; }
.lastcommit { padding: 10px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--panel); }
table.files { border-radius: 0 0 var(--radius) var(--radius); padding: 0; }
table.files td { padding: 7px 14px; }
td.num { text-align: right; white-space: nowrap; }
.filebox { padding: 0; overflow: hidden; }
.filebar { display: flex; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.code { overflow-x: auto; }
.code table { border-collapse: collapse; width: auto; }
.code td { border: 0; padding: 0 12px; }
.code pre { margin: 0; font-size: 13px; line-height: 1.55; }
.code .lnt, .code .lnt a { color: var(--muted); }
.imgview { padding: 16px; text-align: center; }
.imgview img { max-width: 100%; }
.markdown { padding: 4px 4px 0; line-height: 1.6; overflow-wrap: anywhere; }
.markdown img { max-width: 100%; }
.markdown pre, .code-block, .commit-body { background: var(--code-bg); padding: 12px; border-radius: 8px; overflow-x: auto; }
.commit-body { white-space: pre-wrap; }
.markdown code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.markdown pre code { padding: 0; background: none; }
.markdown table td, .markdown table th { border: 1px solid var(--line); }
.readme { margin-top: 18px; }
.commit-list { list-style: none; padding: 0; margin: 0; }
.commit-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pager { display: flex; gap: 10px; }
.diff { padding: 0; overflow-x: auto; }
.diff table, .blame table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.diff td, .blame td { border: 0; padding: 0 8px; white-space: pre; }
.diff td.ln, .blame td.ln { width: 1%; text-align: right; user-select: none; }
.diff tr.add { background: rgba(46,160,67,.15); }
.diff tr.del { background: rgba(248,81,73,.15); }
.diff tr.hunk td { color: var(--muted); background: var(--code-bg); padding: 4px 8px; }
span.add { color: var(--ok); } span.del { color: var(--bad); }
.blame tr.first td { border-top: 1px solid var(--line); }
.blame td.who { width: 1%; white-space: nowrap; padding-right: 14px; }
.repo-list a strong { color: var(--text); }
/* settings */
textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit;
}
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.danger-zone { border-color: var(--bad); }
.bar h1 { margin: 0; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }
td .picker summary { border: 0; background: none; color: var(--accent); padding: 0; display: inline; }
td .picker .menu { left: auto; right: 0; }
/* admin */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat .big { font-size: 26px; font-weight: 700; margin: 4px 0; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.checks .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--ok); }
.checks li.warn .dot { background: var(--warn); }
table.kv th { width: 140px; }
.killswitch { border-color: var(--bad); }
.killswitch form { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.killswitch button { margin: 0; }
.badge.warnb { color: var(--warn); border-color: var(--warn); }
.row3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.row3 button { margin: 0; }
.nowrap { white-space: nowrap; }
.menu form + form { border-top: 1px solid var(--line); margin-top: 10px; }
@media (max-width: 700px) { .grid, .row3 { grid-template-columns: 1fr; } }
/* audit log: long values (fingerprints, hashes) wrap instead of spilling out */
table.audit { table-layout: fixed; }
table.audit td { overflow-wrap: anywhere; word-break: break-word; }
table.audit .c-when { width: 11em; }
table.audit .c-who { width: 8em; }
table.audit .c-ip { width: 9em; }
table.audit .c-what { width: 28%; }
table.audit td.nowrap { white-space: normal; }
/* phones: each entry becomes a small card instead of a squeezed table row */
@media (max-width: 600px) {
  table.audit, table.audit tbody, table.audit tr, table.audit td { display: block; width: auto; }
  table.audit colgroup, table.audit tr:has(th) { display: none; }
  table.audit tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.audit td { border: 0; padding: 1px 0; }
  table.audit td.hide-sm { display: none; }
}
/* ---- admin overview charts (dataviz reference palette: status + categorical slots 1-3) ---- */
:root {
  --st-good: #0ca30c; --st-warn: #fab219; --st-bad: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --chart-base: #c9ced8;
}
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --chart-base: #3a4150; }
}
.health { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.health li { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--bg);
  display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.health li.warn { border-color: var(--st-warn); }
.health li.bad { border-color: var(--st-bad); }
.health .hhead { line-height: 1.45; overflow-wrap: anywhere; }
.health .hhead { font-size: 15px; }
.health .hdetail { overflow-wrap: anywhere; }
@media (max-width: 700px) { .health { grid-template-columns: 1fr; } }
.health .sym { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font-size: 11px; font-weight: 700; color: #fff; margin-right: 6px; vertical-align: 1px; }
.health li.good .sym { background: var(--st-good); }
.health li.warn .sym { background: var(--st-warn); color: #3a2a00; }
.health li.bad .sym { background: var(--st-bad); }
.hviz { margin-top: auto; }
svg.meter, svg.stack, svg.cols { display: block; overflow: visible; }
svg.meter .track { fill: var(--st-good); fill-opacity: .16; }
.warn svg.meter .track { fill: var(--st-warn); }
.bad svg.meter .track { fill: var(--st-bad); }
svg.meter .fill.good { fill: var(--st-good); }
svg.meter .fill.warn { fill: var(--st-warn); }
svg.meter .fill.bad { fill: var(--st-bad); }
svg.stack .s1, .key.s1 { fill: var(--s1); background: var(--s1); }
svg.stack .s2, .key.s2 { fill: var(--s2); background: var(--s2); }
svg.stack .s3, .key.s3 { fill: var(--s3); background: var(--s3); }
svg.stack .gap { fill: var(--panel); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.legend strong { color: var(--text); font-weight: 600; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
svg.strip .day.yes, .key.day-yes { fill: var(--st-good); background: var(--st-good); }
svg.strip .day.no { fill: none; stroke: var(--chart-base); stroke-width: 1.5; }
.key.day-no { background: none; border: 1.5px solid var(--chart-base); width: 9px; height: 9px; }
.bad svg.strip .day.no { stroke: var(--st-bad); }
svg.cols .col { fill: var(--s1); }
svg.cols .hit { fill: transparent; }
svg.cols g:hover .col { fill-opacity: .8; }
svg.cols g:hover .hit { fill: var(--code-bg); }
svg.cols .base { fill: var(--chart-base); }
.axis { display: flex; justify-content: space-between; margin-top: 4px; font-variant-numeric: tabular-nums; }
/* circle meters (Disk, Memory) */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
svg.ring { flex: none; }
svg.ring circle { fill: none; stroke-width: 11; }
svg.ring .track { stroke: var(--st-good); stroke-opacity: .16; }
svg.ring .fill { stroke: var(--st-good); stroke-linecap: round; }
svg.ring.warn .track, svg.ring.warn .fill { stroke: var(--st-warn); }
svg.ring.bad .track, svg.ring.bad .fill { stroke: var(--st-bad); }
svg.ring .pct { fill: var(--text); font-size: 21px; font-weight: 700; }
dl.figs { margin: 0; display: grid; gap: 4px; font-size: 13px; }
dl.figs div { display: flex; gap: 10px; }
dl.figs dt { color: var(--muted); width: 52px; }
dl.figs dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
/* tabs never wrap or get cut off: on narrow screens the row scrolls sideways */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; flex: none; }
@media (max-width: 600px) {
  header.top nav { gap: 4px; font-size: 14px; flex-wrap: nowrap; }
  .pills a, .tabs a, .pill-out { padding: 5px 10px; }
  .pills .user .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pills .user { padding: 4px; }
  .pills .user .avatar { margin-left: 0; width: 26px; height: 26px; }
  .brand { font-size: 17px; }
}
@media (max-width: 380px) { .brand .b1, .brand .b2 { display: none; } }
/* overview tiles: prominent titles; each figure in its own text-safe color (>= 4.5:1 on the panel) */
:root { --fig-repos: #1f6feb; --fig-people: #6250d6; --fig-server: #1a7f37; }
@media (prefers-color-scheme: dark) { :root { --fig-repos: #4c8dff; --fig-people: #9085e9; --fig-server: #3fb950; } }
.stat .stat-title { font-size: 15px; font-weight: 700; color: var(--text); }
.stat .big { font-size: 30px; }
.t-repos .big { color: var(--fig-repos); }
.t-people .big { color: var(--fig-people); }
/* server memory follows its status, so it never looks fine while the Memory card warns */
.t-server .big { color: var(--fig-server); }
.t-server.mem-warn .big { color: var(--warn); }
.t-server.mem-bad .big { color: var(--bad); }

/* mirroring */
.error-text { color: var(--bad); }
td.wrap { overflow-wrap: anywhere; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.actions form { margin: 0; }
.badge.bad { color: var(--bad); border-color: var(--bad); }
