/* ============================================================
   WebPeek — "private archive" design system (light only)
   Pine green on warm paper, Fraunces display + Instrument Sans
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #fffdf9;
  --surface2: #efede6;
  --surface3: #e4e1d7;
  --border: #e0dcd0;
  --border-strong: #c9c3b2;
  --text: #1a2420;
  --muted: #6b7570;
  --accent: #1e5c4f;
  --accent-hover: #174a40;
  --accent-weak: rgba(30, 92, 79, 0.10);
  --accent-weak-2: rgba(30, 92, 79, 0.18);
  --focus-ring: rgba(30, 92, 79, 0.35);
  --gold: #a16207;
  --gold-weak: rgba(161, 98, 7, 0.12);
  --danger: #b3402f;
  --danger-weak: rgba(179, 64, 47, 0.10);
  --ok: #2e7d4f;
  --ok-weak: rgba(46, 125, 79, 0.12);
  --warn: #9a6700;
  --warn-weak: rgba(154, 103, 0, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(26, 36, 32, 0.05), 0 1px 3px rgba(26, 36, 32, 0.06);
  --shadow-md: 0 4px 14px rgba(26, 36, 32, 0.09);
  --shadow-lg: 0 18px 44px rgba(26, 36, 32, 0.16);
  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --font-display: "Fraunces", Georgia, "Songti SC", "SimSun", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, Menlo, monospace;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-weak-2); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 6px; white-space: nowrap;
}

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; caret-color: var(--accent);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.85; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
select { cursor: pointer; }
input[type="file"] { display: none; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* inline svg icons */
.ic { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  padding: 8px 14px; font-weight: 500; line-height: 1.2;
  box-shadow: var(--shadow-sm); text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface2); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fffdf9;
  box-shadow: 0 1px 2px rgba(30, 92, 79, 0.3);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 3px 12px rgba(30, 92, 79, 0.32); }
.btn.danger { color: var(--danger); border-color: rgba(179, 64, 47, 0.35); }
.btn.danger:hover { background: var(--danger-weak); border-color: rgba(179, 64, 47, 0.55); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn .ic { opacity: 0.9; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border-strong); }

.muted { color: var(--muted); }

/* ---------- Tags ---------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tag.green { color: var(--ok); border-color: rgba(46, 125, 79, 0.35); background: var(--ok-weak); }
.tag.red { color: var(--danger); border-color: rgba(179, 64, 47, 0.35); background: var(--danger-weak); }
.tag.amber { color: var(--warn); border-color: rgba(154, 103, 0, 0.35); background: var(--warn-weak); }
.tag.gold { color: var(--gold); border-color: rgba(161, 98, 7, 0.35); background: var(--gold-weak); }

/* ---------- States ---------- */
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 44px 16px; font-size: 13px; }
.empty .empty-ico { color: var(--border-strong); margin-bottom: 10px; }
.empty .empty-ico .ic { width: 34px; height: 34px; }

/* ---------- Skeleton ---------- */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface2); border-radius: var(--radius-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 253, 249, 0.65), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}
.skel-line { height: 12px; }
.skel-line.w40 { width: 40%; }
.skel-line.w60 { width: 60%; }
.skel-line.w80 { width: 80%; }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); }
.skel-row .skel-box { width: 20px; height: 20px; border-radius: 5px; }
.skel-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.skel-card .skel-ico { width: 44px; height: 44px; border-radius: 12px; }
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---------- Landing ---------- */
.landing {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 3rem 1.5rem;
  background:
    radial-gradient(1000px 480px at 50% -10%, var(--accent-weak), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(26, 36, 32, 0.025) 31px, rgba(26, 36, 32, 0.025) 32px),
    repeating-linear-gradient(90deg, transparent, transparent 31px, rgba(26, 36, 32, 0.025) 31px, rgba(26, 36, 32, 0.025) 32px),
    var(--bg);
}
.landing .badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent); background: var(--accent-weak);
  border: 1px solid rgba(30, 92, 79, 0.22);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 26px;
}
.landing .logo-mark {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #245f50, #143d34);
  box-shadow: 0 12px 32px rgba(30, 92, 79, 0.35), inset 0 1px 0 rgba(255, 253, 249, 0.25);
  color: #fffdf9;
}
.landing .logo-mark .ic { width: 42px; height: 42px; }
.landing h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 54px; letter-spacing: -0.015em; line-height: 1.08;
  margin: 26px 0 14px; color: var(--text);
}
.landing .tagline { color: var(--muted); max-width: 620px; font-size: 16px; margin: 0 auto; }
.landing .actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; justify-content: center; }
.landing .btn { padding: 11px 22px; font-size: 14.5px; }
.landing .feats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  max-width: 780px; margin: 52px auto 0; text-align: left;
}
.landing .feat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.landing .feat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.landing .feat .f-ico {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-weak); color: var(--accent);
}
.landing .feat .f-ico .ic { width: 19px; height: 19px; }
.landing .feat b { font-size: 14.5px; font-weight: 600; }
.landing .feat p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.landing .foot { margin-top: 56px; color: var(--muted); font-size: 12px; letter-spacing: 0.03em; }

/* staggered entrance for landing blocks */
.rise { animation: fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem;
  background:
    radial-gradient(900px 420px at 50% -8%, var(--accent-weak), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(26, 36, 32, 0.025) 31px, rgba(26, 36, 32, 0.025) 32px),
    repeating-linear-gradient(90deg, transparent, transparent 31px, rgba(26, 36, 32, 0.025) 31px, rgba(26, 36, 32, 0.025) 32px),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px 28px; box-shadow: var(--shadow-lg);
  animation: fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.login-card .lc-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-card .lc-brand .lc-dot {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #245f50, #143d34); color: #fffdf9;
}
.login-card .lc-brand .lc-dot .ic { width: 16px; height: 16px; }
.login-card .lc-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.login-card .lc-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-card h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.form-error {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--danger-weak); border: 1px solid rgba(179, 64, 47, 0.3);
  color: var(--danger); font-size: 13px;
  border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px;
}
.form-error .ic { margin-top: 1px; }
.login-card .field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.login-card .field label { color: var(--muted); font-size: 13px; font-weight: 500; }
.login-card .btn.primary { width: 100%; padding: 10px; margin-top: 6px; }
.login-card .lc-note { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* ---------- Admin layout ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 228px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 13px; display: flex; flex-direction: column; gap: 3px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px;
  font-family: var(--font-display); letter-spacing: 0.01em;
  padding: 4px 10px 18px;
}
.sidebar .brand .dot {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #245f50, #143d34); color: #fffdf9;
  box-shadow: 0 2px 8px rgba(30, 92, 79, 0.35);
}
.sidebar .brand .dot .ic { width: 13px; height: 13px; }
.sidebar a.nav {
  display: flex; align-items: center; gap: 11px; color: var(--muted);
  padding: 9px 12px; border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px;
  transition: background 0.13s, color 0.13s;
}
.sidebar a.nav .ic { width: 16.5px; height: 16.5px; opacity: 0.85; }
.sidebar a.nav:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.sidebar a.nav.active {
  background: var(--accent-weak); color: var(--accent); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar a.nav.active .ic { opacity: 1; }
.sidebar .spacer { flex: 1; }
.sidebar .user {
  padding: 12px; margin-top: 10px; color: var(--muted); font-size: 13px;
  border-top: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 8px;
}
.sidebar .user .ic { flex-shrink: 0; opacity: 0.8; }
.sidebar .btn.sm { width: 100%; justify-content: flex-start; }
.sidebar .btn.sm .ic { width: 16px; height: 16px; }
.main { flex: 1; min-width: 0; padding: 26px 30px 76px; }
.page { max-width: 1100px; margin: 0 auto; }
.page h2 {
  margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em;
  font-family: var(--font-display); font-weight: 600;
}
.page > p.muted { font-size: 13px; margin: 0 0 12px; }

/* ---------- Toolbar / cards / panels ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 18px 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  animation: fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.card .num {
  font-size: 30px; font-weight: 600; letter-spacing: -0.02em;
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
  color: var(--accent); line-height: 1.15;
}
.card .lbl { color: var(--muted); font-size: 13px; margin-top: 3px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 14px 0; box-shadow: var(--shadow-sm);
}
.panel h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > .table { min-width: 620px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface2); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.row { cursor: pointer; transition: background 0.1s; }
.table tr.row:hover { background: var(--surface2); }
.table .name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .name-cell .ic { color: var(--accent); flex-shrink: 0; }
.table .name-cell .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.table .row-actions { white-space: nowrap; display: flex; gap: 5px; justify-content: flex-end; flex-wrap: nowrap; }

/* ---------- Breadcrumb ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { color: var(--accent); background: var(--accent-weak); text-decoration: none; }
.crumbs .sep { opacity: 0.45; }
.crumbs .crumb-cur { color: var(--text); font-weight: 500; padding: 2px 4px; }

/* ---------- Uploads ---------- */
.up-item { display: flex; flex-direction: column; gap: 7px; padding: 13px 0; }
.up-item + .up-item { border-top: 1px dashed var(--border); }
.up-head { display: flex; gap: 10px; align-items: center; }
.up-head .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; background: var(--surface3); border-radius: 999px; overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: left; border-radius: 999px;
  background: linear-gradient(90deg, #1e5c4f, #4f9d82);
  transition: transform 0.25s;
}
.up-sub { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23, 30, 27, 0.42);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 18px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 460px; padding: 24px; box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 16px; font-size: 17px; letter-spacing: -0.01em; font-family: var(--font-display); font-weight: 600; }
.modal .modal-text { margin: 0; line-height: 1.6; }
.modal .field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.modal .field label { color: var(--muted); font-size: 13px; font-weight: 500; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.share-url-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.share-url-row input { flex: 1; font-family: var(--mono); font-size: 12.5px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 11px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); font-size: 13px; max-width: 340px;
  animation: toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.err { border-left-color: var(--danger); }

/* ---------- Share ---------- */
.share-shell, .preview-shell { max-width: 980px; margin: 0 auto; padding: 28px 20px 72px; }
.share-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.share-head h1 {
  font-size: 22px; letter-spacing: -0.01em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-display); font-weight: 600;
}
.share-head .ic { color: var(--accent); flex-shrink: 0; }
.share-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-toolbar { display: flex; gap: 10px; align-items: center; margin: 12px 0 10px; }
.skel-title { height: 22px; width: 40%; margin-bottom: 10px; display: block; }
.skel-grid { margin-top: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.item-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
  box-shadow: var(--shadow-sm);
  animation: fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.item-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.item-card .ico {
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-weak); color: var(--accent);
  border-radius: 13px; transition: background 0.16s;
}
.item-card:hover .ico { background: var(--accent-weak-2); }
.item-card .it-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.item-card .it-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.item-card .it-actions { display: flex; gap: 6px; margin-top: 2px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.list-item:hover { background: var(--surface2); }
.list-item .li-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Preview ---------- */
.pv-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 18px; }
.pv-toolbar h1 { font-size: 18px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-weight: 600; }
.pv-toolbar .fileinfo { margin-left: auto; }
.pv-body { min-height: 60vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
.pv-body img, .pv-body video, .pv-body audio { max-width: 100%; border-radius: var(--radius-sm); }
.pv-body img { max-height: 78vh; object-fit: contain; box-shadow: var(--shadow-md); background: var(--surface2); }
.pv-body video { max-height: 78vh; box-shadow: var(--shadow-md); background: #101613; }
.pv-body pre.txt {
  width: 100%; max-height: 76vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px; font-family: var(--mono); font-size: 13px; line-height: 1.65; margin: 0;
  box-shadow: var(--shadow-sm);
}
.pv-pdf { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #232825; overflow: hidden; }
.pdf-stack { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0; background: #232825; overflow: auto; min-height: 78vh; }
.pdf-stack canvas { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); background: #fff; max-width: 100%; }
.pv-text { width: 100%; }
.pv-other { max-width: 420px; text-align: center; }
.pv-other .btn { margin-top: 14px; }
.pv-other .empty-ico { color: var(--border-strong); margin-bottom: 12px; }
.pv-other .empty-ico .ic { width: 40px; height: 40px; }
.fileinfo { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- Error page (invalid share link) ---------- */
.error-shell {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem; color: var(--text);
  background:
    radial-gradient(800px 380px at 50% -6%, var(--accent-weak), transparent 60%),
    var(--bg);
}
.error-shell .err-ico {
  width: 72px; height: 72px; border-radius: 20px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--accent);
  box-shadow: var(--shadow-md);
}
.error-shell .err-ico .ic { width: 34px; height: 34px; }
.error-shell h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; margin: 0 0 10px; }
.error-shell p { color: var(--muted); max-width: 420px; margin: 0 0 24px; }

/* ---------- Misc ---------- */
.hidden { display: none !important; }
.spin {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -250px; top: 0; bottom: 0; z-index: 40; width: 250px; transition: left 0.2s; box-shadow: none; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 84px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .landing h1 { font-size: 40px; }
  .landing .feats { grid-template-columns: 1fr; max-width: 420px; }
  /* collapse row action buttons to icon-only in the library table */
  .table .row-actions .btn .btn-txt { display: none; }
  .table .row-actions .btn { padding: 6px 8px; }
  .table-wrap > .table { min-width: 520px; }
}
@media (max-width: 480px) {
  .toolbar .btn { flex: 1 1 auto; }
  .page h2 { font-size: 20px; }
  .card { padding: 14px; }
  .landing h1 { font-size: 34px; }
  .share-head h1 { font-size: 19px; }
}
.menu-btn { display: none; }
