:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: rgba(18, 24, 37, 0.82);
  --panel-solid: #111827;
  --line: rgba(255, 255, 255, 0.1);
  --muted: #96a1b7;
  --text: #f6f8fc;
  --brand: #ff6b5f;
  --brand-2: #ff9b63;
  --green: #4ade80;
  --danger: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 107, 95, 0.18), transparent 34rem),
    radial-gradient(circle at 85% 20%, rgba(78, 108, 255, 0.13), transparent 32rem),
    linear-gradient(180deg, #0b101b 0%, #080b12 55%);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 72px;
}

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

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

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  font-size: 21px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 30px rgba(255, 107, 95, 0.25);
}

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

h1 {
  margin-bottom: 4px;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: -0.03em;
}

.brand p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 11, 18, 0.45);
  font-size: 13px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7280;
}

.connection.online {
  color: #bbf7d0;
}

.connection.online .dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.1);
}

.ghost-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.ghost-button:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

.login-panel,
.dashboard {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-panel {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: clamp(28px, 6vw, 64px);
}

.eyebrow {
  margin-bottom: 14px;
  color: #ff9c8f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.login-copy h2 {
  margin-bottom: 14px;
  font-size: clamp(26px, 5vw, 42px);
  letter-spacing: -0.04em;
}

.login-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.login-form label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

.input-row {
  display: flex;
  gap: 9px;
}

.input-row input {
  min-width: 0;
  flex: 1;
  height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(4, 7, 12, 0.58);
}

.input-row input:focus {
  border-color: rgba(255, 107, 95, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 107, 95, 0.1);
}

.input-row button {
  height: 48px;
  padding: 0 19px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 700;
  cursor: pointer;
}

.input-row button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.error {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.dashboard {
  padding: clamp(18px, 4vw, 34px);
}

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 3px 22px;
  color: var(--muted);
  font-size: 13px;
}

.summary strong {
  margin: 0 4px 0 9px;
  color: var(--text);
  font-size: 24px;
}

.summary-note {
  text-align: right;
}

.empty-state {
  padding: 68px 22px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 17px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 16px;
  color: #ffaca3;
  background: rgba(255, 107, 95, 0.12);
  font-size: 26px;
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

.message-list {
  display: grid;
  gap: 12px;
}

.board-tools {
  display: none;
}

.slot-empty {
  display: none;
}

.message-card.empty-slot {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.012);
}

.message-card.empty-slot .message-head,
.message-card.empty-slot .message-title,
.message-card.empty-slot .message-body,
.message-card.empty-slot .client-time {
  display: none;
}

.message-card.empty-slot .slot-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: rgba(150, 161, 183, 0.35);
  font-size: clamp(13px, 1.3vw, 18px);
}

body.board-mode {
  overflow: hidden;
}

body.board-mode .topbar {
  display: none;
}

body.board-mode .shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

body.board-mode .dashboard {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 7px;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  backdrop-filter: none;
}

body.board-mode .summary {
  display: none;
}

body.board-mode .board-tools {
  position: fixed;
  top: 14px;
  right: 15px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.2;
  transition: opacity 160ms ease;
}

body.board-mode .board-tools:hover,
body.board-mode .board-tools:focus-within {
  opacity: 1;
}

.board-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #e5e7eb;
  font-size: 14px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.1);
}

.board-logout {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #e5e7eb;
  background: rgba(0, 0, 0, 0.78);
  cursor: pointer;
}

body.board-mode .message-list {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: 24dvh;
  gap: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

body.board-mode .message-list::-webkit-scrollbar {
  display: none;
}

body.board-mode .message-card {
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(10px, 1.15vw, 15px) clamp(13px, 1.5vw, 22px);
  overflow: hidden;
  border-color: #353535;
  background: #111;
  box-shadow: none;
}

body.board-mode .empty-state {
  flex: 1;
  display: grid;
  align-content: center;
  margin: 0;
}

body.board-mode .message-head,
body.board-mode .message-title,
body.board-mode .client-time,
body.board-mode .slot-empty {
  display: none;
}

body.board-mode .message-card.empty-slot .slot-empty {
  display: none;
}

body.board-mode .message-body {
  display: -webkit-box;
  width: 100%;
  flex: 0 1 auto;
  margin-bottom: 0;
  overflow: hidden;
  color: #f3f4f6;
  font-size: clamp(42px, 5.15vw, 56px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

body.board-mode .message-body.payment-line {
  white-space: nowrap;
}

body.board-mode .message-body.payment-line > span {
  display: inline-block;
  line-height: 1;
  vertical-align: baseline;
}

body.board-mode .message-body.payment-line > span + span {
  margin-left: 0.18em;
}

body.board-mode .payment-time {
  color: #b9c0cc;
  font-size: 0.34em;
  font-weight: 600;
}

body.board-mode .payment-app {
  color: #ffffff;
  font-size: 0.8em;
  font-weight: 900;
}

body.board-mode .payment-action {
  color: #dfe4ec;
  font-size: 0.42em;
  font-weight: 600;
}

body.board-mode .payment-amount {
  color: #ffffff;
  font-size: 1.18em;
  font-weight: 900;
}

body.board-mode .app-badge {
  padding: 2px 8px;
  border-color: #6b5a00;
  color: #ffe45c;
  background: #1f1b00;
  font-size: clamp(14px, 1.5vw, 19px);
  font-weight: 800;
}

body.board-mode .received-time {
  color: #d1d5db;
  font-size: clamp(15px, 1.45vw, 19px);
  font-weight: 700;
}

body.board-mode .client-time {
  display: none;
}

.message-card {
  padding: 20px 21px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  animation: enter 240ms ease-out;
}

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

.app-badge {
  padding: 5px 9px;
  border: 1px solid rgba(255, 107, 95, 0.25);
  border-radius: 7px;
  color: #ffb3aa;
  background: rgba(255, 107, 95, 0.1);
  font-size: 12px;
}

.received-time,
.client-time {
  color: var(--muted);
  font-size: 12px;
}

.message-title {
  margin-bottom: 9px;
  font-size: 17px;
  line-height: 1.45;
}

.message-body {
  margin-bottom: 0;
  color: #d6ddeb;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.client-time {
  margin: 12px 0 0;
}

.hidden {
  display: none !important;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1040px);
    padding-top: 22px;
  }

  .topbar,
  .summary {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .login-panel {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 28px 22px;
  }

  .summary {
    flex-direction: column;
    gap: 7px;
  }

  .summary-note {
    text-align: left;
  }

  .message-card {
    padding: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-card {
    animation: none;
  }
}
