/* ==========================================================================
   媒体设备管理系统 - 管理员后台样式
   纯静态、无外部字体/UI 库；主色 #2563eb；深色侧边栏 + 浅色内容区。
   ========================================================================== */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-danger: #dc2626;
  --color-danger-soft: #fef2f2;
  --color-success: #15803d;
  --color-success-soft: #f0fdf4;
  --color-warning: #b45309;
  --color-warning-soft: #fffbeb;
  --color-purple: #7c3aed;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --bg-body: #f4f6fb;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-bg-soft: #1e293b;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 20px 45px rgba(15, 23, 42, 0.22);
  --font-sans: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, p { margin: 0; }

button { font-family: inherit; }

.mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ------------------------------------------------------------------ *
 * 启动加载 / 登录 / 初始化
 * ------------------------------------------------------------------ */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #dbeafe;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: dm-spin 0.8s linear infinite;
  display: inline-block;
}

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

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #1d4ed8 100%);
}

.auth-card {
  width: 420px;
  max-width: 100%;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.35);
  padding: 32px 32px 26px;
}

.auth-card--wide { width: 560px; }

.auth-brand { text-align: center; margin-bottom: 22px; }

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.auth-title { font-size: 21px; font-weight: 600; }

.auth-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.auth-form-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.auth-footnote {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* ------------------------------------------------------------------ *
 * 整体布局
 * ------------------------------------------------------------------ */
.app-root { min-height: 100vh; }

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-text { min-width: 0; }

.sidebar-system {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-sub { color: #94a3b8; font-size: 12px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: rgba(148, 163, 184, 0.14); color: #f8fafc; }

.nav-item.active {
  background: var(--color-primary);
  color: #ffffff;
}

.nav-icon {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.9;
}

.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 8px;
}

.sidebar-user-name { color: #f8fafc; font-size: 13px; font-weight: 500; }

.sidebar-user-role {
  font-size: 11px;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  padding: 1px 8px;
}

.nav-item--logout { color: #fca5a5; }
.nav-item--logout:hover { background: rgba(220, 38, 38, 0.18); color: #fecaca; }

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title { font-size: 17px; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-meta { color: var(--text-muted); font-size: 13px; }

.page {
  flex: 1;
  padding: 22px 24px 40px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------ *
 * 通用区块
 * ------------------------------------------------------------------ */
.page-stack { display: flex; flex-direction: column; gap: 16px; }
.page-stack--tight { display: flex; flex-direction: column; gap: 12px; }

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title { font-size: 19px; font-weight: 600; }

.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

.page-heading-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

.card-title { font-size: 15px; font-weight: 600; }

.card-hint { color: var(--text-muted); font-size: 12px; margin-left: 8px; font-weight: 400; }

.card-body { padding: 16px; }

.card-body--flush { padding: 0; }

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

.settings-grid { display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------------------------------------------ *
 * 按钮 / 表单
 * ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { background: var(--bg-hover); border-color: #94a3b8; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: #ffffff; }
.btn--primary:not(:disabled):hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

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

.btn--success { background: var(--color-success); border-color: var(--color-success); color: #ffffff; }
.btn--success:not(:disabled):hover { background: #166534; border-color: #166534; }

.btn--warn { background: var(--color-warning); border-color: var(--color-warning); color: #ffffff; }
.btn--warn:not(:disabled):hover { background: #92400e; border-color: #92400e; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--color-primary); }
.btn--ghost:hover { background: var(--color-primary-soft); border-color: transparent; }

.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }

.btn--block { width: 100%; height: 40px; font-size: 14px; }

.form-field { margin-bottom: 14px; }
.form-field:last-child { margin-bottom: 0; }

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

.required { color: var(--color-danger); margin-left: 3px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input,
.form-select { height: 36px; }

.form-textarea { resize: vertical; min-height: 70px; }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled { background: #f1f5f9; color: var(--text-muted); cursor: not-allowed; }

.form-hint { color: var(--text-faint); font-size: 12px; margin-top: 4px; }

.form-hint-inline { color: var(--text-faint); font-size: 12px; margin-left: 8px; }

.form-error-text { color: var(--color-danger); font-size: 12px; margin-top: 4px; }

.form-static { display: flex; align-items: center; height: 36px; }

.form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.form-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 0;
}

.form-actions--left { justify-content: flex-start; }

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
}

.checkbox-line input { margin-top: 3px; }

.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }

/* ------------------------------------------------------------------ *
 * 工具栏 / 表格
 * ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-search { width: 280px; max-width: 100%; }

.toolbar .form-select { width: auto; min-width: 120px; }

.table-wrap { width: 100%; overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

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

.table tbody tr:hover { background: #f8fafc; }

.table--compact thead th { padding: 8px 10px; }
.table--compact tbody td { padding: 8px 10px; }

.col-check { width: 40px; }
.col-num { text-align: right; white-space: nowrap; }
.col-actions { text-align: right; width: 1%; white-space: nowrap; }

.cell-muted { color: var(--text-muted); }
.cell-sub { color: var(--text-faint); font-size: 12px; }
.cell-error { color: var(--color-danger); max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-nowrap { white-space: nowrap; }
.cell-indent { padding-left: 28px !important; color: var(--text-secondary); }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

.row-root { background: #fbfcfe; }

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--color-primary);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.link-button:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ *
 * 徽章 / 提示
 * ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--green { background: #dcfce7; color: #166534; }
.badge--amber { background: #fef3c7; color: #92400e; }
.badge--red { background: #fee2e2; color: #991b1b; }
.badge--blue { background: #dbeafe; color: #1e40af; }
.badge--purple { background: #ede9fe; color: #5b21b6; }
.badge--gray { background: #f1f5f9; color: #475569; }

.alert {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin: 10px 0;
  border: 1px solid transparent;
}

.alert--error { background: var(--color-danger-soft); border-color: #fecaca; color: #991b1b; }
.alert--info { background: var(--color-primary-soft); border-color: #bfdbfe; color: #1e40af; }
.alert--warning { background: var(--color-warning-soft); border-color: #fde68a; color: #92400e; }
.alert--success { background: var(--color-success-soft); border-color: #bbf7d0; color: #166534; }

/* ------------------------------------------------------------------ *
 * 分页 / 状态块
 * ------------------------------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 2px;
}

.pagination-summary { color: var(--text-muted); font-size: 13px; }

.pagination-buttons { display: flex; gap: 8px; }

.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-align: center;
}

.state-block--error { border-color: #fecaca; color: #991b1b; }

.state-title { font-size: 15px; font-weight: 600; color: var(--text-main); }
.state-block--error .state-title { color: #991b1b; }
.state-text { font-size: 13px; }

.empty-inline {
  padding: 22px 16px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

/* ------------------------------------------------------------------ *
 * 统计卡片 / 概览
 * ------------------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.stat-card--blue { border-left-color: #2563eb; }
.stat-card--green { border-left-color: #16a34a; }
.stat-card--amber { border-left-color: #d97706; }
.stat-card--red { border-left-color: #dc2626; }

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

.stat-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 4px 0 6px; }

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

.event-list { list-style: none; margin: 0; padding: 0; }

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid #eef2f7;
}

.event-item:last-child { border-bottom: 0; }

.event-main { min-width: 0; flex: 1; }

.event-meta { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

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

.quick-action {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfdff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.quick-action:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }

.quick-action-title { font-size: 14px; font-weight: 600; color: var(--text-main); }

.quick-action-desc { font-size: 12px; color: var(--text-muted); }

/* ------------------------------------------------------------------ *
 * 详情 / 时间线
 * ------------------------------------------------------------------ */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

.detail-title { font-size: 20px; font-weight: 600; }

.detail-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.detail-meta { color: var(--text-muted); font-size: 13px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0 0;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.info-item { background: #ffffff; padding: 10px 14px; }

.info-item dt { color: var(--text-faint); font-size: 12px; margin-bottom: 2px; }

.info-item dd { margin: 0; font-size: 14px; color: var(--text-main); word-break: break-word; }

.info-item--wide { grid-column: span 2; }

.info-grid--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }

.sub-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline-item { position: relative; display: flex; gap: 14px; padding: 0 0 18px; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid #bfdbfe;
  position: relative;
  z-index: 1;
}

.timeline-content { min-width: 0; flex: 1; }

.timeline-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.timeline-time { color: var(--text-faint); font-size: 12px; }

.timeline-summary { font-size: 14px; margin-top: 4px; }

.timeline-meta { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

.timeline-hash { margin-left: 8px; }

.timeline-detail { margin-top: 6px; }

.timeline-detail summary {
  cursor: pointer;
  color: var(--color-primary);
  font-size: 12px;
  user-select: none;
}

.json-block {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ------------------------------------------------------------------ *
 * 配件 / 绑定 / 设置细节
 * ------------------------------------------------------------------ */
.accessory-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.accessory-row:last-child { border-bottom: 0; }

.accessory-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 0 12px;
}

.accessory-fields .form-field { margin-bottom: 0; }

.bind-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 12px 14px;
  margin: 6px 0 12px;
}

.bind-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

.bind-form .form-label { margin-bottom: 4px; }

.bind-input-row { display: flex; gap: 8px; }

.bind-input-row .form-input { flex: 1; }

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

.visibility-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fcfdff;
}

.visibility-item:hover { border-color: var(--border-strong); }

.visibility-label { flex: 1; font-size: 13.5px; }

.verify-block { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }

.verify-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.integrity-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 13px;
}

.integrity-result--good { color: var(--color-success); font-weight: 600; }
.integrity-result--bad { color: var(--color-danger); font-weight: 600; }
.integrity-result--muted { color: var(--text-faint); }

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

.qr-image {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.qr-device-code {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.qr-hint { color: var(--text-faint); font-size: 12px; margin-top: 6px; }

/* ------------------------------------------------------------------ *
 * 模态框 / 全局提示
 * ------------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 32px;
  overflow-y: auto;
}

.modal-overlay--top { z-index: 1500; }

.modal {
  width: 100%;
  max-width: 560px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
  animation: dm-modal-in 0.16s ease-out;
}

@keyframes dm-modal-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal--sm { max-width: 440px; }
.modal--md { max-width: 620px; }
.modal--lg { max-width: 880px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-main); }

.modal-body { padding: 16px 18px; overflow-y: auto; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.dialog-message { margin: 0 0 12px; color: var(--text-secondary); font-size: 14px; white-space: pre-line; }

.toast-stack {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  width: max-content;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--color-primary);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  font-size: 13.5px;
  animation: dm-toast-in 0.18s ease-out;
  pointer-events: none;
  max-width: 100%;
}

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

.toast--success { border-left-color: var(--color-success); }
.toast--error { border-left-color: var(--color-danger); }
.toast--warning { border-left-color: var(--color-warning); }
.toast--info { border-left-color: var(--color-primary); }

.toast-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--color-primary);
  margin-top: 1px;
}

.toast--success .toast-icon { background: var(--color-success); }
.toast--error .toast-icon { background: var(--color-danger); }
.toast--warning .toast-icon { background: var(--color-warning); }

.toast-text { flex: 1; word-break: break-word; }

.toast-close {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.toast-close:hover { color: var(--text-main); }

/* ------------------------------------------------------------------ *
 * 设备扩展字段
 * ------------------------------------------------------------------ */
.custom-fields-grid { row-gap: 2px; }

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

.field-key-readonly { font-family: var(--font-mono); color: var(--text-secondary); }

/* ------------------------------------------------------------------ *
 * 响应式
 * ------------------------------------------------------------------ */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visibility-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-item--wide { grid-column: span 2; }
  .form-row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 200px; flex-basis: 200px; }
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-basis: auto; height: auto; position: static; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .sidebar-user { padding: 0; }
  .page { padding: 16px 14px 32px; }
  .topbar { padding: 0 14px; }
  .form-row--2, .form-row--3 { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { gap: 12px; }
  .info-grid { grid-template-columns: minmax(0, 1fr); }
  .info-item--wide { grid-column: auto; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar-search { width: 100%; }
  .accessory-fields { grid-template-columns: minmax(0, 1fr); }
  .accessory-row { flex-direction: column; align-items: stretch; }
  .quick-actions { grid-template-columns: minmax(0, 1fr); }
  .visibility-grid { grid-template-columns: minmax(0, 1fr); }
}
