
:root {
  --bg: #07120f;
  --surface: rgba(255, 255, 255, 0.045);
  --paper: #e8e8df;
  --muted: rgba(232, 232, 223, 0.66);
  --line: rgba(232, 232, 223, 0.12);
  --lime: #c7ff42;
  --danger: #ff8f8f;
  --ok: #77d7a8;
  --radius: 22px;
  --radius-sm: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Manrope", Inter, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(39, 90, 73, 0.45), transparent 40%),
    radial-gradient(circle at 20% 20%, rgba(199, 255, 66, 0.08), transparent 24%),
    var(--bg);
  font-family: var(--sans);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(232, 232, 223, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 232, 223, 0.09) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: rgba(232, 232, 223, 0.58);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 4vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

h2, h3 {
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.subtitle {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.login-panel {
  max-width: 560px;
  margin: 8vh auto 0;
}

.login-card {
  padding: 28px;
}

.dashboard {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.sidebar,
.thread-panel {
  min-height: 72vh;
}

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

.panel-head h3 {
  margin-bottom: 0;
  font-size: 24px;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(232, 232, 223, 0.62);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--paper);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(199, 255, 66, 0.6);
  box-shadow: 0 0 0 4px rgba(199, 255, 66, 0.1);
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--paper);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.065);
  border-color: rgba(232, 232, 223, 0.2);
}

.btn--primary {
  background: var(--lime);
  color: var(--bg);
  border-color: transparent;
}

.btn--primary:hover {
  background: #d7ff68;
}

.btn--ghost {
  color: var(--paper);
}

.btn--danger {
  color: #ffd8d8;
  border-color: rgba(255, 143, 143, 0.22);
}

.btn--small {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
}

.badge--muted { color: rgba(232, 232, 223, 0.72); }
.badge--new { background: rgba(199, 255, 66, 0.14); color: var(--lime); }
.badge--open { background: rgba(122, 162, 255, 0.14); color: #cfe0ff; }
.badge--closed { background: rgba(255, 143, 143, 0.12); color: #ffd0d0; }
.badge--error { background: rgba(255, 143, 143, 0.14); color: #ffd0d0; }

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.list,
.user-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.chat-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--paper);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chat-item:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 232, 223, 0.2);
  background: rgba(255, 255, 255, 0.045);
}

.chat-item--active {
  border-color: rgba(199, 255, 66, 0.6);
  box-shadow: 0 0 0 4px rgba(199, 255, 66, 0.08);
}

.chat-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.chat-item__top strong {
  font-size: 15px;
  line-height: 1.2;
}

.chat-item__meta,
.chat-item__preview,
.user-row__meta,
.thread-meta,
.tiny,
.muted {
  color: var(--muted);
}

.chat-item__meta {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.chat-item__preview {
  line-height: 1.55;
  font-size: 14px;
}

.thread-panel {
  display: flex;
  flex-direction: column;
}

.thread-meta {
  padding: 18px 18px 0;
  line-height: 1.65;
}

.messages {
  flex: 1;
  display: grid;
  gap: 12px;
  padding: 18px;
  align-content: start;
}

.message {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 14px 14px 16px;
}

.message--admin {
  background: rgba(199, 255, 66, 0.08);
  border-color: rgba(199, 255, 66, 0.18);
}

.message__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: rgba(232, 232, 223, 0.58);
}

.message__body {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 15px;
}

.reply-form {
  padding: 0 18px 18px;
  display: grid;
  gap: 14px;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 14px;
}

.user-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.user-row__meta {
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.status {
  margin-top: 16px;
  min-height: 1.2rem;
  color: var(--muted);
}

.status--ok { color: var(--ok); }
.status--error { color: var(--danger); }

.tiny {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

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

  .sidebar,
  .thread-panel {
    min-height: auto;
  }
}

@media (max-width: 700px) {
  .app {
    padding: 18px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .panel-head {
    padding: 16px;
  }

  .list,
  .user-list,
  .messages,
  .thread-meta,
  .reply-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .login-card {
    padding: 20px;
  }
}

