/* First-paint complete themes — applied as soon as data-dp-theme is set (boot script).
   Independent light/dark surfaces, not a white base with a dark overlay. */
html[data-dp-initializing] *,
html[data-dp-initializing] *::before,
html[data-dp-initializing] *::after{
  transition:none!important;
  animation-play-state:paused!important;
}
html[data-dp-theme="light"],
html[data-dp-theme="light"] body{
  color-scheme:light;
  background:#fcfcfd!important;
  color:#0f172a!important;
}
html[data-dp-theme="dark"],
html[data-dp-theme="dark"] body{
  color-scheme:dark;
  background:#07111f!important;
  color:#e5f0ff!important;
}

/* Shared public theme for digitalisierungsplanung.de product domains.
   Domain pages keep their layout; this file owns the common dark paint + toggle chrome. */

html[data-dp-theme="dark"],
html[data-dp-theme="dark"] body{
  color-scheme:dark;
  --bg:#07111f!important;
  --paper:#0b1729!important;
  --soft:#0b1b2a!important;
  --line:#1f3b5c!important;
  --line2:#275078!important;
  --text:#e5f0ff!important;
  --muted:#9fb6cc!important;
  --dim:#8eb2dc!important;
  --navy:#38bdf8!important;
  --navy2:#7dd3fc!important;
  --green:#34d399!important;
  --red:#fb7185!important;
}

html[data-dp-theme="dark"] body{
  background:var(--bg)!important;
  color:var(--text)!important;
}

html[data-dp-theme="dark"] .site-header{
  background:rgba(5,11,20,.96)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
}
html[data-dp-theme="dark"] :is(.site-footer,footer){
  background:#050b14!important;
  border-color:var(--line)!important;
  color:var(--dim)!important;
}
html[data-dp-theme="dark"] :is(.hero-section,.hero,.article-feed,.section,.category,.catalog-section,.content){
  border-color:var(--line)!important;
}
html[data-dp-theme="dark"] :is(.hero-section,.hero,.article-feed){background:var(--paper)!important}
html[data-dp-theme="dark"] :is(.soft,.final-section){background:var(--soft)!important}

html[data-dp-theme="dark"] :is(
  .pillar,.step,.card,.plan,.faq article,.registry-card,.package-card,.admin-card,.admin-row,.state-message,
  .hero-note,.newsletter,.note,.detail-dialog,.detail-dialog article,.preset-item,.fast-read,
  .system-box,.newsletter-compact,.share-tools,.data-card,.legal-card,.checkout-status,
  .notice,.session-cta,.agent-keys,.phone-verify,.status-card,.license
){
  background:var(--paper)!important;
  border-color:var(--line)!important;
  color:var(--text)!important;
  box-shadow:none!important;
}

/* Aktuell endless list must stay a clean list in dark mode — never kachel/tile cards. */
html[data-dp-theme="dark"] .home-feed-item{
  background:transparent!important;
  border:0!important;
  border-bottom:1px solid var(--line)!important;
  border-radius:0!important;
  box-shadow:none!important;
  color:var(--text)!important;
}
html[data-dp-theme="dark"] .home-feed-item:last-child{border-bottom:0!important}
html[data-dp-theme="dark"] .home-feed-list{background:transparent!important}
html[data-dp-theme="dark"] :is(.registry-head,.pipeline span,.chip,.preset-item,.fast-read,.newsletter-compact){
  background:var(--soft)!important;
  border-color:var(--line)!important;
}
html[data-dp-theme="dark"] :is(.note,.newsletter){
  background:#0b2537!important;
  border-color:#275078!important;
}

html[data-dp-theme="dark"] :is(h1,h2,h3,h4,strong,b,label,legend,.brand,.brand-link,.section-title){color:var(--text)!important}
html[data-dp-theme="dark"] :is(p,.hero-subline,.lead,.dek,.hint,.muted,.meta,.header-claim,.footer,.footer-row,.detail-description,.consent,.form-status){color:var(--muted)!important}
html[data-dp-theme="dark"] :is(.nav-link,.footer a,.footer-links a,.article-back a,.topic-nav a){color:var(--muted)!important}
html[data-dp-theme="dark"] :is(.nav-link:hover,.nav-link.active,.footer a:hover,.footer-links a:hover,.topic-nav a:hover){color:var(--text)!important}

html[data-dp-theme="dark"] :is(input,select,textarea){
  background:#06111f!important;
  border-color:var(--line2)!important;
  color:var(--text)!important;
  caret-color:var(--navy)!important;
}
html[data-dp-theme="dark"] :is(input,textarea)::placeholder{color:var(--dim)!important;opacity:.82!important}
html[data-dp-theme="dark"] :is(.btn-secondary,.btn-ghost,.share-actions a,.share-actions button,.admin-audio-bar button,.admin-audio-actions button){
  background:#0b1729!important;
  border-color:var(--line2)!important;
  color:var(--text)!important;
}
html[data-dp-theme="dark"] :is(.btn-secondary,.btn-ghost,.share-actions a,.share-actions button):hover{
  background:#0b2537!important;
  border-color:var(--navy)!important;
  color:var(--navy2)!important;
}

html[data-dp-theme="dark"] button.link-muted,
html[data-dp-theme="dark"] .link-muted{
  background:transparent!important;
  border:0!important;
  color:var(--dim)!important;
  box-shadow:none!important;
}
html[data-dp-theme="dark"] button.link-muted:hover,
html[data-dp-theme="dark"] .link-muted:hover{
  background:transparent!important;
  border:0!important;
  color:var(--muted)!important;
}

html[data-dp-theme="dark"] :is(.btn-primary,.button,.signup-row button,.admin-audio-actions button.primary){
  border-color:#38bdf8!important;
  background:#38bdf8!important;
  color:#03111d!important;
}
html[data-dp-theme="dark"] :is(.btn-primary,.button,.signup-row button,.admin-audio-actions button.primary):hover{
  background:#7dd3fc!important;
  border-color:#7dd3fc!important;
  color:#03111d!important;
}

html[data-dp-theme="dark"] .detail-dialog::backdrop{background:rgba(2,6,23,.76)!important}
html[data-dp-theme="dark"] .toast{background:#e5f0ff!important;color:#07111f!important}
html[data-dp-theme="dark"] .package-icon{background:#0b2537!important;border-color:#275078!important;color:#7dd3fc!important}
html[data-dp-theme="dark"] .count{color:#5f8dbc!important}

html[data-dp-theme="dark"] .success-note{
  background:#0b2537!important;
  border-color:#047857!important;
  color:#6ee7b7!important;
}
html[data-dp-theme="dark"] .status-card{
  background:#0b2537!important;
  border-color:#047857!important;
}
html[data-dp-theme="dark"] .status-card.warning{
  background:#2a2110!important;
  border-color:#a16207!important;
}
html[data-dp-theme="dark"] .phone-verify-status{
  background:var(--paper)!important;
  border-color:#047857!important;
  color:#6ee7b7!important;
}
html[data-dp-theme="dark"] .phone-verify-status.is-pending{
  border-color:var(--line2)!important;
  color:var(--muted)!important;
}
html[data-dp-theme="dark"] .checkout-status.success{
  background:#0b2537!important;
  border-color:#047857!important;
  color:#6ee7b7!important;
}
html[data-dp-theme="dark"] .checkout-status.error{
  background:#2a1219!important;
  border-color:#9f1239!important;
  color:#fda4af!important;
}
html[data-dp-theme="dark"] .plan.recommended{border-color:var(--navy)!important}
html[data-dp-theme="dark"] .recommended .badge{
  background:var(--navy)!important;
  border-color:var(--navy)!important;
  color:#03111d!important;
}
html[data-dp-theme="dark"] .badge{
  background:var(--soft)!important;
  border-color:var(--line2)!important;
  color:var(--text)!important;
}

html[data-dp-theme="dark"] .step-num{color:#7dd3fc!important}

/* Keep native audio controls readable in dark mode when revealed. */
html[data-dp-theme="dark"] :is(.fast-read-audio-wrap,.article-audio-wrap){
  background:transparent!important;
  color:var(--text)!important;
}
html[data-dp-theme="dark"] :is(.fast-read-audio,.article-audio){
  color-scheme:dark;
  width:100%;
  max-width:760px;
}

/* Product mark is invariant: same dark-blue identity in both themes. */
.brand::before,.brand-link .brand-mark rect{transition:none!important}
.brand::before{background:linear-gradient(135deg,#1e3a8a,#172554)!important;box-shadow:inset 0 0 0 2px #0f172a!important}

/* Theme control — styles live here (not inline) so CSP sites can load them. */
.dp-theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 34px;
  width:34px;
  height:34px;
  min-width:34px;
  min-height:34px;
  padding:0;
  border:1px solid var(--line,#cbd5e1);
  border-radius:8px;
  background:var(--paper,#fff);
  color:var(--text,#0f172a);
  cursor:pointer;
  box-shadow:none;
  font:inherit;
  line-height:1;
  transition:border-color .16s ease,background-color .16s ease,color .16s ease,transform .12s ease;
}
.dp-theme-toggle:hover,
.dp-theme-toggle:focus-visible{
  border-color:var(--navy,var(--accent,#1e3a8a));
  outline:0;
}
.dp-theme-toggle:active{transform:translateY(1px) scale(.97)}
.dp-theme-toggle::before{
  content:"";
  display:block;
  width:16px;
  height:16px;
  background:currentColor;
  mask:center/16px 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20.7 15.1A8.5 8.5 0 0 1 8.9 3.3a.75.75 0 0 0-.9-.9A10 10 0 1 0 21.6 16a.75.75 0 0 0-.9-.9A8.5 8.5 0 0 1 20.7 15.1Z'/%3E%3C/svg%3E");
  -webkit-mask:center/16px 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M20.7 15.1A8.5 8.5 0 0 1 8.9 3.3a.75.75 0 0 0-.9-.9A10 10 0 1 0 21.6 16a.75.75 0 0 0-.9-.9A8.5 8.5 0 0 1 20.7 15.1Z'/%3E%3C/svg%3E");
}
html[data-dp-theme="dark"] .dp-theme-toggle::before{
  mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.66 6.34l1.41-1.41'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.66 6.34l1.41-1.41'/%3E%3C/g%3E%3C/svg%3E");
}
.dp-theme-toggle-fallback{position:fixed;top:12px;right:12px;z-index:2147483000}

/* Theme control occupies the same header-action slot on every public domain. */
.site-header .dp-theme-toggle,
.account-nav .dp-theme-toggle,
.header-actions .dp-theme-toggle,
[data-dp-theme-mount] .dp-theme-toggle{
  margin-left:auto;
}
.account-nav .dp-theme-toggle,
.header-actions .dp-theme-toggle,
[data-dp-theme-mount].header-actions .dp-theme-toggle,
.account-nav > .dp-theme-toggle{
  margin-left:0;
}
.header-actions{
  display:inline-flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  margin-left:auto;
  flex:0 0 auto;
}
html[data-dp-theme="dark"] .dp-theme-toggle{
  background:#0b1729!important;
  border-color:#275078!important;
  color:#e5f0ff!important;
}
html[data-dp-theme="dark"] .dp-theme-toggle:hover,
html[data-dp-theme="dark"] .dp-theme-toggle:focus-visible{
  background:#0b2537!important;
  border-color:#38bdf8!important;
  color:#7dd3fc!important;
}

/* Shared public chrome: desktop nav always visible; collapse only on real mobile. */
.site-header .nav-menu{
  display:flex;
  align-items:center;
  gap:22px;
  list-style:none;
  margin:0;
  padding:0;
}
.site-header .account-nav{
  display:grid;
  grid-template-columns:250px 140px 82px 34px;
  align-items:center;
  justify-content:end;
  gap:10px;
  width:536px;
  min-width:536px;
  flex:0 0 536px;
}
.site-header .account-nav .account-identity,
.site-header .account-nav [data-account-identity]{
  display:block;
  width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.site-header .account-nav [data-account-identity]{grid-column:1}
.site-header .account-nav [data-account-primary],
.site-header .account-nav .header-primary{grid-column:2}
.site-header .account-nav [data-account-logout]{grid-column:3}
.site-header .account-nav .dp-theme-toggle{grid-column:4}
.site-header .account-nav > *{grid-row:1}
.site-header .account-nav[data-account-state="pending"] > :not(.dp-theme-toggle){visibility:hidden}
@media(max-width:720px){
  .site-header .nav-menu{display:none}
  .site-header .account-nav{
    gap:6px;
    width:auto;
    flex:1;
    min-width:0;
    grid-template-columns:minmax(0,1fr) 0 74px 34px;
  }
  .site-header .account-nav .account-identity,
  .site-header .account-nav [data-account-identity]{
    min-width:0;
    text-align:right;
    font-size:.78rem;
    line-height:1.2;
  }
  .site-header .header-primary,
  .site-header .account-nav [data-account-primary]{display:none}
}

@media(max-width:920px){
  .site-header .nav,
  .site-header .header-row,
  .site-header > .container{
    position:relative;
  }
  .site-header .nav > .dp-theme-toggle,
  .site-header .header-row > .dp-theme-toggle,
  .site-header > .container > .dp-theme-toggle,
  .site-header .header-actions{
    position:absolute;
    top:10px;
    right:0;
    margin:0;
  }
}
