:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #131c31;
    --border: #23304d;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-soft: rgba(56, 189, 248, 0.14);
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; margin-top: 10px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; margin-top: 16px; font-size: 0.85rem; }

.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.err { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 0.84rem; }

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card-box {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 26px;
  text-align: center;
}
.icon-circle {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 14px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.card-box h1 { margin: 0 0 8px; font-size: 1.35rem; }

.header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-title { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.76rem; color: var(--muted); }

.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-wrap { width: 220px; }

.container { max-width: 1120px; margin: 0 auto; padding: 22px 20px 60px; }
.folder-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 0.84rem; cursor: pointer;
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.meta-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.doc-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.doc-top { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.doc-ext {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-ext.pdf { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.doc-ext.sheet { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.doc-info { min-width: 0; flex: 1; }
.doc-name { font-weight: 600; font-size: 0.94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 56px 20px;
  background: var(--surface); border: 1px dashed var(--border); border-radius: 16px;
}

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 12, 22, 0.7);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1rem; }
.close-btn { border: none; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.field { margin-top: 14px; }
.field label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }

.dropzone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 24px 14px; text-align: center; cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: 0 0 4px; }
.queue { margin-top: 12px; max-height: 140px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 0.82rem; }

.modal-full { padding: 0; background: rgba(6, 9, 16, 0.94); }
.preview-shell { width: 100%; height: 100%; display: flex; flex-direction: column; }
.preview-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: rgba(15, 23, 42, 0.95); color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.preview-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-btns { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.preview-btns .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.22); }
.preview-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 18px; overflow: auto; }
.preview-stage iframe { width: 100%; height: 100%; max-width: 1050px; border: none; border-radius: 10px; background: #fff; }
.preview-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.preview-pre { width: 100%; max-width: 920px; max-height: 100%; overflow: auto; background: var(--surface); color: var(--text); padding: 20px; border-radius: 12px; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 0.86rem; }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 90;
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 0.86rem;
}
