:root {
  --blue: #0b2d4f;
  --blue-2: #16508a;
  --accent: #e2001a;
  --green: #18a957;
  --amber: #f2b51d;
  --bg: #eef2f6;
  --card: #ffffff;
  --line: #dde3ea;
  --muted: #6b7682;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 38, 64, .06), 0 8px 24px rgba(16, 38, 64, .08);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #16212c;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(1200px 600px at 80% -10%, #dbe7f5 0%, transparent 60%), var(--bg); min-height: 100vh; }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  padding: .7rem 1.5rem; background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .75rem; color: var(--blue); text-decoration: none; font-weight: 650; letter-spacing: .01em; }
.brand img { height: 34px; }
nav { display: flex; align-items: center; gap: 1.25rem; }
nav a, button.link { color: var(--blue); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; opacity: .85; }
nav a:hover, button.link:hover { opacity: 1; text-decoration: underline; }

main { max-width: 1180px; margin: 2rem auto; padding: 0 1.25rem; }

/* ---------- generic ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 420px; margin: 3rem auto; }
.card.pending { border-color: #e0a800; background: #fffbea; }
h1 { margin: 0 0 .4rem; font-size: 1.6rem; font-weight: 700; color: var(--blue); letter-spacing: -.01em; }
h2 { font-size: 1.1rem; color: var(--blue); margin: 0 0 1rem; }
h3 { color: var(--blue); }
label { display: block; margin-bottom: 1rem; font-weight: 550; }
small { color: var(--muted); font-weight: 400; }
input:not([type=hidden]):not([type=file]):not([type=radio]):not([type=checkbox]) {
  display: block; width: 100%; margin-top: .35rem; padding: .65rem .8rem;
  border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(22, 80, 138, .15); }
.inline { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }
.inline input:not([type=hidden]):not([type=file]) { display: inline-block; width: auto; margin: 0; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.15rem; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--blue); color: #fff; font: inherit; font-weight: 550; text-decoration: none;
  transition: transform .08s, box-shadow .15s, background .15s;
}
button:hover, .button:hover { background: var(--blue-2); }
button:active, .button:active { transform: translateY(1px); }
button.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
button.secondary:hover { background: #f1f6fb; }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover { background: #f1f4f7; color: var(--blue); }
button.small { padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }
button.danger { background: var(--accent); }
.button.big, button.big { padding: 1rem 2.2rem; font-size: 1.1rem; font-weight: 650; border-radius: 14px; box-shadow: 0 6px 18px rgba(11, 45, 79, .25); }
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f3f6f9; font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { display: flex; gap: .4rem; justify-content: flex-end; }
tr.disabled td { color: var(--muted); }
.tag { font-size: .75rem; background: var(--blue); color: #fff; border-radius: 4px; padding: 0 .35rem; }
.muted { color: var(--muted); }
.flash { padding: .85rem 1.1rem; border-radius: 12px; margin-bottom: 1.25rem; }
.flash.ok { background: #e7f6ec; border: 1px solid #9fd3ae; }
.flash.error { background: #fdecee; border: 1px solid #f1a5ae; }
ul.plain { margin: 0; padding-left: 1.1rem; }
.credentials { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; }
.credentials dd { margin: 0; }
code { font-size: 1.1rem; background: #f0f3f6; padding: .1rem .4rem; border-radius: 4px; }
summary { cursor: pointer; color: var(--blue); font-weight: 550; }

/* ---------- ECO Pro+ page ---------- */
.page-head { margin-bottom: 1.5rem; }
.back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover { color: var(--blue); }

.ecopro-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .ecopro-grid { grid-template-columns: 1fr; } }

.step-card h2 { display: flex; align-items: center; gap: .6rem; }
.step {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-2), var(--blue)); color: #fff; font-size: .9rem;
}
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.field-row:first-of-type { border-top: 0; }
.field-row label { margin: 0; }
.hint { color: var(--muted); font-size: .92rem; margin-top: -.3rem; }

.field-block { padding: .9rem 0 .2rem; border-top: 1px solid var(--line); }
.field-label { display: block; font-weight: 550; margin-bottom: .7rem; }
.style-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .7rem; }
.style-option { margin: 0; cursor: pointer; }
.style-option input { position: absolute; opacity: 0; pointer-events: none; }
.style-card {
  display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border-radius: 12px;
  border: 2px solid var(--line); background: #fbfcfd; transition: border-color .15s, background .15s, box-shadow .15s;
}
.style-card strong { display: block; color: var(--blue); }
.style-card small { display: block; line-height: 1.3; }
.style-card .chip.preview { width: 2.6rem; height: 2.6rem; cursor: inherit; pointer-events: none; }
.style-option:hover .style-card { border-color: #b9c9da; }
.style-option input:checked + .style-card { border-color: var(--blue-2); background: #eef4fa; box-shadow: 0 0 0 3px rgba(22, 80, 138, .12); }
.style-option input:focus-visible + .style-card { box-shadow: 0 0 0 3px rgba(22, 80, 138, .35); }
.rgb-note { display: flex; align-items: flex-start; gap: .55rem; margin: .8rem 0 0; font-size: .88rem; color: var(--muted); }
.rgb-dot { flex: none; width: 14px; height: 14px; margin-top: .15rem; border-radius: 50%; background: conic-gradient(#ff3b3b, #ffd93b, #3bff6b, #3bd8ff, #4d5bff, #ff3bd8, #ff3b3b); }

.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fbfcfd; }
.stepper button { width: 2.6rem; border-radius: 0; background: transparent; color: var(--blue); font-size: 1.3rem; padding: 0; }
.stepper button:hover { background: #eaf1f8; }
.stepper input:not([type=hidden]) {
  width: 3.6rem; margin: 0; border: 0; border-radius: 0; text-align: center; font-size: 1.15rem; font-weight: 650;
  background: #fff; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* floor button chips */
.palette {
  display: flex; flex-wrap: wrap; gap: .55rem; padding: .9rem; min-height: 4.2rem;
  background: #f5f8fb; border: 2px dashed transparent; border-radius: 14px; transition: border-color .15s, background .15s;
}
.palette.drop-target, .has-selection .palette { border-color: #b9c9da; background: #eef4fa; }
.palette.full .chip { opacity: .45; }
.chip {
  --ring: #5cc8ff;
  --glow: rgba(64, 190, 255, .9);
  width: 3.2rem; height: 3.2rem; padding: 0; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: 1.05rem; color: #fff;
  background: radial-gradient(circle at 40% 30%, #3a4148 0%, #1c2126 55%, #0d1013 100%);
  border: 5px solid var(--ring);
  box-shadow: 0 0 4px var(--glow), 0 0 14px 2px var(--glow), 0 2px 4px rgba(0, 0, 0, .25), inset 0 0 6px var(--glow);
  cursor: grab; touch-action: none; user-select: none;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.chip:hover { background: radial-gradient(circle at 40% 30%, #464e56 0%, #22282e 55%, #101316 100%); transform: translateY(-1px); }
/* Exit floor: green ring inside the illuminated ring, around the symbol */
.chip.green {
  box-shadow: 0 0 4px var(--glow), 0 0 14px 2px var(--glow), 0 2px 4px rgba(0, 0, 0, .25),
    inset 0 0 0 2px #15191d, inset 0 0 0 6px #1faa52, inset 0 0 0 7px #137a39;
}
.chip.selected { transform: scale(1.08); outline: 3px solid rgba(47, 123, 255, .6); outline-offset: 3px; }

/* 1 zone: only the symbol is lit, the ring is unlit. 2 zones: ring and symbol lit in different colours. */
.style-1zone .chip, .style-card.style-1zone .chip {
  --ring: #8a939c; --glow: transparent;
  color: #ff4fd8; text-shadow: 0 0 6px rgba(255, 79, 216, .9), 0 0 12px rgba(255, 79, 216, .5);
}
.style-1zone .chip.extra svg, .style-1zone .hole.fixed:not(.alarm) svg { fill: #ff4fd8; filter: drop-shadow(0 0 3px rgba(255, 79, 216, .9)); }
.style-1zone .chip.extra .dot { background: #ff4fd8; box-shadow: 0 0 5px #ff4fd8; }
.style-1zone .hole.fixed:not(.alarm) { border-color: #8a939c; box-shadow: none; }
.style-2zone .chip, .style-card.style-2zone .chip {
  --ring: #5cc8ff; --glow: rgba(64, 190, 255, .9);
  color: #ff4fd8; text-shadow: 0 0 6px rgba(255, 79, 216, .9), 0 0 12px rgba(255, 79, 216, .5);
}
.style-2zone .chip.extra svg, .style-2zone .hole.fixed:not(.alarm) svg { fill: #ff4fd8; filter: drop-shadow(0 0 3px rgba(255, 79, 216, .9)); }
.style-2zone .chip.extra .dot { background: #ff4fd8; box-shadow: 0 0 5px #ff4fd8; }
.cop-note {
  max-width: 300px; margin: 0 auto 12px; padding: .5rem .75rem; border-radius: 10px;
  font-size: .8rem; line-height: 1.35; color: #6b5a1e; background: #fff7dc; border: 1px solid #f0dc9a; text-align: center;
}
.chip.dragging { opacity: .25; }
.chip.ghost {
  position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .3); cursor: grabbing;
}
.chip.mini { width: 1.4rem; height: 1.4rem; margin: 0 .2rem; border-width: 3px; cursor: default; vertical-align: middle; }
.chip.mini.green { box-shadow: inset 0 0 0 1px #15191d, inset 0 0 0 4px #1faa52; }
.chip.extra svg { width: 58%; height: 58%; fill: #fff; pointer-events: none; }
.chip.extra .dot { display: block; width: 12px; height: 12px; border-radius: 50%; background: #fff; pointer-events: none; }
.palette.extras { min-height: 0; }
h3.sub { font-size: 1rem; margin: 1.6rem 0 .4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.legend { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .45rem; }

.progress { margin: 1.2rem 0 .8rem; }
.progress-text { font-size: .95rem; margin-bottom: .45rem; }
.bar { height: 8px; border-radius: 99px; background: #e5ebf1; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue-2), #3a86d4); transition: width .25s; }
.progress.done .bar i { background: linear-gradient(90deg, #13914a, var(--green)); }
.progress.over .bar i { background: var(--accent); }
.progress.done .progress-text { color: #13914a; }
.progress.over .progress-text { color: var(--accent); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; }

/* COP visual */
.cop-stage { position: sticky; top: 5.2rem; }
.cop {
  width: 300px; margin: 0 auto; padding: 22px 26px 30px; border-radius: 22px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .08) 0 1px, rgba(0, 0, 0, .025) 1px 3px),
    linear-gradient(160deg, #f4f6f8 0%, #c9d0d7 45%, #e5e9ed 70%, #b8c0c8 100%);
  border: 1px solid #a9b3bd;
  box-shadow: 0 24px 50px rgba(16, 38, 64, .22), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.cop-display {
  height: 128px; border-radius: 8px; margin-bottom: 12px; padding: 8px 12px;
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, #13202e, #05090d); border: 3px solid #2a3138;
  box-shadow: inset 0 0 22px rgba(70, 140, 220, .25);
}
.disp-top { display: flex; justify-content: space-between; font-size: .7rem; color: #9fb4c9; }
.disp-brand { color: #ff2a3a; font-weight: 800; font-style: italic; letter-spacing: .04em; }
.disp-floor { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; }
.disp-num { font-size: 2.6rem; font-weight: 700; color: #fff; line-height: 1; }
.disp-arrow { width: 34px; height: 34px; fill: #3d8bff; filter: drop-shadow(0 0 4px rgba(61, 139, 255, .7)); }
.cop-info {
  display: flex; justify-content: center; align-items: center; gap: 14px; height: 30px; margin-bottom: 18px;
  border-radius: 6px; background: #0e1216; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
}
.led { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .3); }
.led.green { background: #39c46d; box-shadow: 0 0 6px #39c46d; }
.led.yellow { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.cop-buttons { display: grid; grid-template-columns: repeat(3, 64px); justify-content: center; gap: 16px 22px; }
.hole {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #8d969f 0%, #6c757e 60%, #59626b 100%);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .7);
  transition: box-shadow .15s, transform .15s;
}
.hole:not(.fixed) { cursor: pointer; }
.hole.drop-target, .has-selection .hole:not(.fixed):hover {
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .45), 0 0 0 4px rgba(47, 123, 255, .55);
  transform: scale(1.05);
}
.hole .chip { width: 56px; height: 56px; }
.hole.fixed {
  background: radial-gradient(circle at 40% 30%, #3a4148 0%, #1c2126 55%, #0d1013 100%);
  border: 5px solid #5cc8ff; box-shadow: 0 0 4px rgba(64, 190, 255, .9), 0 0 14px 2px rgba(64, 190, 255, .9), inset 0 0 6px rgba(64, 190, 255, .9); cursor: default;
}
.hole.fixed svg { width: 46%; height: 46%; fill: #fff; }
.hole.fixed.alarm { border-color: var(--amber); box-shadow: 0 0 8px rgba(242, 181, 29, .7); }
.hole.fixed.alarm svg { fill: var(--amber); width: 50%; height: 50%; }

/* key switch: chrome bezel, lock cylinder with key slot, 0 / I positions */
.cop-key { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 24px; }
.cop-key[hidden] { display: none; }
.switch-row { display: flex; align-items: center; gap: .7rem; margin: 1rem 0 0; cursor: pointer; font-weight: 550; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { position: relative; width: 44px; height: 24px; flex: none; border-radius: 99px; background: #cdd6df; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch-row input:checked + .toggle { background: var(--blue-2); }
.switch-row input:checked + .toggle::after { transform: translateX(20px); }
.switch-row input:focus-visible + .toggle { box-shadow: 0 0 0 3px rgba(22, 80, 138, .3); }
.key-mark { font-size: .8rem; font-weight: 700; color: #3a444e; }
.key-bezel {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(from 210deg, #f7f9fb, #9aa4ad, #eef1f4, #7f8a94, #f7f9fb);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.key-cylinder {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #d8a64a 0%, #b0812e 60%, #8a6320 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .45);
}
.key-slot { width: 4px; height: 18px; border-radius: 2px; background: #1b1f23; box-shadow: inset 0 1px 2px #000; transform: rotate(-30deg); }
.cop-caption { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 1rem; }

.submit-bar { display: flex; justify-content: flex-end; margin-top: .5rem; }
@media (max-width: 900px) {
  .cop-stage { position: static; }
  .ecopro-settings { display: contents; }
  .ecopro-settings .step-card:first-child { order: 1; margin-bottom: 0; }
  .cop-stage { order: 2; }
  .ecopro-settings .step-card:last-child { order: 3; }
  .submit-bar { position: sticky; bottom: 0; padding: .8rem 0; background: linear-gradient(transparent, var(--bg) 35%); }
  .submit-bar button { width: 100%; }
}
@media (max-width: 600px) {
  header { position: static; padding: .6rem 1rem; gap: .4rem; }
  .brand img { height: 26px; }
  nav { flex-wrap: wrap; gap: .35rem 1rem; font-size: .9rem; }
  main { margin-top: 1rem; padding: 0 .75rem; }
  .card { padding: 1.1rem; }
  .field-row { flex-wrap: wrap; }
  .chip { width: 2.9rem; height: 2.9rem; font-size: 1rem; }
  .palette { gap: .45rem; padding: .7rem; }
  .cop { width: 270px; padding: 18px 20px 24px; }
  .cop-display { height: 96px; }
  .cop-buttons { grid-template-columns: repeat(3, 58px); gap: 14px 20px; }
  .hole { width: 58px; height: 58px; }
  .hole .chip { width: 50px; height: 50px; }
}
