:root {
  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --brand-soft: rgba(99, 102, 241, 0.1);
  --ink: #1f2430;
  --muted: #767e90;
  --line: #e8ebf2;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --sidebar: #141a29;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 28, 45, 0.04), 0 10px 30px -18px rgba(23, 28, 45, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 236px;
  flex: none;
  background: linear-gradient(180deg, #161d2e 0%, #10162a 100%);
  color: #cbd3e4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 18px -8px rgba(99, 102, 241, 0.9);
  flex: none;
}

.brand-text b {
  display: block;
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.brand-text span {
  font-size: 11px;
  color: #7c88a3;
}

.nav {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-group {
  font-size: 11px;
  color: #5f6b85;
  padding: 14px 10px 6px;
  letter-spacing: 0.6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #b9c2d6;
  font-size: 13.5px;
  transition: all 0.18s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav a.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.9));
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(99, 102, 241, 1);
}

.nav a svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.is-zero {
  display: none;
}

.sidebar-user {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user .role {
  font-size: 11px;
  color: #7c88a3;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 62px;
  flex: none;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
}

.topbar .crumb {
  font-size: 12px;
  color: var(--muted);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 24px 26px 40px;
  flex: 1;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card.pad-0 {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h3 {
  font-size: 15px;
  font-weight: 700;
}

.card-head .sub {
  font-size: 12px;
  color: var(--muted);
}

.card-head .spacer {
  margin-left: auto;
}

.stat {
  position: relative;
  overflow: hidden;
}

.stat .label {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat .value {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-top: 6px;
}

.stat .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.stat .icon {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
}

.stat .icon svg {
  width: 20px;
  height: 20px;
}

.icon-brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.icon-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--ok);
}

.icon-warn {
  background: rgba(245, 158, 11, 0.14);
  color: var(--warn);
}

.icon-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.is-bot {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.badge.is-waiting {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.badge.is-human {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.badge.is-closed {
  background: #eef0f5;
  color: #6b7280;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f4f9;
  color: #4c5566;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: #4c5566;
}

.btn-ghost:hover {
  background: #f7f8fc;
  border-color: #d7dbe6;
}

.btn-ok {
  background: var(--ok);
}

.btn-ok:hover {
  background: #059669;
}

.btn-warn {
  background: var(--warn);
}

.btn-warn:hover {
  background: #d97706;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 16px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f3f8;
  vertical-align: middle;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover {
  background: #fafbff;
}

.field {
  margin-bottom: 15px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #3d4453;
}

.field .hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

label.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
  margin-bottom: 10px;
}

.switch input {
  display: none;
}

.switch .track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d5dae6;
  position: relative;
  transition: background 0.2s ease;
  flex: none;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch input:checked + .track {
  background: var(--brand);
}

.switch input:checked + .track::after {
  transform: translateX(18px);
}

.flash {
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash.ok {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.flash.err {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.22);
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 168px;
  padding-top: 10px;
}

.chart .bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  height: 100%;
  justify-content: flex-end;
}

.chart .bar-stack {
  width: 100%;
  max-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex: 1;
}

.chart .bar {
  width: 100%;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #818cf8, #6366f1);
  min-height: 4px;
  transition: height 0.4s ease;
}

.chart .bar.alt {
  background: linear-gradient(180deg, #c4b5fd, #a78bfa);
  border-radius: 4px;
}

.chart .bar-label {
  font-size: 11px;
  color: var(--muted);
}

.chart .legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

.legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 12% 18%, rgba(99, 102, 241, 0.28), transparent 45%),
    radial-gradient(circle at 88% 82%, rgba(168, 85, 247, 0.28), transparent 45%),
    linear-gradient(135deg, #0f1425, #1b2340);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 34px 30px 28px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
}

.login-logo {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  box-shadow: 0 14px 30px -12px rgba(99, 102, 241, 0.95);
}

.login-card h1 {
  font-size: 21px;
  font-weight: 800;
}

.login-card .desc {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 22px;
}

.login-tip {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  background: #f6f7fb;
  border: 1px dashed #dfe3ec;
  border-radius: 11px;
  padding: 11px 14px;
  line-height: 1.8;
}

.login-tip code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11.5px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 268px;
  gap: 16px;
  height: calc(100vh - 110px);
  min-height: 520px;
}

.session-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.session-list .filters {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.session-tabs {
  display: flex;
  gap: 4px;
  background: #f2f4f9;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 10px;
}

.session-tabs a {
  flex: 1;
  text-align: center;
  font-size: 12px;
  padding: 6px 4px;
  border-radius: 8px;
  color: #5b6478;
  font-weight: 600;
}

.session-tabs a.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(23, 28, 45, 0.1);
}

.session-scroll {
  overflow-y: auto;
  flex: 1;
}

.session-item {
  display: block;
  padding: 13px 15px;
  border-bottom: 1px solid #f1f3f8;
  color: inherit;
  transition: background 0.15s ease;
  position: relative;
}

.session-item:hover {
  background: #f8f9fd;
}

.session-item.active {
  background: var(--brand-soft);
}

.session-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand);
}

.session-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.session-name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-time {
  margin-left: auto;
  font-size: 11px;
  color: #a6adbd;
  flex: none;
}

.session-preview {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.unread-dot {
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: auto;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.chat-head {
  flex: none;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
}

.chat-head .who {
  font-weight: 700;
  font-size: 14.5px;
}

.chat-head .meta {
  font-size: 12px;
  color: var(--muted);
}

.chat-head .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-back {
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #f2f4f9;
  color: #5b6478;
  flex: none;
}

.chat-back svg {
  width: 18px;
  height: 18px;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 8px;
  background: #f7f8fc;
  background-image: radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.06), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(168, 85, 247, 0.06), transparent 40%);
}

.msg {
  display: flex;
  gap: 9px;
  margin-bottom: 16px;
  animation: ad-fade 0.25s ease;
}

@keyframes ad-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.msg.right {
  flex-direction: row-reverse;
}

.msg .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

.msg .avatar.agent {
  background: linear-gradient(135deg, #f97316, #fbbf24);
}

.msg .avatar.visitor {
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
}

.msg .avatar.system {
  background: #cbd5e1;
}

.msg-body {
  max-width: 64%;
  min-width: 0;
}

.msg-name {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 4px 5px;
  font-weight: 600;
}

.msg-bubble {
  background: #fff;
  border-radius: 15px 15px 15px 5px;
  padding: 10px 14px;
  box-shadow: 0 2px 9px -5px rgba(23, 28, 45, 0.28);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.8px;
}

.msg.right .msg-bubble {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 15px 15px 5px 15px;
}

.msg-bubble.msg-bubble-image {
  padding: 4px;
  overflow: hidden;
}

.msg-bubble-image img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 12px;
  cursor: zoom-in;
}

.msg-caption {
  padding: 6px 8px 2px;
  font-size: 13px;
  line-height: 1.45;
}

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(15, 18, 28, 0.86);
}

.img-lightbox.is-open {
  display: flex;
}

.img-lightbox img {
  max-width: 94%;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

.img-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.img-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

.msg.system {
  justify-content: center;
  margin-bottom: 12px;
}

.msg.system .bubble {
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 13px;
}

.msg-time {
  font-size: 10.5px;
  color: #a6adbd;
  margin-top: 4px;
  padding: 0 5px;
}

.msg.right .msg-time {
  text-align: right;
}

.msg-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eef0f7;
  color: #6b7280;
  margin-left: 6px;
  vertical-align: middle;
}

.chat-composer {
  flex: none;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 12px 16px 14px;
}

.composer-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer-row textarea {
  min-height: 46px;
  max-height: 130px;
}

.info-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.info-block h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding: 7px 0;
  border-bottom: 1px dashed #f0f2f7;
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span:first-child {
  color: var(--muted);
  flex: none;
}

.info-row span:last-child {
  text-align: right;
  word-break: break-all;
}

.empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

.empty svg {
  width: 54px;
  height: 54px;
  opacity: 0.35;
  margin-bottom: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #1f2430;
  color: #fff;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s ease;
  z-index: 999;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 37, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 24px;
}

.modal-mask.show {
  display: grid;
}

.modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
  max-height: 88vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal .desc {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.row-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .spacer {
  margin-left: auto;
}

.search-box {
  position: relative;
}

.search-box input {
  padding-left: 34px;
  min-width: 230px;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #a6adbd;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.mark {
  background: rgba(99, 102, 241, 0.14);
  color: #4338ca;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11.5px;
}

@media (max-width: 1200px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chat-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .info-panel {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 68px;
    padding: 18px 10px;
  }

  .sidebar .brand-text,
  .sidebar .nav span:not(.nav-badge),
  .sidebar-user .meta,
  .nav-group {
    display: none;
  }

  .nav a {
    justify-content: center;
  }

  .grid-3,
  .grid-2,
  .two-col,
  .grid.split {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .session-list {
    max-height: 320px;
  }

  .chat-panel {
    min-height: 560px;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 52px;
    padding: 9px 14px;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .topbar h1 {
    font-size: 15px;
  }

  .topbar .crumb {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
    flex-wrap: wrap;
  }

  .topbar .pill {
    font-size: 11px;
    padding: 4px 9px;
  }

  .content {
    padding: 14px 14px 20px;
  }

  .card {
    padding: 15px;
  }

  .card-head {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .stat .icon {
    width: 34px;
    height: 34px;
    right: 12px;
    top: 12px;
    border-radius: 10px;
  }

  .stat .icon svg {
    width: 17px;
    height: 17px;
  }

  .stat .label,
  .stat .hint {
    padding-right: 40px;
  }

  .info-row span:last-child {
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .pie-row {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 14px !important;
  }

  .chart {
    gap: 6px;
    height: 140px;
    overflow: hidden;
  }

  .chart .bar-stack {
    max-width: 24px;
  }

  .chart .bar-label {
    font-size: 9.5px;
  }

  .session-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .session-tabs::-webkit-scrollbar {
    display: none;
  }

  .session-tabs a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 11px;
  }

  .chat-head {
    flex-wrap: wrap;
    row-gap: 9px;
    gap: 9px;
    padding: 11px 13px;
  }

  .chat-head .meta {
    font-size: 11px;
  }

  .chat-head .actions .btn {
    padding: 0 8px;
    font-size: 12px;
  }

  .chat-head .actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 6px;
  }

  .chat-back {
    display: grid;
  }

  .chat-layout,
  .chat-layout.has-selection {
    height: auto;
    min-height: 0;
  }

  .chat-layout:not(.has-selection) .chat-panel {
    display: none;
  }

  .chat-layout.has-selection .session-list {
    display: none;
  }

  .chat-layout.has-selection {
    grid-template-rows: minmax(0, 1fr);
    height: calc(100vh - 86px);
  }

  .session-list {
    max-height: calc(100vh - 86px);
  }

  .chat-panel {
    min-height: 0;
    height: 100%;
  }
}
