:root {
  --bg: #f7f6f3; --surface: #ffffff; --surface-2: #f1efe9; --text: #1f1e1b; --text-2: #5f5d57; --muted: #8a877f;
  --border: #e4e1d9; --border-strong: #cfcbc0; --accent: #2f5bd3; --accent-bg: #e8eefc;
  --ok: #2d7a3e; --ok-bg: #e5f2e7; --warn: #8a5a00; --warn-bg: #fbf0d9; --bad: #b0362d; --bad-bg: #fbe8e6;
  --pro: #6b45c7; --pro-bg: #efe9fb; --on-accent: #ffffff; --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614; --surface: #1f1f1c; --surface-2: #282825; --text: #ecebe6; --text-2: #b3b1aa; --muted: #85837c;
    --border: #33322e; --border-strong: #47463f; --accent: #7d9cf0; --accent-bg: #1f2a47;
    --ok: #7cc68b; --ok-bg: #1d3323; --warn: #e3b75a; --warn-bg: #3a2e14; --bad: #ef8b82; --bad-bg: #42201d;
    --pro: #b49af0; --pro-bg: #2c2342; --on-accent: #10172b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: 13px; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 20px; }
.brand { font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; position: relative; }
.brand .dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--text-2); padding: 6px 10px; border-radius: 8px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head .lede { color: var(--text-2); max-width: 760px; margin-top: 8px; font-size: 16px; white-space: pre-line; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 12px; }
.section-head .hint { color: var(--muted); font-size: 13px; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 550; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
form.inline { display: inline; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.card.pad { padding: 18px 20px; }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.projects { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stat .k { color: var(--text-2); font-size: 13px; }
.stat .v { font-size: 26px; font-weight: 650; margin-top: 2px; letter-spacing: -0.01em; }
.stat .s { color: var(--muted); font-size: 12px; }

.pcard { display: block; color: var(--text); padding: 18px 20px; transition: border-color .15s; }
.pcard:hover { border-color: var(--border-strong); text-decoration: none; }
.pcard p { color: var(--text-2); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .meta { display: flex; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pcard .big { font-size: 22px; font-weight: 650; color: var(--text); margin-top: 12px; }
.pcard .big small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 550; padding: 2px 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-planned, .b-testing { background: var(--surface-2); color: var(--text-2); }
.b-running { background: var(--accent-bg); color: var(--accent); }
.b-done, .b-positive { background: var(--ok-bg); color: var(--ok); }
.b-weak { background: var(--warn-bg); color: var(--warn); }
.b-failed, .b-negative { background: var(--bad-bg); color: var(--bad); }
.b-dropped { background: var(--surface-2); color: var(--muted); }

.trail { list-style: none; margin: 0; padding: 0; }
.trail > li { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--border); }
.trail > li:first-child { border-top: 0; }
.trail .key { width: 40px; height: 40px; border-radius: 10px; background: var(--pro-bg); color: var(--pro);
  display: flex; align-items: center; justify-content: center; font-weight: 650; font-size: 14px; }
.trail .desc { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.trail .decision { margin-top: 8px; font-size: 14px; padding-left: 10px; border-left: 3px solid var(--border-strong); }
.trail .exps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 8px;
  border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.chip:hover { border-color: var(--border-strong); text-decoration: none; }
.chip .st { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.st-running { background: var(--accent) !important; } .st-done { background: var(--ok) !important; } .st-failed { background: var(--bad) !important; }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.col { background: var(--surface-2); border-radius: 14px; padding: 10px; min-height: 120px; }
.col h3 { font-size: 13px; color: var(--text-2); font-weight: 600; padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.col h3 span { color: var(--muted); font-weight: 500; }
.ecard { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  margin-bottom: 8px; color: var(--text); }
.ecard:hover { border-color: var(--border-strong); text-decoration: none; }
.ecard .id { font-weight: 650; font-size: 13px; }
.ecard .t { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.ecard .h { font-size: 13px; margin-top: 6px; font-weight: 600; }
.bar { height: 5px; background: var(--surface-2); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.empty-col { color: var(--muted); font-size: 13px; padding: 6px; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid-l { stroke: var(--border); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.chart .lbl { fill: var(--text); font-size: 12px; font-weight: 600; text-anchor: middle; }
.chart .key { fill: var(--muted); font-size: 11px; text-anchor: middle; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; color: var(--text); }
a.row:hover { background: var(--surface-2); text-decoration: none; }
.row .sub { color: var(--muted); font-size: 13px; }
.row .icon { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-bg); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }

.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty h3 { margin-bottom: 6px; color: var(--text); }
.empty p { margin-bottom: 14px; }

.two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.prose { white-space: pre-line; }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 6px; }
.block + .block { margin-top: 18px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.gallery img { width: 100%; display: block; background: #fff; }
.gallery figcaption { font-size: 13px; padding: 8px 12px; color: var(--text-2); border-top: 1px solid var(--border); }
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { background: var(--surface-2); color: var(--text-2); font-weight: 600; position: sticky; top: 0; }
pre.yaml { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 0; line-height: 1.5; }
details summary { cursor: pointer; color: var(--text-2); font-size: 14px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field small { color: var(--muted); font-weight: 400; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 8px 10px; }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 420px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
input[type=file] { font-size: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }

.flash { max-width: 1120px; margin: 16px auto 0; padding: 0 20px; }
.flash div, .alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; background: var(--ok-bg); color: var(--ok); }
.flash .error, .alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.secret { font-family: var(--mono); font-size: 15px; background: var(--surface); padding: 6px 10px; border-radius: 8px;
  border: 1px dashed var(--border-strong); display: inline-block; margin-top: 6px; user-select: all; color: var(--text); }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { margin-bottom: 18px; font-size: 17px; }

.report-frame { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: 14px; background: #fff; display: block; }
.weeks { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  .who .name { display: none; }
}
@media (max-width: 520px) {
  .board { grid-template-columns: 1fr; }
  .trail > li { grid-template-columns: 1fr; }
  .trail .key { display: none; }
  .nav { display: none; }
  h1 { font-size: 22px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
