:root {
  --bg: #f4f6f9; --panel: #ffffff; --line: #e3e8ee; --text: #1c2733; --muted: #64748b;
  --brand: #c62828; --brand-dark: #a31f1f; --accent: #1d4ed8;
  --ok: #15803d; --warn: #b45309; --err: #b91c1c;
  --radius: 10px; --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14.5px; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.topbar { background: #16212e; color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 52px; position: sticky; top: 0; z-index: 10; }
.topbar .logo { font-weight: 700; letter-spacing: .3px; color: #fff; }
.topbar .logo span { color: #ff8a80; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #cbd5e1; padding: 6px 11px; border-radius: 6px; font-weight: 500; }
.topbar nav a:hover { background: #223146; color: #fff; text-decoration: none; }
.topbar nav a.active { background: var(--brand); color: #fff; }
.topbar .who { color: #94a3b8; font-size: 13px; }
.badge-dot { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }
.btn-link { background: none; border: none; color: #cbd5e1; cursor: pointer; font-size: 14px; padding: 6px 10px; }
.btn-link:hover { color: #fff; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
h1 { font-size: 21px; margin: 0; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; min-width: 150px; flex: 1; color: inherit; }
.stat .n { font-size: 26px; font-weight: 700; } .stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f8fafc; }
tr:hover td { background: #fafbfd; }
.table-scroll { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-Open { background: #e0edff; color: #1d4ed8; } .st-InProcess { background: #fef3c7; color: #92400e; }
.st-Waiting { background: #ede9fe; color: #6d28d9; } .st-Resolved { background: #d1fae5; color: #065f46; }
.st-Closed { background: #e5e7eb; color: #374151; }
.tag { display: inline-block; background: #fee2e2; color: #991b1b; border-radius: 5px; padding: 1px 7px; font-size: 11.5px; font-weight: 600; margin-right: 4px; }
.tag.autoclosed { background: #dbeafe; color: #1e40af; }
.stale-flag { color: var(--warn); font-weight: 700; font-size: 12px; }
form.inline { display: inline; }
label { display: block; font-weight: 600; font-size: 12.5px; margin: 10px 0 4px; color: #334155; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea, input[type=file] {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: var(--accent); }
.btn { display: inline-block; background: var(--brand); color: #fff; border: none; border-radius: 7px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn.secondary { background: #475569; } .btn.secondary:hover { background: #334155; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid #cbd5e1; } .btn.ghost:hover { background: #f1f5f9; }
.btn.small { padding: 5px 10px; font-size: 12.5px; } .btn.ok { background: var(--ok); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-weight: 500; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filters > div { min-width: 130px; } .filters label { margin-top: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.chip { background: #eef2f7; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; color: #334155; cursor: pointer; }
.chip:hover { background: #e2e8f0; text-decoration: none; } .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 8px 0 8px 14px; margin-left: 6px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; border: 2px solid #fff; }
.timeline li.ev-status_change::before, .timeline li.ev-reopened::before { background: var(--accent); }
.timeline li.ev-auto_closed::before { background: var(--brand); } .timeline li.ev-comment::before { background: var(--ok); }
.timeline .meta { color: var(--muted); font-size: 12px; } .timeline .body { margin-top: 2px; }
.kv { display: grid; grid-template-columns: 170px 1fr; row-gap: 7px; }
.kv dt { color: var(--muted); font-size: 12.5px; } .kv dd { margin: 0; font-weight: 500; }
.login-box { max-width: 400px; margin: 9vh auto; }
.login-box .logo { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 18px; }
.public-wrap { max-width: 640px; margin: 5vh auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mt { margin-top: 14px; } .right { text-align: right; }
.mock-note { background: #fffbeb; border: 1px dashed #f59e0b; color: #92400e; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 12px; }

/* ── jQuery UI layer: toasts, modal, sortable headers, counters ── */
#toast-zone { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #16212e; color: #fff; border-radius: 9px; padding: 11px 16px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  font-weight: 500; min-width: 220px; max-width: 360px; display: flex; align-items: center; gap: 10px; }
.toast.ok { border-left: 4px solid #34d399; } .toast.err { border-left: 4px solid #f87171; }
.jq-modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 90; display: flex; align-items: center; justify-content: center; }
.jq-modal { background: #fff; border-radius: 12px; padding: 22px 24px; max-width: 420px; width: 92%; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.jq-modal h3 { margin: 0 0 8px; font-size: 16px; }
.jq-modal p { margin: 0 0 16px; color: #475569; }
.jq-modal .actions { display: flex; gap: 8px; justify-content: flex-end; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brand); }
th.sortable::after { content: ' ↕'; opacity: .35; font-size: 10px; }
th.sortable.asc::after { content: ' ▲'; opacity: 1; }
th.sortable.desc::after { content: ' ▼'; opacity: 1; }
.char-counter { text-align: right; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.char-counter.warn { color: var(--warn); font-weight: 600; }
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; }
.pagination .page-item .page-link { display: inline-block; padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; }
.pagination .page-item.active .page-link { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .page-item.disabled .page-link { opacity: .4; pointer-events: none; }
