/*
 * 后台现代化样式 - 替代 MDUI
 * Author: 景昇 (重构)
*/

/* ========== 主题变量 ========== */
:root {
  --bg: #f1f5f9;
  --bg-grad: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #fdf2f8 100%);

  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-glass: rgba(255, 255, 255, 0.7);

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.1);
  --primary-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-primary: 0 8px 20px rgba(99, 102, 241, 0.3);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --appbar-h: 60px;
  --drawer-w: 240px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[theme='dark'] {
  --bg: #0f172a;
  --bg-grad: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);

  --surface: #1e293b;
  --surface-2: #0f172a;
  --surface-glass: rgba(30, 41, 59, 0.7);

  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --border: #334155;
  --border-light: #1e293b;

  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-light: rgba(129, 140, 248, 0.15);
  --primary-grad: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-primary: 0 8px 20px rgba(129, 140, 248, 0.3);
}

/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
    'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg-grad);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol, li {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========== Material Icons 字体 ========== */
@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('../lib/mdui-v1.0.2/icons/material-icons/MaterialIcons-Regular.woff2') format('woff2');
}

.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'liga';
}

/* ========== iconfont 字体 ========== */
@font-face {
  font-family: 'iconfont';
  src: url('icon/iconfont.woff2?t=1694322651073') format('woff2'),
    url('icon/iconfont.woff?t=1694322651073') format('woff'),
    url('icon/iconfont.ttf?t=1694322651073') format('truetype');
}

.iconfont {
  font-family: 'iconfont' !important;
  font-size: 24px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-heart-pulse:before {
  content: '\e79c';
}

/* ========== 布局 ========== */
.app-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: calc(var(--appbar-h) + 20px) 24px 80px;
}

/* 栅格 */
.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.col {
  flex: 1;
  min-width: 0;
}

.col-full {
  width: 100%;
}

.col-half {
  flex: 0 0 calc(50% - 8px);
}

.col-third {
  flex: 0 0 calc(33.333% - 11px);
}

.col-quarter {
  flex: 0 0 calc(25% - 12px);
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .col-half, .col-third, .col-quarter {
    flex: 0 0 100%;
  }
}

/* ========== 顶栏 ========== */
.appbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--appbar-h);
  z-index: 100;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.appbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}

.appbar-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: var(--transition);
}

.appbar-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.appbar-toggle .material-icons {
  font-size: 22px;
}

.appbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.appbar-spacer {
  flex: 1;
}

.appbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.appbar-badge .material-icons {
  font-size: 16px;
}

/* ========== 抽屉 ========== */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px 80px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

.drawer::-webkit-scrollbar {
  width: 4px;
}

.drawer::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

.drawer.open {
  transform: translateX(0);
  box-shadow: var(--shadow-lg);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* 桌面端：抽屉常驻 */
@media (min-width: 1024px) {
  .drawer {
    transform: translateX(0);
    box-shadow: none;
    transition: none;
  }
  .drawer-overlay {
    display: none !important;
  }
  body {
    padding-left: var(--drawer-w);
  }
  .appbar {
    left: var(--drawer-w);
  }
}

/* ========== 导航列表 ========== */
.nav-section {
  margin-bottom: 8px;
}

.nav-label {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-grad);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.nav-item .material-icons {
  font-size: 20px;
  flex-shrink: 0;
}

.nav-item .nav-arrow {
  margin-left: auto;
  font-size: 18px;
  transition: transform var(--transition);
}

.nav-item.expanded .nav-arrow {
  transform: rotate(90deg);
}

/* 折叠子菜单 */
.nav-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition);
  padding-left: 12px;
}

.nav-children.open {
  max-height: 400px;
}

.nav-children .nav-item {
  font-size: 13px;
  padding: 8px 12px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 8px;
}

/* ========== 卡片 ========== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

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

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  transition: var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--border-light);
  border-color: var(--text-muted);
}

.btn .material-icons {
  font-size: 18px;
}

.btn-primary {
  background: var(--primary-grad);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.4);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
}

.btn-icon .material-icons {
  font-size: 20px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ========== 表单 ========== */
.field {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--text-muted);
}

.field-textarea {
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
}

.field-helper {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.field-with-icon {
  position: relative;
}

.field-with-icon .material-icons {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
  pointer-events: none;
}

.field-with-icon .field-input {
  padding-left: 40px;
}

/* 原生 select 美化 */
.field-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 38px;
}

/* ========== 表格 ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.table .col-actions a,
.table .col-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: var(--transition);
  margin-left: 4px;
}

.table .col-actions a:hover,
.table .col-actions button:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.table .col-actions .btn-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.table .col-actions .material-icons {
  font-size: 18px;
}

/* ========== 弹窗 Dialog ========== */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.dialog-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: scale(0.92) translateY(20px);
  transition: transform var(--transition);
  overflow: hidden;
}

.dialog-overlay.open .dialog {
  transform: scale(1) translateY(0);
}

.dialog-title {
  padding: 20px 24px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.dialog-body {
  padding: 16px 24px 20px;
}

.dialog-actions {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========== 折叠面板 ========== */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: var(--transition);
}

.accordion-header:hover {
  background: var(--border-light);
}

.accordion-header .material-icons {
  font-size: 18px;
  color: var(--text-muted);
}

.accordion-arrow {
  margin-left: auto;
  font-size: 18px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  padding: 0 16px;
}

.accordion-item.open .accordion-body {
  max-height: 600px;
  padding: 16px;
}

/* ========== 统计卡片 ========== */
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  min-height: 0;
  height: auto;
}

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

/* 页面头部统计卡片精简 */
.page-header .stat-card {
  padding: 8px 14px;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons {
  font-size: 24px;
  color: #fff;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== 页面标题 ========== */
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 20px;
  padding-top: 8px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header .page-title {
  margin: 0;
}

/* ========== 分隔线 ========== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
  border: none;
}

/* ========== 文字排版 ========== */
.text-muted {
  color: var(--text-muted);
}

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

.text-primary {
  color: var(--primary);
}

.text-danger {
  color: var(--danger);
}

.text-small {
  font-size: 12px;
}

.text-center {
  text-align: center;
}

.font-weight-500 { font-weight: 500; }
.font-weight-700 { font-weight: 700; }

/* ========== 间距工具类 ========== */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-2 { padding: 12px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.px-2 { padding-left: 12px; padding-right: 12px; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.px-4 { padding-left: 24px; padding-right: 24px; }
.py-2 { padding-top: 12px; padding-bottom: 12px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.pt-2 { padding-top: 12px; }
.pt-4 { padding-top: 24px; }
.pb-2 { padding-bottom: 12px; }
.pb-4 { padding-bottom: 24px; }
.float-right { float: right; }
.flex-right { display: flex; justify-content: flex-end; }

/* ========== Snackbar ========== */
.snackbar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 1000;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.snackbar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.snackbar .material-icons {
  font-size: 18px;
  color: var(--primary);
}

/* ========== 更新提示 ========== */
.update-notice {
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--primary-grad);
  border-radius: var(--radius-lg);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-primary);
}

.update-notice .material-icons {
  font-size: 22px;
}

.update-notice-text {
  flex: 1;
  font-size: 14px;
}

.update-notice kbd {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
}

/* ========== 登录页 ========== */
body.login-page {
  background: #ffffff !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0 !important;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #ffffff;
  position: relative;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12), 0 8px 24px rgba(15, 23, 42, 0.06);
  padding: 40px 36px 32px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--primary-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.login-logo-icon .material-icons {
  font-size: 32px;
  color: #fff;
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 700;
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  letter-spacing: 0.5px;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.login-form .field {
  margin-bottom: 18px;
}

.login-form .field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.login-form .field-with-icon {
  position: relative;
}

.login-form .field-with-icon .material-icons {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.login-form .field-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  color: var(--text);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-sizing: border-box;
}

.login-form .field-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.login-form .field-input::placeholder {
  color: var(--text-muted);
}

.login-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary-grad);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  letter-spacing: 4px;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.login-submit:active {
  transform: translateY(0);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ========== 工具类 ========== */
.hidden { display: none !important; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ========== 文字截断（防止溢出） ========== */
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.text-break {
  word-break: break-all;
  overflow-wrap: break-word;
  white-space: normal;
}

/* ========== 文件路径显示 ========== */
.file-path {
  word-break: break-all;
  overflow-wrap: break-word;
  white-space: normal;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ========== 设置卡片紧凑样式 ========== */
.settings-card {
  padding: 16px 20px;
}
.settings-card .field {
  margin-bottom: 12px;
}
.settings-card .field-label {
  font-size: 12px;
  margin-bottom: 4px;
}
.settings-card .field-input,
.settings-card .field-textarea,
.settings-card .field-select {
  padding: 8px 12px;
  font-size: 13px;
}
.settings-card .row {
  gap: 12px;
}

/* ========== 超级长文字折叠 ========== */
.text-collapse {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.text-collapse.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

/* ========== 文件缩略图双击预览 ========== */
.media-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: var(--transition);
  position: relative;
}
.media-thumb:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-thumb .file-icon {
  font-size: 28px;
  color: var(--text-muted);
}
.media-thumb .file-type-label {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 9px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.2;
}

/* ========== 文件预览弹窗 ========== */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.preview-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.preview-overlay .preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-overlay .preview-close:hover {
  background: rgba(255,255,255,0.25);
}
.preview-overlay img,
.preview-overlay video {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
}
.preview-overlay .preview-file {
  color: #fff;
  text-align: center;
}
.preview-overlay .preview-file a {
  color: #60a5fa;
  text-decoration: underline;
}

/* ========== 平板适配 ========== */
@media (max-width: 1024px) {
  .app-container {
    padding: calc(var(--appbar-h) + 16px) 16px 80px;
  }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .col-half, .col-third, .col-quarter { flex: 0 0 100%; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
