:root {
	--bg: #f6f5f2;
	--surface: #ffffff;
	--surface-2: #f0eee9;
	--border: #e3e0d8;
	--text: #1f1d1a;
	--text-2: #6b665d;
	--accent: rgb(123, 183, 60);
	--accent-ink: #1a2a0a;      /* text on accent fills */
	--accent-text: #4a7a1c;     /* accent used as text on light surfaces */
	--accent-soft: #eef6e4;
	--fatal: #9f1239;
	--error: rgb(235, 39, 39);
	--warning: #b45309;
	--info: rgb(198, 149, 198);
	--ok: #2f7d4f;
	--bad: #b42318;
	--spark: #c9c3b6;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(30, 25, 15, .05);
	--mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #151412;
		--surface: #1d1c19;
		--surface-2: #252420;
		--border: #34322d;
		--text: #ece9e3;
		--text-2: #9d978c;
		--accent: rgb(123, 183, 60);
		--accent-ink: #13200a;
		--accent-text: #9ccf66;
		--accent-soft: #24301a;
		--fatal: #f17a9a;
		--error: rgb(235, 39, 39);
		--warning: #e3b05a;
		--info: rgb(198, 149, 198);
		--ok: #6cc08e;
		--bad: #f0857a;
		--spark: #4a4740;
		--shadow: none;
		color-scheme: dark;
	}
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 54px; gap: 16px; }
.brand { font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); box-shadow: inset 0 -6px 0 rgba(0,0,0,.15); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: var(--text-2); padding: 6px 12px; border-radius: 7px; font-weight: 500; }
.topbar nav a:hover { background: var(--surface-2); text-decoration: none; }
.topbar nav a.active { color: var(--text); background: var(--surface-2); }

/* controls */
input[type=text], input[type=search], input[type=number], input[type=password], select {
	font: inherit; color: var(--text); background: var(--surface);
	border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 34px;
}
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
	font: inherit; font-weight: 550; cursor: pointer; border-radius: 8px; min-height: 34px;
	padding: 6px 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
.btn:hover { filter: brightness(1.07); }
.btn-sm { min-height: 28px; padding: 3px 11px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.icon-btn { font: inherit; background: none; border: 1px solid transparent; color: var(--text-2); cursor: pointer; border-radius: 6px; padding: 0 5px; }
.icon-btn:hover { border-color: var(--border); color: var(--text); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters input[type=search] { flex: 1 1 220px; min-width: 0; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg label { padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg label.on { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.checks { display: inline-flex; gap: 4px; }
.chk { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 500; }
.chk input { margin: 0; accent-color: var(--accent); }
.chk:has(input:not(:checked)) { color: var(--text-2); background: transparent; }

/* summary */
.summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; margin-bottom: 14px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile, .timeline, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tile { padding: 14px 14px 12px; }
.tile-num { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-label { color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.tile-hot .tile-num { color: var(--error); }
.timeline { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.timeline-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 550; flex-wrap: wrap; }
.timeline-head .muted { font-weight: 400; }

.spark { width: 120px; height: 26px; display: block; fill: var(--spark); }
.spark-lg { width: 100%; height: 56px; fill: var(--accent); }
.spark-base { stroke: var(--border); stroke-width: 1; }
.issue.sev-error .spark, .issue.sev-fatal .spark { fill: var(--error); opacity: .65; }
.issue.sev-warning .spark { fill: var(--warning); opacity: .6; }
.issue.sev-information .spark { fill: var(--info); opacity: .55; }

/* log chips */
.logchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
	display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
	background: var(--surface); border: 1px solid var(--border); border-radius: 999px; color: var(--text); font: inherit; cursor: pointer;
}
.chip:hover { text-decoration: none; border-color: var(--text-2); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
.chip b { font-weight: 550; }
.chip-n { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }
.chip-n.has { color: var(--error); }
.chip-sub { color: var(--text-2); font-size: 12px; }
.chip-err { border-color: var(--bad); }
.chip-err .chip-sub { color: var(--bad); }
.hidden-note { color: var(--text-2); margin: -6px 0 14px; font-size: 13px; }

/* issues */
.issues { display: flex; flex-direction: column; gap: 8px; margin-bottom: 30px; }
.issue { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 3px solid var(--spark); }
.issue.sev-fatal { border-left-color: var(--fatal); }
.issue.sev-error { border-left-color: var(--error); }
.issue.sev-warning { border-left-color: var(--warning); }
.issue.sev-information { border-left-color: var(--info); }
.issue.state-resolved, .issue.state-muted { opacity: .7; }
.issue > summary { list-style: none; cursor: pointer; display: flex; gap: 18px; padding: 12px 14px; align-items: center; }
.issue > summary::-webkit-details-marker { display: none; }
.issue > summary:hover { background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.issue[open] > summary { border-bottom: 1px solid var(--border); }
.issue-main { flex: 1; min-width: 0; }
.issue-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.sev { font-weight: 650; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.sev-fatal .sev { color: var(--fatal); }
.sev-error .sev { color: var(--error); }
.sev-warning .sev { color: var(--warning); }
.sev-information .sev { color: var(--info); }
.badge { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); line-height: 18px; }
.badge-new { background: var(--accent); color: var(--accent-ink); }
.badge-reg { background: var(--bad); color: #fff; }
.issue-log::before, .issue-app::before { content: "·"; margin-right: 6px; }
.issue-app { font-family: var(--mono); font-size: 11.5px; }
.issue-title { font-weight: 550; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.issue-loc { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-loc code { color: var(--text-2); font-size: 12px; }
.issue-stats { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.issue-count { text-align: right; min-width: 52px; }
.issue-count b { display: block; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.issue-count span { font-size: 11.5px; color: var(--text-2); }
.issue-when { display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); min-width: 92px; }
.issue-when span:first-child { color: var(--text); font-weight: 500; }
.issue-body { padding: 12px 14px 14px; }
.issue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.issue-actions form { margin: 0; }
.samples { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sample-meta { font-size: 12.5px; margin-bottom: 4px; }
.samples pre {
	margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px;
	white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto;
}
.empty { text-align: center; padding: 50px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-2); }
.empty-mark { font-size: 28px; color: var(--ok); }
.empty p { margin: 6px 0; }

/* settings */
.page-title { font-size: 22px; letter-spacing: -.02em; margin: 0 0 16px; }
.card { padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 6px; }
.card > p { margin: 0 0 14px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { border-color: var(--ok); color: var(--ok); }
.flash.bad { border-color: var(--bad); color: var(--bad); }
.table-wrap { overflow-x: auto; margin-bottom: 14px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 6px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.clip { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.move { white-space: nowrap; width: 1%; }
.in-sm { width: 100%; min-width: 120px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 0 8px; line-height: 19px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); margin-right: 4px; }
.pill-ok { color: var(--ok); }
.pill-bad { color: var(--bad); }
.pill-warn { color: var(--warning); }
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row-form label, .grid-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; }
.row-form label input { min-width: 220px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-form .span2 { grid-column: span 2; }
.hint { font-weight: 400; color: var(--text-2); font-size: 12.5px; }
.quick-add { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-add form { margin: 0; }
.chip-add { font-size: 13px; font-family: var(--mono); }
.foot { color: var(--text-2); font-size: 12px; padding-bottom: 30px; }

/* auth */
.logout-form { margin: 0; display: flex; }
.logout-form button { font: inherit; font-weight: 500; color: var(--text-2); background: none; border: 0; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.logout-form button:hover { background: var(--surface-2); color: var(--text); }
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; padding: 26px 26px 24px; margin: 0; }
.login-brand { margin-bottom: 18px; }
.login-box h1 { font-size: 18px; margin: 0 0 6px; }
.login-box p { margin: 0 0 16px; }
.login-box code { overflow-wrap: anywhere; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; }
.login-form input[type=password] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 36px; }
.login-form .btn { margin-top: 4px; min-height: 38px; }

@media (max-width: 900px) {
	.summary { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
	.wrap { padding: 0 16px; }
	.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.issue > summary { flex-direction: column; align-items: stretch; gap: 10px; }
	.issue-stats { justify-content: space-between; }
	.issue-count { text-align: left; }
	.grid-form { grid-template-columns: 1fr; }
	.grid-form .span2 { grid-column: auto; }
	.row-form label, .row-form label input { width: 100%; min-width: 0; }
	.seg { overflow-x: auto; max-width: 100%; }
}

.ipdiag { display: flex; flex-direction: column; gap: 4px; font-size: 13px; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; }
.ipdiag > div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.ipdiag code { overflow-wrap: anywhere; }
.warn-note { margin: 8px 0 0; color: var(--warning); }

.badge-esc { background: color-mix(in srgb, var(--fatal) 16%, transparent); color: var(--fatal); }
.fatal-form textarea {
	width: 100%; font: 13px/1.6 var(--mono); color: var(--text); background: var(--surface);
	border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical;
}
.fatal-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fatal-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.inline-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.inline-check input { accent-color: var(--accent); margin: 0; }
.task-box { margin-top: 18px; padding: 14px; background: var(--surface-2); border-radius: 8px; display: flex; flex-direction: column; gap: 10px; }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.task-head form { margin: 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
.task-box .hint { margin: 0; }
.last-send { margin: 0; font-size: 13px; }
