/* Professional dark mode for Personal Library Management */
:root {
  color-scheme: light;
  --theme-transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plm-primary:#6ea8fe;
  --plm-success:#5dd39e;
  --plm-warning:#ffd166;
  --plm-danger:#ff7b7b;
  --plm-bg:#0f172a;
  --plm-card:#182235;
  --plm-border:#29364f;
  --plm-text:#e5edf8;
  --plm-muted:#a7b4c8;
  --pl-bg:#0f172a;
  --pl-surface:#182235;
  --pl-surface-2:#101827;
  --pl-text:#e5edf8;
  --pl-muted:#a7b4c8;
  --pl-border:#29364f;
  --bg-color:#0f172a;
  --white:#182235;
  --main-blue:#6ea8fe;
}
:root[data-theme="dark"] body {
  background: radial-gradient(circle at top right, rgba(110,168,254,.12), transparent 34rem), #0f172a !important;
  color:#e5edf8;
}
:root[data-theme="dark"] .main,
:root[data-theme="dark"] .admin-topbar,
:root[data-theme="dark"] .sidenav,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .form-card,
:root[data-theme="dark"] .feature-card,
:root[data-theme="dark"] .plm-card,
:root[data-theme="dark"] .work-card,
:root[data-theme="dark"] .file-card,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .disabled-feature,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .content,
:root[data-theme="dark"] .reader-panel {
  background:#182235 !important;
  color:#e5edf8 !important;
  border-color:#29364f !important;
  box-shadow:0 18px 42px rgba(0,0,0,.32) !important;
}
:root[data-theme="dark"] .sidenav a { color:#dce7f7 !important; }
:root[data-theme="dark"] .sidenav a:hover,
:root[data-theme="dark"] .sidenav a.active,
:root[data-theme="dark"] .sidenav a.selected { color:#fff !important; }
:root[data-theme="dark"] .admin-topbar a,
:root[data-theme="dark"] .btn.secondary,
:root[data-theme="dark"] .quick-rename-btn,
:root[data-theme="dark"] .admin-mobile-tabs,
:root[data-theme="dark"] .personal-note,
:root[data-theme="dark"] .version-list li,
:root[data-theme="dark"] .health-item,
:root[data-theme="dark"] .note-item,
:root[data-theme="dark"] .folder-link,
:root[data-theme="dark"] .result-item,
:root[data-theme="dark"] .smart-tags-box,
:root[data-theme="dark"] .merge-preview-box {
  background:#101827 !important;
  color:#e5edf8 !important;
  border-color:#29364f !important;
}
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .form-control {
  background:#0f172a !important;
  color:#f8fafc !important;
  border-color:#334155 !important;
  box-shadow:none !important;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color:#8493aa !important; }
:root[data-theme="dark"] label,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] strong { color:#f8fafc; }
:root[data-theme="dark"] table,
:root[data-theme="dark"] .plm-table { background:#182235 !important; color:#e5edf8 !important; }
:root[data-theme="dark"] th,
:root[data-theme="dark"] td,
:root[data-theme="dark"] .plm-table th,
:root[data-theme="dark"] .plm-table td { border-color:#29364f !important; }
:root[data-theme="dark"] .plm-table th,
:root[data-theme="dark"] table th { background:#101827 !important; color:#a7b4c8 !important; }
:root[data-theme="dark"] a { color:#8bbcff; }
:root[data-theme="dark"] .meta,
:root[data-theme="dark"] .help-text,
:root[data-theme="dark"] .page-subtitle,
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] small { color:#a7b4c8 !important; }
:root[data-theme="dark"] .personal-mode-badge { background:#102b20 !important; color:#9af2bd !important; border-color:#1d5c3d !important; }
:root[data-theme="dark"] .install-warning-link,
:root[data-theme="dark"] .plm-badge.warn { background:#3b2d11 !important; color:#ffd166 !important; border-color:#66501e !important; }
:root[data-theme="dark"] .success,
:root[data-theme="dark"] .alert-success,
:root[data-theme="dark"] .plm-badge.ok { background:#123524 !important; color:#a5f3c7 !important; }
:root[data-theme="dark"] .error,
:root[data-theme="dark"] .alert-error,
:root[data-theme="dark"] .plm-badge.danger { background:#401c1c !important; color:#ffb4b4 !important; }
:root[data-theme="dark"] .reader iframe,
:root[data-theme="dark"] #barcode-video,
:root[data-theme="dark"] #bulk-video { background:#050816 !important; border-color:#29364f !important; }
.theme-control { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.theme-select { min-height:38px !important; width:auto !important; margin:0 !important; padding:7px 10px !important; border-radius:999px !important; font-size:13px !important; }
.theme-toggle-btn { border:1px solid rgba(219,228,238,.9); background:#f8fafc; color:#243447; border-radius:999px; min-height:38px; padding:7px 11px; cursor:pointer; font-weight:800; }
:root[data-theme="dark"] .theme-toggle-btn { background:#101827; color:#e5edf8; border-color:#334155; }
.reader-soft-bg { background:#f3efe6 !important; }
:root[data-theme="dark"] .reader-soft-bg { background:#141923 !important; }
@media(max-width:900px){
  .theme-control { gap:4px; }
  .theme-select { max-width:112px; font-size:12px !important; padding:7px 8px !important; }
  .theme-toggle-btn { min-width:40px; padding:6px 9px; }
}
