:root {
  color-scheme: light;
  --bg: #edf5ff;
  --panel: #ffffff;
  --text: #111827;
  --muted: #7a8598;
  --line: #d9e3f2;
  --accent: #3f73ff;
  --accent-strong: #2d5ee8;
  --pink: #e93554;
  --green: #2fc66f;
  --card-blue: #eaf3ff;
  --shadow: 0 16px 36px rgba(48, 75, 120, 0.12);
  --shadow-soft: 0 8px 22px rgba(48, 75, 120, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #dfeeff 0%, #f7fbff 46%, #ffffff 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
  transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  background: var(--accent-strong);
  box-shadow: 0 10px 20px rgba(63, 115, 255, 0.18);
  transform: translateY(-1px);
}

button.secondary {
  color: var(--text);
  background: #eef3fb;
}

button.secondary:hover {
  background: #e1e9f5;
  box-shadow: none;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 28px 18px 110px;
}

.hidden {
  display: none !important;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.app-header h1,
.topbar h1 {
  margin: 0 0 6px;
  color: #2f48b6;
  font-size: clamp(28px, 6vw, 42px);
  letter-spacing: 0;
}

.app-header p,
.topbar p {
  margin: 0;
  color: var(--muted);
}

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

.connection {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 100px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a8afbd;
}

.connection.connected .dot {
  background: var(--green);
}

.connection.error .dot {
  background: var(--pink);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.app-content {
  position: relative;
}

.app-page {
  display: none;
  gap: 16px;
}

.app-page.active {
  display: grid;
}

.hero-banner {
  width: 100%;
  border: 0;
  border-radius: 24px;
  min-height: 138px;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-banner strong {
  display: block;
  color: #fff;
  font-size: clamp(32px, 8vw, 52px);
  line-height: 1.05;
}

.hero-banner span {
  display: block;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 12px;
  font-size: clamp(17px, 4vw, 26px);
  font-weight: 800;
}

.hero-banner em {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  background: #fff;
  border-radius: 999px;
  padding: 7px 13px;
  font-style: normal;
  font-size: 14px;
}

.tutorial-banner {
  background: linear-gradient(135deg, #35d37a, #22bc65);
}

.start-banner {
  background: linear-gradient(135deg, #3d7cff, #3a70ef);
}

.phone-art,
.tv-art {
  flex: 0 0 auto;
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  color: #fff;
  font-size: 40px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.16);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
}

.section-heading span {
  width: 6px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent);
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.feature-card {
  position: relative;
  min-height: 138px;
  padding: 22px 18px;
  border-radius: 22px;
  color: #26384d;
  background: linear-gradient(135deg, #f8fbff, #e8f2ff);
  box-shadow: var(--shadow-soft);
  text-align: left;
  overflow: hidden;
}

.feature-card:hover {
  color: #26384d;
  background: linear-gradient(135deg, #ffffff, #e3efff);
  box-shadow: var(--shadow);
}

.feature-card strong {
  display: block;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 900;
}

.feature-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.feature-card i {
  position: absolute;
  right: 18px;
  bottom: 10px;
  color: #ff9d17;
  font-style: normal;
  font-size: 58px;
  line-height: 1;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(980px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  align-items: end;
  min-height: 86px;
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(217, 227, 242, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 2px;
  color: #b8c0cd;
  background: transparent;
  box-shadow: none;
}

.nav-item span {
  font-size: 28px;
}

.nav-item strong {
  font-size: 16px;
}

.nav-item:hover,
.nav-item.active {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.nav-fab {
  justify-self: center;
  width: 86px;
  height: 86px;
  min-height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #406fff, #2f78ff);
  box-shadow: 0 18px 34px rgba(63, 115, 255, 0.34);
}

.nav-fab span {
  font-size: 38px;
}

.nav-fab.active {
  box-shadow: 0 18px 34px rgba(63, 115, 255, 0.42);
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-title {
  justify-content: flex-start;
  margin-bottom: 4px;
}

.account-meta {
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.section-title span {
  color: var(--muted);
  font-size: 14px;
}

.dropzone {
  display: grid;
  gap: 5px;
  min-height: 118px;
  place-content: center;
  text-align: center;
  border: 1px dashed #aeb7c8;
  border-radius: 16px;
  background: #f8fbff;
  cursor: pointer;
}

.source-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: #eef3fb;
}

.source-tab {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.source-tab.active,
.source-tab:hover {
  color: var(--text);
  background: #fff;
  box-shadow: 0 4px 10px rgba(31, 40, 56, 0.08);
  transform: none;
}

.rule-audio-source {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.rule-audio-source > span {
  color: var(--muted);
  font-size: 14px;
}

.compact-source-tabs {
  margin-bottom: 0;
}

.strategy-panel,
.config-card {
  border-radius: 6px;
  padding: 14px 12px;
  background: #fff;
  box-shadow: none;
}

.strategy-panel h2 {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0f5;
  font-size: 17px;
}

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

.strategy-list label {
  display: grid;
  grid-template-columns: auto 60px 1fr;
  align-items: center;
  gap: 8px;
  color: #111827;
  font-size: 14px;
}

.strategy-list input,
.strategy-list select {
  min-height: 30px;
  border-radius: 4px;
  padding: 5px 8px;
  text-align: center;
}

.strategy-list select {
  grid-column: 2 / -1;
  width: 100%;
  text-align: left;
}

.config-card-title {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0f5;
}

.config-card-title h2 {
  margin: 0;
  font-size: 17px;
}

.config-card-title small {
  color: #a2adbf;
  font-size: 13px;
  font-weight: 500;
}

.config-card-title > span {
  color: var(--muted);
}

.config-card-title button {
  min-height: 32px;
  border-radius: 5px;
  padding: 0 13px;
  font-size: 14px;
}

.config-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  color: #1f2937;
  font-size: 14px;
}

.config-card-meta strong {
  color: var(--accent-strong);
}

.config-card-meta span {
  margin-left: auto;
  color: var(--muted);
}

.config-card .config-detail {
  display: none;
  gap: 12px;
  padding-top: 10px;
}

.config-card.open .config-detail {
  display: grid;
}

.live-room-active {
  background: #f0efef;
}

.live-room-active .app-shell {
  max-width: none;
  padding: 0;
}

.live-room-active .app-header,
.live-room-active .bottom-nav {
  display: none;
}

.live-room-shell {
  min-height: 100vh;
  padding: 0 8px 22px;
  background: #f0efef;
}

.live-room-title {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 46px;
  margin: 0 -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  background: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
}

.live-room-status,
.live-room-barrage {
  margin-top: 10px;
  border-radius: 5px;
  background: #232432;
  color: #fff;
}

.live-room-status {
  padding: 15px 11px 16px;
}

.live-room-card-main {
  display: grid;
  gap: 12px;
}

.live-room-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-room-running {
  display: flex;
  align-items: end;
  gap: 5px;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.live-room-running span {
  width: 6px;
  height: 18px;
  display: inline-block;
  background: #fff;
}

.live-room-running span:nth-child(2) {
  height: 14px;
}

.live-room-running span:nth-child(3) {
  height: 20px;
}

.live-room-name {
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.live-room-message {
  color: #c6cfdf;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.live-room-bars {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 32px;
}

.live-room-bars span {
  width: 5px;
  height: 23px;
  background: #b6ff63;
  border-radius: 2px;
}

.live-room-bars span:nth-child(2) {
  height: 16px;
}

.live-room-bars span:nth-child(3) {
  height: 29px;
}

.live-room-bars span:nth-child(4) {
  height: 20px;
}

.live-room-bars span:nth-child(5) {
  height: 27px;
}

.live-room-bars span:nth-child(6) {
  height: 13px;
}

.live-room-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.live-room-actions button {
  width: auto;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #6e7079;
  font-size: 14px;
  white-space: nowrap;
  word-break: keep-all;
  letter-spacing: 0;
}

.live-room-actions button:last-child {
  border-radius: 4px;
  background: #72747c;
}

.live-room-barrage {
  min-height: calc(100vh - 178px);
  padding: 14px 15px 18px;
}

.live-room-barrage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.live-room-barrage h2 {
  margin: 0;
  font-size: 20px;
  white-space: nowrap;
}

#liveRoomStats {
  color: #bfc7d8;
  font-size: 12px;
  text-align: right;
}

.live-room-list {
  display: grid;
  align-content: start;
  gap: 11px;
  max-height: calc(100vh - 238px);
  overflow: auto;
}

.live-room-list.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #bfc7d8;
  border: 0;
  background: transparent;
}

.live-room-barrage-item {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: #a9ff5f;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

.live-room-barrage-item span {
  color: #fff;
}

.live-room-barrage-item.hit strong {
  color: #ffefff;
}

@media (max-width: 360px) {
  .live-room-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .live-room-actions {
    width: 100%;
  }

  .live-room-actions button {
    flex: 1;
  }
}

.library-source-panel {
  display: grid;
  gap: 10px;
}

.library-source-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.library-source-title strong {
  color: var(--text);
}

.library-select-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.library-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.library-select-item input {
  width: 18px;
  height: 18px;
}

.library-select-item span {
  display: grid;
  gap: 3px;
}

.library-select-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.dropzone input {
  display: none;
}

.dropzone span {
  color: var(--muted);
  font-size: 14px;
}

audio {
  width: 100%;
  margin-top: 14px;
}

.control-row,
.test-form,
.live-form,
.auth-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}

.auth-form input,
.auth-form button,
.auth-form .remember-row {
  width: 100%;
}

.auth-form .remember-row {
  justify-content: flex-start;
  min-height: 26px;
}

.auth-form .remember-row input {
  width: 18px;
  flex: 0 0 18px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-height: 42px;
}

.rule-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.rule-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 13px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: rgba(63, 115, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(63, 115, 255, 0.12);
}

.test-form input,
.live-form input,
.auth-form input {
  flex: 1 1 260px;
}

.rules-list,
.barrage-list,
.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  max-height: 310px;
  overflow: auto;
}

.empty {
  min-height: 82px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.rule-item,
.barrage-item,
.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.rule-item strong,
.barrage-item strong {
  display: block;
}

.meta,
.listen-info {
  color: var(--muted);
  font-size: 14px;
}

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

.keyword {
  color: var(--accent-strong);
}

.hit {
  border-color: rgba(63, 115, 255, 0.45);
  background: #f4f8ff;
}

.profile-grid {
  display: grid;
  gap: 14px;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  color: var(--text);
  text-decoration: none;
}

.profile-card strong {
  font-size: 18px;
}

.profile-card span {
  color: var(--muted);
}

button.profile-card {
  width: 100%;
  min-height: 0;
  color: var(--text);
  background: #fff;
  text-align: left;
  font-weight: inherit;
}

button.profile-card:hover {
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-soft);
  transform: none;
}

.script-shell {
  display: grid;
  gap: 12px;
  min-height: calc(100vh - 140px);
  padding: 0 0 12px;
  background: #f4f2f2;
  border-radius: 18px;
  overflow: hidden;
}

.script-titlebar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 54px;
  padding: 0 10px;
  background: #fff;
  text-align: center;
}

.script-titlebar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.ghost-button {
  color: #26384d;
  background: transparent;
  box-shadow: none;
  font-size: 28px;
  padding: 0;
}

.ghost-button:hover {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}

.script-tabs {
  display: flex;
  gap: 6px;
  padding: 0 12px;
}

.script-tab {
  min-height: 40px;
  border-radius: 5px;
  padding: 0 12px;
  color: #26384d;
  background: #fff;
  box-shadow: none;
  font-weight: 500;
}

.script-tab.active {
  color: #fff;
  background: #63b7f4;
}

.script-tab:hover {
  transform: none;
  box-shadow: none;
}

.add-script-button {
  margin: 14px 12px 0;
  border-radius: 3px;
  min-height: 38px;
  background: #314a6d;
  font-weight: 700;
}

.script-list {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.reply-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 12px 0;
}

.reply-tab {
  flex: 0 0 auto;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 18px;
  color: #111;
  background: #fff;
  box-shadow: none;
  font-weight: 500;
}

.reply-tab.active {
  color: #fff;
  background: #29405f;
}

.reply-tab:hover {
  transform: none;
  box-shadow: none;
}

.reply-list {
  display: grid;
  gap: 10px;
  padding: 0 12px;
}

.reply-card {
  display: grid;
  gap: 16px;
  padding: 14px 10px 10px;
  border-radius: 5px;
  background: #fff;
}

.reply-keywords {
  color: #40444c;
  line-height: 1.65;
}

.reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.pill.white {
  color: #111;
  background: #f3f3f3;
}

.reply-more {
  color: #777;
  text-align: center;
  padding: 2px 0 18px;
}

.script-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  background: #fff;
  border-radius: 5px;
}

.script-card {
  display: grid;
  gap: 12px;
  padding: 10px;
  border-radius: 5px;
  background: #fff;
}

.script-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.script-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.pill {
  min-height: 24px;
  border-radius: 999px;
  padding: 0 16px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
}

.pill:hover {
  transform: none;
  box-shadow: none;
}

.pill.yellow {
  color: #c58b00;
  background: #fff59a;
}

.pill.cyan {
  color: #37a9df;
  background: #b9f0ff;
}

.pill.green {
  color: #009f8d;
  background: #8ff4d8;
}

.pill.blue {
  color: #fff;
  background: #64baf2;
}

.pill.red {
  color: #ff2b50;
  background: #ffe0e9;
}

.pill.wide {
  min-width: 86px;
}

.script-time {
  justify-self: end;
  color: #b6bbc5;
  font-size: 12px;
}

.auth-panel {
  padding: 0;
  overflow: hidden;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  min-height: 420px;
}

.auth-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 42px;
  border-right: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(63, 115, 255, 0.14), rgba(47, 198, 111, 0.12)), #fff;
}

.eyebrow {
  width: fit-content;
  color: var(--accent-strong);
  background: #eef4ff;
  border: 1px solid rgba(63, 115, 255, 0.18);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 900;
}

.auth-copy h2 {
  margin: 0;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.08;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.auth-points {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-points span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: #364154;
  background: rgba(255, 255, 255, 0.74);
  font-weight: 800;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.auth-card {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 42px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  background: #eef3fb;
  border-radius: 14px;
}

button.tab {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

button.tab.active,
button.tab:hover {
  color: var(--text);
  background: #fff;
  box-shadow: 0 4px 10px rgba(31, 40, 56, 0.08);
  transform: none;
}

.admin-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.stat-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fafcff;
}

.stat-item strong {
  display: block;
  font-size: 24px;
}

.stat-item span {
  color: var(--muted);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}

textarea:focus {
  border-color: rgba(63, 115, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(63, 115, 255, 0.12);
}

.admin-body {
  background: #f5f8fc;
}

.admin-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 18px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 44px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.admin-brand {
  display: grid;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-brand strong {
  color: #2f48b6;
  font-size: 24px;
}

.admin-brand span {
  color: var(--muted);
}

.admin-menu {
  display: grid;
  gap: 8px;
  align-content: start;
}

.admin-menu-item {
  justify-content: flex-start;
  width: 100%;
  border-radius: 12px;
  color: #334155;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.admin-menu-item.active,
.admin-menu-item:hover {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 18px rgba(63, 115, 255, 0.18);
  transform: none;
}

.admin-logout {
  align-self: end;
}

.admin-main {
  display: grid;
  gap: 16px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-topbar h1 {
  margin: 0 0 6px;
  color: #172554;
  font-size: 30px;
}

.admin-topbar p {
  margin: 0;
  color: var(--muted);
}

.admin-page {
  display: none;
}

.admin-page.active {
  display: grid;
  gap: 16px;
}

.contact-form .full-row {
  grid-column: 1 / -1;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 34px 16px 112px;
  }

  .topbar,
  .auth-layout,
  .admin-layout,
  .rule-form,
  .admin-row,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .admin-shell {
    padding: 14px;
  }

  .admin-sidebar {
    position: static;
    min-height: auto;
  }

  .admin-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-menu-item {
    justify-content: center;
    text-align: center;
    padding: 0 10px;
  }

  .admin-topbar {
    display: grid;
  }

  .auth-copy,
  .auth-card {
    padding: 24px;
  }

  .auth-copy {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 260px;
  }

  .hero-banner {
    min-height: 132px;
    padding: 22px;
  }

  .phone-art,
  .tv-art {
    width: 86px;
    height: 86px;
    font-size: 32px;
  }

  .feature-grid {
    gap: 12px;
  }

  .feature-card {
    min-height: 122px;
    padding: 18px 14px;
  }

  .feature-card i {
    font-size: 48px;
  }

  .account-panel {
    align-items: stretch;
  }

  .control-row button,
  .live-form button,
  .auth-form button,
  .test-form button {
    flex: 1 1 120px;
  }

  .auth-form button {
    flex: none;
  }

  .admin-actions {
    justify-content: stretch;
  }

  .admin-actions button {
    flex: 1 1 120px;
  }
}
