html{color-scheme:light}
.theme159-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:14px 0}
.theme159-options button{display:grid;gap:8px;align-content:start;padding:8px!important;font-size:12px!important;line-height:1.3;min-width:0;text-align:center}
.theme159-options button[aria-pressed=true]{outline:2px solid #238574;outline-offset:1px;font-weight:700}
.theme159-sample{display:grid;gap:5px;padding:9px;border:1px solid #aac5bb;border-radius:6px;height:64px;background:#f4f6f8!important}
.theme159-sample i{display:block;height:7px;border-radius:3px;background:#c4d5ce!important}.theme159-sample i:last-child{background:#197b6a!important;width:65%}
.theme159-dark{background:#14221d!important}.theme159-dark i{background:#426056!important}.theme159-system{background:linear-gradient(90deg,#f4f6f8 50%,#14221d 50%)!important}
@media screen{
html[data-theme159=dark]{--bg:#111e19;--panel:#1c2c27;--text:#dbe7e3;--muted:#afc1b9;--line:#425951;--accent:#238574;--accent-soft:#243d35;--danger:#f0a59b;color-scheme:dark;background:#111e19}
html[data-theme159=dark] body{background:#111e19;color:#dbe7e3}
html[data-theme159=dark] dialog{background:#1c2c27;color:#dbe7e3}
html[data-theme159=dark] :is(input,textarea,select){background-color:#15271f;color:#e2eee8;border-color:#425951}
html[data-theme159=dark] :is(input,textarea)::placeholder{color:#a1b7ac;opacity:1}
/* Documents and CAD artwork retain their original light palette. No image filters. */
html[data-theme159] .preview-sheet{color-scheme:light;--bg:#f4f6f8;--panel:#fff;--text:#1c252b;--muted:#73818a;--line:#e5e9ec;--accent:#1f7a6d;--accent-soft:#eaf5f2;--danger:#b34a4a;background:white;color:#1c252b}
}

/* Home shortcut: one row alongside the existing version and HOTO controls. */
.theme159-home{display:grid;place-items:center;width:38px;height:38px;min-width:38px;min-height:38px;padding:0!important;margin:0;border:1px solid #bfd6cf;border-radius:12px;background:#edf6f3;color:#286e62;cursor:pointer}
.theme159-home:focus-visible{outline:2px solid #238574;outline-offset:2px}
.theme159-dialog{box-sizing:border-box;width:min(360px,calc(100vw - 24px));max-width:360px;margin:auto;padding:18px;border:1px solid #bfd6cf;border-radius:18px;background:#fff;color:#243c35}
.theme159-dialog::backdrop{background:rgb(12 30 24 / 35%)}
.theme159-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px}
.theme159-dialog header button{width:36px;height:36px;min-height:36px;padding:0;background:transparent;color:inherit;border:1px solid #bfd6cf;border-radius:10px;font-size:24px}
.theme159-dialog small{font-size:12px;color:inherit;opacity:.8}
.theme159-dialog .theme159-options button{color:inherit;border:1px solid #bfd6cf;border-radius:10px;background:transparent}
html[data-theme159=dark] .theme159-home,html[data-theme159=dark] .theme159-dialog{background:#1c2c27;color:#dbe7e3;border-color:#425951}
.dashboard-head .hoto-home-tools{flex-wrap:nowrap;gap:5px}
@media(max-width:700px){.dashboard-head:has(#theme159Home) .hoto-home-tools{display:inline-flex!important}.dashboard-head:has(#theme159Home){flex-wrap:wrap}.dashboard-head:has(#theme159Home) .hoto-home-tools .version-badge{font-size:10px;padding:5px 6px}}

@media screen {
  html[data-theme159=dark] #measureCadEditor :is(button.opening-entry,button.room3d-launch) {
    background: #2d4840 !important;
    color: #effcf8 !important;
    border: 1px solid #83a99c !important;
    border-radius: 10px;
    font-weight: 600;
  }
  html[data-theme159=dark] #measureCadEditor button.room3d-launch {
    background: #225b50 !important;
    border-color: #8cd7c3 !important;
    font-weight: 700;
  }
}

@media screen {
  html[data-theme159=dark] #measureCadEditor :is(#light128Tools button,#light116Open,button[id^="option133-"],#cadAxisConstraintToggle,.cad-dock button,#cadDiagonalTools button):not(.opening-entry) {
    background:#2d4840!important;color:#effcf8!important;border:1px solid #83a99c!important;
  }
  html[data-theme159=dark] #measureCadEditor :is(#light128Tools button,#light116Open,button[id^="option133-"],#cadAxisConstraintToggle,.cad-dock button,#cadDiagonalTools button):is(.selected,.active,[aria-pressed=true],.primary),
  html[data-theme159=dark] #measureCadEditor button.cad-dock-primary {
    background:#1c6556!important;color:white!important;border:1px solid #97d6c5!important;
  }
  html[data-theme159=dark] #measureCadEditor :is(#light128Tools button,#light116Open,button[id^="option133-"],#cadAxisConstraintToggle,.cad-dock button,#cadDiagonalTools button):disabled {
    background:#24322d!important;color:#aec0b9!important;border:1px solid #566b62!important;opacity:1!important;
  }
  html[data-theme159=dark] #measureCadEditor #cadAxisConstraintToggle.cad-axis-warning {
    background:#543832!important;color:#ffdad1!important;border-color:#da9b89!important;
  }
  html[data-theme159=dark] #measureCadEditor .option133-count {color:inherit!important;opacity:1}
}

@media screen {
  html[data-theme159=dark] :is(#accountPanel,#recoveryCode137,#syncLogin149,#deleteAccount264,#light116Modal .modal-box) {
    background-color:#1c2c27!important;color:#effaf5!important;
  }
  html[data-theme159=dark] :is(#accountPanel,#recoveryCode137,#syncLogin149) :is(.help137,.optional137,.intro137),
  html[data-theme159=dark] #deleteAccount264 p:not([role=alert]),
  html[data-theme159=dark] #light116Modal :is(.light116-help,.catalog216-hint,.ch224-note,.surface231-hint,.walls250-hint,[class$="-catalog-note"]),
  html[data-theme159=dark] #measureCadEditor :is(.cad-flow-note,.cad-diag-pick-note,.light122-path-help,.walls250-hint,.surface231-hint) {
    color:#cfe5db!important;opacity:1;
  }
  html[data-theme159=dark] #accountPanel #deleteAccountOpen264,
  html[data-theme159=dark] #deleteAccount264 #deleteError264,
  html[data-theme159=dark] #light116Modal [role=alert] {color:#ffc3b6!important}
}
