:root {
  --ink: #161616; --ink2: #525252; --ink3: #6f6f6f; --line: #e0e0e0; --line2: #c6c6c6; --bg: #f4f4f4; --layer: #ffffff;
  --blue: #0f62fe; --blue-bg: #edf5ff; --red: #da1e28; --red-bg: #fff1f1; --green: #198038; --green-bg: #defbe6;
  --teal: #007d79; --teal-bg: #d9fbfb; --purple: #8a3ffc; --purple-bg: #f6f2ff; --yellow: #f1c21b; --yellow-bg: #fcf4d6;
  --magenta: #d02670; --gray-bg: #e0e0e0; --flash: #fff8c4;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); letter-spacing: .16px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }

.top { position: fixed; inset: 0 0 auto 0; height: 48px; background: var(--ink); color: #f4f4f4; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; z-index: 5; border-bottom: 1px solid #393939; }
.brand { display: flex; align-items: center; gap: 10px; }
.product { font-weight: 600; font-size: 14px; }
.sep { width: 1px; height: 20px; background: #525252; }
.tenant { color: #c6c6c6; }
.right { display: flex; align-items: center; gap: 18px; color: #c6c6c6; font-size: 13px; }
.env { background: #393939; color: #f1c21b; font-size: 11px; font-weight: 600; letter-spacing: .32px; padding: 3px 8px; border-radius: 12px; }
.user { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #4589ff; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 600; }

.side { position: fixed; top: 48px; bottom: 0; left: 0; width: 232px; background: var(--layer); border-right: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; }
.side a { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 40px; color: var(--ink2); font-weight: 500; border-left: 3px solid transparent; }
.side a svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.side a:hover { background: #e8e8e8; text-decoration: none; color: var(--ink); }
.side a.on { background: #e0e0e0; color: var(--ink); border-left-color: var(--blue); }
.side .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; min-width: 22px; height: 18px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center; }
.side .count:empty { display: none; }
.side-foot { margin-top: auto; padding: 12px 16px; font-size: 12px; color: var(--ink3); }

main { margin: 48px 0 0 232px; padding: 24px 32px 48px; min-height: calc(100vh - 48px); }
.crumbs { font-size: 12px; color: var(--ink3); margin-bottom: 6px; }
h1 { font-size: 26px; font-weight: 400; margin: 0 0 4px; line-height: 1.25; }
.sub { color: var(--ink2); margin: 0 0 20px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 20px; }
.tile { background: var(--layer); padding: 14px 16px; }
.tile .k { font-size: 12px; color: var(--ink2); }
.tile .v { font-size: 30px; font-weight: 300; margin-top: 4px; line-height: 1.15; }
.tile .v small { font-size: 13px; color: var(--ink3); font-weight: 400; margin-left: 6px; }
.tile.red .v { color: var(--red); } .tile.green .v { color: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip { background: var(--layer); border: 1px solid var(--line2); border-radius: 16px; padding: 4px 12px; font-size: 12px; color: var(--ink2); cursor: pointer; }
.chip b { color: var(--ink); font-weight: 600; margin-left: 4px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); } .chip.on b { color: #fff; }

.tabs { display: flex; border-bottom: 1px solid var(--line2); margin-bottom: 0; background: transparent; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 16px; font: inherit; color: var(--ink2); cursor: pointer; }
.tabs button.on { border-bottom-color: var(--blue); color: var(--ink); font-weight: 600; }

.toolbar { display: flex; gap: 8px; align-items: center; background: var(--layer); padding: 8px; border: 1px solid var(--line); border-bottom: 0; }
.toolbar input, .toolbar select { font: inherit; height: 32px; border: 0; border-bottom: 1px solid var(--ink3); background: var(--bg); padding: 0 12px; min-width: 260px; }
.toolbar select { min-width: 180px; }

table.dt { width: 100%; border-collapse: collapse; background: var(--layer); border: 1px solid var(--line); }
.dt th { text-align: left; font-weight: 600; font-size: 13px; background: var(--gray-bg); padding: 10px 12px; white-space: nowrap; }
.dt td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.dt tr.click { cursor: pointer; }
.dt tr.click:hover td { background: #e8e8e8; }
.dt tr.closed td { color: var(--ink3); }
.dt td.desc { max-width: 520px; }
.dt .muted { color: var(--ink3); font-size: 12px; }
.dt td.num, .dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
.flash td { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 35% { background: var(--flash); } 100% { background: transparent; } }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--gray-bg); color: var(--ink); }
.tag.red { background: #ffd7d9; color: #750e13; } .tag.blue { background: #d0e2ff; color: #002d9c; } .tag.teal { background: #9ef0f0; color: #004144; }
.tag.purple { background: #e8daff; color: #491d8b; } .tag.green { background: #a7f0ba; color: #044317; } .tag.yellow { background: #fcf4d6; color: #8e6a00; }
.tag.magenta { background: #ffd6e8; color: #740937; } .tag.outline { background: transparent; border: 1px solid var(--line2); color: var(--ink2); }
.prio { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.prio::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--line2); }
.prio.High::before { background: var(--red); } .prio.Medium::before { background: #ff832b; } .prio.Low::before { background: var(--line2); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.card { background: var(--layer); border: 1px solid var(--line); padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.card .big { font-size: 20px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--ink3); }
.span2 { grid-column: span 2; }
h2 { font-size: 18px; font-weight: 400; margin: 28px 0 10px; }

.notice { display: flex; gap: 12px; align-items: flex-start; border-left: 3px solid var(--red); background: var(--red-bg); padding: 12px 16px; margin: 0 0 12px; }
.notice.warn { border-color: var(--yellow); background: var(--yellow-bg); }
.notice.ok { border-color: var(--green); background: var(--green-bg); }
.notice b { font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; background: var(--layer); border: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 150px 190px 1fr; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline .who { color: var(--ink2); }
.timeline li.agent .who { color: var(--purple); font-weight: 600; }
.timeline li.agent { background: #faf7ff; }

.drawer { position: fixed; top: 48px; right: 0; bottom: 0; width: 520px; background: var(--layer); border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0,0,0,.08); z-index: 4; overflow: auto; padding: 20px 24px 40px; }
.drawer .x { position: absolute; top: 14px; right: 16px; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink2); }
.drawer h2 { margin-top: 4px; }
.note { border-left: 3px solid var(--line2); padding: 8px 12px; margin: 8px 0; background: var(--bg); font-size: 13px; white-space: pre-wrap; }
.note.agent { border-left-color: var(--purple); background: #faf7ff; }
.note .meta { font-size: 12px; color: var(--ink3); margin-bottom: 4px; white-space: normal; }
.note.agent .meta b { color: var(--purple); }

.btn { font: inherit; background: var(--blue); color: #fff; border: 0; height: 40px; padding: 0 16px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.events { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.events li { padding: 4px 0 4px 16px; position: relative; color: var(--ink2); }
.events li::before { content: ''; position: absolute; left: 2px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--line2); }
.events li:last-child { color: var(--ink); } .events li:last-child::before { background: var(--blue); }
.empty { padding: 32px; text-align: center; color: var(--ink3); background: var(--layer); border: 1px solid var(--line); }
.dt td.mono, .dt td:has(> a.mono) { white-space: nowrap; }
.dt td:nth-child(2) { white-space: nowrap; }
