
:root {
  --bg: #f4f6f8;
  --card: #fff;
  --line: #dde3ea;
  --text: #1f2933;
  --muted: #6b7280;
  --accent: #0d6efd;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { background: #111827; color: #fff; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .75rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.topbar a { color: #fff; opacity: .9; margin-left: .85rem; }
.brand { font-weight: 700; opacity: 1 !important; margin-left: 0 !important; }
.wrap { max-width: 1100px; margin: 1.25rem auto; padding: 0 1rem 2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.login-card { max-width: 420px; margin: 4rem auto; }
h1 { font-size: 1.35rem; margin: 0 0 1rem; }
label { display: block; font-size: .85rem; margin: .7rem 0 .25rem; color: var(--muted); }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
button, .btn {
  display: inline-block; border: 0; border-radius: 6px; padding: .55rem .9rem; background: var(--accent); color: #fff; font: inherit; cursor: pointer;
}
.btn-secondary { background: #6c757d; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: .6rem; align-items: end; margin-bottom: 1rem; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }
.muted { color: var(--muted); font-size: .85rem; }
.err { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; padding: .6rem .75rem; border-radius: 6px; margin-bottom: 1rem; }
.thread-list { display: flex; flex-direction: column; gap: .45rem; }
.thread-row {
  display: grid; grid-template-columns: 160px 1fr 120px 130px; gap: .75rem; align-items: center;
  padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.thread-row:hover { border-color: #bcd0f7; background: #f8fbff; }
.thread-row.kind-complaint { border-left: 4px solid #f0b429; }
.thread-row.kind-discussion { border-left: 4px solid #3bb273; }
.thread-row.kind-message { border-left: 4px solid #6b7280; }
.thread-row.kind-problem { border-left: 4px solid #e11d48; background: #fdecef; }
.thread-row.kind-problem:hover { background: #fbdce3; }
.login-cell { font-weight: 600; }
.preview { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; padding: .15rem .45rem; border-radius: 999px; color: #fff; font-size: .75rem; font-weight: 600; }
.meta { font-size: .8rem; color: var(--muted); text-align: right; }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: space-between; margin-top: 1rem; }
.msg { border: 1px solid var(--line); border-radius: 8px; padding: .8rem; margin-bottom: .6rem; background: #fff; }
.msg.out { background: #f0f7ff; }
.msg.in { background: #fff; }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.msg-body { white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.detail-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
@media (max-width: 700px) {
  .thread-row { grid-template-columns: 1fr; }
  .meta { text-align: left; }
}
