/* DiviVault share viewer. No inline styles anywhere (CSP style-src 'self'). */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --line: #e2e5ea;
  --accent: #2456d6;
  --accent-text: #ffffff;
  --error: #b42318;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --card: #1a1d24;
    --text: #e8eaef;
    --muted: #a0a6b3;
    --line: #2b303a;
    --accent: #7aa2ff;
    --accent-text: #0b1020;
    --error: #ff8a80;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.top { padding: 16px; max-width: 880px; width: 100%; margin: 0 auto; }
.brand { font-weight: 700; letter-spacing: 0.01em; }
main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 8px 0 24px;
}
h1 { font-size: 1.35rem; margin: 0 0 8px; overflow-wrap: anywhere; }
p { margin: 8px 0; }
.meta, .item-meta, .small { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--error); }
.note { margin: 12px 0; padding: 8px 12px; border-left: 3px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
label { display: block; font-weight: 600; margin-top: 16px; }
input[type=password] {
  width: 100%;
  max-width: 420px;
  padding: 10px 12px;
  margin: 6px 0 12px;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
}
button {
  font: inherit;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.6; cursor: default; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.items { list-style: none; margin: 16px 0 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.item-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--line); flex: none; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--muted); }
.kind-photo::after { content: "IMG"; }
.kind-video::after { content: "VID"; }
.kind-audio::after { content: "AUD"; }
.kind-document::after { content: "DOC"; }
.kind-note::after { content: "TXT"; }
.item-status { margin: 4px 0 0; font-size: 0.9rem; }
.list-actions { margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
progress { width: 100%; max-width: 420px; height: 6px; }
.item-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.item-title { flex: 1; min-width: 0; margin: 0; }
.preview { margin-top: 12px; }
.preview-image, .preview-video { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; }
.preview-audio { width: 100%; }
.preview-text, .preview-markdown pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  max-height: 80vh;
  overflow: auto;
}
.preview-markdown { overflow-wrap: anywhere; }
.preview-markdown blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 4px 12px; color: var(--muted); }
.md-href { color: var(--muted); font-size: 0.85rem; }
.md-open { padding: 0 8px; font-size: 0.8rem; }
.preview-pdf { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pdf-page { max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin-top: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.foot { max-width: 880px; width: 100%; margin: 0 auto; padding: 16px; color: var(--muted); font-size: 0.9rem; }
.foot a { color: var(--accent); }
.about summary { cursor: pointer; }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  .item { flex-wrap: wrap; }
  .item-actions { width: 100%; justify-content: flex-start; }
}
