:root {
  --red: #b42318;
  --red-dark: #8b160f;
  --ink: #1c1412;
  --muted: #6d5b56;
  --line: #ead9d3;
  --paper: #fff8f4;
  --card: #ffffff;
  --sidebar: #2a1613;
  --ok: #157347;
  --warn: #b45309;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Manrope, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

h1,
h2,
h3 {
  font-family: Newsreader, Georgia, serif;
  margin: 0 0 0.35rem;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, #fde8e4, transparent 45%),
    var(--paper);
}

.auth-card,
.card,
.stat-card,
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(90, 24, 16, 0.06);
}

.auth-card {
  width: min(440px, 100%);
  padding: 36px 32px;
}

.auth-logo {
  width: 92px;
  height: auto;
  display: block;
  margin-bottom: 16px;
}

.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  margin: 0 0 8px;
}

.muted,
.sidebar-user p,
.stat-card em {
  color: var(--muted);
}

label {
  display: block;
  margin: 14px 0;
  font-size: 13px;
  font-weight: 600;
}

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

input,
select {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: #f3d4cd;
  border-color: transparent;
}

.btn.danger {
  color: var(--bad);
}

.error {
  color: var(--bad);
  min-height: 1.2em;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #f8ece9;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
}

.brand span {
  display: block;
  color: #e2c4bc;
  font-size: 12px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #f3d4cd;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-user {
  margin-top: auto;
}

.content {
  padding: 32px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card,
.card {
  padding: 20px;
}

.stat-card strong {
  display: block;
  font-size: 36px;
  line-height: 1.1;
  margin: 8px 0;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form input,
.inline-form select {
  width: auto;
  min-width: 180px;
  margin: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f3e7e3;
}

.badge.online,
.badge.delivered,
.badge.sent {
  background: #dcfce7;
  color: var(--ok);
}

.badge.pending,
.badge.queued,
.badge.sending {
  background: #ffedd5;
  color: var(--warn);
}

.badge.offline,
.badge.failed {
  background: #fee2e2;
  color: var(--bad);
}

.pairing-box {
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: 16px;
  background: #2a1613;
  color: #fff;
}

.pairing-code {
  font-size: 40px;
  letter-spacing: 0.28em;
  font-weight: 800;
}

.pairing-code.long {
  font-size: 15px;
  letter-spacing: 0;
  word-break: break-all;
}

.secret-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.secret-row .pairing-code {
  flex: 1;
  min-width: 0;
}

.secret-row .btn {
  flex-shrink: 0;
  margin: 0;
}

.copy-hint {
  margin: 0;
  color: #9ae6b4;
  font-size: 13px;
  font-weight: 700;
}

.steps {
  padding-left: 18px;
  line-height: 1.7;
}

pre {
  background: #1c1412;
  color: #f8ece9;
  padding: 16px;
  border-radius: 12px;
  overflow: auto;
  white-space: pre-wrap;
}

.card h3 {
  margin-top: 24px;
}

.card h3:first-of-type {
  margin-top: 16px;
}

.split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

@media (max-width: 960px) {
  .app-shell,
  .stat-grid,
  .split,
  .page-head,
  .inline-form {
    display: block;
  }

  .sidebar {
    min-height: auto;
  }

  .inline-form input,
  .inline-form select,
  .btn {
    width: 100%;
    margin-top: 8px;
  }
}
