:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --panel2: #243044;
  --text: #e8eef5;
  --muted: #8b9bb4;
  --accent: #3d8bfd;
  --accent2: #6ea8fe;
  --success: #2fb344;
  --danger: #e35d6a;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --scrollbar-size: 10px;
  --scrollbar-track: rgba(0, 0, 0, 0.22);
  --scrollbar-thumb: rgba(100, 125, 160, 0.38);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(61, 139, 253, 0.38), rgba(124, 92, 255, 0.28));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(61, 139, 253, 0.55), rgba(124, 92, 255, 0.42));
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, rgba(61, 139, 253, 0.68), rgba(124, 92, 255, 0.52));
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a5f 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #2d1f4e 0%, transparent 50%), var(--bg);
  color: var(--text);
}

a {
  color: var(--accent2);
}

.card {
  background: linear-gradient(145deg, rgba(36, 48, 68, 0.95), rgba(26, 35, 50, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563c4);
  color: #fff;
  box-shadow: 0 8px 24px rgba(61, 139, 253, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(227, 93, 106, 0.15);
  color: #ffb3bc;
  border: 1px solid rgba(227, 93, 106, 0.35);
}

.input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.input:focus,
textarea:focus {
  border-color: rgba(61, 139, 253, 0.55);
  box-shadow: 0 0 0 3px rgba(61, 139, 253, 0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-online {
  background: rgba(47, 179, 68, 0.2);
  color: #9cf0ad;
  border: 1px solid rgba(47, 179, 68, 0.35);
}

.badge-offline {
  background: rgba(139, 155, 180, 0.15);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

/* Tenant theme: a bright, low-glare workspace with sky-blue accents. */
html[data-theme="sky-blue"] {
  --bg: #f3f8fd;
  --panel: #ffffff;
  --panel2: #eaf4fc;
  --text: #17324d;
  --muted: #607d98;
  --accent: #1687d9;
  --accent2: #0876c4;
  --success: #168a55;
  --danger: #d94b5b;
  --shadow: 0 12px 32px rgba(38, 91, 132, 0.12);
  --scrollbar-track: #e8f1f8;
  --scrollbar-thumb: #a9cbe3;
  color-scheme: light;
}

html[data-theme="sky-blue"] body {
  background: linear-gradient(180deg, #eef7fd 0%, #f8fbfe 42%, #f3f8fd 100%);
}

html[data-theme="sky-blue"] .card {
  background: #ffffff;
  border-color: #d8e8f3;
}

html[data-theme="sky-blue"] .btn-ghost {
  background: #f4f9fd;
  color: var(--text);
  border-color: #cbdfea;
}

html[data-theme="sky-blue"] .btn-ghost:hover {
  background: #e8f4fb;
}

html[data-theme="sky-blue"] .btn-danger {
  background: #fff1f2;
  color: #b52f40;
  border-color: #f3bdc4;
}

html[data-theme="sky-blue"] .input,
html[data-theme="sky-blue"] textarea {
  background: #ffffff;
  color: var(--text);
  border-color: #cbdfea;
}

html[data-theme="sky-blue"] .badge-offline {
  background: #edf3f7;
  border-color: #d5e1e9;
}

html[data-theme="sky-blue"] .badge-online {
  background: #e2f7eb;
  color: #167245;
  border-color: #a9dfbf;
}

html[data-theme="sky-blue"] .table th,
html[data-theme="sky-blue"] .table td {
  border-bottom-color: #e1edf5;
}

html[data-theme="sky-blue"] .table tr:hover td {
  background: #f5faff;
}

html[data-theme="sky-blue"] .logo-mark {
  background: linear-gradient(135deg, #24a4e8, #0876c4);
}

html[data-theme="sky-blue"] *::-webkit-scrollbar-thumb {
  background: #a9cbe3;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: none;
}

html[data-theme="sky-blue"] .side,
html[data-theme="sky-blue"] .top,
html[data-theme="sky-blue"] .main-top,
html[data-theme="sky-blue"] .view-tabs,
html[data-theme="sky-blue"] .agent-main-tabs,
html[data-theme="sky-blue"] .composer-wrap,
html[data-theme="sky-blue"] .side-footer,
html[data-theme="sky-blue"] .reply-settings-head,
html[data-theme="sky-blue"] .reply-settings-tabs,
html[data-theme="sky-blue"] .hall-room-toolbar-inner {
  background: #ffffff;
  border-color: #dbe9f2;
}

html[data-theme="sky-blue"] .foot,
html[data-theme="sky-blue"] .chat-toolbar {
  background: #ffffff;
  border-color: #dbe9f2;
}

html[data-theme="sky-blue"] .main,
html[data-theme="sky-blue"] .thread,
html[data-theme="sky-blue"] .msgs,
html[data-theme="sky-blue"] .agent-view-panel,
html[data-theme="sky-blue"] .chat-view-panel {
  background-color: #f5f9fc;
}

html[data-theme="sky-blue"] .session-item,
html[data-theme="sky-blue"] .quick-reply-item,
html[data-theme="sky-blue"] .qr-item,
html[data-theme="sky-blue"] .hall-user-row,
html[data-theme="sky-blue"] .theme-choice {
  color: var(--text);
  border-color: #dbe9f2;
}

html[data-theme="sky-blue"] .side-footer-btn {
  background: #f4f9fd;
  color: var(--text);
  border-color: #cbdfea;
}

html[data-theme="sky-blue"] .side-footer-btn-primary {
  background: #fff1f2;
  color: #b52f40;
  border-color: #f3bdc4;
}

html[data-theme="sky-blue"] .emoji-picker-panel,
html[data-theme="sky-blue"] .quick-reply-panel {
  background: #ffffff;
  color: var(--text);
  border-color: #cbdfea;
  box-shadow: 0 12px 32px rgba(38, 91, 132, 0.18);
}

html[data-theme="sky-blue"] .emoji-picker-panel .emoji-cell,
html[data-theme="sky-blue"] .quick-reply-panel .quick-reply-item {
  background: #f3f8fc;
  color: var(--text);
  border-color: #dbe9f2;
}

html[data-theme="sky-blue"] .emoji-picker-panel .emoji-cell:hover,
html[data-theme="sky-blue"] .quick-reply-panel .quick-reply-item:hover:not(:disabled) {
  background: #e1f1fb;
  border-color: #9fd0ed;
}

html[data-theme="sky-blue"] .session-item:hover,
html[data-theme="sky-blue"] .session-item.active,
html[data-theme="sky-blue"] .quick-reply-item:hover:not(:disabled) {
  background: #e7f4fc;
}

html[data-theme="sky-blue"] .tab-btn,
html[data-theme="sky-blue"] .agent-tab,
html[data-theme="sky-blue"] .reply-settings-tab {
  color: var(--muted);
  border-color: #dbe9f2;
}

html[data-theme="sky-blue"] .tab-btn.tab-active,
html[data-theme="sky-blue"] .agent-tab-active,
html[data-theme="sky-blue"] .reply-settings-tab-active {
  color: #075f9e;
  background: #e7f4fc;
  border-color: #9fd0ed;
}

html[data-theme="sky-blue"] .row:not(.me) .bubble {
  background: #ffffff;
  color: var(--text);
  border-color: #d8e8f3;
}

html[data-theme="sky-blue"] .row.me .bubble {
  background: #dff1fc;
  color: #153c59;
  border-color: #add9f1;
}

html[data-theme="sky-blue"] .modal-overlay {
  background: rgba(24, 55, 80, 0.32);
}

html[data-theme="sky-blue"] .thread-offline-hint,
html[data-theme="sky-blue"] .thread-blocked-hint,
html[data-theme="sky-blue"] .agent-offline-banner,
html[data-theme="sky-blue"] .err {
  color: #a52d3d;
  background: #fff1f2;
  border-color: #f3bdc4;
}

html[data-theme="sky-blue"] input[type="radio"],
html[data-theme="sky-blue"] input[type="checkbox"] {
  accent-color: var(--accent);
}

html[data-theme="sky-blue"] .settings-save-notice {
  color: #167245;
}

html[data-theme="sky-blue"] .agent-mobile-back {
  background: #f4f9fd;
  color: var(--text);
  border-color: #cbdfea;
}

html[data-theme="sky-blue"] .hall-agent-split > div,
html[data-theme="sky-blue"] .hall-mod-aside {
  background: #ffffff !important;
  border-color: #dbe9f2 !important;
}
