:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1c2330; --muted: #667085; --line: #d9dde3;
  --brand: #0b5cad; --brand-ink: #fff; --op: #e8f1fb; --as: #fff; --eng: #eef7ee; --warn: #fff4e0; --int: #f3eefc;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
header { background: var(--brand); color: var(--brand-ink); padding: 12px 18px; display: flex; align-items: center; gap: 14px; }
header h1 { font-size: 18px; margin: 0; flex: 1; }
header button { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.5); }
button, .btn { font: inherit; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; }
textarea { resize: vertical; }
.muted { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.center { max-width: 380px; margin: 12vh auto; display: grid; gap: 12px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef0f3; }
.badge.open { background: #e5f0ff; } .badge.escalated { background: #ffe9d6; } .badge.closed { background: #eee; color: #777; }
.badge.pending { background: #fff1b8; }
/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 16px; overflow-y: auto; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); white-space: pre-wrap; line-height: 1.4; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg.operator { align-self: flex-end; background: var(--op); }
.msg.assistant { align-self: flex-start; background: var(--as); }
.msg.engineer { align-self: flex-start; background: var(--eng); }
.msg.system { align-self: center; background: transparent; border: none; color: var(--muted); font-size: 14px; }
.msg.internal { background: var(--int); border-style: dashed; }
.msg.pending { background: var(--warn); border-style: dashed; }
.msg.rejected { opacity: .45; text-decoration: line-through; }
.msg img, .msg video { max-width: 100%; max-height: 320px; border-radius: 8px; margin-top: 6px; display: block; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--card); align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 160px; }
.thinking { color: var(--muted); font-style: italic; padding: 0 16px 8px; min-height: 22px; }
/* tablet */
.tablet { height: 100vh; display: flex; flex-direction: column; }
.tablet main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tablet .list { padding: 16px; display: grid; gap: 10px; overflow-y: auto; }
.tablet .case-row { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.tablet button { min-height: 48px; font-size: 17px; }
.media-btn { font-size: 24px; padding: 8px 12px; }
/* console */
.console { display: grid; grid-template-columns: 330px 1fr 360px; height: calc(100vh - 52px); }
.console > section { overflow-y: auto; border-right: 1px solid var(--line); min-height: 0; }
.console .cases .item { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.console .cases .item.active { background: #e8eef7; }
.console .detail { display: flex; flex-direction: column; }
.console .side { padding: 14px; display: grid; gap: 14px; align-content: start; }
.console h3 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
pre.article { white-space: pre-wrap; font-size: 13px; background: #fafafa; padding: 8px; border-radius: 8px; max-height: 260px; overflow: auto; }
@media (max-width: 1100px) { .console { grid-template-columns: 260px 1fr; } .console .side { grid-column: 1 / -1; } }
