:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66737f;
  --line: #dce3e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #b7791f;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.toolbar,
.stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

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

.icon-button,
.text-button,
.primary-button,
.tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.icon-button {
  width: 40px;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.icon-button.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.text-button,
.primary-button,
.tab {
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stats article {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats span,
.status-line,
.message-meta,
.device {
  color: var(--muted);
  font-size: 13px;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.toolbar {
  margin: 12px 0;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  min-width: 82px;
}

.tab.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: #d9f0ed;
  color: var(--accent-strong);
}

.status-line {
  margin: 0;
}

.messages {
  display: grid;
  gap: 12px;
}

.message-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.message-card.handled {
  opacity: 0.72;
}

.message-meta,
.message-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account,
.platform {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.account {
  background: #e5f4f1;
  color: var(--accent-strong);
}

.platform {
  background: #fff2d8;
  color: var(--warn);
}

.message-card h2 {
  margin: 12px 0 8px;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.message-card p {
  margin: 0 0 14px;
  color: #2b3842;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-footer {
  justify-content: space-between;
}

.empty {
  padding: 28px;
  border: 1px dashed #b7c4cc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-align: center;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 22px;
  font-size: 30px;
}

.login-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.login-panel input {
  width: 100%;
  height: 44px;
  margin-bottom: 14px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.login-error {
  display: none;
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 14px;
}

.login-page {
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.08), rgba(183, 121, 31, 0.08)),
    var(--bg);
}

.login-error.visible {
  display: block;
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 18px;
  }

  .topbar,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .message-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
