:root {
  --bg: #07090f;
  --panel: #0f121b;
  --panel2: #151925;
  --line: #22283a;
  --txt: #e8edf7;
  --dim: #8b95ab;
  --ok: #3dd6a5;
  --warn: #ffb547;
  --danger: #ff6b7a;
  --cyan: #3ad4e6;
  --accent: #67d0a8;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--txt);
  background-image:
    radial-gradient(
      80% 50% at 10% -10%,
      rgba(103, 208, 168, 0.12),
      transparent 55%
    ),
    radial-gradient(
      70% 40% at 100% 0%,
      rgba(58, 212, 230, 0.08),
      transparent 50%
    );
}
.hidden {
  display: none !important;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--panel2);
  color: var(--txt);
  border: 1px solid var(--line);
}
button:hover {
  border-color: var(--accent);
}
button.ok {
  background: linear-gradient(120deg, #33d9a6, #2aa7c4);
  color: #04120c;
  font-weight: 700;
  border: 0;
}
button.warn {
  background: rgba(255, 181, 71, 0.12);
  color: var(--warn);
  border-color: rgba(255, 181, 71, 0.35);
}
button.danger {
  background: rgba(255, 107, 122, 0.12);
  color: var(--danger);
  border-color: rgba(255, 107, 122, 0.35);
}
button.ghost {
  background: transparent;
}

.login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  width: min(420px, 100%);
  background: linear-gradient(
    180deg,
    rgba(20, 24, 36, 0.95),
    rgba(12, 14, 22, 0.95)
  );
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.brand span {
  color: var(--accent);
}
.sub {
  color: var(--dim);
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0 18px;
}
label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--dim);
  margin-bottom: 8px;
}
input {
  width: 100%;
  background: #0a0c14;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 12px;
  padding: 14px 14px;
  outline: none;
}
input:focus {
  border-color: var(--accent);
}
#loginBtn {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(120deg, #33d9a6, #2aa7c4);
  color: #04120c;
  font-weight: 800;
  border: 0;
  padding: 14px;
}
.err {
  color: var(--danger);
  min-height: 18px;
  margin-top: 12px;
  font-size: 13px;
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "header header"
    "aside main";
}
header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 12, 20, 0.9);
  backdrop-filter: blur(10px);
}
.hdr-meta {
  flex: 1;
  color: var(--dim);
  font-size: 12px;
}
aside {
  grid-area: aside;
  border-right: 1px solid var(--line);
  overflow: auto;
  background: rgba(10, 12, 18, 0.7);
  padding: 10px;
}
main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}
.num-item {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  padding: 12px;
  background: var(--panel);
}
.num-item.on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(103, 208, 168, 0.25);
}
.num-item .n {
  font-weight: 700;
  font-size: 14px;
}
.num-item .s {
  color: var(--dim);
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.4;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  margin-right: 6px;
}
.dot.live {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.dot.busy {
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}
.dot.off {
  background: var(--danger);
}

.empty {
  color: var(--dim);
  text-align: center;
  padding: 60px 20px;
  font-size: 14px;
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-head h1 {
  font-size: 24px;
  letter-spacing: -0.3px;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: var(--panel);
}
.pill.live {
  color: var(--ok);
  border-color: rgba(61, 214, 165, 0.35);
}
.pill.busy {
  color: var(--warn);
  border-color: rgba(255, 181, 71, 0.35);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.stat b {
  display: block;
  font-size: 18px;
  margin-top: 4px;
}
.stat span {
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.priority-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.priority-box label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--dim);
  margin-bottom: 8px;
}
.priority-box textarea {
  width: 100%;
  min-height: 110px;
  background: #0a0c14;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 10px;
  padding: 10px;
  font:
    12px/1.4 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  resize: vertical;
  margin-bottom: 8px;
}
.chat-item .prio {
  margin-top: 8px;
  font-size: 11px;
  padding: 6px 8px;
  color: var(--warn);
  border-color: rgba(255, 181, 71, 0.35);
  background: rgba(255, 181, 71, 0.08);
}
.msg {
  min-height: 18px;
  color: var(--cyan);
  font-size: 13px;
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--dim);
  padding: 10px 12px;
}
.tab.on {
  color: var(--txt);
  border-bottom-color: var(--accent);
}
.tabpane {
  display: none;
}
.tabpane.on {
  display: block;
}

.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
  min-height: 480px;
}
.list {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: var(--panel);
  max-height: 70vh;
}
.chat-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px;
  background: transparent;
}
.chat-item:hover,
.chat-item.on {
  background: var(--panel2);
}
.chat-item .t {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item .m {
  color: var(--dim);
  font-size: 11px;
  margin-top: 3px;
}
.chatview {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: auto;
  max-height: 70vh;
  padding: 14px;
}
.msg-row {
  margin-bottom: 12px;
  max-width: 85%;
}
.msg-row.me {
  margin-left: auto;
}
.msg-row .meta {
  color: var(--dim);
  font-size: 10px;
  margin-bottom: 3px;
}
.msg-row .bubble {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-row.me .bubble {
  background: rgba(58, 212, 230, 0.1);
  border-color: rgba(58, 212, 230, 0.25);
}

.media-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chip {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--dim);
}
.chip.on {
  color: var(--txt);
  border-color: var(--accent);
  background: rgba(103, 208, 168, 0.1);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.media-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.media-card:hover {
  border-color: var(--accent);
}
.media-card .thumb {
  height: 120px;
  background: #0a0c14;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--dim);
  font-size: 12px;
}
.media-card .thumb img,
.media-card .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-card .cap {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  min-height: 420px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viewer img,
.viewer video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 10px;
}
.viewer audio {
  width: min(520px, 100%);
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto 1fr;
    grid-template-areas:
      "header"
      "aside"
      "main";
  }
  aside {
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .split {
    grid-template-columns: 1fr;
  }
}
