:root {
  --bg-1: #f3efe4;
  --bg-2: #dce6f2;
  --ink: #1d2433;
  --card: rgba(255, 255, 255, 0.9);
  --line: rgba(29, 36, 51, 0.18);
  --muted: #526071;
  --brand: #c4432f;
  --brand-2: #2f6cc4;
  --ok: #2c7a48;
  --danger: #9c2a2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  min-height: 100vh;
  background: linear-gradient(130deg, var(--bg-1), var(--bg-2));
}

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.page-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(196, 67, 47, 0.18), transparent 33%),
    radial-gradient(circle at 88% 8%, rgba(47, 108, 196, 0.18), transparent 28%),
    radial-gradient(circle at 85% 75%, rgba(44, 122, 72, 0.15), transparent 35%);
  pointer-events: none;
}

.shell {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
}

.me-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.65);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
}

.card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  backdrop-filter: blur(4px);
  box-shadow: 0 14px 36px rgba(21, 25, 34, 0.08);
}

.no-access {
  padding: 24px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
}

.tab.is-active {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}

.tab-content {
  padding: 16px;
}

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

.row-wrap {
  flex-wrap: wrap;
}

.row-between {
  justify-content: space-between;
}

.row-end {
  justify-content: flex-end;
}

.row-gap-top {
  margin-top: 10px;
}

h2 {
  margin: 0;
  font-size: 20px;
}

h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}

label {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
}

textarea {
  resize: vertical;
}

button {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.primary-btn {
  border-color: transparent;
  background: linear-gradient(95deg, var(--brand), #e06f4c);
  color: #fff;
  font-weight: 600;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.78);
}

.danger-btn {
  border-color: transparent;
  background: linear-gradient(95deg, var(--danger), #c94242);
  color: #fff;
  font-weight: 600;
}

.status-pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.support-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
}

.support-threads,
.support-thread-view {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.threads-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.thread-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  cursor: pointer;
  background: #fff;
}

.thread-item.is-active {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 1px rgba(47, 108, 196, 0.28) inset;
}

.thread-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.thread-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-status {
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
}

.thread-last {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 8px;
}

.messages {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 340px;
  max-height: 470px;
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  max-width: 82%;
}

.msg .meta {
  font-size: 11px;
  margin-top: 4px;
}

.msg.admin {
  margin-left: auto;
  background: #f6f2ff;
  border-color: rgba(72, 42, 123, 0.24);
}

.msg.user {
  margin-right: auto;
  background: #f8fff7;
  border-color: rgba(44, 122, 72, 0.22);
}

.broadcast-layout {
  display: grid;
  grid-template-columns: 320px 340px minmax(300px, 1fr);
  gap: 14px;
}

.broadcast-create,
.broadcast-list,
.broadcast-details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.jobs-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.job-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  background: #fff;
}

.job-item.is-active {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 1px rgba(47, 108, 196, 0.28) inset;
}

.job-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.job-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-status {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
}

.job-totals {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 8px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-weight: 700;
  font-size: 20px;
}

.attempts {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attempt-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
}

.status-bar {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 7px 12px;
}

@media (max-width: 1220px) {
  .support-layout,
  .broadcast-layout {
    grid-template-columns: 1fr;
  }

  .threads-list,
  .jobs-list {
    max-height: 280px;
  }

  .messages,
  .attempts {
    max-height: 300px;
  }
}
