:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1d2330; --muted: #677085; --border: #dfe3ea;
  --accent: #2f5bea; --accent-dark: #2447bd; --danger: #c62f2f; --warn: #b8730a; --ok: #1f8a4c;
  --note: #fff8e1; --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: #1d2330; color: #fff; }
header.top .wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding-block: .75rem; }
header.top a { color: #d6dcff; }
header.top .brand { font-weight: 700; color: #fff; font-size: 1.1rem; }
header.top nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; }
header.top .user { display: flex; gap: .75rem; align-items: center; font-size: .9rem; color: #aab3c8; }
header.top form { margin: 0; }
.wrap { max-width: 1150px; margin: 0 auto; padding-inline: 1rem; }
main.wrap { padding-block: 1.5rem 3rem; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.muted { color: var(--muted); font-size: .9rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }
.btn, button { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: .5rem 1rem; font: inherit; cursor: pointer; }
.btn:hover, button:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary, button.secondary { background: #e7eaf0; color: var(--text); }
button.danger { background: var(--danger); }
button.link { background: none; color: #d6dcff; padding: 0; }
label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .9rem; }
input[type=text], input[type=password], input[type=email], input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff;
}
textarea { resize: vertical; }
.field { margin-bottom: .9rem; }
.field.inline label { display: inline; font-weight: normal; }
.helptext, .field .help { color: var(--muted); font-size: .8rem; }
.errorlist { color: var(--danger); margin: .25rem 0; padding-left: 1rem; font-size: .85rem; }
.filters { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.filters .field { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr.breached td:first-child { box-shadow: inset 3px 0 var(--danger); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e7eaf0; white-space: nowrap; }
.status-new { background: #dfe8ff; color: #2447bd; }
.status-open { background: #e0f4ea; color: #1f6e41; }
.status-pending { background: #fff0d6; color: #8a5600; }
.status-resolved { background: #e9e4fb; color: #5a3fb0; }
.status-closed { background: #eceef1; color: #5b6272; }
.prio-low { background: #eceef1; color: #5b6272; }
.prio-normal { background: #dfe8ff; color: #2447bd; }
.prio-high { background: #ffe6cc; color: #9a4b00; }
.prio-urgent { background: #fbd9d9; color: #a11f1f; }
.breach { background: var(--danger); color: #fff; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem 1rem; border-radius: 6px; margin-bottom: .5rem; background: #e0f4ea; color: #1f6e41; }
.messages li.error { background: #fbd9d9; color: #a11f1f; }
.message { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .75rem; background: var(--surface); }
.message.agent { border-left: 3px solid var(--accent); }
.message.internal { background: var(--note); border-left: 3px solid var(--warn); }
.message .meta { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .9rem; }
dl.props { display: grid; grid-template-columns: auto 1fr; gap: .35rem .75rem; margin: 0; font-size: .92rem; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.timeline li { padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.stat { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat.danger { color: var(--danger); }
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: 90px 1fr 36px; align-items: center; gap: .5rem; margin-bottom: .4rem; font-size: .9rem; }
.bars .bar { height: 10px; background: var(--accent); border-radius: 4px; }
.bars .track { background: #eceef1; border-radius: 4px; }
.pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.auth { max-width: 420px; margin: 2rem auto; }
.empty { text-align: center; padding: 2rem; color: var(--muted); }
.form > div { margin-bottom: .9rem; }
.form input[type=checkbox] { margin-right: .4rem; }
.form input[type=file] { font-size: .9rem; }
