:root {
  --paper: #f5f0e5;
  --paper-light: #fbf8f0;
  --paper-deep: #e8dfcf;
  --ink: #252b28;
  --ink-soft: #4f5752;
  --muted: #7f8179;
  --faint: #aaa79c;
  --line: #d9cfbd;
  --line-light: #e9e1d4;
  --cinnabar: #ae3f32;
  --cinnabar-dark: #812f27;
  --cinnabar-soft: #f4e5df;
  --jade: #3f6960;
  --jade-dark: #294b45;
  --jade-soft: #e2ece7;
  --gold: #a88753;
  --success: #52806f;
  --danger: #a73932;
  --shadow-sm: 0 4px 14px rgba(54, 45, 32, 0.07);
  --shadow-md: 0 16px 45px rgba(46, 38, 27, 0.14);
  --shadow-lg: 0 28px 80px rgba(35, 30, 23, 0.22);
  --font-display: "STKaiti", "KaiTi", "FangSong", "Noto Serif SC", serif;
  --font-text:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  color-scheme: light;
}

body,
button,
input {
  font-family: var(--font-text);
}

button,
input {
  font: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(174, 63, 50, 0.2);
  outline-offset: 2px;
}

/* 移动端主界面 */
.app-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior-y: contain;
  color: var(--ink);
  background: #d8d1c4;
}

.chat-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
}

/* 顶栏 */
.chat-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: calc(70px + env(safe-area-inset-top));
  padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 14% 25%,
      rgba(168, 135, 83, 0.08) 0 1px,
      transparent 1.5px
    ),
    rgba(251, 248, 240, 0.96);
  background-size:
    17px 17px,
    auto;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(62, 51, 36, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.chat-header::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  content: "";
  opacity: 0.36;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold) 18%,
    var(--gold) 82%,
    transparent
  );
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

.header-right {
  justify-content: flex-end;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 9px;
}

.brand-mark,
.login-brand-mark {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 37px;
  height: 37px;
  color: #fff8ed;
  background: var(--cinnabar);
  border: 1px solid rgba(111, 34, 28, 0.3);
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 248, 237, 0.15),
    0 6px 15px rgba(129, 47, 39, 0.18);
  transform: rotate(-2deg);
}

.brand-mark::after,
.login-brand-mark::after {
  position: absolute;
  inset: 3px;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(255, 248, 237, 0.35);
  border-radius: 2px;
}

.brand-mark > span,
.login-brand-mark > span {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

.header-copy {
  min-width: 0;
}

.chat-title {
  overflow: hidden;
  color: #2d332f;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-subtitle {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 17px;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.live-dot,
.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(82, 128, 111, 0.12);
}

.live-dot {
  animation: livePulse 2.3s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(82, 128, 111, 0.12);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(82, 128, 111, 0.02);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 39px;
  color: #5d625e;
  cursor: pointer;
  background: rgba(255, 252, 244, 0.72);
  border: 1px solid var(--line-light);
  border-radius: 8px;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.back-btn svg {
  fill: none;
}

.icon-btn:active {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  border-color: #ddc1b7;
  transform: scale(0.95);
}

/* 消息检索工具 */
.message-toolbar {
  position: relative;
  z-index: 12;
  flex: 0 0 auto;
  padding: 10px 13px 9px;
  background:
    radial-gradient(rgba(97, 82, 60, 0.075) 0.45px, transparent 0.7px),
    rgba(248, 244, 235, 0.98);
  background-size:
    14px 14px,
    auto;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 13px rgba(65, 51, 33, 0.045);
}

.message-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-search-box {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  height: 39px;
  color: #88857d;
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid #d8cdbb;
  border-radius: 7px;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.message-search-box:focus-within {
  color: var(--cinnabar);
  background: #fffdf8;
  border-color: #b98b7c;
  box-shadow: 0 0 0 3px rgba(174, 63, 50, 0.07);
}

.message-search-box > svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-left: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.message-search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 34px 0 8px;
  color: #3f4541;
  font-size: 12px;
  background: transparent;
  border: 0;
  outline: 0;
}

.message-search-box input::placeholder {
  color: #aaa59a;
}

.message-search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-clear-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: #99948b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  background: transparent;
  border: 0;
  border-radius: 5px;
  transform: translateY(-50%);
}

.search-clear-btn.is-visible {
  visibility: visible;
  opacity: 1;
}

.toolbar-refresh-btn {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 39px;
  height: 39px;
  color: var(--jade);
  cursor: pointer;
  background: var(--jade-soft);
  border: 1px solid #c7d6ce;
  border-radius: 7px;
}

.toolbar-refresh-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.toolbar-refresh-btn.is-loading svg {
  animation: spin 0.72s linear infinite;
}

.message-filter-row {
  display: flex;
  align-items: center;
  min-height: 31px;
  margin-top: 6px;
  gap: 7px;
}

.date-filter-field {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  height: 29px;
  padding: 0 7px;
  color: #716e67;
  font-family: var(--font-display);
  font-size: 10px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line-light);
  border-radius: 5px;
}

.date-filter-field svg {
  width: 14px;
  height: 14px;
  color: var(--cinnabar);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.date-filter-field input {
  width: 24px;
  height: 27px;
  color: transparent;
  cursor: pointer;
  background: transparent;
  border: 0;
  outline: 0;
}

.date-filter-field input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.filter-result-count {
  min-width: 0;
  overflow: hidden;
  color: #979289;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-reset-btn {
  margin-left: auto;
  padding: 5px 8px;
  color: var(--cinnabar);
  font-size: 10px;
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  background: var(--cinnabar-soft);
  border: 1px solid #e4c8be;
  border-radius: 5px;
}

.filter-reset-btn.is-visible {
  visibility: visible;
  opacity: 1;
}

/* 消息卷面 */
.messages-wrapper {
  position: relative;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background-color: var(--paper);
  background-image:
    radial-gradient(
      ellipse at 18% 2%,
      rgba(63, 105, 96, 0.07),
      transparent 30%
    ),
    radial-gradient(
      ellipse at 90% 98%,
      rgba(174, 63, 50, 0.045),
      transparent 28%
    ),
    radial-gradient(rgba(87, 75, 57, 0.11) 0.45px, transparent 0.7px);
  background-size:
    auto,
    auto,
    13px 13px;
  scrollbar-color: #c9beac transparent;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.messages-wrapper::before {
  position: absolute;
  top: -15px;
  right: -20%;
  left: -20%;
  height: 128px;
  content: "";
  pointer-events: none;
  opacity: 0.09;
  background:
    linear-gradient(
        150deg,
        transparent 36%,
        var(--jade) 36.5% 42%,
        transparent 42.5%
      )
      20% 45px / 150px 85px no-repeat,
    linear-gradient(
        215deg,
        transparent 39%,
        var(--ink) 39.5% 44%,
        transparent 44.5%
      )
      65% 25px / 190px 100px no-repeat;
  filter: blur(0.2px);
}

.messages-container {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100%;
  margin: 0 auto;
  padding: 18px 14px calc(28px + env(safe-area-inset-bottom));
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 17px 2px 19px;
  color: #918b7f;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-align: center;
}

.date-divider::before,
.date-divider::after {
  height: 1px;
  content: "";
  flex: 1;
  background: linear-gradient(90deg, transparent, #cfc3af);
}

.date-divider::after {
  background: linear-gradient(90deg, #cfc3af, transparent);
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  animation: messageEnter 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.message-avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  color: var(--jade);
  background: #edf1e9;
  border: 1px solid #cdd9cf;
  border-radius: 50% 50% 50% 5px;
  box-shadow: var(--shadow-sm);
}

.message-avatar svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.message-bubble {
  position: relative;
  width: fit-content;
  max-width: calc(100% - 38px);
  padding: 12px 13px 9px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 253, 247, 0.94), rgba(255, 253, 247, 0.94)),
    radial-gradient(#9b8b72 0.5px, transparent 0.7px);
  background-size:
    auto,
    11px 11px;
  border: 1px solid #ded4c3;
  border-radius: 3px 13px 13px;
  box-shadow: 0 5px 16px rgba(68, 54, 36, 0.07);
}

.message-bubble::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 20px;
  content: "";
  border-top: 1px solid rgba(174, 63, 50, 0.32);
  border-right: 1px solid rgba(174, 63, 50, 0.32);
  border-radius: 0 12px 0 0;
}

@keyframes messageEnter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content {
  color: #303632;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 11px;
  margin-top: 8px;
  padding-top: 7px;
  color: #969186;
  font-size: 10px;
  border-top: 1px solid #eee7db;
}

.message-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.message-copy-btn {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: #777d77;
  cursor: pointer;
  background: #f4eee3;
  border: 1px solid #e1d7c6;
  border-radius: 4px;
}

.message-copy-btn:active {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.message-copy-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.message-time {
  font-weight: 500;
}

.message-ip,
.log-ip,
.password-value {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.message-ip {
  padding: 2px 6px;
  color: #65736d;
  background: #edf1ec;
  border: 1px solid #dce4dc;
  border-radius: 4px;
}

.loading-indicator,
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 44px 20px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 0.05em;
  text-align: center;
}

.page-spinner {
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  border: 2px solid #ded5c7;
  border-top-color: var(--cinnabar);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-state::before {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 17px;
  color: #fff7ec;
  content: "信";
  font-family: var(--font-display);
  font-size: 22px;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar-dark);
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 248, 237, 0.14),
    0 9px 22px rgba(129, 47, 39, 0.16);
  transform: rotate(-3deg);
}

.empty-state strong {
  margin-bottom: 3px;
  color: #4d514c;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.12em;
}

.empty-state span {
  color: #99958b;
  font-family: var(--font-text);
  font-size: 11px;
  letter-spacing: 0;
}

.error-state {
  color: var(--danger);
}

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

.messages-wrapper::-webkit-scrollbar,
.settings-content::-webkit-scrollbar,
.log-content::-webkit-scrollbar,
.password-content::-webkit-scrollbar {
  width: 5px;
}

.messages-wrapper::-webkit-scrollbar-track,
.settings-content::-webkit-scrollbar-track,
.log-content::-webkit-scrollbar-track,
.password-content::-webkit-scrollbar-track {
  background: transparent;
}

.messages-wrapper::-webkit-scrollbar-thumb,
.settings-content::-webkit-scrollbar-thumb,
.log-content::-webkit-scrollbar-thumb,
.password-content::-webkit-scrollbar-thumb {
  background: #c8bdab;
  border-radius: 99px;
}

/* 侧栏 */
.settings-panel,
.log-panel,
.password-panel {
  position: fixed;
  z-index: 1000;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(92vw, 420px);
  overflow: visible;
  visibility: hidden;
  background: var(--paper-light);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transition:
    left 280ms cubic-bezier(0.22, 1, 0.36, 1),
    right 280ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 280ms;
}

.settings-panel {
  left: min(-94vw, -440px);
  border-radius: 0 18px 18px 0;
}

.settings-panel.show {
  left: 0;
  visibility: visible;
}

.log-panel,
.password-panel {
  right: min(-94vw, -520px);
  border-radius: 18px 0 0 18px;
}

.log-panel.show,
.password-panel.show {
  right: 0;
  visibility: visible;
}

.settings-panel::before,
.log-panel::before,
.password-panel::before,
.menu-panel::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  background: rgba(28, 32, 29, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition:
    opacity 200ms ease,
    visibility 200ms;
}

.settings-panel.show::before,
.log-panel.show::before,
.password-panel.show::before,
.menu-panel.show::before {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.settings-header,
.log-header,
.password-header {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  min-height: calc(76px + env(safe-area-inset-top));
  padding: calc(16px + env(safe-area-inset-top)) 17px 16px;
  color: var(--ink);
  background:
    radial-gradient(rgba(97, 82, 60, 0.09) 0.5px, transparent 0.8px),
    var(--paper-light);
  background-size:
    14px 14px,
    auto;
  border-bottom: 1px solid var(--line);
}

.settings-header::after,
.log-header::after,
.password-header::after {
  position: absolute;
  right: 17px;
  bottom: 6px;
  left: 17px;
  height: 1px;
  content: "";
  background: linear-gradient(
    90deg,
    var(--cinnabar),
    var(--gold) 28%,
    transparent 72%
  );
  opacity: 0.38;
}

.settings-header h3,
.log-header h3,
.password-header h3 {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel-eyebrow,
.login-kicker,
.login-section-label {
  display: block;
  color: var(--cinnabar);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.17em;
}

.close-btn {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 37px;
  height: 37px;
  color: #6c706b;
  cursor: pointer;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition:
    color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.close-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.close-btn:active {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  transform: scale(0.95);
}

.settings-content,
.log-content,
.password-content {
  flex: 1;
  min-height: 0;
  padding: 16px 15px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background-color: var(--paper);
  background-image: radial-gradient(
    rgba(87, 75, 57, 0.09) 0.45px,
    transparent 0.7px
  );
  background-size: 13px 13px;
}

.setting-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 3px 9px;
  color: #89857b;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.setting-section-title::before {
  width: 13px;
  height: 2px;
  content: "";
  background: var(--cinnabar);
}

.account-section-title {
  margin-top: 22px;
}

.setting-item {
  margin-bottom: 9px;
}

.endpoint-card,
.stat-card,
.admin-only,
.user-info {
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.endpoint-card {
  padding: 13px;
  margin-bottom: 20px;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: #858178;
  font-size: 11px;
  font-weight: 550;
}

.setting-value {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #343a36;
  font-size: 13px;
  font-weight: 650;
}

.setting-value input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  overflow: hidden;
  color: #62665f;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  background: #f3ede2;
  border: 1px solid #ded4c3;
  border-radius: 5px;
  outline: none;
}

.setting-value button {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: #fff8ed;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar-dark);
  border-radius: 5px;
  box-shadow: 0 5px 12px rgba(129, 47, 39, 0.13);
}

.setting-value button:active {
  background: var(--cinnabar-dark);
  transform: scale(0.96);
}

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

.stat-card {
  position: relative;
  padding: 12px;
  overflow: hidden;
}

.stat-card::after {
  position: absolute;
  top: -15px;
  right: -12px;
  width: 42px;
  height: 42px;
  content: "";
  border: 1px solid rgba(168, 135, 83, 0.18);
  border-radius: 50%;
}

.stat-card .setting-label {
  margin-bottom: 3px;
}

.stat-card .setting-value {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
}

.stat-card-wide {
  grid-column: 1 / -1;
}

.stat-card-wide .setting-value {
  font-family: var(--font-text);
  font-size: 14px;
}

.admin-only,
.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 49px;
  padding: 11px 12px;
}

.admin-only .setting-label,
.user-info .setting-label {
  flex: 0 0 auto;
  margin: 0;
}

.admin-only .setting-value,
.user-info .setting-value {
  justify-content: flex-end;
  overflow: hidden;
  color: var(--jade);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-only:first-of-type {
  background: #f6edda;
  border-color: #d9c397;
}

.admin-only:first-of-type .setting-label,
.admin-only:first-of-type .setting-value {
  color: #8b662d;
}

.setting-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.setting-actions button,
.btn-add,
.btn-edit-expire,
.btn-delete-password {
  min-height: 41px;
  padding: 9px 10px;
  color: #535851;
  font-size: 11px;
  font-weight: 620;
  cursor: pointer;
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.setting-actions button:active,
.btn-add:active,
.btn-edit-expire:active,
.btn-delete-password:active {
  transform: scale(0.97);
}

.setting-actions .btn-refresh {
  color: #f9f3e8;
  background: var(--jade);
  border-color: var(--jade-dark);
}

.setting-actions .btn-admin:active {
  color: var(--jade-dark);
  background: var(--jade-soft);
}

.setting-actions .btn-warning:active {
  color: #855d22;
  background: #f4e8cf;
}

.setting-actions .btn-danger:active {
  color: var(--danger);
  background: var(--cinnabar-soft);
}

.setting-actions .btn-logout {
  grid-column: 1 / -1;
}

.setting-actions .admin-console-entry {
  color: #f9f3e8;
  background: var(--cinnabar);
  border-color: var(--cinnabar-dark);
}

/* 快捷菜单 */
.menu-panel {
  position: fixed;
  z-index: 1200;
  right: 0;
  bottom: -430px;
  left: 0;
  width: calc(100% - 20px);
  max-width: 390px;
  margin: 0 auto calc(10px + env(safe-area-inset-bottom));
  padding: 9px;
  visibility: hidden;
  background:
    radial-gradient(rgba(87, 75, 57, 0.09) 0.45px, transparent 0.7px),
    rgba(251, 248, 240, 0.98);
  background-size:
    13px 13px,
    auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-lg);
  transition:
    bottom 280ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 280ms;
}

.menu-panel.show {
  bottom: 0;
  visibility: visible;
}

.menu-handle {
  width: 31px;
  height: 3px;
  margin: 2px auto 9px;
  background: #cfc5b5;
  border-radius: 99px;
}

.menu-caption {
  padding: 4px 10px 8px;
  color: #938e84;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.15em;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 47px;
  padding: 9px 11px;
  color: #414742;
  font-size: 12px;
  font-weight: 560;
  cursor: pointer;
  border-radius: 8px;
}

.menu-item > span:first-child {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: var(--jade);
  background: var(--jade-soft);
  border: 1px solid #cedbd4;
  border-radius: 5px;
}

.menu-item:active {
  color: var(--cinnabar-dark);
  background: #f1eadf;
}

.menu-cancel {
  justify-content: center;
  margin-top: 5px;
  color: #817e76;
  border-top: 1px solid var(--line-light);
  border-radius: 0 0 8px 8px;
}

/* 轻提示 */
.toast {
  position: fixed;
  z-index: 10000;
  top: calc(17px + env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100% - 30px);
  padding: 10px 15px;
  color: #f9f3e8;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  background: rgba(42, 51, 47, 0.95);
  border: 1px solid rgba(232, 223, 207, 0.22);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(31, 35, 32, 0.24);
  transform: translate(-50%, -10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms;
}

.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 登录记录与密码卡片 */
.login-logs-list,
.password-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.login-log-item,
.password-item,
.add-password-form {
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.login-log-item {
  position: relative;
  padding: 13px 13px 13px 16px;
  overflow: hidden;
}

.login-log-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  content: "";
  background: #bdb5a7;
}

.login-log-item.success::before {
  background: var(--jade);
}

.login-log-item.failed::before {
  background: var(--cinnabar);
}

.log-time {
  margin-bottom: 8px;
  color: #99948a;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.log-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-row {
  display: flex;
  gap: 9px;
  color: #3f4541;
  font-size: 11px;
  line-height: 1.5;
}

.log-label {
  flex: 0 0 43px;
  color: #8b877e;
}

.log-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.log-value.status-success {
  color: var(--jade);
  font-weight: 700;
}

.log-value.status-failed {
  color: var(--cinnabar);
  font-weight: 700;
}

.log-ip {
  display: inline-flex;
  width: fit-content;
  padding: 2px 5px;
  color: #5d6e67;
  background: var(--jade-soft);
  border-radius: 4px;
}

.add-password-form {
  padding: 14px;
  margin-bottom: 18px;
}

.add-password-form h4,
.password-list-wrapper h4 {
  margin-bottom: 12px;
  color: #373d39;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.form-row {
  margin-bottom: 10px;
}

.form-row label {
  display: block;
  margin-bottom: 6px;
  color: #817d74;
  font-size: 10px;
}

.form-row input[type="text"],
.form-row input[type="date"] {
  width: 100%;
  min-height: 41px;
  padding: 9px 11px;
  color: var(--ink);
  font-size: 12px;
  background: #f6f0e6;
  border: 1px solid #d8cdbb;
  border-radius: 5px;
  outline: none;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.form-row input:focus {
  background: #fffdf7;
  border-color: #af8979;
  box-shadow: 0 0 0 3px rgba(174, 63, 50, 0.08);
}

.btn-add {
  width: 100%;
  color: #f9f3e8;
  background: var(--cinnabar);
  border-color: var(--cinnabar-dark);
}

.password-item {
  padding: 13px;
  border-left: 3px solid var(--jade);
}

.password-item.expired {
  border-left-color: var(--cinnabar);
  opacity: 0.76;
}

.password-info {
  margin-bottom: 10px;
}

.password-value {
  margin-bottom: 7px;
  color: #333a36;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.password-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: #817d74;
  font-size: 10px;
}

.password-status {
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
}

.password-status.status-active {
  color: var(--jade-dark);
  background: var(--jade-soft);
}

.password-status.status-expired {
  color: var(--cinnabar-dark);
  background: var(--cinnabar-soft);
}

.password-created {
  color: #aaa499;
  font-size: 9px;
}

.password-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.btn-edit-expire,
.btn-delete-password {
  min-height: 35px;
  padding: 7px 9px;
  font-size: 10px;
}

.btn-delete-password {
  color: var(--cinnabar);
  background: #fbefea;
  border-color: #e3c3b9;
}

/* 登录页：移动端优先 */
.login-page {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: 14px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 8% 3%, rgba(63, 105, 96, 0.13), transparent 30%),
    radial-gradient(
      ellipse at 95% 97%,
      rgba(174, 63, 50, 0.09),
      transparent 29%
    ),
    var(--paper-deep);
}

.login-page::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.54;
  background-image: radial-gradient(
    rgba(81, 68, 50, 0.14) 0.45px,
    transparent 0.7px
  );
  background-size: 13px 13px;
}

.login-orb {
  position: fixed;
  width: 230px;
  height: 230px;
  pointer-events: none;
  opacity: 0.09;
  filter: blur(70px);
  border-radius: 50%;
}

.login-orb-one {
  top: -100px;
  right: -30px;
  background: var(--jade);
}

.login-orb-two {
  bottom: -110px;
  left: -50px;
  background: var(--cinnabar);
}

.login-shell {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 460px);
  min-height: calc(100svh - 28px);
  overflow: hidden;
  background:
    linear-gradient(rgba(251, 248, 240, 0.96), rgba(251, 248, 240, 0.96)),
    radial-gradient(#8f7f67 0.5px, transparent 0.7px);
  background-size:
    auto,
    12px 12px;
  border: 1px solid #d5c9b6;
  border-radius: 17px;
  box-shadow: var(--shadow-lg);
  animation: shellEnter 450ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes shellEnter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-brand-panel {
  display: none;
}

.login-page .login-container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: none;
  min-height: calc(100svh - 30px);
  padding: 32px 24px max(30px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}

.login-page .login-container::before {
  position: absolute;
  z-index: 0;
  top: 35px;
  right: -78px;
  width: 210px;
  height: 210px;
  content: "";
  pointer-events: none;
  opacity: 0.08;
  border: 1px solid var(--cinnabar);
  border-radius: 50%;
  box-shadow:
    0 0 0 30px rgba(174, 63, 50, 0.1),
    0 0 0 60px rgba(174, 63, 50, 0.07);
}

.login-page .login-container::after {
  position: absolute;
  z-index: 0;
  right: -10%;
  bottom: 8%;
  left: -10%;
  height: 100px;
  content: "";
  pointer-events: none;
  opacity: 0.06;
  background:
    linear-gradient(
        150deg,
        transparent 35%,
        var(--jade-dark) 35.5% 42%,
        transparent 42.5%
      )
      15% 10px / 160px 90px no-repeat,
    linear-gradient(
        215deg,
        transparent 38%,
        var(--ink) 38.5% 44%,
        transparent 44.5%
      )
      80% 0 / 190px 100px no-repeat;
}

.login-mobile-brand,
.login-header,
.login-page form,
.login-security-note,
.login-page .error-message,
.login-page .lock-message {
  position: relative;
  z-index: 1;
}

.login-mobile-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: auto;
  padding-bottom: 62px;
  color: #353b37;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.login-mobile-brand .login-brand-mark {
  width: 39px;
  height: 39px;
}

.login-page .login-header {
  margin-bottom: 27px;
  text-align: left;
}

.login-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.login-section-label::before {
  width: 16px;
  height: 2px;
  content: "";
  background: var(--cinnabar);
}

.login-page h1 {
  margin-bottom: 8px;
  color: #29302c;
  font-family: var(--font-display);
  font-size: 33px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.08em;
}

.login-page .subtitle {
  color: #858178;
  font-size: 12px;
  line-height: 1.7;
}

.login-page .form-group {
  margin-bottom: 17px;
}

.login-page label {
  display: block;
  margin-bottom: 8px;
  color: #5c625d;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.password-input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #89877f;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transform: translateY(-50%);
}

.login-page input[type="password"],
.login-page input[type="text"] {
  width: 100%;
  min-height: 51px;
  padding: 12px 45px 12px 42px;
  color: #303632;
  font-size: 14px;
  background: rgba(246, 240, 230, 0.85);
  border: 1px solid #d5c9b7;
  border-radius: 7px;
  outline: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.login-page input::placeholder {
  color: #aaa59b;
}

.login-page input[type="password"]:focus,
.login-page input[type="text"]:focus {
  background: #fffdf8;
  border-color: #b08473;
  box-shadow: 0 0 0 4px rgba(174, 63, 50, 0.07);
}

.password-toggle {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  color: #8e8b83;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 5px;
  transform: translateY(-50%);
}

.password-toggle:active {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.password-toggle.is-visible {
  color: var(--cinnabar);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.login-page .btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 51px;
  padding: 12px 17px;
  color: #fff8ed;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  background:
    linear-gradient(rgba(174, 63, 50, 0.96), rgba(151, 51, 42, 0.96)),
    radial-gradient(#fff 0.5px, transparent 0.8px);
  background-size:
    auto,
    10px 10px;
  border: 1px solid var(--cinnabar-dark);
  border-radius: 7px;
  box-shadow:
    0 11px 24px rgba(129, 47, 39, 0.19),
    inset 0 1px rgba(255, 255, 255, 0.16);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.login-page .btn-login svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.login-page .btn-login:active {
  box-shadow: 0 6px 15px rgba(129, 47, 39, 0.15);
  transform: scale(0.985);
}

.login-page .btn-login:disabled {
  cursor: wait;
  opacity: 0.68;
  box-shadow: none;
}

.login-page .error-message,
.login-page .lock-message {
  display: none;
  margin-bottom: 16px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.6;
  border: 1px solid;
  border-radius: 6px;
}

.login-page .error-message {
  color: var(--cinnabar-dark);
  background: #f8e9e3;
  border-color: #dfbcb1;
  animation: gentleShake 340ms ease;
}

.login-page .lock-message {
  color: #765a2d;
  background: #f5ecd8;
  border-color: #dcc89f;
}

.login-page .error-message.show,
.login-page .lock-message.show {
  display: block;
}

@keyframes gentleShake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(4px);
  }
}

.login-page .countdown {
  color: var(--cinnabar);
  font-weight: 700;
}

.login-page .loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border: 2px solid rgba(255, 248, 237, 0.4);
  border-top-color: #fff8ed;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.login-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 48px;
  color: #9b978d;
  font-size: 9px;
}

.login-security-note svg {
  width: 13px;
  height: 13px;
  color: var(--jade);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

/* 小屏幕 */
@media (max-width: 370px) {
  .chat-header {
    grid-template-columns: 39px minmax(0, 1fr) 39px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand-mark {
    display: none;
  }

  .chat-title {
    font-size: 17px;
  }

  #refreshCountdown {
    display: none;
  }

  .login-page .login-container {
    padding-right: 20px;
    padding-left: 20px;
  }
}

/* 平板与桌面端：延展移动体验 */
@media (min-width: 721px) {
  .app-page {
    padding: 16px;
    background:
      radial-gradient(
        ellipse at 8% 10%,
        rgba(63, 105, 96, 0.1),
        transparent 31%
      ),
      radial-gradient(
        ellipse at 92% 90%,
        rgba(174, 63, 50, 0.07),
        transparent 29%
      ),
      #d9d2c5;
  }

  .chat-container {
    width: min(100%, 820px);
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    border: 1px solid #cfc3b1;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
  }

  .chat-header {
    min-height: 78px;
    padding: 10px 21px;
  }

  .icon-btn:hover {
    color: var(--cinnabar);
    background: var(--cinnabar-soft);
    border-color: #ddc1b7;
  }

  .messages-container {
    width: min(100%, 700px);
    padding: 26px 26px 36px;
  }

  .message-row {
    gap: 10px;
    margin-bottom: 14px;
  }

  .message-avatar {
    width: 33px;
    height: 33px;
  }

  .message-bubble {
    max-width: min(86%, 610px);
    padding: 13px 15px 10px;
  }

  .message-bubble:hover {
    border-color: #cdbfa9;
    box-shadow: 0 10px 28px rgba(68, 54, 36, 0.11);
    transform: translateY(-1px);
  }

  .settings-panel,
  .log-panel,
  .password-panel {
    top: 12px;
    bottom: 12px;
    border-radius: 17px;
  }

  .settings-panel.show {
    left: 12px;
  }

  .log-panel.show,
  .password-panel.show {
    right: 12px;
  }

  .setting-actions button:hover,
  .btn-edit-expire:hover {
    color: var(--jade-dark);
    background: var(--jade-soft);
    border-color: #bdcec5;
  }

  .btn-delete-password:hover {
    color: #fff8ed;
    background: var(--cinnabar);
    border-color: var(--cinnabar-dark);
  }
}

@media (min-width: 900px) {
  .login-page {
    padding: 38px;
  }

  .login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
    width: min(100%, 1020px);
    min-height: min(660px, calc(100svh - 76px));
    border-radius: 20px;
  }

  .login-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 47px;
    overflow: hidden;
    color: #f4eee2;
    background:
      radial-gradient(
        ellipse at 92% 3%,
        rgba(224, 208, 177, 0.16),
        transparent 28%
      ),
      linear-gradient(145deg, #304d47, #27423d 58%, #203632);
  }

  .login-brand-panel::before {
    position: absolute;
    right: -12%;
    bottom: 4%;
    left: -12%;
    height: 200px;
    content: "";
    opacity: 0.14;
    background:
      linear-gradient(
          150deg,
          transparent 34%,
          #efe4d3 34.5% 41%,
          transparent 41.5%
        )
        12% 35px / 230px 150px no-repeat,
      linear-gradient(
          215deg,
          transparent 37%,
          #efe4d3 37.5% 44%,
          transparent 44.5%
        )
        82% 0 / 290px 180px no-repeat;
  }

  .login-brand-panel::after {
    position: absolute;
    right: -100px;
    bottom: -130px;
    width: 330px;
    height: 330px;
    content: "";
    opacity: 0.18;
    border: 1px solid #d8c69f;
    border-radius: 50%;
    box-shadow:
      0 0 0 42px rgba(216, 198, 159, 0.08),
      0 0 0 84px rgba(216, 198, 159, 0.05);
  }

  .login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.12em;
  }

  .login-brand-copy {
    position: relative;
    z-index: 1;
    margin: auto 0 25px;
  }

  .login-kicker {
    margin-bottom: 15px;
    color: #d9c49a;
  }

  .login-brand-copy h2 {
    margin-bottom: 17px;
    color: #f5efe4;
    font-family: var(--font-display);
    font-size: 49px;
    font-weight: 700;
    line-height: 1.24;
    letter-spacing: 0.08em;
  }

  .login-brand-copy p {
    max-width: 390px;
    color: rgba(245, 239, 228, 0.66);
    font-size: 13px;
    line-height: 1.85;
  }

  .login-preview {
    position: relative;
    z-index: 1;
    width: min(100%, 370px);
    margin-bottom: 30px;
    padding: 14px;
    background: rgba(244, 238, 226, 0.08);
    border: 1px solid rgba(232, 215, 183, 0.17);
    border-radius: 9px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .preview-topline {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    color: rgba(245, 239, 228, 0.62);
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .preview-topline span:first-child,
  .login-brand-footer i {
    width: 6px;
    height: 6px;
    background: #8fb3a4;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(143, 179, 164, 0.12);
  }

  .preview-message {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px;
    background: rgba(245, 239, 228, 0.07);
    border-radius: 6px;
  }

  .preview-message + .preview-message {
    margin-top: 7px;
  }

  .preview-message i {
    flex: 0 0 auto;
    width: 27px;
    height: 27px;
    background: rgba(216, 196, 154, 0.12);
    border: 1px solid rgba(216, 196, 154, 0.13);
    border-radius: 4px;
  }

  .preview-message div {
    flex: 1;
  }

  .preview-message b,
  .preview-message span {
    display: block;
    height: 4px;
    background: rgba(245, 239, 228, 0.34);
    border-radius: 99px;
  }

  .preview-message b {
    width: 43%;
    margin-bottom: 7px;
  }

  .preview-message span {
    width: 74%;
    background: rgba(245, 239, 228, 0.13);
  }

  .preview-message-two {
    margin-left: 27px;
    opacity: 0.66;
  }

  .login-brand-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(245, 239, 228, 0.46);
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .login-brand-footer span:first-child {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .login-brand-footer i {
    display: inline-block;
  }

  .login-page .login-container {
    min-height: 100%;
    padding: 55px;
  }

  .login-mobile-brand {
    display: none;
  }

  .login-security-note {
    margin-top: 22px;
    padding-top: 0;
  }

  .login-page .btn-login:hover {
    filter: brightness(1.04);
    box-shadow: 0 14px 28px rgba(129, 47, 39, 0.22);
    transform: translateY(-1px);
  }
}

@media (max-width: 480px) {
  .login-page {
    padding: 0;
    background: var(--paper-light);
  }

  .login-shell {
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-page .login-container {
    min-height: 100svh;
  }
}

/* 管理员后台 */
.admin-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 8% 8%, rgba(63, 105, 96, 0.12), transparent 30%),
    radial-gradient(
      ellipse at 94% 92%,
      rgba(174, 63, 50, 0.08),
      transparent 28%
    ),
    #d8d1c4;
}

.admin-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
}

.admin-header {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: calc(70px + env(safe-area-inset-top));
  padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
  background:
    radial-gradient(rgba(97, 82, 60, 0.08) 0.45px, transparent 0.7px),
    rgba(251, 248, 240, 0.97);
  background-size:
    14px 14px,
    auto;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(62, 51, 36, 0.06);
}

.admin-header::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  content: "";
  opacity: 0.4;
  background: linear-gradient(
    90deg,
    transparent,
    var(--cinnabar) 20%,
    var(--gold) 70%,
    transparent
  );
}

.admin-header-btn {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  color: #62665f;
  cursor: pointer;
  background: rgba(255, 253, 247, 0.78);
  border: 1px solid var(--line-light);
  border-radius: 8px;
  text-decoration: none;
}

.admin-header-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.admin-header-btn.is-loading svg {
  animation: spin 0.72s linear infinite;
}

.admin-header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 9px;
}

.admin-seal {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff8ed;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar-dark);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 237, 0.15);
  transform: rotate(-2deg);
}

.admin-header-title h1 {
  overflow: hidden;
  color: #2d332f;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-header-title p {
  margin-top: 1px;
  color: #8e8a81;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.admin-main {
  flex: 1;
  min-height: 0;
  padding: 14px 13px calc(92px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background-color: var(--paper);
  background-image:
    radial-gradient(
      ellipse at 92% 2%,
      rgba(63, 105, 96, 0.08),
      transparent 27%
    ),
    radial-gradient(rgba(87, 75, 57, 0.1) 0.45px, transparent 0.7px);
  background-size:
    auto,
    13px 13px;
  scrollbar-width: thin;
  scrollbar-color: #c8bdab transparent;
}

.admin-hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 130px;
  padding: 20px 18px;
  overflow: hidden;
  color: #f6f0e5;
  background:
    radial-gradient(
      ellipse at 95% 0,
      rgba(224, 208, 177, 0.16),
      transparent 35%
    ),
    linear-gradient(145deg, #365b53, #284a43 68%, #223d38);
  border: 1px solid #24463f;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(38, 71, 64, 0.18);
}

.admin-hero::before {
  position: absolute;
  right: -70px;
  bottom: -88px;
  width: 190px;
  height: 190px;
  content: "";
  opacity: 0.16;
  border: 1px solid #e3d1ad;
  border-radius: 50%;
  box-shadow:
    0 0 0 24px rgba(227, 209, 173, 0.08),
    0 0 0 48px rgba(227, 209, 173, 0.05);
}

.admin-hero::after {
  position: absolute;
  right: 4%;
  bottom: -10px;
  left: 34%;
  height: 70px;
  content: "";
  opacity: 0.12;
  background: linear-gradient(
      150deg,
      transparent 35%,
      #f0e3cc 35.5% 42%,
      transparent 42.5%
    )
    center / 180px 95px no-repeat;
}

.admin-hero > * {
  position: relative;
  z-index: 1;
}

.admin-kicker,
.admin-section-kicker {
  display: block;
  color: var(--cinnabar);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.admin-hero .admin-kicker {
  margin-bottom: 8px;
  color: #ddc99f;
}

.admin-hero h2 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.admin-hero p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  color: rgba(246, 240, 229, 0.63);
  font-size: 9px;
}

.admin-live-dot {
  width: 6px;
  height: 6px;
  background: #9ac1b0;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(154, 193, 176, 0.1);
}

.admin-hero-date {
  max-width: 62px;
  color: rgba(246, 240, 229, 0.62);
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1.55;
  text-align: right;
}

.admin-view {
  padding-top: 12px;
}

#viewOverview {
  padding-top: 0;
}

.admin-view[hidden] {
  display: none !important;
}

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

.admin-hero + .admin-stat-grid {
  margin-top: 12px;
}

.admin-stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 112px;
  padding: 13px;
  overflow: hidden;
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.admin-stat-card::after {
  position: absolute;
  top: -20px;
  right: -18px;
  width: 57px;
  height: 57px;
  content: "";
  opacity: 0.42;
  border: 1px solid var(--gold);
  border-radius: 50%;
}

.admin-stat-primary {
  color: #fff8ed;
  background: linear-gradient(145deg, #b3483c, #98392f);
  border-color: #8d322a;
}

.admin-stat-primary::after {
  border-color: rgba(255, 248, 237, 0.55);
}

.admin-stat-label {
  color: #858178;
  font-size: 10px;
  font-weight: 560;
}

.admin-stat-primary .admin-stat-label,
.admin-stat-primary small {
  color: rgba(255, 248, 237, 0.7);
}

.admin-stat-card strong {
  margin-top: auto;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 700;
  line-height: 1;
}

.admin-stat-primary strong {
  color: #fff8ed;
}

.admin-stat-card strong.admin-status-word {
  color: var(--jade);
  font-size: 22px;
}

.admin-stat-card small {
  margin-top: 6px;
  color: #9b968c;
  font-size: 9px;
}

.admin-card {
  margin-top: 12px;
  padding: 14px;
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.admin-card-heading,
.admin-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-heading h3,
.admin-section-heading h3 {
  margin-top: 3px;
  color: #363c38;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.admin-online-badge,
.admin-count-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: var(--jade-dark);
  font-size: 9px;
  font-weight: 650;
  background: var(--jade-soft);
  border: 1px solid #c9d8d0;
  border-radius: 5px;
}

.admin-online-badge i {
  width: 5px;
  height: 5px;
  background: var(--success);
  border-radius: 50%;
}

.admin-endpoint-value {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
}

.admin-endpoint-value code {
  flex: 1;
  min-width: 0;
  padding: 9px;
  overflow: hidden;
  color: #5b615c;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f2ece1;
  border: 1px solid #ded4c3;
  border-radius: 5px;
}

.admin-endpoint-value button {
  flex: 0 0 auto;
  padding: 9px 12px;
  color: #fff8ed;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar-dark);
  border-radius: 5px;
}

.admin-section-block {
  margin-top: 20px;
}

.admin-section-heading {
  margin: 0 2px 10px;
}

.admin-section-heading a {
  color: var(--cinnabar);
  font-size: 10px;
  text-decoration: none;
}

.admin-recent-list,
.admin-password-list,
.admin-login-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-recent-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-recent-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--jade);
  font-family: var(--font-display);
  font-size: 13px;
  background: var(--jade-soft);
  border: 1px solid #c8d8cf;
  border-radius: 4px;
}

.admin-recent-item > div {
  min-width: 0;
}

.admin-recent-item p {
  display: -webkit-box;
  overflow: hidden;
  color: #3c423e;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.admin-recent-item small {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #9c978e;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.admin-tool-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 67px;
  padding: 10px;
  color: #4b514c;
  text-align: left;
  cursor: pointer;
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-tool-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 31px;
  height: 31px;
  color: var(--jade);
  font-family: var(--font-display);
  font-size: 11px;
  background: var(--jade-soft);
  border: 1px solid #cad9d1;
  border-radius: 5px;
}

.admin-tool-btn.is-danger .admin-tool-icon {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  border-color: #e0c2b8;
}

.admin-tool-btn > span:last-child {
  min-width: 0;
}

.admin-tool-btn strong,
.admin-tool-btn small {
  display: block;
}

.admin-tool-btn strong {
  font-size: 10px;
  font-weight: 650;
}

.admin-tool-btn small {
  margin-top: 4px;
  overflow: hidden;
  color: #9a958c;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-session-card {
  margin-top: 20px;
}

.admin-detail-list {
  margin-top: 11px;
}

.admin-detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  border-top: 1px solid var(--line-light);
}

.admin-detail-list dt {
  color: #8c887e;
  font-size: 10px;
}

.admin-detail-list dd {
  overflow: hidden;
  color: #444a45;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-role-badge {
  padding: 3px 6px;
  color: var(--cinnabar-dark);
  background: var(--cinnabar-soft);
  border-radius: 4px;
}

.admin-page-heading {
  padding: 8px 4px 15px;
}

.admin-page-heading h2 {
  margin-top: 5px;
  color: #2f3531;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.09em;
}

.admin-page-heading p {
  margin-top: 7px;
  color: #8e8a80;
  font-size: 10px;
  line-height: 1.65;
}

.admin-password-form {
  margin-top: 0;
}

.admin-form-field {
  margin-bottom: 11px;
}

.admin-form-field label {
  display: block;
  margin-bottom: 6px;
  color: #5c625d;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.admin-form-field label span {
  color: #9f9a90;
  font-family: var(--font-text);
  font-size: 9px;
  font-weight: 400;
}

.admin-form-field input {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  color: #363c38;
  font-size: 12px;
  background: #f6f0e6;
  border: 1px solid #d8cdbb;
  border-radius: 6px;
  outline: 0;
}

.admin-form-field input:focus {
  background: #fffdf8;
  border-color: #b08473;
  box-shadow: 0 0 0 3px rgba(174, 63, 50, 0.07);
}

.admin-primary-btn {
  width: 100%;
  min-height: 43px;
  color: #fff8ed;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar-dark);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(129, 47, 39, 0.15);
}

.admin-list-heading {
  margin-top: 20px;
}

.admin-password-item,
.admin-login-item {
  position: relative;
  padding: 13px;
  overflow: hidden;
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-password-item::before,
.admin-login-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  content: "";
  background: var(--jade);
}

.admin-password-item.is-expired::before,
.admin-login-item.is-failed::before {
  background: var(--cinnabar);
}

.admin-password-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-password-value {
  min-width: 0;
  overflow: hidden;
  color: #333a36;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-credential-status {
  flex: 0 0 auto;
  padding: 3px 7px;
  color: var(--jade-dark);
  font-size: 9px;
  font-weight: 700;
  background: var(--jade-soft);
  border-radius: 4px;
}

.admin-credential-status.is-expired {
  color: var(--cinnabar-dark);
  background: var(--cinnabar-soft);
}

.admin-password-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 13px;
  margin-top: 8px;
  color: #98938a;
  font-size: 9px;
}

.admin-password-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line-light);
}

.admin-password-actions button {
  min-height: 34px;
  color: #555c57;
  font-size: 10px;
  cursor: pointer;
  background: #f6f0e6;
  border: 1px solid #dfd5c5;
  border-radius: 5px;
}

.admin-password-actions button.is-danger {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  border-color: #e1c5bb;
}

.admin-log-tools {
  padding: 12px;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-log-search {
  display: flex;
  align-items: center;
  height: 40px;
  color: #8d8980;
  background: #f5efe4;
  border: 1px solid #d9cebc;
  border-radius: 6px;
}

.admin-log-search:focus-within {
  color: var(--cinnabar);
  background: #fffdf8;
  border-color: #b98b7c;
}

.admin-log-search svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-left: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.admin-log-search input {
  width: 100%;
  height: 100%;
  padding: 0 10px 0 8px;
  color: #414742;
  font-size: 11px;
  background: transparent;
  border: 0;
  outline: 0;
}

.admin-log-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.admin-log-filters button {
  min-height: 33px;
  color: #77746c;
  font-size: 10px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--line-light);
  border-radius: 5px;
}

.admin-log-filters button.is-active {
  color: #fff8ed;
  background: var(--jade);
  border-color: var(--jade-dark);
}

.admin-login-item.is-success::before {
  background: var(--jade);
}

.admin-login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-login-status {
  padding: 3px 7px;
  color: var(--jade-dark);
  font-size: 9px;
  font-weight: 700;
  background: var(--jade-soft);
  border-radius: 4px;
}

.admin-login-item.is-failed .admin-login-status {
  color: var(--cinnabar-dark);
  background: var(--cinnabar-soft);
}

.admin-login-head time {
  color: #9b968d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.admin-login-item dl {
  margin-top: 9px;
}

.admin-login-item dl > div {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.45;
}

.admin-login-item dt {
  flex: 0 0 34px;
  color: #918d84;
}

.admin-login-item dd {
  min-width: 0;
  color: #454b46;
  overflow-wrap: anywhere;
}

.admin-login-item code {
  padding: 2px 5px;
  color: #536861;
  background: var(--jade-soft);
  border-radius: 3px;
}

.admin-skeleton-card {
  height: 69px;
  overflow: hidden;
  background: linear-gradient(90deg, #eee6d9 25%, #f7f2e9 50%, #eee6d9 75%);
  background-size: 200% 100%;
  border: 1px solid var(--line-light);
  border-radius: 8px;
  animation: adminSkeleton 1.35s ease-in-out infinite;
}

@keyframes adminSkeleton {
  to {
    background-position: -200% 0;
  }
}

.admin-empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 25px;
  color: #89867e;
  text-align: center;
  background: rgba(255, 253, 247, 0.72);
  border: 1px dashed #d5cab8;
  border-radius: 8px;
}

.admin-empty-card > span {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  margin-bottom: 10px;
  color: var(--cinnabar);
  font-family: var(--font-display);
  font-size: 17px;
  background: var(--cinnabar-soft);
  border: 1px solid #e1c3b8;
  border-radius: 5px;
}

.admin-empty-card p {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.admin-empty-card small {
  margin-top: 5px;
  color: #aaa59b;
  font-size: 9px;
}

.admin-bottom-nav {
  position: absolute;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(65px + env(safe-area-inset-bottom));
  padding: 7px 18px env(safe-area-inset-bottom);
  background: rgba(251, 248, 240, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(56, 45, 31, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.admin-bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: #88847b;
  font-size: 9px;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.admin-bottom-nav button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.admin-bottom-nav button:first-child svg {
  fill: currentColor;
  stroke: none;
}

.admin-bottom-nav button.is-active {
  color: var(--cinnabar);
  font-weight: 650;
  background: var(--cinnabar-soft);
}

.admin-dialog-backdrop {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  background: rgba(29, 34, 31, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.admin-dialog-backdrop[hidden] {
  display: none !important;
}

.admin-dialog-backdrop.is-visible {
  visibility: visible;
  opacity: 1;
}

.admin-dialog {
  width: min(100%, 340px);
  padding: 24px 20px 18px;
  text-align: center;
  background:
    radial-gradient(rgba(87, 75, 57, 0.09) 0.45px, transparent 0.7px),
    var(--paper-light);
  background-size:
    13px 13px,
    auto;
  border: 1px solid #cfc2ae;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98);
  transition: transform 180ms ease;
}

.admin-dialog-backdrop.is-visible .admin-dialog {
  transform: translateY(0) scale(1);
}

.admin-dialog-seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 13px;
  color: #fff8ed;
  font-family: var(--font-display);
  font-size: 18px;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar-dark);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 237, 0.17);
  transform: rotate(-2deg);
}

.admin-dialog-seal.is-jade {
  background: var(--jade);
  border-color: var(--jade-dark);
}

.admin-dialog h3 {
  color: #343a36;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.07em;
}

.admin-dialog > p {
  margin: 8px 0 16px;
  color: #858178;
  font-size: 10px;
  line-height: 1.65;
}

.admin-dialog .admin-form-field {
  text-align: left;
}

.admin-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 15px;
}

.admin-dialog-actions button {
  min-height: 39px;
  color: #595e59;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  background: #f5efe5;
  border: 1px solid #ddd2c1;
  border-radius: 6px;
}

.admin-dialog-actions button.is-danger {
  color: #fff8ed;
  background: var(--cinnabar);
  border-color: var(--cinnabar-dark);
}

.admin-dialog-actions button.is-primary {
  color: #fff8ed;
  background: var(--jade);
  border-color: var(--jade-dark);
}

.admin-page .toast {
  top: calc(18px + env(safe-area-inset-top));
}

@media (min-width: 721px) {
  .admin-page {
    padding: 16px;
  }

  .admin-shell {
    width: min(100%, 980px);
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    border: 1px solid #cfc3b1;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
  }

  .admin-header {
    min-height: 76px;
    padding: 10px 20px;
  }

  .admin-main {
    padding: 22px 28px 100px;
  }

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

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

  .admin-bottom-nav {
    right: 24px;
    bottom: 16px;
    left: 24px;
    width: min(420px, calc(100% - 48px));
    min-height: 58px;
    margin: 0 auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
  }

  .admin-password-form {
    display: grid;
    grid-template-columns: 1.25fr 1fr auto;
    align-items: end;
    gap: 10px;
  }

  .admin-password-form .admin-form-field {
    margin-bottom: 0;
  }

  .admin-password-form .admin-primary-btn {
    width: auto;
    padding: 0 22px;
  }

  .admin-password-list,
  .admin-login-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tool-btn:hover,
  .admin-password-actions button:hover,
  .admin-header-btn:hover {
    color: var(--cinnabar);
    background: var(--cinnabar-soft);
    border-color: #dfc2b8;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
