/* Day is the default look; night-only elements stay hidden. */
.night-shade, .night-sky, .lamp-pool, .headlight, .win-stars { opacity: 0; transition: opacity .8s; pointer-events: none; }
.night-shade { fill: #08102e; }
.street-lamp rect, .street-lamp path { fill: none; stroke: #4a4f66; stroke-width: 3; }
.street-lamp rect { fill: #4a4f66; stroke: none; }
.street-lamp .bulb { fill: #d9dde8; stroke: #4a4f66; stroke-width: 2; transition: fill .6s; }
.lamp-pool { fill: #ffe38a; filter: blur(6px); }
.headlight { fill: #fff3b0; filter: blur(3px); }
.taillight { fill: #b33; }
.star { fill: #fff; animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .25; } }
.moon-glow { fill: #fff6d0; opacity: .18; }
.moon-disc { fill: #fff4c8; }
.moon-cut { fill: #1a2550; opacity: 0; }
.win-stars circle { fill: #fff; }
.win-moon { fill: #fff4c8; }

html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .7s, color .7s, fill .7s, stroke .7s, border-color .7s, opacity .7s, filter .7s, box-shadow .7s !important;
}

/* ---------- Night ---------- */
[data-theme=night] { --text: #e6e9ff; --muted: #9aa0bd; --border: #3b4060; --paper: #23263a; }
[data-theme=night] body { background: #10131f; }

/* map */
[data-theme=night] #map { background: #16243a; }
[data-theme=night] .map-svg .night-shade { opacity: .62; }
[data-theme=night] .night-sky, [data-theme=night] .lamp-pool { opacity: 1; }
[data-theme=night] .lamp-pool { opacity: .5; }
[data-theme=night] .headlight { opacity: .55; }
[data-theme=night] .taillight { fill: #ff3b30; filter: drop-shadow(0 0 4px #ff3b30); }
[data-theme=night] .street-lamp .bulb { fill: #ffe38a; filter: drop-shadow(0 0 8px #ffd24d); }
[data-theme=night] .cloud { opacity: .18; }
[data-theme=night] .building .wall { fill: #8f8ba8; }
[data-theme=night] .building .side, [data-theme=night] .building .base { fill: #6f6b88; }
[data-theme=night] .building .roof, [data-theme=night] .building .roof-side, [data-theme=night] .building .b-chimney { filter: brightness(.6); }
[data-theme=night] .building .glass { fill: #2a3a6a; }
[data-theme=night] .building .slat { fill: #5c6378; }
[data-theme=night] .building .b-win { fill: #ffd76a; filter: drop-shadow(0 0 6px rgba(255,200,80,.9)); }
[data-theme=night] .building.is-connected .b-win { fill: #fff0a8; filter: drop-shadow(0 0 10px #ffd24d); }
[data-theme=night] .building .gate-light { fill: #ffcf5a; filter: drop-shadow(0 0 8px #ffb02e); }
[data-theme=night] .building .sign-board { filter: drop-shadow(0 0 6px var(--roof)); }
[data-theme=night] .pad.concrete { fill: #6b7088; stroke: #545970; }
[data-theme=night] .pad.dirt { fill: #8a6c48; stroke: #6e5436; }
[data-theme=night] .plot-sign .board { fill: #c99a62; }
[data-theme=night] .hud-title { background: rgba(35,38,58,.94); color: #e6e9ff; }

/* factory floor */
[data-theme=night] #factory, [data-theme=night] .stage-wrap { background: #121522; }
[data-theme=night] .layer.bg .night-shade { opacity: .55; }
[data-theme=night] .win { fill: url(#nightSkyGrad); }
[data-theme=night] .win-stars { opacity: 1; }
[data-theme=night] .win-shine { opacity: .08; }
[data-theme=night] .floor { fill: #2b2f45; }
[data-theme=night] .lamp-cone { opacity: 1; filter: brightness(1.3); }
[data-theme=night] .lamp-shade { filter: drop-shadow(0 0 10px #ffd24d); }
[data-theme=night] .belt, [data-theme=night] .shelf, [data-theme=night] .qa-table, [data-theme=night] .pallet-zone, [data-theme=night] .pipe { filter: brightness(.8); }
[data-theme=night] .m-eye { filter: drop-shadow(0 0 18px var(--glow)) drop-shadow(0 0 30px var(--glow)); }
[data-theme=night] .m-glass { filter: drop-shadow(0 0 10px rgba(77,255,154,.35)); }
[data-theme=night] .m-idle .m-antenna-tip, [data-theme=night] .m-working .m-antenna-tip { filter: drop-shadow(0 0 8px #ff5a4f); }
[data-theme=night] .m-working .m-scan { filter: drop-shadow(0 0 12px #ff9f43); }
[data-theme=night] .m-body, [data-theme=night] .m-dome { filter: brightness(.85); }
[data-theme=night] .mp-run { box-shadow: 0 4px 0 #157a40, 0 0 18px rgba(62,224,127,.45); }
[data-theme=night] .mp-run.stop { box-shadow: 0 4px 0 #9c2119, 0 0 18px rgba(255,90,79,.5); }
[data-theme=night] .box-body { filter: brightness(.9); }
[data-theme=night] .stencil { opacity: .1; }

/* dialogs */
[data-theme=night] .dialog { background: #23263a; color: #e6e9ff; }
[data-theme=night] .dialog.blueprint { background-color: #0e2547; border-color: #5b7fb8; }
[data-theme=night] input, [data-theme=night] textarea, [data-theme=night] select { background: #1b1e2e; color: #e6e9ff; border-color: #3b4060; }
[data-theme=night] label { color: #b9bfd9; }
[data-theme=night] .btn { background: #2f3350; color: #e6e9ff; border-color: #444a6e; }
[data-theme=night] .btn:hover { background: #3b4064; }
[data-theme=night] .btn.primary { background: var(--primary); color: #fff; border-color: var(--primary-dark); }
[data-theme=night] .btn.approve { background: var(--green); color: #fff; }
[data-theme=night] .btn.reject { background: var(--red); color: #fff; }
[data-theme=night] .btn.danger { color: #ff8a80; }
[data-theme=night] code { background: rgba(255,255,255,.1); color: #ffe2a8; }
[data-theme=night] .description, [data-theme=night] .dropzone, [data-theme=night] .run { background: #1b1e2e; border-color: #3b4060; }
[data-theme=night] .comment { background: #1b1e2e; border-color: #3b4060; }
[data-theme=night] .comment.agent { background: #1d2a44; }
[data-theme=night] .comment.kind-question, [data-theme=night] .notice.yellow { background: #3d3418; border-color: #b8901f; }
[data-theme=night] .comment.kind-feedback, [data-theme=night] .notice.red { background: #3d1f22; border-color: #b8423a; }
[data-theme=night] .comment.kind-summary { background: #17352a; border-color: #2f8f63; }
[data-theme=night] .notice.draft { background: #1d2a44; }
[data-theme=night] .notice.review { background: #2a2548; }
[data-theme=night] .log-entry::before { border-color: #23263a; }
[data-theme=night] .md .md-h { color: #fff; }
[data-theme=night] .md pre { background: #10131f; }
[data-theme=night] .badge.muted, [data-theme=night] .pill { background: #3b4060; color: #d0d4ea; }
[data-theme=night] .thumb { background: #1b1e2e; border-color: #3b4060; }
[data-theme=night] .toast { background: #e6e9ff; color: #23263a; }

/* review desk & sheet */
[data-theme=night] #inspect .desk { background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 46px), linear-gradient(180deg, #5e3c20, #43291a); }
[data-theme=night] #inspect .desk::before { background: radial-gradient(ellipse at 45% 35%, rgba(255,210,120,.28), transparent 55%); }
[data-theme=night] .sheet { background-color: #262a40; color: #e6e9ff; background-image: linear-gradient(rgba(140,170,255,.08) 1px, transparent 1px);
  box-shadow: 0 2px 0 #1b1e2e, 0 4px 0 #2c3048, 0 24px 50px rgba(0,0,0,.6); }
[data-theme=night] .sheet-head { border-color: #3b4060; }
[data-theme=night] .imprint { mix-blend-mode: normal; opacity: .9; }
[data-theme=night] .imprint.approved { color: #3ee07f; }
[data-theme=night] .imprint.rejected { color: #ff6b5f; }
[data-theme=night] .reject-form { background: #23263a; }
[data-theme=night] .ib-label { background: #e9e2cf; }
[data-theme=night] .box-label { background: #efe8d6; }
[data-theme=night] .fp-title code { background: none; color: #9aa0bd; }
