/* ClipeDeVis — dark mode of the public site (body.is-home / .is-party) and the admin (.admin-body).
   <html data-theme="dark"> is set by the small script in views/partials/head.php before anything is drawn;
   the header / sidebar button is js/color-mode.js. Loaded with media="screen": printing is always light.
   Guest album pages never get data-theme: they keep the theme their owner chose.
   Mostly token overrides; rules below them only fix colours that are not tokens in app.css / admin.css.
   Text keeps ≥4.5:1 on the surface it sits on. */

html[data-theme="dark"] { color-scheme: dark; background: #151517; }

/* ============ public site ============ */
html[data-theme="dark"] .is-home, html[data-theme="dark"] .is-party {
  --a-canvas: #151517;
  --a-card: #1D1D20;
  --a-on-ink: #151517;
  --a-primary-soft: #3A1628;
  --a-primary-line: #7D2F52;
  --a-ink: #F3F3F4;
  --a-ink-hover: #FFFFFF;
  --a-body: #D6D6DA;
  --a-muted: #A5A5AD;
  --a-placeholder: #93939C;
  --a-hairline: #3A3A40;
  --a-hairline-soft: #2C2C31;
  --a-border-strong: #66666F;
  --a-surface-soft: #1B1B1E;
  --a-surface-strong: #2B2B30;
  --a-success: #5FD3A2;
  --a-success-soft: #12352A;
  --a-danger: #FF8F7A;
  --a-shadow: rgba(255, 255, 255, .05) 0 0 0 1px, rgba(0, 0, 0, .5) 0 6px 20px 0;
  --a-switch-on: #D81B67;
  --brand: #FF85B3; --brand-dark: #FFA6C9;
  --white: var(--a-card); --danger: var(--a-danger); --success: var(--a-success);
}
html[data-theme="dark"] .is-home ::selection, html[data-theme="dark"] .is-party ::selection { background: #7D2F52; color: #fff; }
html[data-theme="dark"] .site-header.scrolled { box-shadow: rgba(0, 0, 0, .5) 0 1px 12px; }
@media (max-width: 1020px) { html[data-theme="dark"] .nav { background: var(--a-card); } }
html[data-theme="dark"] .plans-include li:not(:first-child)::before, html[data-theme="dark"] .plan li::before { filter: invert(1); }

/* product mockups on the homepage are real objects (paper card, phone, TV): only their backdrop goes dark */
html[data-theme="dark"] .a-stage { background: #26262A; }
html[data-theme="dark"] .a-stage-table { background: #2C2722; }
html[data-theme="dark"] .a-stage-phone { background: #2E2027; }
html[data-theme="dark"] .a-stage-tv { background: #25232D; }
html[data-theme="dark"] .a-stage > * {
  --a-ink: #222222; --a-body: #3F3F3F; --a-muted: #6A6A6A; --a-hairline-soft: #EBEBEB; --a-surface-strong: #F2F2F2;
  --a-success: #0B7A52; --a-success-soft: #E8F6EF; --a-shadow: rgba(0, 0, 0, .45) 0 8px 24px; color: #222222; }

html[data-theme="dark"] .m-phone { box-shadow: 0 0 0 6px #4A4A51, var(--a-shadow); }
html[data-theme="dark"] .m-tv-screen { box-shadow: 0 0 0 6px #4A4A51, var(--a-shadow); }
html[data-theme="dark"] .m-tv-stand { background: #4A4A51; }
html[data-theme="dark"] .cookie-ghost:hover { background: var(--a-surface-strong); }

/* QR codes stay black on white, otherwise phones can't read them */
html[data-theme="dark"] .qr-box img { background: #fff; }
html[data-theme="dark"] .prose mark { color: #222; }
html[data-theme="dark"] .theme-opt { background: var(--a-card, var(--white)); }
html[data-theme="dark"] .theme-opt .preview-link, html[data-theme="dark"] .is-party main .theme-opt a.preview-link:not(.btn):not(.p-btn):not(.a-btn):not(.acc-order):not(.seg-btn) { background: rgba(255, 255, 255, .92); color: #222; }
html[data-theme="dark"] .theme-opt .preview-link:hover { background: #fff; color: #000; }
html[data-theme="dark"] .fake-card input[disabled] { background: var(--a-card); }
html[data-theme="dark"] .acc-settings fieldset:disabled input, html[data-theme="dark"] .acc-settings fieldset:disabled select { background: var(--a-surface-soft); color: var(--a-muted); }
html[data-theme="dark"] .acc-flags .flag:not(.on):not(.off) { background: var(--a-surface-strong); color: var(--a-body); }
html[data-theme="dark"] .acc-flags .flag.off { background: #3D1A18; color: #FFB3A8; }
html[data-theme="dark"] .acc-nav a:hover { color: var(--a-ink); }
html[data-theme="dark"] .overflow-card h3 { color: #FFD479; }
html[data-theme="dark"] .footer-badges img { opacity: .9; }

/* ============ shared: alerts, badges, tables, logs ============ */
html[data-theme="dark"] .alert-success { background: #12352A; border-color: #23614C; color: #A9EBCF; }
html[data-theme="dark"] .alert-error { background: #3D181D; border-color: #77303A; color: #FFC2C8; }
html[data-theme="dark"] .alert-warn { background: #372B0C; border-color: #6E5717; color: #FBE3A1; }
html[data-theme="dark"] .alert a, html[data-theme="dark"] .is-party main .alert a:not(.btn):not(.p-btn):not(.a-btn):not(.acc-order):not(.seg-btn) { color: inherit; text-decoration: underline; }
html[data-theme="dark"] .badge { background: #2F2F36; color: #C3C3CB; }
html[data-theme="dark"] .badge-active, html[data-theme="dark"] .badge-paid-pay { background: #12352A; color: #7FE3B8; }
html[data-theme="dark"] .badge-pending, html[data-theme="dark"] .badge-suspended, html[data-theme="dark"] .badge-unpaid { background: #372B0C; color: #F7D77F; }
html[data-theme="dark"] .badge-scheduled { background: #2C2050; color: #CBB5FF; }
html[data-theme="dark"] .badge-paid, html[data-theme="dark"] .badge-processing { background: #3D181D; color: #FFA9B2; }
html[data-theme="dark"] .badge-expired, html[data-theme="dark"] .badge-cancelled, html[data-theme="dark"] .badge-refunded { background: #2F2F36; color: #B4B4BD; }
html[data-theme="dark"] .badge-test { background: #FFB400; color: #000; }
html[data-theme="dark"] .table th { background: var(--light); }
html[data-theme="dark"] .table tr:hover td { background: var(--light); }
html[data-theme="dark"] .timeline .ev-error .msg { color: #FFA9B2; }
html[data-theme="dark"] .dbx-bar { background: #12352A; }
html[data-theme="dark"] .dbx-legend i.f { background: #12352A; }

/* ============ admin ============ */
html[data-theme="dark"] .admin-body {
  --brand: #FF85B3;
  --brand-dark: #FFA6C9;
  --brand-soft: #3A1628;
  --accent: #FF5C9E;
  --ink: #F3F3F4;
  --ink-2: #FFFFFF;
  --muted: #A5A5AD;
  --line: #3A3A40;
  --light: #26262A;
  --white: #1D1D20;
  --danger: #FF8A97;
  --success: #7FE3B8;
  --warn-text: #F7D77F;
  --footer: #0E0E10;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 18px 40px -30px rgba(0, 0, 0, .8);
  background: #151517;
}
html[data-theme="dark"]:has(.admin-body) { background: #151517; }
html[data-theme="dark"] .admin-body .btn { background: #F3F3F4; color: #222; }
html[data-theme="dark"] .admin-body .btn:hover, html[data-theme="dark"] .admin-body .btn:focus-visible { background: #fff; color: #222; }
html[data-theme="dark"] .admin-body .btn-brand { background: #D81B67; color: #fff; }
html[data-theme="dark"] .admin-body .btn-brand:hover, html[data-theme="dark"] .admin-body .btn-brand:focus-visible { background: #B8135A; color: #fff; }
html[data-theme="dark"] .admin-side nav a:not(.active) .pill, html[data-theme="dark"] .admin-toggle .pill { background: #D81B67; color: #fff; }
html[data-theme="dark"] .admin-body .btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px #66666F; }
html[data-theme="dark"] .admin-body .btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
html[data-theme="dark"] .admin-body .btn-danger, html[data-theme="dark"] .admin-body .btn-danger:hover { background: #C13515; color: #fff; }
html[data-theme="dark"] .admin-body .table th { background: #26262A; }
html[data-theme="dark"] .admin-body .table tr:hover td { background: #232327; }
html[data-theme="dark"] .admin-body input[type=text], html[data-theme="dark"] .admin-body input[type=email], html[data-theme="dark"] .admin-body input[type=tel], html[data-theme="dark"] .admin-body input[type=password],
html[data-theme="dark"] .admin-body input[type=number], html[data-theme="dark"] .admin-body input[type=datetime-local], html[data-theme="dark"] .admin-body input[type=url], html[data-theme="dark"] .admin-body input[type=date],
html[data-theme="dark"] .admin-body select, html[data-theme="dark"] .admin-body textarea { background: #151517; border-color: #55555D; color: var(--ink); }
html[data-theme="dark"] .admin-body input:focus, html[data-theme="dark"] .admin-body select:focus, html[data-theme="dark"] .admin-body textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px #4A1C38; }
html[data-theme="dark"] .admin-body .alert-info { background: #2B2B30; border-color: #4A4A51; color: #D6D6DA; }
html[data-theme="dark"] .admin-body .pin-display { color: #FF8AB6; }
html[data-theme="dark"] .admin-body code.ph:hover { color: #222; }
html[data-theme="dark"] .admin-main .pill { color: #222; }
html[data-theme="dark"] .admin-main .center > img[alt="QR"] { padding: 8px; background: #fff; border-radius: 10px; }
@media (max-width: 720px) {
  html[data-theme="dark"] .table-cards tr { background: var(--white); }
  html[data-theme="dark"] .admin-body .table-cards tr:hover td { background: none; }
}
/* the admin login is a dark page already: its white card stays, in both modes */
html[data-theme="dark"] .adm-card { --ink: #222222; --line: #DDDDDD; --white: #fff; color-scheme: light; }
html[data-theme="dark"] .adm-card input[type=text], html[data-theme="dark"] .adm-card input[type=password] { background: #fff !important; border-color: #B0B0B0 !important; color: #222222 !important; }
html[data-theme="dark"] .adm-card .alert-error { background: #FDECEE; border-color: #F5B5BD; color: #8A1422; }
