/* 私人收藏夹 —— 样式（含 dataviz 规范配色） */
:root {
  color-scheme: light dark;

  /* dataviz 墨色 / 表面 */
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  /* 状态色（固定，不随主题变化） */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  /* 应用强调色（分类 slot 1：蓝） */
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --danger: #d03b3b;

  --shadow: 0 1px 3px rgba(11, 11, 11, 0.08), 0 1px 2px rgba(11, 11, 11, 0.04);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.12);
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 登录页 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-sub { margin: 0 0 24px; color: var(--text-secondary); font-size: 14px; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 16px; }
.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.field input, .field textarea, .select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.18);
}

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--surface-1);
  color: var(--text-primary);
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--gridline); }
.btn.full { width: 100%; }
.icon-btn {
  width: 36px; height: 36px;
  font-size: 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
}
.icon-btn:hover { background: var(--gridline); }
.error-text { color: var(--danger); font-size: 13px; margin: 12px 0 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; font-size: 17px; }
.search { flex: 1; max-width: 420px; }
.search input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 主体容器 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 20px 24px 60px; }

/* ---------- 存储仪表盘 ---------- */
.storage-dash {
  display: flex; align-items: center; gap: 32px;
  padding: 24px 28px;
  margin-bottom: 20px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gauge-wrap { flex-shrink: 0; }
.drop { width: 150px; height: 180px; display: block; }
.drop-outline { fill: none; stroke: var(--baseline); stroke-width: 2; }
#drop-liquid, #drop-wave {
  transition: y .6s ease, height .6s ease, cy .6s ease, fill .3s ease;
}
.drop-shine { fill: rgba(255, 255, 255, 0.45); }

.gauge-meta { flex: 1; min-width: 0; }
.gauge-title { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.hero { display: flex; align-items: baseline; gap: 6px; }
.hero-value {
  font-size: 46px;
  font-weight: 650;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.hero-unit { font-size: 16px; color: var(--text-secondary); }
.hero-label { font-size: 14px; color: var(--text-muted); margin-left: 4px; }

.gauge-status { display: flex; align-items: center; gap: 7px; margin: 10px 0 14px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
#status-text { font-size: 14px; color: var(--text-secondary); }

.gauge-lines { display: flex; gap: 28px; margin-bottom: 14px; flex-wrap: wrap; }
.gauge-line { display: flex; flex-direction: column; }
.gauge-line span { font-size: 12px; color: var(--text-muted); }
.gauge-line b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.meter { height: 10px; background: var(--gridline); border-radius: 999px; overflow: hidden; }
.meter-fill {
  height: 100%; width: 0;
  border-radius: 999px;
  background: var(--text-muted);
  transition: width .6s ease, background .3s ease;
}

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.tabs {
  display: inline-flex;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.tab {
  padding: 6px 16px;
  font-size: 14px;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; }
.toolbar-spacer { flex: 1; }

/* ---------- 卡片列表 ---------- */
.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 14px 16px 8px; }
.card-title {
  margin: 0 0 6px; font-size: 15px; font-weight: 600;
  overflow-wrap: anywhere;
}
.card-content {
  margin: 0; font-size: 13px; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap;
}
.card-link {
  display: inline-block; max-width: 100%;
  font-size: 13px; color: var(--accent-ink);
  text-decoration: none; overflow-wrap: anywhere;
}
.card-link:hover { text-decoration: underline; }

.card-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 16px 12px; margin-top: auto;
}
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--gridline); color: var(--text-secondary);
}
.cat { font-size: 12px; color: var(--text-muted); }
.time { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.card-actions { display: flex; gap: 6px; }
.mini {
  font-size: 12px; font-family: inherit;
  padding: 3px 9px; border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary);
  cursor: pointer; text-decoration: none;
}
.mini:hover { background: var(--gridline); }
.mini.danger { color: var(--danger); border-color: rgba(208, 59, 59, 0.35); }
.mini.danger:hover { background: rgba(208, 59, 59, 0.08); }

/* 文件卡片 */
.file-preview {
  height: 150px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gridline);
  cursor: pointer;
  overflow: hidden;
}
.file-thumb { width: 100%; height: 100%; object-fit: cover; }
.file-icon { font-size: 46px; opacity: 0.55; }
.file-meta { font-size: 12px; color: var(--text-muted); }

.empty { text-align: center; color: var(--text-muted); padding: 48px 0; font-size: 14px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 24px;
}
.modal-card {
  width: 100%; max-width: 480px;
  background: var(--surface-1);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 18px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.hint { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }
.upload-status { text-align: center; color: var(--text-secondary); font-size: 14px; margin: 12px 0 0; }

/* ---------- 图片预览 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  padding: 32px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  width: 40px; height: 40px; font-size: 18px;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  border: none; border-radius: 50%; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .storage-dash { flex-direction: column; align-items: stretch; }
  .gauge-wrap { display: flex; justify-content: center; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .toolbar-spacer { display: none; }
}
