:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fefefe;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-muted: #cbd5e1;
  --accent-primary: #3b82f6;
  --accent-primary-soft: rgba(59, 130, 246, 0.1);
  --accent-primary-strong: #2563eb;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-success-soft: rgba(16, 185, 129, 0.1);
  --accent-warning: #f59e0b;
  --accent-warning-soft: rgba(245, 158, 11, 0.1);
  --accent-danger: #ef4444;
  --accent-danger-soft: rgba(239, 68, 68, 0.1);
  --accent-purple: #8b5cf6;
  --accent-purple-soft: rgba(139, 92, 246, 0.1);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

/* 紫色主题 */
.theme-purple {
  --accent-primary: #8b5cf6;
  --accent-primary-soft: rgba(139, 92, 246, 0.1);
  --accent-primary-strong: #7c3aed;
  --accent-purple: #3b82f6;
  --accent-purple-soft: rgba(59, 130, 246, 0.1);
}

/* 绿色主题 */
.theme-green {
  --accent-primary: #10b981;
  --accent-primary-soft: rgba(16, 185, 129, 0.1);
  --accent-primary-strong: #059669;
  --accent-success: #3b82f6;
  --accent-success-soft: rgba(59, 130, 246, 0.1);
}

/* 橙色主题 */
.theme-orange {
  --accent-primary: #f59e0b;
  --accent-primary-soft: rgba(245, 158, 11, 0.1);
  --accent-primary-strong: #d97706;
  --accent-warning: #3b82f6;
  --accent-warning-soft: rgba(59, 130, 246, 0.1);
}

/* 皮肤切换器 */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition: all var(--transition-fast);
}

.theme-btn:hover {
  transform: scale(1.15);
}

.theme-btn.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
}

.theme-btn[data-theme="blue"] .theme-dot {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.theme-btn[data-theme="purple"] .theme-dot {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.theme-btn[data-theme="green"] .theme-dot {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.theme-btn[data-theme="orange"] .theme-dot {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-purple) 100%);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.sidebar h1,
.workspace h2,
.panel h3 {
  margin: 0;
}

.sidebar h1 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
}

.sidebar-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(248, 250, 252, 0.6);
}

.sidebar-card,
.panel,
.stat-card,
.login-copy,
.topbar {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.sidebar-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: none;
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
}

.sidebar-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.5);
  margin-bottom: 10px;
  font-weight: 600;
}

.sidebar-value {
  font-size: 22px;
  font-weight: 700;
}

.sidebar-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(248, 250, 252, 0.7);
}

.sidebar-card code {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
  color: #a5f3fc;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.compact-list ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: rgba(248, 250, 252, 0.85);
}

.compact-list li + li {
  margin-top: 8px;
}

/* 侧边栏导航 */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: transparent;
  border: 1px solid transparent;
  color: rgba(248, 250, 252, 0.7);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-purple) 100%);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.nav-icon {
  font-size: 20px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}

/* 标签页容器 */
.tabs-container {
  display: block;
}

.tab-content {
  display: none;
  animation: tab-fade-in 200ms ease;
}

.tab-content.active {
  display: block;
}

@keyframes tab-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 统计卡片 */
.stat-card {
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-purple) 100%);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-content span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-content strong {
  font-size: 36px;
  line-height: 1;
  color: var(--accent-primary-strong);
  font-weight: 800;
}

/* 信息发布网格 */
.publishing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.publishing-grid .full-width {
  grid-column: 1 / -1;
}

.workspace {
  padding: 24px;
  overflow-y: auto;
  max-height: 100vh;
}

.login-view {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 1.3fr minmax(340px, 420px);
  gap: 24px;
  align-items: stretch;
}

.login-copy {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 28%),
    radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.12), transparent 28%),
    var(--bg-card);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-2xl);
}

.login-copy h2 {
  margin: 0 0 16px;
  max-width: 14ch;
  font-size: clamp(32px, 4.5vw, 44px);
  line-height: 1.05;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-copy p,
.topbar p,
.hint,
.panel-note,
.meta-row {
  color: var(--text-secondary);
}

.login-copy p,
.topbar p {
  margin: 0;
  max-width: 60ch;
  font-size: 15px;
}

.metric-row,
.stats-grid,
.field-grid,
.row-panels,
.workspace-grid {
  display: grid;
  gap: 16px;
}

.metric-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

.mini-stat {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.mini-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mini-stat strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-primary-strong);
  font-size: 18px;
  font-weight: 700;
}

.mini-stat span {
  font-size: 13px;
  color: var(--text-secondary);
}

.panel {
  padding: 20px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-normal);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

.announcement-editor {
  margin-bottom: 20px;
}

.policy-toggles {
  margin: 16px 0;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-chip:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.toggle-chip input {
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

.inline-toggle {
  min-height: 48px;
  justify-content: flex-start;
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-primary-soft);
}

.announcement-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 16px;
}

.announcement-editor-field,
.announcement-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement-editor-field span,
.announcement-preview span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.announcement-editor-field textarea {
  width: 100%;
  min-height: 160px;
  padding: 16px;
  resize: vertical;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

.announcement-preview-card {
  min-height: 160px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.6;
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-2xl);
  padding: 32px;
}

.topbar {
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.topbar h2 {
  font-size: 26px;
  font-weight: 800;
}

.topbar-actions,
.action-row,
.table-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-primary);
  font-weight: 700;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.9fr);
  align-items: start;
  gap: 20px;
}

.main-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h3 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: 12px;
  align-items: center;
}

.captcha-image {
  width: 180px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  object-fit: cover;
}

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

.duration-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: center;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-primary-soft);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn,
.table-action,
.pager button {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.ghost-btn:hover,
.table-action:hover,
.pager button:hover {
  transform: translateY(-2px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-strong) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.secondary-btn,
.table-action,
.pager button {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.secondary-btn:hover,
.table-action:hover,
.pager button:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.danger-btn {
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.danger-btn:hover {
  background: var(--accent-danger);
  color: #ffffff;
  border-color: var(--accent-danger);
}

.ghost-btn {
  width: 100%;
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(248, 250, 252, 0.2);
  padding: 14px 18px;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(248, 250, 252, 0.3);
}

.toolbar-card {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.filter-row,
.batch-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row {
  margin-bottom: 12px;
}

.filter-row input {
  flex: 1 1 300px;
}

.check-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.selection-summary {
  flex: 1 1 200px;
  font-size: 13px;
  color: var(--text-secondary);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  font-weight: 700;
}

.check-col {
  width: 60px;
  text-align: center;
}

.row-selector,
#selectPageCheckbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

tbody tr:hover {
  background: var(--bg-secondary);
}

tbody tr[data-selected="true"] {
  background: var(--accent-primary-soft);
}

.batch-key {
  font-family: "SF Mono", "Fira Code", Consolas, "Courier New", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-primary-strong);
  word-break: break-all;
}

.meta-row {
  margin-top: 6px;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.active {
  background: var(--accent-success-soft);
  color: var(--accent-success);
}

.status-pill.disabled {
  background: var(--accent-warning-soft);
  color: var(--accent-warning);
}

.status-pill.banned {
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
}

.status-pill.expired {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
  color: #dc2626;
  border: 1px dashed rgba(239, 68, 68, 0.4);
}

.batch-list,
.detail-list,
.log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.batch-item,
.device-item,
.log-item {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.batch-item:hover,
.device-item:hover,
.log-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.detail-list {
  min-height: 200px;
}

.log-list {
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.log-list::-webkit-scrollbar {
  width: 6px;
}

.log-list::-webkit-scrollbar-track {
  background: transparent;
}

.log-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.log-item {
  border-left: 4px solid var(--accent-primary);
  padding: 12px;
}

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

.log-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.log-action {
  color: var(--accent-primary-strong);
  font-weight: 700;
  font-size: 13px;
}

.log-time,
.log-meta,
.log-details,
.panel-note,
.hint,
.error,
.empty,
.empty-cell {
  font-size: 12px;
}

.log-meta {
  margin-top: 2px;
  color: var(--text-secondary);
  word-break: break-word;
}

.log-toggle-btn {
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-primary-soft);
  color: var(--accent-primary-strong);
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all var(--transition-fast);
  cursor: pointer;
  align-self: flex-start;
}

.log-toggle-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.log-details {
  margin-top: 10px;
  font-family: "SF Mono", "Fira Code", Consolas, "Courier New", monospace;
  background: var(--bg-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
}

.pager {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 13px;
}

.pager button[disabled],
.secondary-btn[disabled],
.danger-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.empty,
.empty-cell {
  text-align: center;
  color: var(--text-tertiary);
  padding: 28px 16px;
}

.error {
  min-height: 20px;
  color: var(--accent-danger);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-xl);
  animation: toast-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
}

.toast.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

body.modal-open {
  overflow: hidden;
}

.dialog-host {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.dialog-panel {
  position: relative;
  width: min(560px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-2xl);
  pointer-events: auto;
  animation: dialog-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog-panel[data-size="sm"] {
  width: min(420px, calc(100vw - 48px));
}

.dialog-panel[data-size="lg"] {
  width: min(680px, calc(100vw - 48px));
}

.dialog-panel[data-tone="danger"] {
  border-color: rgba(239, 68, 68, 0.25);
  box-shadow: 0 24px 60px -20px rgba(239, 68, 68, 0.28), var(--shadow-2xl);
}

.dialog-panel[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.22);
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  box-shadow: none;
}

.dialog-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.04);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-right: 48px;
  margin-bottom: 20px;
}

.dialog-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-primary-soft);
  color: var(--accent-primary-strong);
  font-size: 18px;
  font-weight: 800;
}

.dialog-panel[data-tone="danger"] .dialog-icon {
  background: var(--accent-danger-soft);
  color: var(--accent-danger);
}

.dialog-panel[data-tone="warning"] .dialog-icon {
  background: var(--accent-warning-soft);
  color: var(--accent-warning);
}

.dialog-panel[data-tone="success"] .dialog-icon {
  background: var(--accent-success-soft);
  color: var(--accent-success);
}

.dialog-heading {
  min-width: 0;
}

.dialog-heading h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.dialog-heading p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialog-field span {
  display: block;
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dialog-input {
  width: 100%;
}

.dialog-textarea {
  min-height: 112px;
  resize: vertical;
}

.dialog-help {
  font-size: 12px;
  color: var(--text-tertiary);
}

.dialog-error {
  min-height: 20px;
  color: var(--accent-danger);
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.dialog-actions .primary-btn,
.dialog-actions .secondary-btn,
.dialog-actions .danger-btn {
  min-width: 108px;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .dialog-backdrop {
    padding: 16px;
  }

  .dialog-panel {
    width: 100%;
    max-height: calc(100vh - 32px);
    padding: 20px;
  }

  .dialog-header {
    padding-right: 44px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .primary-btn,
  .dialog-actions .secondary-btn,
  .dialog-actions .danger-btn {
    width: 100%;
  }
}

/* 新增的卡密列表样式 */
.license-key-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-key-btn {
  background: var(--accent-primary-soft);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent-primary-strong);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.copy-key-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  transform: translateY(-1px);
}

.status-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.expiry-warning {
  font-size: 11px;
  color: var(--accent-warning);
  font-weight: 600;
}

.duration-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.usage-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.usage-cell.over-limit {
  background: var(--accent-danger-soft);
  border-color: rgba(239, 68, 68, 0.3);
}

.usage-value {
  font-weight: 700;
  font-size: 14px;
}

.usage-cell.over-limit .usage-value {
  color: var(--accent-danger);
}

.usage-separator {
  color: var(--text-tertiary);
}

.usage-max {
  color: var(--text-secondary);
}

.usage-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 4px;
}

.note-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.action-group + .action-group {
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.table-action {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* 即将到期和已过期的行样式 */
.expiring-soon {
  background: rgba(245, 158, 11, 0.05);
}

.expiring-soon:hover {
  background: rgba(245, 158, 11, 0.1);
}

.expired-row {
  background: rgba(239, 68, 68, 0.05);
}

.expired-row:hover {
  background: rgba(239, 68, 68, 0.1);
}

.expired-row .batch-key {
  color: var(--text-secondary);
}

.filter-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* 卡密管理布局 */
.licenses-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(380px, 0.9fr);
  gap: 20px;
  height: calc(100vh - 340px);
  min-height: 600px;
}

.licenses-left {
  overflow-y: auto;
  padding-right: 4px;
}

.licenses-left::-webkit-scrollbar {
  width: 8px;
}

.licenses-left::-webkit-scrollbar-track {
  background: transparent;
}

.licenses-left::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.licenses-left::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.licenses-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
}

.licenses-right::-webkit-scrollbar {
  width: 8px;
}

.licenses-right::-webkit-scrollbar-track {
  background: transparent;
}

.licenses-right::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.licenses-right::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 768px) {
  .captcha-row {
    grid-template-columns: 1fr;
  }

  .captcha-image {
    width: 100%;
    max-width: 240px;
  }
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    position: static;
    height: auto;
    max-height: 400px;
  }

  .login-view,
  .row-panels,
  .stats-grid,
  .field-grid,
  .announcement-editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .filter-row,
  .batch-toolbar,
  .action-row,
  .topbar-actions {
    align-items: stretch;
  }

  .filter-row > *,
  .action-row > *,
  .topbar-actions > * {
    width: 100%;
  }

  .table-actions {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
