:root {
  --bg: #0f1420;
  --panel: #1a2233;
  --panel2: #202a40;
  --text: #e6ebf5;
  --muted: #8b97ad;
  --line: #2c3750;
  --accent: #4f8cff;
  --ok: #3fb96a;
  --err: #e05b5b;
  --warn: #e0a94f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .5px; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--text); }
.topbar .who { color: var(--muted); font-size: 13px; }
main { max-width: 1080px; margin: 24px auto; padding: 0 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin-bottom: 20px;
}
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { margin: 18px 0 10px; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.ok { color: var(--ok); }
.ml { margin-left: 0; }
.searchbox h1 { margin-bottom: 8px; }
#search-form { display: flex; gap: 10px; margin: 12px 0 6px; }
#q { flex: 1; }
input, select, textarea, button {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 12px; font: inherit;
}
button { cursor: pointer; }
button.primary, button.act { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
textarea { width: 100%; resize: vertical; }
label { display: block; margin: 10px 0; }
label input, label select { width: 100%; margin-top: 4px; }
.login { max-width: 380px; margin: 80px auto; }
.hint { color: var(--muted); font-size: 13px; }
.results { margin-top: 14px; }
.hit { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: var(--panel2); }
.hit h3 { margin: 0 0 6px; }
.hit .det { color: var(--muted); font-size: 13px; }
.hit table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
.hit td, .hit th { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.hit th { width: 160px; color: var(--muted); }
.no-match { color: var(--warn); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .grid.two { grid-template-columns: 1fr; } }
.card.site { margin-bottom: 0; }
.profile { width: 100%; border-collapse: collapse; font-size: 13px; }
.profile th, .profile td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.profile th { width: 40%; color: var(--muted); }
.actions { margin-top: 12px; }
.actions button { margin-right: 6px; }
.result { margin: 8px 0 0; }
table.tickets { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tickets th, table.tickets td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
table.tickets th { color: var(--muted); font-weight: 600; }
.status, .prio, .badge { border-radius: 20px; padding: 2px 10px; font-size: 12px; white-space: nowrap; }
.s-open { background: #274768; color: #9cc5ff; }
.s-in_progress { background: #3a4a1f; color: #cfe8a0; }
.s-resolved { background: #1f4a33; color: #7fe0a8; }
.s-closed { background: #333a48; color: #9aa3b5; }
.p-low { background: #2a3442; color: #b7c2d6; }
.p-normal { background: #274768; color: #9cc5ff; }
.p-high { background: #5a421f; color: #f0d08a; }
.p-urgent { background: #5a1f1f; color: #ff9c9c; }
.filters { display: flex; gap: 10px; margin-bottom: 16px; }
.thread .msg { border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel2); }
.thread .msg.note { border-left-color: var(--warn); }
.thread .msg p { margin: 6px 0 0; white-space: pre-wrap; }
.row { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.chk { display: flex; align-items: center; gap: 6px; }
#status-form { display: flex; gap: 10px; margin-top: 16px; }
#status-form select { flex: 1; }
details.ai { margin-top: 18px; border: 1px dashed var(--line); padding: 12px; border-radius: 8px; }
details.ai summary { cursor: pointer; font-weight: 600; }
.action-list { margin: 10px 0; display: flex; gap: 10px; }
.notes { list-style: none; padding: 0; }
.notes li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.notes li p { margin: 4px 0; white-space: pre-wrap; }
form#note-form, form#ticket-form { margin-top: 14px; }
form#ticket-form input, form#ticket-form select { margin-bottom: 8px; width: 100%; }
#user-form input, #user-form select { margin-bottom: 8px; width: 100%; }
.link { color: var(--muted); font-size: 13px; }
.meta { display: flex; gap: 10px; align-items: center; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.spin { opacity: .6; pointer-events: none; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.titem { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.titem:last-child { border-bottom: none; }
.tdate { color: var(--muted); min-width: 132px; font-size: 12px; }
.tsite { color: var(--accent); font-weight: 600; min-width: 130px; font-size: 12px; }
.tlabel { color: var(--text); min-width: 130px; font-weight: 600; }
.ttitle { color: var(--text); }
.tdetail { color: var(--muted); font-size: 13px; }
.scripts { display: flex; flex-direction: column; gap: 10px; }
.script { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 12px; background: var(--panel2); }
.script p { margin: 6px 0 0; }
.tmpl-pick { margin-bottom: 8px; }
.tmpl-pick select { width: 100%; }
details.tt { display: inline-block; margin-left: 6px; }
details.tt summary { cursor: pointer; color: var(--muted); }
