:root {
  --bg: #e8f4fb;
  --bg-panel: #ffffff;
  /* Skyeng: тёмно-синее меню + фирменный голубой */
  --sidebar: #06263f;
  --sidebar-hover: #0b3a5c;
  --sidebar-active: #0e4f7a;
  --sidebar-text: #d5e8f5;
  --sidebar-muted: #7eb3d4;
  --accent: #1cb0f6;
  --accent-soft: #dff3fc;
  --skyeng: #1cb0f6;
  --skysmart: #58cc02;
  --border: #c9e0ef;
  --text: #0b1f33;
  --text-muted: #4f6b82;
  --danger: #e11d48;
  --warning: #d97706;
  --success: #16a34a;
  --radius: 8px;
  --font: "Segoe UI", "PT Sans", "Helvetica Neue", sans-serif;
  --shadow: 0 1px 2px rgba(6, 38, 63, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

/* Anti-FOUC: при смене страниц до сборки .app — сразу тёмный сайдбар, без голубого экрана */
body:not(:has(> .app)):not(:has(.login-page))::before {
  content: "";
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(28, 176, 246, 0.22), transparent 55%),
    linear-gradient(180deg, #083552 0%, #06263f 42%, #041c2e 100%);
  border-right: 1px solid rgba(28, 176, 246, 0.18);
  z-index: 1;
  pointer-events: none;
}
body.sidebar-boot-collapsed:not(:has(> .app)):not(:has(.login-page))::before {
  width: 72px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

/* ——— Login ——— */
.login-page {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 520px at 12% 18%, rgba(28, 176, 246, 0.28), transparent 60%),
    radial-gradient(800px 480px at 88% 78%, rgba(28, 176, 246, 0.22), transparent 58%),
    linear-gradient(135deg, #f7fcff 0%, #dff3fc 48%, #bfe8fb 100%);
}

.login-page .login-card {
  position: relative;
  z-index: 2;
}

.login-mascots {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.login-mascot {
  position: absolute;
  object-fit: contain;
  opacity: 0.36;
  filter: saturate(0.9) brightness(1.03) drop-shadow(0 8px 14px rgba(6, 38, 63, 0.08));
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: 55% 70%;
  will-change: transform;
}

@keyframes login-wave {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  35% {
    transform: translateY(-12px) rotate(4deg);
  }
  70% {
    transform: translateY(7px) rotate(-4.5deg);
  }
}

@keyframes login-wave-alt {
  0%,
  100% {
    transform: translateY(0) rotate(3deg) scaleX(-1);
  }
  40% {
    transform: translateY(9px) rotate(-3.5deg) scaleX(-1);
  }
  75% {
    transform: translateY(-10px) rotate(4.5deg) scaleX(-1);
  }
}

@keyframes login-drift {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-14px) rotate(2.5deg);
  }
}

/* 10 уникальных + 4 для заполнения середины по бокам от формы */
.login-mascot.m01 { left: 1%; top: 5%; width: min(12vw, 118px); animation: login-wave 4.4s ease-in-out infinite; }
.login-mascot.m02 { right: 2%; top: 4%; width: min(11vw, 110px); animation: login-drift 4.9s ease-in-out infinite; }
.login-mascot.m03 { right: 0; bottom: 1%; width: min(18vw, 180px); opacity: 0.4; animation: login-wave 5.4s ease-in-out infinite; }
.login-mascot.m04 { left: 3%; top: 38%; width: min(12vw, 120px); animation: login-wave 5s ease-in-out infinite 0.2s; }
.login-mascot.m05 { right: 3%; top: 36%; width: min(11vw, 112px); animation: login-drift 4.6s ease-in-out infinite 0.15s; }
.login-mascot.m06 { left: 2%; bottom: 8%; width: min(12vw, 122px); animation: login-wave-alt 4.7s ease-in-out infinite; }
.login-mascot.m07 { left: 18%; top: 12%; width: min(11vw, 108px); opacity: 0.32; animation: login-drift 5.1s ease-in-out infinite 0.3s; }
.login-mascot.m08 { right: 17%; top: 14%; width: min(11vw, 108px); opacity: 0.32; animation: login-wave 5.5s ease-in-out infinite 0.25s; }
.login-mascot.m09 { left: 17%; bottom: 14%; width: min(11vw, 110px); opacity: 0.33; animation: login-wave-alt 5.3s ease-in-out infinite 0.35s; }
.login-mascot.m10 { right: 16%; bottom: 16%; width: min(11vw, 110px); opacity: 0.33; animation: login-drift 4.8s ease-in-out infinite 0.18s; }
.login-mascot.m11 { left: 7%; top: 22%; width: min(10vw, 98px); opacity: 0.3; animation: login-wave 5.7s ease-in-out infinite 0.4s; }
.login-mascot.m12 { right: 7%; top: 24%; width: min(10vw, 98px); opacity: 0.3; animation: login-wave-alt 5.5s ease-in-out infinite 0.28s; }
.login-mascot.m13 { left: 9%; bottom: 28%; width: min(10vw, 100px); opacity: 0.3; animation: login-drift 5s ease-in-out infinite 0.32s; }
.login-mascot.m14 { right: 8%; bottom: 30%; width: min(10vw, 100px); opacity: 0.3; animation: login-wave 4.9s ease-in-out infinite 0.22s; }

@media (max-width: 1100px) {
  .login-mascot.m07,
  .login-mascot.m08,
  .login-mascot.m11,
  .login-mascot.m12 {
    opacity: 0.26;
  }
}

@media (max-width: 900px) {
  .login-mascot.m07,
  .login-mascot.m08,
  .login-mascot.m09,
  .login-mascot.m10,
  .login-mascot.m13,
  .login-mascot.m14 {
    display: none;
  }
}

@media (max-width: 640px) {
  .login-mascot {
    display: none;
  }
  .login-mascot.m03 {
    display: block;
    width: min(46vw, 190px);
    opacity: 0.26;
    right: -4%;
    bottom: 0;
  }
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.captcha-question {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
}

.login-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.admin-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.admin-link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.admin-link-card:hover {
  border-color: #bfdbfe;
  background: var(--accent-soft);
}

.admin-link-card strong {
  font-size: 14px;
}

.admin-link-card span {
  font-size: 12px;
  color: var(--text-muted);
}

.login-card {
  width: min(400px, calc(100% - 32px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(28, 176, 246, 0.22);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 18px 50px rgba(6, 38, 63, 0.14);
  backdrop-filter: blur(6px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1cb0f6, #0b1f33);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  color: var(--text-muted);
}

.field input,
.field select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #fff;
}

.field input:focus,
.field select:focus,
.composer input:focus,
.composer textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #0ea5e9;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.demo-accounts {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.demo-accounts strong {
  color: var(--text);
}

.demo-accounts ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.demo-accounts button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-weight: 600;
}

/* ——— App shell ——— */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100%;
  height: 100%;
  transition: grid-template-columns 0.2s ease;
}

.app.sidebar-collapsed {
  grid-template-columns: 72px 1fr;
}

.sidebar {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(28, 176, 246, 0.22), transparent 55%),
    linear-gradient(180deg, #083552 0%, #06263f 42%, #041c2e 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow: hidden;
  min-height: 0;
  transition: padding 0.2s ease;
  border-right: 1px solid rgba(28, 176, 246, 0.18);
}

.sidebar-nav-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  position: relative;
}

.sidebar-brand .login-logo {
  width: 32px;
  height: 32px;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  min-width: 0;
  flex: 1;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: #7eb3d4;
}

.sidebar-brand strong {
  color: #fff;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app.sidebar-collapsed .sidebar {
  padding: 16px 8px;
}

.app.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 14px;
}

.app.sidebar-collapsed .brand-text,
.app.sidebar-collapsed .nav-section-title,
.app.sidebar-collapsed .nav-label,
.app.sidebar-collapsed .user-chip,
.app.sidebar-collapsed .logout-link,
.app.sidebar-collapsed .nav-item .badge {
  display: none;
}

.app.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.app.sidebar-collapsed .nav-item .dot {
  width: 8px;
  height: 8px;
}

.app.sidebar-collapsed .sidebar-foot {
  padding: 10px 0 4px;
  display: flex;
  justify-content: center;
}

.nav-section {
  margin-bottom: 14px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
  padding: 6px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(28, 176, 246, 0.32), rgba(14, 79, 122, 0.9));
  color: #fff;
  box-shadow: inset 3px 0 0 #1cb0f6;
}

.nav-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sidebar-muted);
  flex-shrink: 0;
}

.nav-item.active .dot,
.nav-item:hover .dot {
  background: var(--accent);
}

.nav-item.stub {
  opacity: 0.72;
}

.nav-item .badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.sidebar-foot {
  flex-shrink: 0;
  margin-top: 0;
  padding: 12px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--sidebar);
}

.user-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.user-chip strong {
  color: #fff;
}

.user-chip span {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.logout-link {
  display: block;
  margin-top: 10px;
  color: #93c5fd;
  font-size: 12px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
}

.topbar {
  height: 52px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.topbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.work-status-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.work-status-label {
  font-size: 12px;
  font-weight: 600;
  color: #4f6b82;
  white-space: nowrap;
}

.work-status-bar {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: #e8f4fb;
  border: 1px solid #c9e0ef;
}

.work-status-btn {
  border: 0;
  background: transparent;
  color: #4f6b82;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.work-status-btn:hover {
  background: rgba(28, 176, 246, 0.12);
  color: #0b1f33;
}

.work-status-btn.active {
  background: #1cb0f6;
  color: #fff;
}

.work-status-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.topbar-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* ——— Operator workspace ——— */
.operator-layout {
  display: grid;
  grid-template-columns: 250px 1fr 250px;
  height: 100%;
  min-height: 0;
}

.dialog-list,
.chat-pane,
.student-pane {
  background: var(--bg-panel);
  min-height: 0;
  overflow: auto;
}

.dialog-list {
  border-right: 1px solid var(--border);
}

.student-pane {
  border-left: 1px solid var(--border);
}

.pane-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 650;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 1;
}

.dialog-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.dialog-item:hover {
  background: #f8fafc;
}

.dialog-item.active {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.dialog-item .row1 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.dialog-item .name {
  font-weight: 650;
  font-size: 14px;
}

.dialog-item .time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dialog-item .subject {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

.dialog-item .meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2f7;
  color: #475569;
}

.chip.product-skyeng {
  background: #e0f2fe;
  color: #0369a1;
}

.chip.product-skysmart {
  background: #ecfccb;
  color: #3f6212;
}

.chip.status-incoming {
  background: #fee2e2;
  color: #b91c1c;
}

.chip.status-in_progress {
  background: #fef3c7;
  color: #b45309;
}

.chip.status-archive {
  background: #e2e8f0;
  color: #475569;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.chat-pane {
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 15px;
}

.chat-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.messages {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.msg {
  max-width: 72%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow);
}

.msg.student {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg.operator {
  align-self: flex-end;
  background: #dbeafe;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: repeating-linear-gradient(
    -45deg,
    #fff7ed,
    #fff7ed 7px,
    #ffedd5 7px,
    #ffedd5 14px
  );
  border: 1px solid #fdba74;
  color: #9a3412;
  border-bottom-left-radius: 4px;
}

.msg .when {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.composer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  background: var(--bg-panel);
}

.composer textarea {
  resize: vertical;
  min-height: 44px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  line-height: 1.4;
  overflow-y: auto;
}

.emoji-btn {
  width: 40px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
}

.emoji-btn:hover {
  background: #f8fafc;
}

.student-card {
  padding: 16px;
}

.student-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.student-card .email {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.kv {
  display: grid;
  gap: 10px;
}

.kv-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-row span {
  font-size: 12px;
  color: var(--text-muted);
}

.kv-row strong {
  font-size: 14px;
  font-weight: 650;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ——— Manager tables ——— */
.page-pad {
  padding: 20px;
}

.page-intro {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.hint-line {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-card.tone-warn .kpi-value {
  color: var(--warning);
}

.kpi-card.tone-danger .kpi-value {
  color: var(--danger);
}

.kpi-card.tone-ok .kpi-value {
  color: var(--success);
}

.kpi-card.tone-muted .kpi-value {
  color: var(--text-muted);
}

.manager-filters {
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.filter-field select,
.filter-field input {
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.filter-field.grow {
  flex: 1;
  min-width: 200px;
}

.filter-field.grow input {
  width: 100%;
}

table.requests tbody tr.row-sla-risk td {
  background: #fff7ed;
}

.wait-hot {
  color: var(--danger);
}

.cell-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cell-wrap {
  white-space: normal !important;
  max-width: 280px;
}

.btn-sm {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.line-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.line-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.line-status.online .line-dot {
  background: var(--success);
}

.line-status.loading .line-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.line-status.offline .line-dot {
  background: var(--danger);
}

.account-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

.account-form input,
.account-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  min-width: 140px;
}

.account-toolbar {
  margin-bottom: 12px;
}

.account-editor {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.account-editor h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}

.editor-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.editor-grid input,
.editor-grid select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.editor-grid .check-alone {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--text);
  font-size: 13px;
}

.editor-block {
  margin-bottom: 12px;
}

.editor-block-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

table.requests tbody tr.account-row.is-editing {
  background: var(--accent-soft);
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  box-shadow: var(--shadow);
}

table.requests {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.requests th,
table.requests td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.requests th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 650;
  font-size: 12px;
}

table.requests tr:last-child td {
  border-bottom: none;
}

table.requests tbody tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

/* ——— Groups accordion ——— */
.groups-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 960px;
}

.group-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.group-head {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  text-align: left;
  padding: 14px 16px;
  border: none;
  background: #fff;
  cursor: pointer;
}

.group-head:hover {
  background: #f8fafc;
}

.chevron {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.group-card.open .chevron {
  transform: rotate(90deg);
}

.group-title {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}

.group-comment {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.group-body {
  display: none;
  padding: 0 16px 16px 50px;
  border-top: 1px solid var(--border);
}

.group-card.open .group-body {
  display: block;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip-row .label {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.chip.channel {
  background: #ede9fe;
  color: #5b21b6;
}

.chip.kb {
  background: #cffafe;
  color: #0e7490;
}

.chip.user {
  background: #fce7f3;
  color: #9d174d;
}

.stub-page {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.stub-page h2 {
  margin: 0 0 8px;
  color: var(--text);
}

@media (max-width: 1100px) {
  .operator-layout {
    grid-template-columns: 220px 1fr;
  }

  .student-pane {
    display: none;
  }
}

@media (max-width: 800px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .operator-layout {
    grid-template-columns: 1fr;
  }

  .dialog-list {
    max-height: 220px;
  }
}

/* ——— Live operator chat ——— */
.live-chat {
  grid-template-columns: 250px 1fr 250px;
  background: #e8edf5;
  gap: 0;
}

.live-chat .dialog-list,
.live-chat .chat-pane,
.live-chat .student-pane {
  background: #fff;
}

/* Узкий скролл у боковых колонок — без толстой серой полосы */
.live-chat .dialog-list,
.live-chat .dlg-scroll,
.live-chat .student-pane,
.live-chat .messages {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.live-chat .dialog-list::-webkit-scrollbar,
.live-chat .dlg-scroll::-webkit-scrollbar,
.live-chat .student-pane::-webkit-scrollbar,
.live-chat .messages::-webkit-scrollbar {
  width: 6px;
}

.live-chat .dialog-list::-webkit-scrollbar-track,
.live-chat .dlg-scroll::-webkit-scrollbar-track,
.live-chat .student-pane::-webkit-scrollbar-track,
.live-chat .messages::-webkit-scrollbar-track {
  background: transparent;
}

.live-chat .dialog-list::-webkit-scrollbar-thumb,
.live-chat .dlg-scroll::-webkit-scrollbar-thumb,
.live-chat .student-pane::-webkit-scrollbar-thumb,
.live-chat .messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.queue-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
}

.queue-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.queue-tab {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 8px;
  padding: 7px 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.queue-tab.active {
  background: var(--accent-soft);
  border-color: #bfdbfe;
  color: #0284c7;
}

.queue-tab .qcount {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.dlg-scroll {
  overflow: auto;
  height: calc(100% - 92px);
}

.live-chat .dialog-item {
  width: 100%;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.live-chat .dialog-item.active {
  padding-left: 11px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #64748b, #334155);
  flex-shrink: 0;
}

.avatar.product-skyeng {
  background: linear-gradient(145deg, #38bdf8, #0284c7);
}

.avatar.product-skysmart {
  background: linear-gradient(145deg, #84cc16, #16a34a);
}

.avatar.lg {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.avatar.xl {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 16px;
}

.dlg-body .preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.unread-pill {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.chat-title {
  display: flex;
  gap: 12px;
  align-items: center;
}

.live-chat .messages {
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.05), transparent 40%),
    radial-gradient(circle at 90% 0%, rgba(88, 204, 2, 0.06), transparent 35%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.live-chat .msg {
  max-width: 78%;
  padding: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-chat .msg .bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: var(--shadow);
}

.live-chat .msg.student .bubble {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.live-chat .msg.operator .bubble {
  background: linear-gradient(145deg, #1cb0f6, #0ea5e9);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.live-chat .msg.operator .when {
  color: #94a3b8;
  text-align: right;
}

/* Бот → ученику: полосатый фон, сразу видно в ленте оператора */
.live-chat .msg.bot {
  align-self: flex-start;
  max-width: 85%;
}

.live-chat .msg.bot .bubble {
  background: repeating-linear-gradient(
    -45deg,
    #fff7ed,
    #fff7ed 8px,
    #ffedd5 8px,
    #ffedd5 16px
  );
  color: #9a3412;
  border: 1px solid #fb923c;
  border-left: 4px solid #ea580c;
  border-bottom-left-radius: 4px;
  box-shadow: none;
}

.live-chat .msg.bot .when {
  color: #c2410c;
  font-weight: 600;
}

.typing-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.7);
  border-top: 1px dashed var(--border);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #94a3b8;
  display: block;
  animation: blink 1.2s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.composer-wrap {
  border-top: 1px solid var(--border);
  background: #fff;
}

.archive-summary {
  padding: 12px 14px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
  background: #f8fafc;
}

.archive-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.archive-summary > div {
  margin-top: 4px;
}

.archive-csat {
  margin-top: 8px !important;
  font-weight: 600;
}

.composer-tools {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px 0;
}

.tool-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tool-field select,
.tool-field .cip-combo-input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  background: #f8fafc;
  font-size: 12px;
}

.tool-field .cip-combo {
  position: relative;
}

.tool-field .cip-combo-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: #eef2f7;
}

.tool-field .cip-combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 40;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(6, 38, 63, 0.12);
}

.tool-field .cip-combo-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.tool-field .cip-combo-item:hover,
.tool-field .cip-combo-item:focus {
  background: var(--accent-soft);
  outline: none;
}

.tool-field .cip-combo-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.composer-hint {
  padding: 8px 14px 0;
  font-size: 12px;
  color: #64748b;
}

.btn-ghost {
  width: auto !important;
  min-width: 120px;
  height: 52px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #e2e8f0;
}

.live-chat .composer {
  grid-template-columns: 1fr auto auto;
  align-items: end;
  padding-top: 8px;
  gap: 10px;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 2px;
}

.composer-toolbar-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.composer-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.composer-toolbar .emoji-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 16px;
}

.attach-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 8px;
}

.attach-bar[hidden] {
  display: none !important;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 12px;
}

.attach-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.attach-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
}

.tpl-wrap,
.attach-wrap {
  position: relative;
}

.tpl-panel {
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  width: min(420px, 70vw);
  max-height: min(360px, 45vh);
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  z-index: 6;
  overflow: hidden;
}

.tpl-panel.is-open {
  display: flex;
}

.tpl-panel[hidden] {
  display: none !important;
}

.tpl-head {
  padding: 10px 12px 6px;
  font-size: 13px;
  font-weight: 650;
}

.tpl-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--border);
}

.tpl-tab {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.tpl-tab.active {
  background: var(--accent-soft);
  border-color: #bfdbfe;
  color: #0284c7;
}

.tpl-list {
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tpl-item {
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tpl-item:hover {
  background: #f8fafc;
}

.tpl-item strong {
  font-size: 12px;
}

.tpl-item span {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tpl-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.msg-file {
  margin-top: 6px;
  font-size: 12px;
  padding: 4px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.msg-image {
  margin-top: 8px;
}

.msg-image-btn {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  max-width: 100%;
  text-align: left;
}

.msg-image img {
  display: block;
  max-width: min(280px, 100%);
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.04);
  transition: max-width 0.2s ease, max-height 0.2s ease;
}

.msg-image.is-expanded .msg-image-btn {
  cursor: zoom-out;
}

.msg-image.is-expanded img {
  max-width: min(720px, 100%);
  max-height: min(70vh, 640px);
}

.msg.student .msg-file,
.msg.system .msg-file {
  border-top-color: var(--border);
}

.live-chat .composer textarea {
  min-height: 96px;
  max-height: 240px;
  height: 120px;
  border-radius: 12px;
  resize: vertical;
  field-sizing: content; /* progressive; ignored if unsupported */
}

.send-btn {
  width: auto !important;
  min-width: 110px;
  height: 52px;
  border-radius: 12px;
}

.emoji-wrap {
  position: relative;
}

.composer-toolbar .emoji-panel {
  top: auto;
  bottom: calc(100% + 6px);
}

.emoji-panel {
  position: absolute;
  bottom: 52px;
  left: 0;
  width: 220px;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  z-index: 5;
}

.emoji-panel.is-open {
  display: grid;
}

.emoji-panel[hidden] {
  display: none !important;
}

.emoji-pick {
  border: none;
  background: #f8fafc;
  border-radius: 8px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
}

.emoji-pick:hover {
  background: var(--accent-soft);
}

.student-hero {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.svc-chip {
  cursor: pointer;
  border: 1px solid transparent;
}

.svc-chip.active-svc {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #0284c7;
}

.svc-list {
  margin-top: 8px;
}

.crm-link {
  color: #0ea5e9;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.crm-link:hover {
  text-decoration: underline;
}

.crm-link strong {
  color: #0ea5e9;
}

.svc-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.svc-crm-link {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eff6ff;
  color: #0ea5e9;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.svc-crm-link:hover {
  background: #dbeafe;
}

.hero-empty {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 15px;
}

@media (max-width: 1200px) {
  .live-chat {
    grid-template-columns: 220px 1fr 220px;
  }

  .composer-tools {
    grid-template-columns: 1fr;
  }
}

/* ——— Chat actions / transfer modal ——— */
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.btn-sm {
  height: 32px !important;
  min-width: 0 !important;
  width: auto !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
}

.btn-danger {
  background: #e11d48;
  color: #fff;
  border: none;
}

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

.live-chat .msg.system {
  align-self: center;
  max-width: 90%;
}

.live-chat .msg.system .bubble {
  background: #f1f5f9;
  color: #475569;
  border: 1px dashed #cbd5e1;
  box-shadow: none;
  font-size: 13px;
  text-align: center;
}

.live-chat .msg.system .when {
  text-align: center;
}

/* Автолог назначения — как в AutoFAQ: серая строка по центру */
.live-chat .msg.system.assign {
  max-width: 96%;
  margin: 10px 0;
}

.live-chat .msg.system.assign .bubble {
  background: transparent;
  border: none;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  color: #64748b;
  font-size: 12px;
  padding: 8px 12px;
}

.live-chat .msg.system.assign .when {
  color: #94a3b8;
  font-size: 11px;
}

.live-chat .msg.whisper {
  align-self: stretch;
  max-width: 92%;
}

.live-chat .msg.whisper .bubble {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  box-shadow: none;
  font-size: 13px;
}

.live-chat .msg.whisper .when {
  color: #b45309;
}

.live-chat .msg.whisper.note .bubble {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.live-chat .msg.whisper.note .when {
  color: #047857;
}

.live-chat .msg.whisper.summary .bubble {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #93c5fd;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
}

.live-chat .msg.whisper.summary .when {
  color: #1d4ed8;
}

/* Скрыто по умолчанию: .composer { display:grid } перебивает [hidden]. */
.note-composer {
  display: none !important;
  margin-bottom: 8px;
  align-items: stretch;
}

.note-composer.is-open {
  display: grid !important;
}

.note-composer textarea {
  min-height: 40px;
  max-height: 72px;
  height: 44px;
  resize: vertical;
  background: #f0fdf4;
  border-color: #a7f3d0;
  font-size: 13px;
  padding: 8px 10px;
}

.note-composer .send-btn {
  align-self: stretch;
  height: auto;
  min-height: 44px;
}

.note-composer .btn-ghost {
  border: 1px solid #6ee7b7;
  color: #065f46;
  background: #ecfdf5;
}

.note-composer .btn-ghost:hover {
  background: #d1fae5;
}

.emoji-btn.note-toggle.active {
  background: #d1fae5;
  color: #065f46;
  box-shadow: inset 0 0 0 1px #6ee7b7;
}

.listen-wrap .composer textarea {
  min-height: 56px;
  max-height: 96px;
}

.chip-listen {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}

.listen-wrap .listen-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: #64748b;
}

.team-block {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.team-block-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
  color: #334155;
}

.team-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.team-queue-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}

.team-queue-card.tone-ok {
  border-color: #86efac;
  background: #f0fdf4;
}

.team-queue-card.tone-warn {
  border-color: #fdba74;
  background: #fff7ed;
}

.team-queue-card.tone-danger {
  border-color: #fca5a5;
  background: #fef2f2;
}

.team-queue-card.tone-muted {
  background: #f8fafc;
}

.team-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.team-queue-badge {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.team-queue-name {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}

.team-queue-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  color: #475569;
}

.team-queue-stats .sla-hot {
  color: #b91c1c;
}

.empty-state.soft {
  padding: 12px 0;
  border: 0;
  background: transparent;
  color: #64748b;
}

.team-ops-table .online-chip {
  white-space: nowrap;
}

.online-board {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.online-board-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  color: #334155;
}

.online-board-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #e2e8f0;
  color: #475569;
}

.online-chip.tone-ok {
  background: #dcfce7;
  color: #166534;
}

.online-chip.tone-warn {
  background: #ffedd5;
  color: #9a3412;
}

.online-chip.tone-muted {
  background: #e2e8f0;
  color: #64748b;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.modal-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.modal-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.modal-sub {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.modal-note {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 13px;
  color: #334155;
}

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

.modal-actions .btn-ghost {
  height: 40px;
  min-width: 96px;
}

.editor-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.integ-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.integ-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.integ-tab.is-active {
  background: var(--accent-soft);
  border-color: #93c5fd;
  color: var(--accent);
  font-weight: 600;
}

.integ-pill {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 600;
}

.integ-summary {
  display: grid;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.integ-kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  font-size: 13px;
  align-items: start;
}

.integ-kv-k {
  color: #6b7385;
}

.integ-kv-v {
  color: var(--text);
  word-break: break-word;
}

.editor-grid label.full,
.editor-grid .full {
  grid-column: 1 / -1;
}

.mech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.mech-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.mech-card input {
  margin-top: 3px;
}

.mech-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.mech-card p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.mech-card.is-selected {
  border-color: #93c5fd;
  background: var(--accent-soft);
}

.mech-card.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.integ-log {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.tool-actions .tool-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 8px;
}

.quick-chip {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.quick-chip:hover {
  background: var(--accent-soft);
  border-color: #bfdbfe;
}

.scenario-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scenario-step {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}

.sc-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .sc-layout {
    grid-template-columns: 1fr;
  }
}

.sc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sc-list-item {
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.sc-list-item.is-active {
  border-color: #93c5fd;
  background: var(--accent-soft);
}

.sc-list-item strong {
  display: block;
  font-size: 13px;
}

.sc-editor h3 {
  margin: 0 0 12px;
}

.sc-error {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}

.sc-step-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}

.sc-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.sc-step-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.sc-step-grid label.full {
  grid-column: 1 / -1;
}

.sc-step-grid textarea {
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  font: inherit;
}

.sc-opts {
  margin-top: 10px;
}

.sc-opt-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}

.sc-opt-row input,
.sc-opt-row select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.sc-preview {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.sc-prev-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin-bottom: 8px;
}

.sc-prev-msg {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--border);
}

.sc-prev-msg.user {
  background: var(--accent-soft);
  border-color: #bfdbfe;
}

.sc-prev-msg.bot {
  background: #fff;
}

.sc-prev-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sla-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7385;
  white-space: nowrap;
}

.sla-input {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  background: #fff;
}

.sla-input:focus {
  outline: 2px solid #bfdbfe;
  border-color: #93c5fd;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  font-size: 13px;
  color: #4b5563;
}

.modal-card .filter-field {
  display: block;
  margin: 10px 0;
  font-size: 13px;
  color: #4b5563;
}

.modal-card .filter-field select,
.modal-card .filter-field textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  box-sizing: border-box;
}
