/* Account and login theme control. */
.theme-toggle {
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:44px;padding:8px 12px;border:1px solid var(--line);
  border-radius:11px;background:var(--surface);color:var(--text);
  font:inherit;font-size:11px;font-weight:800;line-height:1.4;
  cursor:pointer;white-space:nowrap;transition:background .18s,border-color .18s
}
.theme-toggle:hover {background:var(--mehr-soft);border-color:var(--mehr)}
.theme-toggle .theme-icon {font-family:Arial,sans-serif;font-size:20px;line-height:1;min-width:20px;text-align:center}
.theme-toggle-public {position:fixed;z-index:35;top:calc(14px + env(safe-area-inset-top,0px));left:16px;box-shadow:0 6px 19px rgba(25,37,43,.09)}
.theme-toggle-menu {display:none}

/* LTR password text needs physical left padding because the button is on the left.
   Logical padding-inline-end targeted the right edge after direction:ltr. */
.auth-form .password-input-wrap input,
.install-grid .password-input-wrap input,
.password-change-form .password-input-wrap input {
  padding-left:90px;padding-right:42px;direction:ltr;text-align:left
}
.auth-form .password-input-wrap input {padding-right:16px}
.install-grid .password-input-wrap input {padding-right:13px}
.password-input-wrap .password-toggle {z-index:2;left:7px}
.install-grid .password-input-wrap input::placeholder,
.password-change-form .password-input-wrap input::placeholder {direction:rtl;text-align:right}

/* Dark mode is explicit: the initial visit stays in the light theme. */
html[data-theme="dark"] {
  color-scheme:dark;
  --mehr:#ee8b92;--mehr-dark:#f2a0a5;--mehr-soft:#3a262c;
  --ink:#f3f7f6;--text:#dae5e4;--muted:#a9b9bd;
  --line:#3a4c51;--surface:#1b2b30;--bg:#101b1f;
  --success:#8ce3ae;--danger:#ff9a9f;
  --shadow:0 18px 48px rgba(0,0,0,.25);
  background:var(--bg)
}
html[data-theme="dark"] body {background:var(--bg);color:var(--text)}
html[data-theme="dark"] ::selection {background:#693b44;color:#fff}
html[data-theme="dark"] :focus-visible {outline-color:#ffa3a9}

/* Navigation and controls. */
html[data-theme="dark"] .site-header {background:rgba(20,32,36,.97);border-color:var(--line);box-shadow:0 4px 20px rgba(0,0,0,.16)}
html[data-theme="dark"] .brand-logo-badge,
html[data-theme="dark"] .auth-logo-frame,
html[data-theme="dark"] .footer-logo-wrap,
html[data-theme="dark"] .brand-highlight-logo {background:#f9f8f4;border-color:#d9d5cf}
html[data-theme="dark"] .brand-mark {background:#ac3042;color:#fff}
html[data-theme="dark"] .brand-copy strong,
html[data-theme="dark"] .auth-masthead strong {color:var(--ink)}
html[data-theme="dark"] .brand-copy small,
html[data-theme="dark"] .auth-masthead small {color:var(--muted)}
html[data-theme="dark"] .desktop-primary-nav {background:#16252a;border-color:var(--line)}
html[data-theme="dark"] .desktop-primary-nav .nav-btn {color:var(--text)}
html[data-theme="dark"] .desktop-primary-nav .nav-btn.is-current,
html[data-theme="dark"] .desktop-primary-nav .nav-btn:hover {background:#304046;color:#ffc0c3;box-shadow:none}
html[data-theme="dark"] .nav-more-list,
html[data-theme="dark"] .mobile-nav-panel {background:#1b2b30;border-color:var(--line)}
html[data-theme="dark"] .nav-more-list a:hover {background:var(--mehr-soft)}
html[data-theme="dark"] .user-chip,
html[data-theme="dark"] .mobile-nav-user {background:#24363b;border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .user-chip em {border-color:var(--line)}
html[data-theme="dark"] .site-footer {background:var(--bg);border-color:var(--line)}
html[data-theme="dark"] .site-footer>div {color:var(--muted)}
html[data-theme="dark"] .mobile-menu-toggle,
html[data-theme="dark"] .mobile-nav-link,
html[data-theme="dark"] .theme-toggle {background:#24363b;border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .mobile-nav-link>span,
html[data-theme="dark"] .folder-create-disclosure>summary>span {background:#304247}
html[data-theme="dark"] .mobile-menu-toggle[aria-expanded="true"],
html[data-theme="dark"] .mobile-nav-link-primary,
html[data-theme="dark"] .mobile-nav-logout,
html[data-theme="dark"] .theme-toggle:hover {background:var(--mehr-soft);border-color:#87505a;color:#ffc0c3}
html[data-theme="dark"] .mobile-bottom-nav {background:rgba(22,35,39,.98);border-color:var(--line);box-shadow:0 -8px 22px rgba(0,0,0,.25)}
html[data-theme="dark"] .mobile-bottom-nav a,
html[data-theme="dark"] .mobile-bottom-nav button {color:var(--text)}
html[data-theme="dark"] .mobile-bottom-nav [aria-current="page"],
html[data-theme="dark"] .mobile-bottom-nav [aria-expanded="true"] {background:var(--mehr-soft);color:#ffb1b7}
html[data-theme="dark"] .nav-btn,
html[data-theme="dark"] .btn:not(.btn-primary):not(.btn-danger),
html[data-theme="dark"] .folder-action,
html[data-theme="dark"] .upload-received-shortcut {background:#2a3b40;border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .btn:not(.btn-primary):not(.btn-danger):hover,
html[data-theme="dark"] .folder-action:not(.primary):hover {background:#364a50;color:#fff}
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .folder-action.primary,
html[data-theme="dark"] .upload-primary-cta,
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .folder-action.primary:hover {background:#bf4250;color:#fff}
html[data-theme="dark"] .btn-danger {background:#4b292e;color:#ffadb1}
html[data-theme="dark"] .count-pill,
html[data-theme="dark"] .folder-type-label,
html[data-theme="dark"] .folder-choice-state {background:#304247;border-color:var(--line);color:var(--text)}

/* Forms and messages. */
html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input:not([type]),
html[data-theme="dark"] input[type=search],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .auth-form .input-wrap input,
html[data-theme="dark"] .auth-form .input-wrap input:focus {
  background:#162529;border-color:#4c6166;color:var(--ink)
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .auth-form .input-wrap input::placeholder {color:#a4b1b4;opacity:1}
html[data-theme="dark"] label,
html[data-theme="dark"] .auth-form label {color:var(--text)}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {border-color:#f09aa0;box-shadow:0 0 0 4px rgba(238,139,146,.17)}
html[data-theme="dark"] .password-toggle,
html[data-theme="dark"] .queue-file-remove {background:#304247;border-color:var(--line);color:var(--ink)}
html[data-theme="dark"] .password-toggle:hover,
html[data-theme="dark"] .queue-file-remove:hover {background:#40555b}
html[data-theme="dark"] .alert.ok,
html[data-theme="dark"] .upload-result.success,
html[data-theme="dark"] .phase-note-success {background:#173b32;border-color:#346550;color:#a4edbc}
html[data-theme="dark"] .alert.err,
html[data-theme="dark"] .upload-result.error,
html[data-theme="dark"] .progress-error {background:#44272d;border-color:#75414a;color:#ffb7bb}
html[data-theme="dark"] .upload-result.notice,
html[data-theme="dark"] .phase-note,
html[data-theme="dark"] .search-limit-note,
html[data-theme="dark"] .bulk-security-note {background:#3c3424;border-color:#68583b;color:#f1d693}

/* Entry and shared cards. */
html[data-theme="dark"] body.page-index {
  background:radial-gradient(circle at 13% 5%,#30262a 0,transparent 380px),
    radial-gradient(circle at 100% 100%,#1d3435 0,transparent 380px),var(--bg)
}
html[data-theme="dark"] .page-index .auth-shell:before {border-color:rgba(238,139,146,.14);box-shadow:0 0 0 38px rgba(238,139,146,.03),0 0 0 78px rgba(238,139,146,.016)}
html[data-theme="dark"] .page-index .auth-card,
html[data-theme="dark"] .auth-shell,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .password-change-card,
html[data-theme="dark"] .confirm-dialog,
html[data-theme="dark"] .large-download-dialog {background:var(--surface);border-color:var(--line);color:var(--text);box-shadow:var(--shadow)}
html[data-theme="dark"] .page-index .auth-shell {background:transparent;border:0;box-shadow:none}
html[data-theme="dark"] .auth-kicker span {box-shadow:0 0 0 4px #3a262c}
html[data-theme="dark"] .page-index .auth-card-head h1,
html[data-theme="dark"] .page-heading h1,
html[data-theme="dark"] .photo-upload-card .upload-intro h2,
html[data-theme="dark"] .card-title-row h2,
html[data-theme="dark"] .section-heading h1,
html[data-theme="dark"] .empty-state strong {color:var(--ink)}
html[data-theme="dark"] .page-index .auth-card-head p,
html[data-theme="dark"] .page-index .login-note,
html[data-theme="dark"] .photo-upload-card .upload-intro .mini-label {color:var(--muted)}
html[data-theme="dark"] .page-index .login-note {border-color:var(--line)}
html[data-theme="dark"] .account-box,
html[data-theme="dark"] .password-account-summary>div,
html[data-theme="dark"] .password-rules span,
html[data-theme="dark"] .empty-icon,
html[data-theme="dark"] .folder-icon,
html[data-theme="dark"] .icon-box,
html[data-theme="dark"] .step-badge,
html[data-theme="dark"] .metric-icon,
html[data-theme="dark"] .received-file-icon {background:#304247;border-color:var(--line);color:var(--text)}

/* Upload, folder selection, and photo gallery. */
html[data-theme="dark"] .page-upload_page .photo-upload-card,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .metric-card.metric-primary {background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .photo-upload-card .upload-step,
html[data-theme="dark"] .folder-choice-icon,
html[data-theme="dark"] .folder-choice-card.is-category .folder-choice-icon,
html[data-theme="dark"] .folder-row-icon {background:var(--mehr-soft);color:#ffb8bd}
html[data-theme="dark"] .upload-illustration {color:#b7cbce}
html[data-theme="dark"] .upload-illustration rect {fill:#304247}
html[data-theme="dark"] .photo-upload-card .dropzone,
html[data-theme="dark"] .quick-dropzone {background:radial-gradient(circle at 50% 25%,#24383c 0,#1c2c31 80%);border-color:#8a6567}
html[data-theme="dark"] .photo-upload-card .dropzone:hover,
html[data-theme="dark"] .photo-upload-card .dropzone.drag-active,
html[data-theme="dark"] .photo-upload-card .dropzone:focus-within,
html[data-theme="dark"] .quick-dropzone:hover {background:#304044;border-color:#ed9299}
html[data-theme="dark"] .photo-upload-card .dropzone strong,
html[data-theme="dark"] .queue-summary strong,
html[data-theme="dark"] .queue-file-name strong,
html[data-theme="dark"] .received-file-main strong,
html[data-theme="dark"] .folder-choice-copy strong,
html[data-theme="dark"] .photo-gallery-heading strong {color:var(--ink)}
html[data-theme="dark"] .photo-upload-card .dropzone>span:not(.upload-illustration):not(.upload-primary-cta),
html[data-theme="dark"] .path-trail,
html[data-theme="dark"] .back-link {color:var(--muted)}
html[data-theme="dark"] .upload-photo-tip {background:#21363b;border-color:#45616a;color:#d6e7e8}
html[data-theme="dark"] .photo-fields {background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .photo-fields-body {border-color:var(--line)}
html[data-theme="dark"] .photo-fields-body>.photo-fields-resume {background:#293f4b;color:#d3ebf1}
html[data-theme="dark"] .photo-fields-heading strong,html[data-theme="dark"] .photo-field {color:var(--text)}
html[data-theme="dark"] .photo-fields-icon,html[data-theme="dark"] .photo-fields-add,html[data-theme="dark"] .photo-info>summary {background:#423036;color:#ffd2c5}
html[data-theme="dark"] .photo-field input,html[data-theme="dark"] .photo-field textarea,html[data-theme="dark"] .photo-info-body {background:#203137;border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .photo-info-body b {color:var(--muted)}
html[data-theme="dark"] .upload-tip-icon {background:#31565e;color:#d5f2ef}
html[data-theme="dark"] .queue-summary,
html[data-theme="dark"] .queue-file,
html[data-theme="dark"] .overall-progress,
html[data-theme="dark"] .selected-files,
html[data-theme="dark"] .upload-progress {background:#203137;border-color:var(--line)}
html[data-theme="dark"] .queue-file.success {background:#1d3832;border-color:#37634e}
html[data-theme="dark"] .queue-file.failed {background:#3c2930;border-color:#75414a}
html[data-theme="dark"] .queue-file.duplicate {background:#373324;border-color:#68583b}
html[data-theme="dark"] .queue-file.resume {background:#243448;border-color:#4b7093}
html[data-theme="dark"] .resume-notice {background:#243448;border-color:#4b7093;color:#d0e7fa}
html[data-theme="dark"] .queue-file-status {background:#304247;color:var(--text)}
html[data-theme="dark"] .queue-progress-track,
html[data-theme="dark"] .progress-track,
html[data-theme="dark"] .storage-progress,
html[data-theme="dark"] .province-storage-bar {background:#43545a}
html[data-theme="dark"] .role-uploader.leaf-workspace .mobile-upload-action,
html[data-theme="dark"] .mobile-upload-action,
html[data-theme="dark"] .bulk-create-sticky {background:rgba(27,43,48,.98);border-color:var(--line);box-shadow:0 -9px 28px rgba(0,0,0,.28)}
html[data-theme="dark"] .folder-list-card>.card-title-row,
html[data-theme="dark"] .received-files-card>.card-title-row,
html[data-theme="dark"] .recent-activity-card>.card-title-row {background:#203137;border-color:var(--line)}
html[data-theme="dark"] .folder-list,
html[data-theme="dark"] .folder-choice-grid,
html[data-theme="dark"] .received-file-row,
html[data-theme="dark"] .folder-choice-card,
html[data-theme="dark"] .folder-choice-card.is-ready,
html[data-theme="dark"] .photo-gallery-card,
html[data-theme="dark"] .folder-create-disclosure {background:var(--surface);border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .folder-choice-card:hover,
html[data-theme="dark"] .folder-list-row:hover,
html[data-theme="dark"] .received-file-row:hover {background:#293d42;border-color:#745156}
html[data-theme="dark"] .photo-gallery-section,
html[data-theme="dark"] .received-empty,
html[data-theme="dark"] .photo-gallery-heading>span {background:#203137;border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .received-status,
html[data-theme="dark"] .account-state.is-active {background:#1d3832;color:#a4edbc}
html[data-theme="dark"] .folder-create-disclosure>summary,
html[data-theme="dark"] .folder-choice-card.is-category .folder-choice-state {color:var(--text)}

/* Management views, lists, and dialogs. */
html[data-theme="dark"] .admin-dashboard-heading {background:linear-gradient(125deg,#213b3f,#2d4b4b);border-color:#416063}
html[data-theme="dark"] .metric-copy strong,
html[data-theme="dark"] .recent-main strong,
html[data-theme="dark"] .folder-row-title strong,
html[data-theme="dark"] .folder-row-stat,
html[data-theme="dark"] .folder-row-activity strong,
html[data-theme="dark"] .search-result-name strong,
html[data-theme="dark"] .search-result-path strong,
html[data-theme="dark"] .search-result-date strong,
html[data-theme="dark"] .folder-info strong {color:var(--ink)}
html[data-theme="dark"] .metric-primary .metric-copy strong {color:#ffb2b9}
html[data-theme="dark"] .metric-copy em {color:var(--muted)}
html[data-theme="dark"] .new-files-hero,
html[data-theme="dark"] .new-badge {background:#ac3042;color:#fff}
html[data-theme="dark"] .new-files-hero.all-seen {background:#1d3832;border-color:#37634e;color:#a4edbc}
html[data-theme="dark"] .province-filter-toolbar,
html[data-theme="dark"] .folder-list-head,
html[data-theme="dark"] .search-results-head,
html[data-theme="dark"] .local-file-filter,
html[data-theme="dark"] .batch-toolbar,
html[data-theme="dark"] .bulk-select-toolbar,
html[data-theme="dark"] th,
html[data-theme="dark"] .search-result-path,
html[data-theme="dark"] .search-result-type,
html[data-theme="dark"] .search-result-size,
html[data-theme="dark"] .search-result-date,
html[data-theme="dark"] .folder-row-stat,
html[data-theme="dark"] .folder-row-date,
html[data-theme="dark"] .dashboard-folder-list .folder-row-new,
html[data-theme="dark"] .dashboard-folder-list .folder-row-activity,
html[data-theme="dark"] .bulk-auto-value,
html[data-theme="dark"] .account-folder {background:#24363b;border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .folder-list-row-link:hover,
html[data-theme="dark"] .dashboard-folder-list .folder-list-row.has-new-files,
html[data-theme="dark"] .recent-activity-item:hover,
html[data-theme="dark"] .search-result-row:hover,
html[data-theme="dark"] .province-storage-row:hover,
html[data-theme="dark"] tr.row-selected td {background:#2e373b}
html[data-theme="dark"] .folder-row-date,
html[data-theme="dark"] .recent-count,
html[data-theme="dark"] .search-result-type,
html[data-theme="dark"] .search-result-size,
html[data-theme="dark"] .search-results-head,
html[data-theme="dark"] .folder-list-head {color:var(--muted)}
html[data-theme="dark"] .search-file-icon,
html[data-theme="dark"] .recent-folder-icon,
html[data-theme="dark"] .file-badge,
html[data-theme="dark"] .province-search-wrap button,
html[data-theme="dark"] .search-clear,
html[data-theme="dark"] .local-file-filter button {background:#304247;color:var(--text)}
html[data-theme="dark"] .folder-action.primary,
html[data-theme="dark"] .province-filter-chip.active {background:#ac3042;border-color:#ac3042;color:#fff}
html[data-theme="dark"] .province-filter-chip,
html[data-theme="dark"] .folder-card,
html[data-theme="dark"] .bulk-folder-account-row,
html[data-theme="dark"] .password-mini-form,
html[data-theme="dark"] .account-edit-form {background:var(--surface);border-color:var(--line);color:var(--text)}
html[data-theme="dark"] .bulk-folder-account-row:hover:not(.is-disabled),
html[data-theme="dark"] .bulk-folder-account-row:has(.bulk-folder-checkbox:checked) {background:#304046}
html[data-theme="dark"] .account-state.is-off,
html[data-theme="dark"] .account-exists {background:#304247;color:var(--text)}
html[data-theme="dark"] .quick-tip-item {background:#24363b;border-color:var(--line)}
html[data-theme="dark"] .quick-tip-item strong,
html[data-theme="dark"] .brand-highlight-copy h2,
html[data-theme="dark"] .folder-stage-copy h2,
html[data-theme="dark"] .bulk-users-note strong {color:var(--ink)}
html[data-theme="dark"] .account-ready {background:#1d3832;color:#a4edbc}
html[data-theme="dark"] .account-conflict {background:#44272d;color:#ffb7bb}
html[data-theme="dark"] .table-wrap:has(.local-file-row) .local-file-row {background:var(--surface);border-color:var(--line)}
html[data-theme="dark"] .table-wrap:has(.local-file-row) .mobile-file-meta {background:#24363b!important;color:var(--text)}
html[data-theme="dark"] .large-download-status,
html[data-theme="dark"] .search-result-summary {color:var(--text)}

@media(max-width:720px) {
  .theme-toggle-public {left:14px;top:calc(12px + env(safe-area-inset-top,0px));width:44px;padding:0}
  .theme-toggle-public .theme-label {display:none}
  .theme-toggle-header {display:none}
  .theme-toggle-menu {display:flex;width:100%;min-height:47px;justify-content:flex-start;text-align:right;padding:9px 10px;font-size:10px}
  .theme-toggle-menu .theme-icon {width:28px;height:28px;display:grid;place-items:center;border-radius:8px;background:#f4f4f5;font-size:18px;flex:0 0 auto}
  html[data-theme="dark"] .theme-toggle-menu .theme-icon {background:#304247}
}
@media(min-width:721px) and (max-width:1020px) {
  .theme-toggle-header {width:44px;padding:0}
  .theme-toggle-header .theme-label {display:none}
}
@media(max-width:370px) {
  .page-index .public-container {padding-top:72px}
}
