:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --ok: #16a34a;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #0b1224, #1a2744 50%, #0f172a);
  color: var(--text);
  min-height: 100vh;
}
#app { display: flex; min-height: 100vh; }
.side {
  width: 210px;
  min-width: 210px;
  background: linear-gradient(180deg, #2360c4 0%, #1f56af 100%);
  border-right: 0;
  box-shadow: 8px 0 28px rgba(20, 54, 108, .18);
  padding: 14px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  color: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 10px;
}
.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex: 0 0 auto;
}
.brandtext b { display: block; font-size: .95rem; color: #fff; }
.brandtext small { color: rgba(255,255,255,.78); font-size: .72rem; }
.side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 4px 8px;
  scrollbar-width: thin;
}
.side nav button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: .92rem;
  font-weight: 600;
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}
.side nav button .navicon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.side nav button .navicon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}
.side nav button .navlabel { color: #fff; white-space: nowrap; }
.side nav button:hover {
  background: rgba(255,255,255,.10);
  transform: translateX(2px);
}
.side nav button.active {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.side nav button.nav-logout { margin-top: 6px; opacity: .92; font-weight: 500; }
.userbox {
  font-size: .75rem;
  color: rgba(255,255,255,.82);
  border-top: 1px solid rgba(255,255,255,.18);
  padding: 8px 8px 4px;
  line-height: 1.35;
}
.userbox b { color: #fff; }
.system-owner {
  flex: 0 0 auto;
  padding: 8px 6px 14px;
  color: #fff;
  text-align: center;
  font-size: 10px;
  line-height: 1.35;
}
.system-owner-box {
  border: 1px solid rgba(255,255,255,.92);
  padding: 8px 7px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.02);
}
.system-owner-box strong { font-weight: 800; }
.system-owner-site {
  appearance: none;
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 10px;
  cursor: pointer;
}
.system-owner-site:hover { text-decoration: underline; opacity: .92; }
.about-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(19,34,51,.48);
  backdrop-filter: blur(3px);
}
.about-modal.hidden { display: none; }
.about-card {
  position: relative;
  width: min(480px, 94vw);
  background: #fff;
  border: 1px solid #dfe7ef;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(14,36,61,.24);
  padding: 28px 30px 22px;
  text-align: center;
  color: #15344f;
}
.about-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #748494;
  font-size: 24px;
  cursor: pointer;
}
.about-close:hover { background: #eef3f8; color: #233b51; }
.about-logo-wrap { display: flex; justify-content: center; margin: 6px 0 16px; }
.about-logo-mark {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(180deg, #2360c4, #1f56af);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
}
.about-card h2 { margin: 0 0 16px; color: #15344f; }
.about-owner-text {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 16px;
  border-radius: 12px;
  background: #f6f9fc;
  border: 1px solid #e0e8f0;
}
.about-owner-text span { color: #66798a; }
.about-owner-text strong { font-size: 1.1rem; color: #1d3c59; }
.about-owner-text button {
  border: 0;
  background: transparent;
  color: #2f6fdc;
  cursor: pointer;
  padding: 3px 5px;
}
.about-owner-text button:hover { text-decoration: underline; }
.about-version {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e7edf3;
  color: #718292;
  font-size: .9rem;
}
.about-version b { color: #315f9d; }
main { flex: 1; padding: 18px 22px; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.top h1 { margin: 0; font-size: 1.4rem; }
.top p { margin: 4px 0 0; color: var(--muted); }
.panel {
  background: rgba(30, 41, 59, .85);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.card {
  background: rgba(15, 23, 42, .55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.card b { font-size: 1.4rem; display: block; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, textarea, select {
  background: #0f172a;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
}
button.primary, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}
button.soft {
  background: #334155;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.hidden { display: none !important; }
.banner {
  background: #78350f;
  color: #ffedd5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .9rem;
}
.list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15,23,42,.45);
  cursor: pointer;
}
.item:hover { border-color: var(--accent); }
.cols { display: grid; grid-template-columns: 280px 1fr; gap: 12px; }
.msg {
  padding: 8px 10px;
  border-radius: 10px;
  margin: 6px 0;
  max-width: 80%;
  white-space: pre-wrap;
}
.msg.me { background: #1d4ed8; margin-left: auto; }
.msg.them { background: #334155; }
#toast {
  position: fixed; right: 16px; bottom: 16px;
  background: #022c22; color: #a7f3d0; padding: 10px 14px;
  border-radius: 10px; display: none;
}
.login-wrap { max-width: 380px; margin: 40px auto; }
.kanban { display: flex; gap: 10px; overflow-x: auto; }
.kanban .col { min-width: 200px; background: rgba(15,23,42,.5); border-radius: 12px; padding: 8px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; font-size: .9rem; vertical-align: top; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: lowercase;
}
.badge.ok { background: rgba(22,163,74,.25); color: #86efac; }
.badge.warn { background: rgba(245,158,11,.25); color: #fcd34d; }
.badge.bad { background: rgba(220,38,38,.25); color: #fca5a5; }
.tabs .active-tab, button.active-tab {
  background: rgba(59,130,246,.35) !important;
  outline: 1px solid var(--accent);
}
code { font-size: .8rem; color: #93c5fd; }
.muted { color: var(--muted); font-size: .85rem; }
.menu-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 60;
  width: 42px;
  height: 42px;
  padding: 0;
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 40;
}
.queue-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 12px;
  min-height: calc(100vh - 120px);
}
.queue-side { display: flex; flex-direction: column; min-height: 0; }
.queue-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.queue-filters select { flex: 1; min-width: 0; }
.queue-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 10px 0 8px;
  overflow-x: auto;
}
.qtab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 600;
  font-size: .8rem;
}
.qtab.active { color: #93c5fd; border-bottom-color: var(--accent); }
.qbadge {
  display: inline-block;
  min-width: 1.2rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(59,130,246,.25);
  color: #bfdbfe;
  font-size: .7rem;
  margin-left: 4px;
}
.queue-list { flex: 1; max-height: none; overflow: auto; }
.item.selected { border-color: var(--accent); background: rgba(59,130,246,.15); }
.queue-chat { min-height: 420px; }
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  body.nav-open .nav-backdrop { display: block; }
  #app { flex-direction: row; }
  .side {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.nav-open .side { transform: translateX(0); }
  .menu-toggle {
    background: #2360c4 !important;
    color: #fff !important;
  }
  main { padding: 56px 12px 16px; width: 100%; }
  .cols, .queue-layout { grid-template-columns: 1fr; }
  .queue-side { max-height: 48vh; }
  .queue-chat { min-height: 50vh; }
  .table { display: block; overflow-x: auto; }
}
@media (min-width: 901px) {
  .menu-toggle, .nav-backdrop { display: none !important; }
}
