/* ==========================================================================
   应用布局与页面样式
   ========================================================================== */

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  height: 100dvh;
  padding: 14px;
  gap: 14px;
}

.boot-screen {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--ink-3);
  font-size: 14px;
}
.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent-grad);
  box-shadow: 0 12px 32px rgba(10, 132, 255, 0.3);
  animation: pulse 1.5s var(--ease) infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.92);
    opacity: 0.7;
  }
}

/* ==========================================================================
   侧边栏
   ========================================================================== */

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 6px;
  background: var(--glass);
  backdrop-filter: blur(var(--blur-lg)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
  transition: transform 0.4s var(--ease), width 0.3s var(--ease);
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 16px;
}
.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 6px 16px rgba(10, 132, 255, 0.32);
}
.brand-mark svg {
  width: 20px;
  height: 20px;
  color: #fff;
}
.brand-text {
  min-width: 0;
}
.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--ink-4);
  margin-top: 2px;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 14px 12px 6px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 570;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, transform 0.16s var(--ease);
  user-select: none;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.78;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}
:root[data-theme='dark'] .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.nav-item:active {
  transform: scale(0.98);
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--glass-border);
  color: var(--ink);
  font-weight: 640;
  box-shadow: 0 2px 10px rgba(23, 37, 84, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
:root[data-theme='dark'] .nav-item.active {
  background: rgba(74, 110, 180, 0.26);
}
.nav-item.active svg {
  opacity: 1;
  color: var(--accent);
}
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-sm);
  background: var(--glass-soft);
  border: 1px solid var(--glass-border-soft);
  cursor: pointer;
  transition: background 0.2s;
}
.account-chip:hover {
  background: rgba(255, 255, 255, 0.6);
}
.account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex: none;
  overflow: hidden;
}
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-meta {
  min-width: 0;
  line-height: 1.3;
}
.account-name {
  font-size: 13px;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-status {
  font-size: 11.5px;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: 5px;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
}
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.18);
}
.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 55, 95, 0.16);
}

/* ==========================================================================
   主区域
   ========================================================================== */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 10px 0 20px;
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  flex: none;
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.02em;
}
.topbar-sub {
  font-size: 12.5px;
  color: var(--ink-4);
  margin-top: 1px;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu-btn {
  display: none;
}

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 130, 155, 0.3) transparent;
  padding-right: 4px;
  padding-bottom: 24px;
}
.view::-webkit-scrollbar {
  width: 10px;
}
.view::-webkit-scrollbar-thumb {
  background: rgba(120, 130, 155, 0.26);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}

.view.view-full {
  overflow: hidden;
  padding-bottom: 0;
}
.view.view-full > * {
  height: 100%;
  min-height: 0;
}

.view-enter {
  animation: view-in 0.36s var(--ease-out);
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ==========================================================================
   总览
   ========================================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stat-card {
  position: relative;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
}
.stat-card::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}
.stat-card.tone-blue::before {
  background: radial-gradient(circle, rgba(10, 132, 255, 0.16), transparent 68%);
}
.stat-card.tone-green::before {
  background: radial-gradient(circle, rgba(48, 209, 88, 0.16), transparent 68%);
}
.stat-card.tone-orange::before {
  background: radial-gradient(circle, rgba(255, 159, 10, 0.18), transparent 68%);
}
.stat-card.tone-purple::before {
  background: radial-gradient(circle, rgba(94, 92, 230, 0.16), transparent 68%);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.stat-label svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}
.stat-value {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.stat-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-4);
  letter-spacing: 0;
}
.stat-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.trend.up {
  color: #1a9c43;
}
.trend.down {
  color: #d42a4e;
}
.trend.flat {
  color: var(--ink-4);
}
.trend svg {
  width: 12px;
  height: 12px;
}

/* 图表 */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}
.chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.seg-control {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-pill);
  background: rgba(120, 130, 155, 0.12);
  border: 1px solid var(--glass-border-soft);
}
.seg-item {
  height: 28px;
  padding: 0 13px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.seg-item:hover {
  color: var(--ink);
}
.seg-item.active {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(23, 37, 84, 0.12);
}

/* 列表 */
.list {
  display: flex;
  flex-direction: column;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--glass-border-soft);
  font-size: 13.5px;
}
.list-row:last-child {
  border-bottom: none;
}
.list-rank {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(120, 130, 155, 0.14);
  color: var(--ink-3);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.list-rank.top1 {
  background: linear-gradient(135deg, #ffd60a, #ff9f0a);
  color: #fff;
}
.list-rank.top2 {
  background: linear-gradient(135deg, #d7dce5, #a8b2c4);
  color: #fff;
}
.list-rank.top3 {
  background: linear-gradient(135deg, #ffb27a, #e08a4f);
  color: #fff;
}

.work-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(120, 130, 155, 0.14);
  flex: none;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-3);
  overflow: hidden;
}
.work-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   评论
   ========================================================================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.toolbar .input,
.toolbar .select {
  width: auto;
  min-width: 150px;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}
.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-4);
  pointer-events: none;
}
.search-box .input {
  width: 100%;
  padding-left: 38px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-card {
  position: relative;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  transition: box-shadow 0.3s var(--ease), transform 0.2s var(--ease), border-color 0.2s;
}
.comment-card:hover {
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
}
.comment-card.selected {
  border-color: rgba(10, 132, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.14), var(--glass-shadow);
}
.comment-card.replied {
  opacity: 0.82;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: none;
}
.comment-author {
  font-size: 14px;
  font-weight: 640;
}
.comment-time {
  font-size: 12px;
  color: var(--ink-4);
}
.comment-body {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 8px 0 12px;
}
.comment-imgs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.comment-imgs img {
  width: 84px;
  height: 62px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  cursor: zoom-in;
}

.reply-bubble {
  position: relative;
  margin-top: 12px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid rgba(10, 132, 255, 0.16);
  font-size: 13.5px;
  line-height: 1.6;
}
.reply-bubble-label {
  font-size: 11.5px;
  font-weight: 660;
  color: var(--accent);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ai-draft {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(94, 92, 230, 0.1), rgba(10, 132, 255, 0.08));
  border: 1px solid rgba(94, 92, 230, 0.22);
  animation: view-in 0.3s var(--ease-out);
}
.ai-draft-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 660;
  color: var(--accent-2);
  margin-bottom: 9px;
}
.ai-draft-head svg {
  width: 14px;
  height: 14px;
}
.ai-draft .textarea {
  background: rgba(255, 255, 255, 0.7);
  min-height: 72px;
  font-size: 13.5px;
}
:root[data-theme='dark'] .ai-draft .textarea {
  background: rgba(20, 28, 44, 0.7);
}
.ai-draft-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.counter {
  font-size: 12px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.counter.warn {
  color: var(--warn);
  font-weight: 600;
}
.counter.over {
  color: var(--danger);
  font-weight: 700;
}

/* ==========================================================================
   表格
   ========================================================================== */

.table-wrap {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
table.data-table {
  width: 100%;
}

table.data-table.compact-mobile {
  min-width: 680px;
}

.data-table {
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 13px 16px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border-soft);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--glass-border-soft);
  color: var(--ink-2);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.42);
}
:root[data-theme='dark'] .data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}
.data-table .num-cell {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 620;
  color: var(--ink);
}

/* ==========================================================================
   空状态 / 加载
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 64px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(120, 130, 155, 0.1);
  border: 1px solid var(--glass-border-soft);
}
.empty-icon svg {
  width: 28px;
  height: 28px;
  color: var(--ink-4);
}
.empty-state h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}
.empty-state p {
  margin: 0;
  font-size: 13.5px;
  max-width: 380px;
  line-height: 1.6;
}

.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px;
  color: var(--ink-3);
  font-size: 14px;
}

/* ==========================================================================
   登录页
   ========================================================================== */

.login-shell {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(440px, 100%);
  padding: 40px 38px 34px;
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
  text-align: center;
  animation: view-in 0.5s var(--ease-out);
}
.login-logo {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  margin: 0 auto 20px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  box-shadow: 0 16px 40px rgba(10, 132, 255, 0.34);
}
.login-logo svg {
  width: 34px;
  height: 34px;
  color: #fff;
}
.login-card h2 {
  margin: 0 0 8px;
  font-size: 23px;
  font-weight: 720;
  letter-spacing: -0.03em;
}
.login-card > p {
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-3);
}
.login-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
  text-align: left;
}
.login-step {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--glass-soft);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}
.login-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.login-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-4);
  line-height: 1.6;
}

.status-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid rgba(10, 132, 255, 0.2);
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  color: var(--ink-2);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.status-panel svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
  flex: none;
  margin-top: 1px;
}

/* ==========================================================================
   设置页
   ========================================================================== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
  align-items: start;
}
.settings-card {
  padding: 22px 24px;
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.settings-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 660;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-card h3 svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}
.settings-card .desc {
  margin: 0 0 18px;
  font-size: 12.5px;
  color: var(--ink-4);
  line-height: 1.55;
}
.settings-card .field + .field {
  margin-top: 14px;
}

.switch {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: rgba(120, 130, 155, 0.3);
  border: none;
  cursor: pointer;
  transition: background 0.25s var(--ease);
  flex: none;
  padding: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s var(--ease);
}
.switch.on {
  background: var(--success);
}
.switch.on::after {
  transform: translateX(18px);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border-soft);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-row-label {
  font-size: 13.5px;
  font-weight: 580;
}
.setting-row-sub {
  font-size: 12px;
  color: var(--ink-4);
  margin-top: 2px;
}

/* ==========================================================================
   响应式
   ========================================================================== */

@media (max-width: 1080px) {
  .stat-value {
    font-size: 28px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 8px;
    gap: 0;
  }
  .sidebar {
    position: fixed;
    left: 8px;
    top: 8px;
    bottom: 8px;
    transform: translateX(calc(-100% - 16px));
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu-btn {
    display: inline-grid;
  }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(12, 18, 32, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fade-in 0.2s;
  }
  .topbar {
    height: 54px;
    padding: 0 8px 0 10px;
    gap: 8px;
  }
  .topbar h1 {
    font-size: 16px;
  }
  .topbar-sub {
    display: none;
  }
  /* 手机上统计卡片要紧凑：2x2 一屏能看全 */
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  .stat-card {
    padding: 13px 14px;
    border-radius: var(--r-md);
  }
  .stat-card::before {
    width: 90px;
    height: 90px;
    right: -28px;
    top: -28px;
  }
  .stat-label {
    font-size: 11.5px;
    margin-bottom: 7px;
    gap: 5px;
  }
  .stat-label svg {
    width: 13px;
    height: 13px;
  }
  .stat-value {
    font-size: 21px;
    gap: 3px;
  }
  .stat-unit {
    font-size: 11px;
  }
  .stat-foot {
    font-size: 10.5px;
    margin-top: 7px;
    gap: 5px;
    flex-wrap: wrap;
    line-height: 1.4;
  }
  .stat-foot .trend svg {
    width: 10px;
    height: 10px;
  }
  .trend {
    font-size: 10.5px;
  }
  .chart-wrap {
    height: 230px;
  }
  .toolbar .input,
  .toolbar .select {
    min-width: 0;
    flex: 1 1 calc(50% - 6px);
  }
  .toolbar .btn {
    flex: 1 1 auto;
  }
  .search-box {
    max-width: none;
    flex-basis: 100%;
  }
  .table-wrap {
    overflow-x: auto;
  }
  /* 普通表格允许横向滚动；带 compact-mobile 的会自动隐藏次要列 */
  .data-table {
    min-width: 620px;
  }
  table.data-table.compact-mobile {
    min-width: 0;
  }
  .modal {
    width: 100%;
    max-height: 92vh;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 32px 24px 28px;
  }
  .comment-card {
    padding: 15px 16px;
  }
}

@media (max-width: 360px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* 安全区域 */
@supports (padding: env(safe-area-inset-bottom)) {
  .sidebar-foot {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .view {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* ---------- AI 思考过程 ---------- */

.think-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  margin-left: 4px;
  border-radius: 999px;
  border: 1px solid rgba(94, 92, 230, 0.24);
  background: rgba(94, 92, 230, 0.08);
  color: var(--accent-2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.think-toggle:hover {
  background: rgba(94, 92, 230, 0.16);
}
.think-toggle.on {
  background: rgba(94, 92, 230, 0.2);
}
.think-box {
  margin: 0 0 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(94, 92, 230, 0.06);
  border-left: 3px solid rgba(94, 92, 230, 0.4);
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--ink-3);
  white-space: pre-wrap;
  word-break: break-word;
  animation: view-in 0.22s var(--ease-out);
}
.custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.custom-range label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}
.custom-range .input {
  width: auto;
  min-width: 148px;
  padding: 7px 11px;
}

/* ==========================================================================
   移动端 / 平板适配增强
   ========================================================================== */

/* 触控目标：手机上按钮/分段控件要够大才好点 */
@media (max-width: 860px), (pointer: coarse) {
  .btn {
    min-height: 40px;
  }
  .btn-sm {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }
  .icon-btn {
    min-width: 40px;
    min-height: 40px;
  }
  .seg-item {
    min-height: 34px;
    padding: 0 13px;
  }
  .nav-item {
    min-height: 46px;
  }
  .quick-chip {
    min-height: 34px;
    padding: 0 14px;
  }
  .input,
  .select {
    min-height: 42px;
  }
  /* iOS 上 <16px 会触发页面缩放 */
  .input,
  .textarea,
  .select,
  .chat-input,
  .draft-input,
  .ask-input {
    font-size: 16px;
  }
}

/* 手机：卡片标题允许换行，避免被挤成竖排 */
@media (max-width: 860px) {
  .card-title {
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-title > span:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }
  .settings-card h3 {
    flex-wrap: wrap;
  }
  /* 工具栏里的分段控件可横向滚动，不挤成两行 */
  .toolbar .seg-control {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .toolbar .seg-control::-webkit-scrollbar {
    display: none;
  }
  .toolbar {
    gap: 8px;
  }
  /* 表格：手机上隐藏次要列，保证主要内容不横向滚动 */
  table.data-table.compact-mobile {
    min-width: 0;
  }
  .data-table.compact-mobile th:nth-child(n + 4),
  .data-table.compact-mobile td:nth-child(n + 4) {
    display: none;
  }
  .data-table th,
  .data-table td {
    padding: 11px 10px;
  }
  /* 弹窗：手机上接近全屏，避免内容被裁 */
  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg);
  }
  .modal-header {
    padding: 16px 18px 8px;
  }
  .modal-body {
    padding: 8px 18px 16px;
  }
  .modal-footer {
    padding: 12px 18px 16px;
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  /* 评论区操作按钮换行 */
  .comment-actions {
    gap: 6px;
  }
  .ai-draft-foot {
    gap: 6px;
  }
  .ai-draft-foot .counter {
    order: 3;
    width: 100%;
    text-align: right;
  }
}

/* 小屏手机 */
@media (max-width: 400px) {
  .app-shell {
    padding: 6px;
  }
  .topbar {
    padding: 0 6px 0 8px;
  }
  .topbar h1 {
    font-size: 15px;
  }
  .btn-sm {
    padding: 0 11px;
  }
  .seg-item {
    padding: 0 10px;
    font-size: 12px;
  }
  .stat-value {
    font-size: 19px;
  }
}

/* 列表里的小图标按钮（快捷回复的编辑/删除等），手机上放大触控区 */
@media (max-width: 860px), (pointer: coarse) {
  .list-row .icon-btn,
  .settings-card .icon-btn {
    min-width: 38px !important;
    min-height: 38px !important;
    width: 38px !important;
    height: 38px !important;
  }
  .switches-row {
    flex-wrap: wrap;
  }
  /* 设置页两列按钮在窄屏堆叠 */
  .settings-card .row.gap-2 {
    flex-wrap: wrap;
  }
  .settings-card .row.gap-2 .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
/* 开关：手机上视觉不变，但把可点区域扩到 44px 高（iOS 推荐） */
@media (max-width: 860px), (pointer: coarse) {
  .switch {
    position: relative;
  }
  .switch::before {
    content: '';
    position: absolute;
    left: -8px;
    right: -8px;
    top: -8px;
    bottom: -8px;
  }
}

/* ==========================================================================
   访问密码界面
   ========================================================================== */

.gate-view {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 20px;
}

.gate-wrap {
  width: 100%;
  display: grid;
  place-items: center;
}

.gate-card {
  width: 100%;
  max-width: 400px;
  padding: 34px 30px 26px;
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner), 0 40px 80px -50px rgba(20, 50, 110, 0.6);
  text-align: center;
}

.gate-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  box-shadow: 0 18px 36px -18px rgba(10, 132, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.gate-logo svg {
  width: 26px;
  height: 26px;
}

.gate-card h1 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.gate-sub {
  margin: 0 0 24px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-3);
}

.gate-label {
  display: block;
  text-align: left;
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 620;
  color: var(--ink-3);
}

.gate-input {
  width: 100%;
  margin-bottom: 16px;
  height: 46px;
  font-size: 16px;
}

.gate-user-fixed {
  background: rgba(120, 130, 155, 0.07);
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.gate-remember {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: -4px 0 16px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(10, 132, 255, 0.07);
  border: 1px solid rgba(10, 132, 255, 0.14);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
  text-align: left;
}

.gate-remember svg {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
  color: #0a84ff;
}

.gate-hint {
  text-align: left;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-4);
  margin: -6px 0 18px;
}

.gate-btn {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 640;
  margin-top: 4px;
}

.gate-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--ink-4);
  line-height: 1.5;
}

.gate-foot svg {
  width: 12px;
  height: 12px;
  flex: none;
}

@media (max-width: 420px) {
  .gate-card {
    padding: 28px 22px 22px;
  }
  .gate-card h1 {
    font-size: 20px;
  }
}
