:root {
    --ink: #1c1917;
    --muted: #78716c;
    --line: #e7e5e4;
    --paper: #f6f4f1;
    --card: #fffcf8;
    --accent: #be123c;
    --sidebar: #1c1917;
    --sidebar-text: #f5f5f4;
    --ok: #3f6212;
    --warn: #a16207;
    --bad: #9f1239;
    --info: #1d4ed8;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 0.3rem; }
h2 { font-size: 1rem; margin: 0; }
code, pre, .key, .fn, .loc { font-family: Consolas, ui-monospace, monospace; }
pre {
    background: #fff;
    border: 1px solid var(--line);
    padding: 0.75rem 1rem;
    overflow: auto;
    white-space: pre-wrap;
}

.shell { display: flex; min-height: 100vh; }
aside {
    width: 220px;
    flex: none;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.brand { color: white; font-weight: 650; font-size: 1.05rem; text-decoration: none; }
.brand span { color: #fda4af; }
.brand-note { color: #a8a29e; font-size: 0.8rem; margin: 0 0 1rem; }
aside nav { display: flex; flex-direction: column; gap: 0.2rem; }
aside nav a {
    color: #e7e5e4;
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}
aside nav a.active, aside nav a:hover { background: #292524; text-decoration: none; }
.aside-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: #a8a29e; font-size: 0.85rem; }
.aside-foot button, button.quiet {
    background: transparent;
    color: inherit;
    border: 1px solid #44403c;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}
main { flex: 1; padding: 1.5rem 1.75rem 3rem; min-width: 0; }
.lede, .meta, .hint, .empty { color: var(--muted); }
.hint { font-size: 0.85rem; }
.eyebrow { color: var(--muted); margin: 0 0 0.35rem; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.crumb { color: var(--muted); margin: 0 0 0.8rem; }
.issue-head { margin-bottom: 1rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.stats article, .panel, .banner, .login-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.stats article { padding: 0.8rem 1rem; }
.stats span { display: block; color: var(--muted); font-size: 0.8rem; }
.stats strong { font-size: 1.6rem; }
.panel { margin: 1rem 0; padding: 0.9rem 1rem 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; }
.prose p { white-space: pre-wrap; margin: 0; }
.banner { padding: 1rem; border-color: #fecdd3; background: #fff1f2; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr); gap: 1rem; align-items: start; }
.side { min-width: 0; }

.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.grid th, .grid td { padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.issue-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.issue-link:hover .title { text-decoration: underline; }
.issue-link .key { color: var(--accent); font-size: 0.8rem; }
.issue-link .title { font-weight: 600; }

.pill {
    display: inline-block;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.75rem;
    background: #f5f5f4;
    border: 1px solid var(--line);
    white-space: nowrap;
}
.priority-low { color: var(--ok); }
.priority-medium { color: var(--warn); }
.priority-high, .priority-critical, .status-regressed { color: var(--bad); background: #fff1f2; }
.status-open { color: var(--info); background: #eff6ff; }
.status-inprogress { color: #6d28d9; background: #f5f3ff; }
.status-resolved { color: var(--ok); background: #f7fee7; }
.status-ignored { color: var(--muted); }
.pill.hub { color: #9f1239; background: #fff1f2; }

.filters, .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0.8rem 0; }
input, select, textarea, button, .button {
    font: inherit;
    border-radius: 8px;
    border: 1px solid #d6d3d1;
    padding: 0.45rem 0.6rem;
    background: white;
    color: var(--ink);
}
button, .button {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}
button.quiet { background: white; color: var(--ink); }
.stack-form { display: flex; flex-direction: column; gap: 0.7rem; }
.stack-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.stack-form label.check { flex-direction: row; align-items: center; color: var(--ink); }
.stack-form input, .stack-form select, .stack-form textarea { color: var(--ink); }

.flash { padding: 0.6rem 0.8rem; border-radius: 8px; background: #ecfccb; color: #365314; }
.flash.error { background: #ffe4e6; color: #9f1239; }
.stack, .crumbs, .activity { list-style: none; margin: 0; padding: 0; }
.stack li { padding: 0.35rem 0.5rem; border-left: 3px solid #e7e5e4; margin: 0.25rem 0; }
.stack li.in-app { border-left-color: var(--accent); background: #fff7f8; }
.stack .fn { display: block; }
.stack .loc, .crumbs .cat { color: var(--muted); font-size: 0.8rem; }
.crumbs li, .activity li { padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.activity li.change { color: var(--muted); }
.activity p { margin: 0.2rem 0 0; white-space: pre-wrap; }
.tags { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0; }
.tags div { margin: 0; }
.tags dt { color: var(--muted); font-size: 0.75rem; }
.tags dd { margin: 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.panel h3 { font-size: 0.92rem; margin: 0.9rem 0 0.35rem; }
.error-block { margin: 0.35rem 0 0.6rem; }
.log-list { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow: auto; }
.log-list li { font-family: Consolas, ui-monospace, monospace; font-size: 0.78rem; padding: 0.2rem 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; }
.log-list .lvl { color: var(--muted); display: inline-block; min-width: 4.5rem; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(420px, calc(100% - 2rem)); padding: 1.5rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.login-card button, .login-card a.button { margin-top: 0.4rem; }
.login-card a.button { display: block; text-align: center; }
.login-card .or { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0.8rem 0 0; }

@media (max-width: 860px) {
    .shell { display: block; }
    aside { width: auto; }
    aside nav { flex-direction: row; flex-wrap: wrap; }
    .aside-foot { margin-top: 0.8rem; }
    .stats, .split, .tags { grid-template-columns: 1fr; }
    .log-list { max-height: 16rem; }
    main { padding: 1rem; }
}
