:root {
  --ink: #17211c;
  --muted: #68746e;
  --line: rgba(23, 33, 28, 0.1);
  --paper: rgba(255, 255, 252, 0.82);
  --green: #0f9d68;
  --green-deep: #08704a;
  --green-soft: #e4f6ed;
  --amber: #d89322;
  --red: #b94646;
  --shadow: 0 20px 70px rgba(26, 65, 46, 0.1);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(118, 220, 166, 0.2), transparent 32rem),
    radial-gradient(circle at 90% 2%, rgba(246, 207, 111, 0.15), transparent 28rem),
    #f4f7f3;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input { font: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.28;
}

.ambient-one { left: -8rem; bottom: -4rem; background: #4bd493; }
.ambient-two { right: -9rem; top: 12rem; background: #f1c865; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 30px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.eyebrow, .kicker {
  margin: 0 0 8px;
  color: var(--green-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(38px, 6vw, 72px);
  font-weight: 720;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.lead {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-status {
  display: flex;
  min-width: 180px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
}

.hero-status small, .hero-status strong { display: block; }
.hero-status small { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.hero-status strong { font-size: 14px; }

.status-dot, .mini-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b8c0bc;
  box-shadow: 0 0 0 5px rgba(184, 192, 188, 0.14);
}

.status-dot.good, .mini-dot.good { background: var(--green); box-shadow: 0 0 0 5px rgba(15, 157, 104, 0.13); }
.status-dot.warn, .mini-dot.warn { background: var(--amber); box-shadow: 0 0 0 5px rgba(216, 147, 34, 0.13); }
.status-dot.bad, .mini-dot.bad { background: var(--red); box-shadow: 0 0 0 5px rgba(185, 70, 70, 0.12); }

.notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(216, 147, 34, 0.22);
  border-radius: 16px;
  color: #6d582f;
  background: rgba(255, 248, 226, 0.72);
  font-size: 13px;
  line-height: 1.55;
}

.view-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.62);
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 720;
}

.view-tab.active { color: #fff; background: var(--green-deep); }
.view-tab span { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 10px; }

.session-switcher { margin-bottom: 18px; padding: 26px; }
.button.compact { width: auto; }
.session-list { display: grid; gap: 10px; margin-top: 20px; }
.session-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}
.session-card strong, .session-card small { display: block; }
.session-card strong { margin-bottom: 6px; overflow-wrap: anywhere; }
.session-card small { color: var(--muted); line-height: 1.5; }
.session-card .button { width: auto; min-width: 92px; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.login-panel, .control-panel { padding: 26px; }

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.badge, .counter {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green-deep);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}

.badge.muted { color: var(--muted); background: #edf0ee; }
.badge.warn { color: #8d5e0c; background: #fff0cb; }
.badge.bad { color: #923737; background: #fce5e5; }

.qr-stage {
  display: grid;
  min-height: 292px;
  place-items: center;
  margin: 22px 0 16px;
  overflow: hidden;
  border: 1px dashed rgba(15, 157, 104, 0.24);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(229, 247, 238, 0.78), rgba(255, 255, 255, 0.7));
}

.qr-stage img {
  width: 238px;
  height: 238px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(12, 79, 51, 0.12);
}

.qr-placeholder {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(15, 157, 104, 0.15);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.account-summary span { color: var(--muted); }
.hint { min-height: 42px; margin: 13px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.button {
  width: 100%;
  padding: 12px 17px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 720;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button.primary { color: #fff; background: linear-gradient(135deg, var(--green), var(--green-deep)); }
.button.secondary { color: var(--green-deep); background: var(--green-soft); }
.button.ghost { color: var(--muted); background: #f0f2f1; }
.button.danger { color: var(--red); }
.button.danger.armed { color: #fff; background: var(--red); }

.model-card {
  display: grid;
  gap: 6px;
  margin: 26px 0 18px;
  padding: 20px;
  border-radius: 18px;
  color: white;
  background:
    linear-gradient(135deg, rgba(8, 112, 74, 0.96), rgba(18, 156, 104, 0.9)),
    #08704a;
}

.model-card span, .model-card small { opacity: 0.72; font-size: 12px; }
.model-card strong { font-size: 16px; overflow-wrap: anywhere; }

.source-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.source-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
}

.source-row + .source-row { border-top: 1px solid var(--line); }
.source-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--green-deep); background: var(--green-soft); font-weight: 800; }
.source-row strong, .source-row small { display: block; }
.source-row strong { margin-bottom: 4px; font-size: 14px; }
.source-row small { color: var(--muted); font-size: 11px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

.timeline-panel { padding: 26px; }
.timeline-heading { align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.counter { color: var(--muted); background: #edf0ee; }

.timeline { display: grid; gap: 12px; padding-top: 18px; }
.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.empty-state span { color: var(--green); font-size: 28px; }
.empty-state p { max-width: 520px; margin: 0; font-size: 13px; line-height: 1.7; }

.timeline-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.62);
}

.channel-chip { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--green-deep); background: var(--green-soft); font-weight: 800; }
.item-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; font-size: 12px; }
.item-meta strong { font-size: 13px; }
.item-meta time, .item-meta span { color: var(--muted); }
.item-text { margin: 0; font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-box { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--green); border-radius: 4px 12px 12px 4px; background: var(--green-soft); }
.reply-box small { display: block; margin-bottom: 5px; color: var(--green-deep); font-weight: 700; }
.reply-box p { margin: 0; font-size: 13px; line-height: 1.65; }
.reply-state { display: inline-flex; margin-top: 8px; padding: 4px 8px; border-radius: 999px; color: var(--muted); background: #edf0ee; font-size: 10px; font-weight: 700; }
.reply-state.confirmed { color: var(--green-deep); background: #d9f3e6; }
.reply-state.failed, .reply-state.submitted_unknown { color: #923737; background: #fce5e5; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 4px 0;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 620px); padding-top: 28px; }
  .hero { display: grid; }
  .hero-status { width: 100%; }
  .notice { grid-template-columns: 1fr; gap: 6px; }
  .dashboard { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  footer { display: grid; }
}
