/* MMO8386-MANAGED-FILE-V1 | assets/css/theme.css */
:root{
  --ui-bg:#f5f6f8;
  --ui-surface:#ffffff;
  --ui-surface-2:#fafafa;
  --ui-border:#e7e7e7;
  --ui-border-soft:#eeeeee;
  --ui-text:#222222;
  --ui-muted:#7b7f86;
  --ui-input:#ffffff;
  --ui-shadow:rgba(0,0,0,.10);
}

html[data-theme="dark"]{
  --ui-bg:#111317;
  --ui-surface:#1a1d22;
  --ui-surface-2:#20242a;
  --ui-border:#30343b;
  --ui-border-soft:#292d33;
  --ui-text:#f1f3f5;
  --ui-muted:#a6adb7;
  --ui-input:#171a1f;
  --ui-shadow:rgba(0,0,0,.32);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .workspace,
html[data-theme="dark"] .workspace__main,
html[data-theme="dark"] .workspace__content{
  background:var(--ui-bg)!important;
  color:var(--ui-text)!important;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .welcome-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .panel-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .backup-card,
html[data-theme="dark"] .backup-empty,
html[data-theme="dark"] .accounts-card,
html[data-theme="dark"] .permissions-card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .dialog-card{
  background:var(--ui-surface)!important;
  color:var(--ui-text)!important;
  border-color:var(--ui-border)!important;
  box-shadow:0 14px 42px var(--ui-shadow);
}

html[data-theme="dark"] .topbar{
  border-bottom-color:var(--ui-border)!important;
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] .topbar__title span,
html[data-theme="dark"] .topbar__identity,
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .stat-card span,
html[data-theme="dark"] .stat-card small,
html[data-theme="dark"] .module-list__item span,
html[data-theme="dark"] .backup-card__info>span{
  color:var(--ui-muted)!important;
}

html[data-theme="dark"] .status-list>div,
html[data-theme="dark"] .module-list__item,
html[data-theme="dark"] table td,
html[data-theme="dark"] table th,
html[data-theme="dark"] .table-row{
  border-color:var(--ui-border-soft)!important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:var(--ui-input)!important;
  color:var(--ui-text)!important;
  border-color:var(--ui-border)!important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{
  color:#747b85!important;
}

html[data-theme="dark"] .topbar__menu,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .backup-delete{
  background:var(--ui-surface-2)!important;
  color:var(--ui-text)!important;
  border-color:var(--ui-border)!important;
}

html[data-theme="dark"] .module-pill{
  background:#2a2f36!important;
  color:#c5cad1!important;
}

html[data-theme="dark"] .module-pill--ready{
  background:#173b24!important;
  color:#82d99e!important;
}

html[data-theme="dark"] a{
  color:#9fc1ff;
}

.theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-width:76px;
  height:36px;
  margin-left:8px;
  padding:0 11px;
  border:1px solid #dddddd;
  border-radius:9px;
  background:#ffffff;
  color:#333333;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
}

.theme-toggle:hover{background:#f4f4f4}
.theme-toggle:disabled{opacity:.55;cursor:wait}

html[data-theme="dark"] .theme-toggle{
  background:#20242a;
  color:#f1f3f5;
  border-color:#343941;
}

html[data-theme="dark"] .theme-toggle:hover{
  background:#292e35;
}

@media(max-width:620px){
  .theme-toggle{
    min-width:38px;
    width:38px;
    padding:0;
  }
  .theme-toggle [data-theme-text]{display:none}
}


/* v0.8.1 — dark mode consistency fix.
   Keep light mode untouched. Target the real module containers, including
   generic section/card/table wrappers used by Accounts/Permissions/Backups. */
html[data-theme="dark"]{
  background:#111317;
}

html[data-theme="dark"] body,
html[data-theme="dark"] main,
html[data-theme="dark"] .page,
html[data-theme="dark"] .page-content,
html[data-theme="dark"] .content,
html[data-theme="dark"] .module-page{
  background:#111317!important;
  color:#f1f3f5!important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .accounts-panel,
html[data-theme="dark"] .accounts-form,
html[data-theme="dark"] .accounts-table,
html[data-theme="dark"] .permission-card,
html[data-theme="dark"] .backup-card,
html[data-theme="dark"] .backup-panel,
html[data-theme="dark"] .data-card,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .table-container{
  background:#1a1d22!important;
  color:#f1f3f5!important;
  border-color:#30343b!important;
}

html[data-theme="dark"] .card *,
html[data-theme="dark"] .panel *,
html[data-theme="dark"] .section-card *,
html[data-theme="dark"] .form-card *,
html[data-theme="dark"] .account-card *,
html[data-theme="dark"] .accounts-panel *,
html[data-theme="dark"] .accounts-form *,
html[data-theme="dark"] .accounts-table *,
html[data-theme="dark"] .table-wrap *,
html[data-theme="dark"] .table-container *{
  border-color:#30343b;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] label,
html[data-theme="dark"] legend,
html[data-theme="dark"] .title,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .section-title{
  color:#f1f3f5!important;
}

html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .description,
html[data-theme="dark"] .help,
html[data-theme="dark"] .hint{
  color:#a6adb7!important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:#171a1f!important;
  color:#f1f3f5!important;
  border-color:#3a3f47!important;
  color-scheme:dark;
}

html[data-theme="dark"] option{
  background:#171a1f;
  color:#f1f3f5;
}

html[data-theme="dark"] table,
html[data-theme="dark"] thead,
html[data-theme="dark"] tbody,
html[data-theme="dark"] tr,
html[data-theme="dark"] th,
html[data-theme="dark"] td{
  background:#1a1d22!important;
  color:#e8eaed!important;
  border-color:#30343b!important;
}

html[data-theme="dark"] thead th{
  background:#20242a!important;
  color:#c9ced6!important;
}

html[data-theme="dark"] tbody tr:hover td{
  background:#20242a!important;
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] button.btn-secondary,
html[data-theme="dark"] .reload-btn{
  background:#252a31!important;
  color:#f1f3f5!important;
  border-color:#383e47!important;
}

/* Do not invert primary/danger semantics. */
html[data-theme="dark"] .btn-primary{
  color:#fff!important;
}

/* v0.8.2 exact Accounts module dark selectors */
html[data-theme="dark"] .account-create-card{background:#1a1d22!important;color:#f1f3f5!important;border-color:#30343b!important;}
html[data-theme="dark"] .account-create-card .section-head h3,
html[data-theme="dark"] .account-create-card .mini-field label{color:#f1f3f5!important;}
html[data-theme="dark"] .account-create-card .muted{color:#a6adb7!important;}
html[data-theme="dark"] .account-create-card .mini-field input,
html[data-theme="dark"] .account-create-card .mini-field select{background:#171a1f!important;color:#f1f3f5!important;border-color:#3a3f47!important;}
html[data-theme="dark"] .account-table-wrap{background:#1a1d22!important;border-color:#30343b!important;}
html[data-theme="dark"] .account-table th{background:#20242a!important;color:#c9ced6!important;}
html[data-theme="dark"] .account-table td{background:#1a1d22!important;color:#e8eaed!important;border-bottom-color:#30343b!important;}
html[data-theme="dark"] .account-table .inline-input,
html[data-theme="dark"] .account-table .inline-select{background:#171a1f!important;color:#f1f3f5!important;border-color:#3a3f47!important;}

/* v0.8.3 — system-wide dark-mode finishing pass (visual only) */
html[data-theme="dark"] .backup-password-modal__dialog{
  background:var(--ui-surface)!important;
  color:var(--ui-text)!important;
  border:1px solid var(--ui-border)!important;
  box-shadow:0 22px 70px rgba(0,0,0,.55)!important;
}
html[data-theme="dark"] .backup-password-modal__dialog h2,
html[data-theme="dark"] .backup-password-modal__dialog label{color:var(--ui-text)!important;}
html[data-theme="dark"] .backup-password-modal__dialog .muted,
html[data-theme="dark"] .backup-password-modal__dialog .eyebrow{color:var(--ui-muted)!important;}
html[data-theme="dark"] .backup-password-modal__dialog input{
  background:var(--ui-input)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;
}
html[data-theme="dark"] .backup-password-modal__backdrop{background:rgba(0,0,0,.68)!important;}
html[data-theme="dark"] .backup-create-card,
html[data-theme="dark"] .backup-upload-card,
html[data-theme="dark"] .permission-table-wrap{
  background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;
}
html[data-theme="dark"] .backup-badge{background:#2a2f36!important;color:#c5cad1!important;}
html[data-theme="dark"] .backup-delete{background:var(--ui-surface-2)!important;color:#ff8e8e!important;border-color:#5b3538!important;}
html[data-theme="dark"] input[type="file"]{background:var(--ui-input)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;}
html[data-theme="dark"] input[type="file"]::file-selector-button{background:#2a2f36;color:#e7e9ec;border:1px solid #3b4149;border-radius:6px;padding:6px 10px;}


/* v0.8.5 — dark mode small badge/button consistency */
html[data-theme="dark"] .self-badge{
  background:#2a2f36!important;
  color:#cfd4dc!important;
  border:1px solid #3a4048!important;
}

html[data-theme="dark"] .account-table .btn-small,
html[data-theme="dark"] .account-table .revoke-sessions{
  background:#252a31!important;
  color:#f1f3f5!important;
  border-color:#383e47!important;
}
