:root {
  --ink: #172027; --muted: #72808b; --line: #dfe5e8; --soft: #f4f7f8;
  --panel: #ffffff; --brand: #155f5b; --brand-dark: #0d4745; --brand-soft: #e6f2f0;
  --accent: #ed9d52; --danger: #c84f4f; --shadow: 0 16px 42px rgba(24, 44, 50, .14);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: #eef2f3; font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; letter-spacing: 0; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.icon-btn { width: 38px; height: 38px; padding: 0; border: 0; background: transparent; display: inline-grid; place-items: center; border-radius: 6px; cursor: pointer; }
.icon-btn:hover { background: #edf2f3; }
.icon-btn svg { width: 19px; height: 19px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.avatar.has-image { background-size: cover !important; background-position: center; color: transparent; }
.avatar.has-image img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #9da8ad; border: 2px solid #fff; }
.status-dot.online { background: #38a875; }
.status-dot.busy { background: #e08a44; }
.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; }
.visitor-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9da8ad; flex: none; }
.visitor-status.online { color: #287d5c; background: #e9f6ef; }
.visitor-status.online::before { background: #38a875; }
.visitor-status.typing { color: var(--brand); background: var(--brand-soft); }
.visitor-status.typing::before { background: var(--brand); box-shadow: 0 0 0 3px rgba(21,95,91,.12); }
.primary-btn { border: 0; background: var(--brand); color: #fff; min-height: 38px; padding: 0 15px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
.primary-btn:hover { background: var(--brand-dark); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.empty { color: var(--muted); text-align: center; padding: 40px 18px; font-size: 14px; }
.connection { width: 8px; height: 8px; border-radius: 50%; background: #9da8ad; }
.connection.online { background: #37a572; box-shadow: 0 0 0 4px rgba(55,165,114,.13); }
.connection.busy { background: #e08a44; box-shadow: 0 0 0 4px rgba(224,138,68,.13); }
.connection.disconnected { background: #c75c51; box-shadow: 0 0 0 4px rgba(199,92,81,.12); }

/* Agent workspace */
.agent-app { height: 100dvh; min-height: 620px; display: grid; grid-template-columns: 68px 238px 330px minmax(0, 1fr) 290px; overflow: hidden; background: var(--panel); position: relative; }
.rail { background: #15333b; color: #d8e6e7; display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 8px; background: var(--accent); color: #18373e; display: grid; place-items: center; margin-bottom: 15px; }
.brand-mark svg { width: 24px; height: 24px; }
.rail .icon-btn { color: #9eb4b8; }
.rail .icon-btn.active, .rail .icon-btn:hover { color: #fff; background: rgba(255,255,255,.11); }
.rail-bottom { margin-top: auto; display: grid; gap: 12px; }
.agent-mini { position: relative; border: 0; padding: 0; background: transparent; cursor: pointer; }
.agent-mini .status-dot { position: absolute; right: -1px; bottom: 0; }
.agent-only-label { display: none; }
.sidebar { background: #f7f9f9; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.side-head { height: 72px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.side-head h1 { font-size: 18px; margin: 0; font-weight: 700; }
.workspace-name { font-size: 11px; color: var(--muted); margin-top: 3px; }
.nav-section { padding: 18px 12px; }
.nav-label { color: #98a4aa; font-size: 11px; padding: 0 10px 8px; text-transform: uppercase; }
.nav-item { height: 42px; border: 0; width: 100%; border-radius: 6px; background: transparent; display: flex; align-items: center; gap: 10px; padding: 0 11px; cursor: pointer; color: #53616a; margin-bottom: 3px; text-align: left; }
.nav-item svg { width: 17px; }
.nav-item.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.nav-item .count { margin-left: auto; min-width: 22px; height: 20px; border-radius: 999px; background: #dfe8e7; display: grid; place-items: center; font-size: 11px; }
.team-panel { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 12px 12px; }
.team-title { padding: 0 8px 9px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.team-manage { border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.team-manage:hover { color: var(--brand); }
.team-manage svg { width: 13px; }
.team-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: center; padding: 7px 8px; border-radius: 6px; }
.team-row:hover { background: #fff; }
.team-row .avatar { width: 30px; height: 30px; font-size: 11px; }
.agent-name { font-size: 13px; }
.agent-state { color: var(--muted); font-size: 11px; margin-top: 1px; }
.queue { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: #fff; }
.queue-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.queue-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.queue-title { font-weight: 700; }
.queue-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin-bottom: 10px; background: #edf1f2; border-radius: 6px; }
.queue-modes button { height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; }
.queue-modes button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(29,50,55,.08); font-weight: 650; }
.queue-modes b { min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; background: #dfe6e7; font-size: 10px; font-weight: 650; }
.queue-modes button.active b { background: var(--brand-soft); }
.search { height: 38px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafb; display: flex; align-items: center; gap: 7px; padding: 0 10px; }
.search svg { width: 16px; color: #8a969d; }
.search input { min-width: 0; border: 0; outline: 0; background: transparent; width: 100%; }
.filters { display: flex; gap: 4px; padding-top: 10px; }
.filter { border: 0; background: transparent; padding: 7px 9px; font-size: 12px; color: var(--muted); border-radius: 5px; cursor: pointer; }
.filter.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.conversation-list { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; }
.conversation-item { width: 100%; border: 0; border-bottom: 1px solid #edf1f2; background: #fff; padding: 15px 15px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; text-align: left; cursor: pointer; position: relative; }
.conversation-item:hover { background: #f8fafb; }
.conversation-item.active { background: #edf6f5; }
.conversation-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.conversation-item .avatar { width: 42px; height: 42px; background: #657b85; }
.conv-main { min-width: 0; }
.conv-top { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; }
.priority { color: var(--accent); width: 14px; fill: currentColor; }
.preview { margin-top: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { text-align: right; color: #99a3a8; font-size: 11px; }
.unread { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; background: var(--danger); color: white; border-radius: 999px; margin: 9px 0 0 auto; }
.chat { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: #f8faf9; }
.chat-head { height: 72px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 18px; display: flex; align-items: center; justify-content: space-between; }
.chat-title { font-weight: 700; display: flex; align-items: center; gap: 9px; }
.chat-head > div:first-child { min-width: 0; }
.chat-title { min-width: 0; }
.chat-title #chatName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { color: var(--muted); font-size: 11px; margin-top: 3px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions { display: flex; align-items: center; gap: 3px; }
.accept-btn { display: none; white-space: nowrap; }
.message-list { flex: 1; min-height: 0; overflow: auto; padding: 26px clamp(18px, 4vw, 54px); }
.visitor-draft { display: none; flex: none; max-height: 104px; overflow: auto; padding: 10px 18px 12px; background: #eef6f4; border-top: 1px solid #d9e9e6; }
.visitor-draft.show { display: block; }
.visitor-draft-label { display: flex; align-items: center; gap: 6px; color: var(--brand); font-size: 11px; }
.visitor-draft-label svg { width: 15px; height: 15px; }
.visitor-draft-label b { margin-left: auto; color: var(--muted); font-weight: 500; }
.visitor-draft-content { margin-top: 6px; color: #294947; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row { display: flex; gap: 9px; margin: 15px 0; align-items: flex-end; }
.message-row.mine { flex-direction: row-reverse; }
.message-row.system { justify-content: center; margin: 20px 0; }
.system-message { color: #879399; background: #edf1f1; padding: 5px 10px; font-size: 11px; border-radius: 999px; }
.message-row .avatar { width: 31px; height: 31px; font-size: 10px; }
.message-wrap { max-width: min(72%, 560px); }
.sender { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.mine .sender { text-align: right; }
.bubble { background: #fff; border: 1px solid #e5eaec; border-radius: 7px 7px 7px 2px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(34,51,57,.04); font-size: 14px; line-height: 1.55; }
.mine .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-radius: 7px 7px 2px 7px; }
.bubble p { margin: 0; overflow-wrap: anywhere; }
.message-image { max-width: min(300px, 100%); max-height: 280px; display: block; border-radius: 5px; object-fit: cover; cursor: zoom-in; }
.bubble:has(.message-image), .bubble:has(.sticker-message) { padding: 4px; background: transparent; border: 0; box-shadow: none; }
.sticker-message { display: block; font-size: 56px; line-height: 1.25; }
.composer { min-height: 164px; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px 14px; position: relative; }
.composer-tools { display: flex; align-items: center; gap: 2px; }
.composer textarea { width: 100%; height: 66px; border: 0; resize: none; outline: 0; padding: 9px 6px; line-height: 1.5; }
.composer-bottom { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.send-hint { color: #9aa4aa; font-size: 11px; }
.emoji-popover { display: none; position: absolute; left: 18px; bottom: 152px; width: min(340px, calc(100% - 36px)); max-height: 280px; overflow-y: auto; overscroll-behavior: contain; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 10px; z-index: 5; }
.emoji-popover.open { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.emoji-popover button { border: 0; background: transparent; font-size: 24px; height: 38px; border-radius: 5px; cursor: pointer; }
.emoji-popover button:hover { background: var(--soft); }
.quick-popover { display: none; position: absolute; left: 58px; bottom: 152px; width: 310px; max-height: 280px; overflow: auto; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 7px; z-index: 5; }
.quick-popover.open { display: block; }
.quick-item { width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 5px; text-align: left; cursor: pointer; }
.quick-item:hover { background: var(--soft); }
.quick-item strong { display: block; font-size: 12px; margin-bottom: 3px; }
.quick-item span { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details { border-left: 1px solid var(--line); background: #fff; overflow: auto; }
.details-head { height: 72px; padding: 0 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; font-weight: 700; }
.profile { text-align: center; padding: 24px 18px 19px; border-bottom: 1px solid var(--line); }
.profile .avatar { width: 56px; height: 56px; margin: 0 auto 10px; background: #657b85; font-size: 17px; }
.profile-name { font-weight: 700; }
.profile-id { color: var(--muted); font-size: 11px; margin-top: 3px; }
.detail-section { padding: 18px; border-bottom: 1px solid var(--line); }
.detail-title { font-size: 12px; color: #8b979d; margin-bottom: 12px; text-transform: uppercase; }
.detail-row { display: flex; align-items: center; gap: 9px; margin: 11px 0; font-size: 13px; }
.detail-row svg { width: 16px; color: #849198; }
.detail-row strong { margin-left: auto; max-width: 58%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-select, .note-input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: #fff; outline: none; }
.note-input { height: 72px; resize: none; line-height: 1.45; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.tag { border: 0; border-radius: 999px; background: var(--brand-soft); color: var(--brand); padding: 4px 8px; font-size: 11px; cursor: pointer; }
.tag-entry { display: grid; grid-template-columns: 1fr 34px; gap: 6px; }
.tag-entry input { min-width: 0; border: 1px solid var(--line); border-radius: 5px; padding: 7px 8px; outline: 0; }
.tag-entry button { border: 1px solid var(--line); background: #fff; border-radius: 5px; display: grid; place-items: center; cursor: pointer; }
.tag-entry svg { width: 15px; }
.detail-actions { display: grid; gap: 8px; }
.secondary-btn { width: 100%; min-height: 38px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; }
.secondary-btn:hover { background: var(--soft); }
.secondary-btn svg { width: 16px; }
.danger-btn { width: 100%; height: 38px; border: 1px solid #e7b8b8; color: var(--danger); background: #fff; border-radius: 6px; cursor: pointer; }
.danger-btn:hover { background: #fff5f5; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 15px); background: #172a2e; color: #fff; padding: 9px 14px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Admin drawer */
.admin-backdrop { position: fixed; inset: 0; background: rgba(18,35,39,.24); opacity: 0; visibility: hidden; transition: .2s; z-index: 30; }
.admin-backdrop.open { opacity: 1; visibility: visible; }
.admin-drawer { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(760px, calc(100vw - 68px)); background: #f7f9f9; box-shadow: -18px 0 48px rgba(19,43,47,.18); transform: translateX(102%); transition: transform .24s ease; display: flex; flex-direction: column; }
.admin-drawer.open { transform: translateX(0); }
.admin-head { min-height: 82px; padding: 17px 24px; background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.admin-head h2 { margin: 3px 0 0; font-size: 20px; }
.admin-eyebrow { color: var(--brand); font-size: 10px; font-weight: 750; }
.admin-tabs { display: flex; gap: 4px; padding: 9px 24px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tabs button { flex: none; border: 0; padding: 8px 12px; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.admin-tabs button.active { color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.admin-content { flex: 1; min-height: 0; overflow: auto; padding: 22px 24px 38px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.admin-description { color: var(--muted); font-size: 13px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 18px; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { font-size: 28px; font-weight: 750; margin-top: 9px; }
.metric-trend { color: #348566; font-size: 11px; margin-top: 5px; }
.admin-section { background: #fff; border: 1px solid var(--line); border-radius: 7px; margin-top: 14px; overflow: hidden; }
.admin-section-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.admin-row { min-height: 64px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 11px 15px; border-bottom: 1px solid #edf1f2; }
.admin-row:last-child { border-bottom: 0; }
.admin-row-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.admin-row .avatar { width: 36px; height: 36px; }
.admin-row-title { font-size: 13px; font-weight: 650; }
.admin-row-sub { color: var(--muted); font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-actions { display: flex; align-items: center; gap: 7px; }
.compact-select, .admin-input, .admin-textarea { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 8px 9px; outline: 0; }
.admin-input { width: 100%; }
.admin-textarea { width: 100%; min-height: 88px; resize: vertical; }
.form-row { display: grid; gap: 7px; margin-bottom: 15px; }
.form-row label { font-size: 12px; font-weight: 650; }
.form-hint { color: var(--muted); font-size: 11px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 14px; }
.agent-create-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px; margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.agent-create-form .primary-btn { grid-column: 1 / -1; justify-self: start; }
.role-badge { display: inline-flex; vertical-align: middle; padding: 2px 6px; margin-left: 5px; border-radius: 999px; font-size: 9px; font-weight: 650; background: #edf1f2; color: var(--muted); }
.role-badge.admin { background: #fff0df; color: #9b5d26; }
.back-button { border: 0; background: transparent; color: var(--brand); padding: 0; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.back-button svg { width: 16px; }
.account-editor { padding: 18px; }
.account-editor-head { display: flex; align-items: center; gap: 12px; padding-bottom: 17px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.account-editor-head strong, .account-editor-head span { display: block; }
.account-editor-head span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.avatar-editor { display: flex; align-items: center; gap: 13px; padding: 14px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafb; }
.avatar-preview { width: 58px; height: 58px; border-radius: 50%; background: #657b85; color: #fff; display: grid; place-items: center; font-size: 18px; font-weight: 700; overflow: hidden; flex: none; }
.avatar-preview.has-image img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-btn { min-height: 32px; width: auto; display: inline-flex; padding: 0 10px; cursor: pointer; }
.avatar-upload-btn svg { width: 15px; }
.text-btn { border: 0; background: transparent; padding: 5px 0; color: var(--danger); cursor: pointer; font-size: 11px; }
.reply-form { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 15px; margin-bottom: 14px; }
.mini-danger { border: 0; background: transparent; color: var(--danger); cursor: pointer; padding: 6px; }
.mini-danger svg { width: 16px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.switch { width: 42px; height: 24px; border: 0; border-radius: 999px; background: #b9c4c7; padding: 3px; cursor: pointer; }
.switch::after { content: ''; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }
.bar-list { padding: 16px; }
.bar-row { display: grid; grid-template-columns: 76px 1fr 32px; gap: 10px; align-items: center; margin: 12px 0; font-size: 12px; }
.bar-track { height: 8px; background: #edf1f1; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: inherit; }
.status-menu { display: none; position: fixed; z-index: 40; left: 62px; bottom: 14px; width: 130px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); }
.status-menu.open { display: grid; }
.status-menu button { border: 0; background: transparent; padding: 9px; border-radius: 5px; display: flex; align-items: center; gap: 9px; cursor: pointer; }
.status-menu button:hover { background: var(--soft); }
.status-account { display: grid; gap: 2px; padding: 8px 9px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.status-account strong { font-size: 12px; }
.status-account span { color: var(--muted); font-size: 10px; }
.status-menu .logout-action { color: var(--danger); border-top: 1px solid var(--line); margin-top: 3px; border-radius: 0 0 5px 5px; }
.status-menu .logout-action svg { width: 15px; }
.admin-only.is-hidden { display: none !important; }
body.role-agent .agent-only-label { display: inline; }

/* Visitor chat */
.client-page { min-height: 100vh; background: #e8efef; display: grid; place-items: center; padding: 28px; overflow: hidden; position: relative; }
.client-page::before { content: ''; position: fixed; inset: 0; background: linear-gradient(135deg, #dbe9e7 0 38%, transparent 38% 100%); opacity: .8; pointer-events: none; }
.client-shell { width: min(1040px, 100%); height: min(760px, calc(100vh - 56px)); min-height: 580px; display: grid; grid-template-columns: 340px 1fr; background: #fff; box-shadow: 0 28px 80px rgba(23,52,57,.18); border-radius: 8px; overflow: hidden; position: relative; }
.client-shell-compact { width: min(780px, 100%); grid-template-columns: minmax(0, 1fr); }
.client-aside { background: #173a3e; color: #fff; padding: 42px 34px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.client-aside::after { content: ''; position: absolute; width: 240px; height: 240px; border: 46px solid rgba(255,255,255,.045); border-radius: 50%; right: -120px; bottom: -80px; }
.client-brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 18px; }
.client-brand span:first-child { width: 36px; height: 36px; border-radius: 7px; background: var(--accent); color: #18373e; display: grid; place-items: center; }
.client-brand svg { width: 21px; }
.client-aside h1 { font-size: 32px; line-height: 1.28; margin: 80px 0 16px; max-width: 260px; letter-spacing: 0; }
.client-aside p { color: #b9cccd; font-size: 14px; line-height: 1.8; margin: 0; }
.service-card { margin-top: auto; border-top: 1px solid rgba(255,255,255,.13); padding-top: 20px; display: flex; gap: 12px; align-items: center; position: relative; z-index: 1; }
.service-card .avatar { background: #5b63d3; }
.service-name { font-size: 13px; font-weight: 650; }
.service-status { font-size: 11px; color: #9ebbbc; margin-top: 3px; }
.client-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: #f9fbfb; }
.client-head { height: 78px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.client-head-title { display: flex; align-items: center; gap: 11px; }
.client-head-title .avatar { background: #5b63d3; }
.client-brand-icon { width: 35px; height: 35px; border-radius: 7px; background: var(--accent); color: #173a3e; display: grid; place-items: center; }
.client-brand-icon svg { width: 20px; }
.client-title { font-weight: 700; font-size: 15px; }
.client-sub { color: var(--muted); font-size: 11px; margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.client-sub .status-dot { border: 0; width: 7px; height: 7px; }
.client-message-list { flex: 1; min-height: 0; overflow: auto; padding: 25px 28px; }
.client-composer { background: #fff; min-height: 148px; border-top: 1px solid var(--line); padding: 10px 18px 14px; position: relative; }
.client-composer textarea { width: 100%; height: 62px; border: 0; resize: none; outline: 0; padding: 8px 5px; line-height: 1.5; }
.client-composer .emoji-popover { bottom: 134px; }
.welcome { background: #edf5f4; border-left: 3px solid var(--brand); color: #42605f; padding: 10px 12px; margin: 0 auto 20px; max-width: 360px; font-size: 12px; line-height: 1.6; }

@media (max-width: 1250px) {
  .agent-app { grid-template-columns: 62px 0 300px minmax(410px, 1fr) 270px; }
  .sidebar { overflow: hidden; border: 0; }
}
@media (max-width: 960px) {
  .agent-app { grid-template-columns: 56px 300px minmax(0, 1fr); }
  .sidebar { display: none; }
  .details { display: none; }
  .queue { grid-column: 2; }
  .chat { grid-column: 3; }
  .client-shell { grid-template-columns: 270px 1fr; }
  .client-shell-compact { grid-template-columns: minmax(0, 1fr); }
  .client-aside { padding: 32px 26px; }
  .client-aside h1 { font-size: 27px; }
}
@media (max-width: 720px) {
  .agent-app { min-height: 100dvh; grid-template-columns: 1fr; }
  .rail, .sidebar, .queue { display: none; }
  .chat { grid-column: 1; }
  .chat-head { height: 62px; }
  .message-list { padding: 18px 14px; }
  .message-wrap { max-width: 82%; }
  .client-page { padding: 0; }
  .client-shell { height: 100dvh; min-height: 0; border-radius: 0; grid-template-columns: 1fr; }
  .client-aside { display: none; }
  .client-head { height: 68px; padding: 0 16px; }
  .client-message-list { padding: 18px 14px; }
  .admin-drawer { width: 100vw; }
  .admin-content { padding: 18px 14px 30px; }
  .agent-create-form { grid-template-columns: 1fr; }
  .agent-create-form .primary-btn { grid-column: 1; }
}

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: #e8efef; position: relative; overflow: hidden; }
.login-page::before { content: ''; position: fixed; inset: 0; background: linear-gradient(135deg, #dbe9e7 0 42%, transparent 42% 100%); pointer-events: none; }
.login-shell { width: min(920px, 100%); min-height: 600px; display: grid; grid-template-columns: 1fr 1fr; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 28px 80px rgba(23,52,57,.18); position: relative; }
.login-brand { background: #173a3e; color: #fff; padding: 48px 44px; display: flex; flex-direction: column; }
.login-logo { width: 48px; height: 48px; border-radius: 8px; background: var(--accent); color: #173a3e; display: grid; place-items: center; margin-bottom: 70px; }
.login-logo svg { width: 28px; height: 28px; }
.login-product { color: #9fc0be; text-transform: uppercase; font-size: 12px; font-weight: 700; }
.login-brand h1 { font-size: 36px; margin: 8px 0 15px; }
.login-brand p { max-width: 300px; color: #b7cbcc; line-height: 1.75; font-size: 14px; }
.login-security { margin-top: auto; border-top: 1px solid rgba(255,255,255,.14); padding-top: 20px; color: #a9c0c1; display: flex; gap: 10px; align-items: center; font-size: 12px; }
.login-security svg { width: 18px; }
.login-panel { padding: 55px 52px 40px; display: flex; flex-direction: column; }
.login-heading span { color: var(--brand); font-size: 10px; font-weight: 750; }
.login-heading h2 { font-size: 27px; margin: 6px 0 34px; }
.login-field { display: grid; gap: 8px; margin-bottom: 18px; font-size: 12px; font-weight: 650; }
.login-field > div { height: 46px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 9px; padding: 0 12px; }
.login-field > div:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21,95,91,.1); }
.login-field svg { width: 17px; color: var(--muted); }
.login-field input { min-width: 0; flex: 1; border: 0; outline: 0; }
.login-error { min-height: 20px; color: var(--danger); font-size: 12px; }
.login-submit { width: 100%; height: 46px; margin-top: 5px; justify-content: space-between; padding: 0 17px; }
.login-submit svg { width: 17px; }
@media (max-width: 720px) {
  .login-page { padding: 0; }
  .login-shell { min-height: 100dvh; grid-template-columns: 1fr; border-radius: 0; }
  .login-brand { display: none; }
  .login-panel { padding: 42px 24px 28px; }
}
