/* ул. Цанко Церковски — измерен план на дупките
   Светла тема. Ink #1c2333 · хартия #eceae3 · акцент амбър #9a6a08 */

:root {
  --ink: #1c2333;
  --ink-2: #333d51;
  --ink-3: #4a5468;
  --ink-4: #5a6478;
  --ink-5: #626c82;
  --ink-6: #6e7889;
  --ink-7: #5f6878;
  --ink-8: #6b7383;
  --amber: #9a6a08;
  --amber-dark: #a8760c;
  --line: rgba(28,35,51,.1);
  --line-2: rgba(28,35,51,.14);
  --paper: #eceae3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #f2f3f6;
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: #7d5606; }
button { font-family: inherit; cursor: pointer; }
h1 { margin: 0; }

.mono { font-family: 'IBM Plex Mono', monospace; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(28,35,51,.16); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes pop { from { opacity: 0; transform: translateY(7px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes halo {
  0% { transform: translate(-50%,-50%) scale(.8); opacity: .5; }
  70%, 100% { transform: translate(-50%,-50%) scale(1.9); opacity: 0; }
}
@keyframes sweep { from { opacity: 0; } to { opacity: 1; } }

/* ---------- shell ---------- */

.app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: radial-gradient(1200px 700px at 12% -10%, #ffffff, transparent), #eceff4;
}

.panel {
  width: 316px;
  flex: 0 0 316px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #f5f6f8 100%);
  border-right: 1px solid var(--line);
  margin-left: 0;
  transition: margin-left .26s cubic-bezier(.2,.8,.25,1);
}
.panel.collapsed { margin-left: -317px; }

.panel-head { padding: 24px 22px 18px; border-bottom: 1px solid var(--line); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-5);
}
.rule { width: 26px; height: 3px; flex: 0 0 26px; border-radius: 2px; background: linear-gradient(90deg, #f2c94e, #c93f53); }

.panel h1 { font-size: 22px; line-height: 1.15; font-weight: 800; letter-spacing: -.015em; margin-bottom: 5px; }
.panel .sub { font-size: 12.5px; color: var(--ink-5); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 18px; }
.stat {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(28,35,51,.035);
}
.stat b { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 16px; font-weight: 500; color: var(--amber); }
.stat span { display: block; font-size: 9.5px; color: var(--ink-6); letter-spacing: .04em; margin-top: 3px; }

.panel-legend { padding: 14px 22px 12px; border-bottom: 1px solid var(--line); }
.mono-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: .16em;
  color: var(--ink-7);
  margin-bottom: 9px;
}
.legend { display: flex; flex-wrap: wrap; gap: 7px 13px; }
.legend > div { display: flex; align-items: center; gap: 6px; }
.legend span.txt { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }
.legend span.num { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-7); }
.dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 2px; }
.dot.round { border-radius: 50%; }

.schedule { flex: 1; overflow-y: auto; padding-bottom: 18px; }
.house-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 22px 7px;
  cursor: pointer;
  border-top: 1px solid rgba(28,35,51,.06);
  background: rgba(28,35,51,.025);
  transition: background .16s;
}
.house-head:hover { background: rgba(242,201,78,.26); }
.house-head b { font-size: 13px; font-weight: 600; }
.house-head span { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--ink-6); margin-left: auto; }

.row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 22px;
  cursor: pointer;
  transition: background .16s;
}
.row:hover { background: rgba(28,35,51,.05); }
.row.on { background: rgba(242,201,78,.34); box-shadow: inset 2px 0 0 var(--amber-dark); }
.row .id { font-family: 'IBM Plex Mono', monospace; font-size: 12px; width: 33px; color: var(--ink); }
.row .dims { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-5); flex: 1; }
.row .area { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-7); }

/* ---------- main ---------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 54px;
  flex: 0 0 54px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.72);
}
.caption {
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--ink-7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  border: 1px solid rgba(28,35,51,.16);
  border-radius: 9px;
  background: rgba(28,35,51,.04);
  color: var(--ink-5);
  transition: background .16s, color .16s, border-color .16s;
}
.icon-btn:hover { background: rgba(242,201,78,.32); color: var(--amber); border-color: rgba(176,124,12,.5); }
.icon-btn:active { transform: scale(.94); }

.mapwrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.map {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  background: var(--paper);
}
.map.grabbing { cursor: grabbing; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map svg rect.defect { cursor: pointer; }

.fade {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 40px;
  background: linear-gradient(180deg, rgba(236,234,227,.92), transparent);
  pointer-events: none;
}
.overlay { position: absolute; inset: 0; pointer-events: none; }

.lab {
  position: absolute;
  transform: translate(-50%,-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(255,255,255,.9);
  white-space: nowrap;
}
.lab.on { color: #0b1220; text-shadow: none; }

.tick, .band, .plotno, .street, .housetag {
  position: absolute;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}
.tick { top: 7px; transform: translateX(-50%); font-size: 10px; color: var(--ink-7); }
.housetag { top: 24px; font-size: 10.5px; letter-spacing: .1em; color: rgba(158,110,8,.85); }
.band { left: 16px; transform: translateY(-50%); font-size: 9.5px; letter-spacing: .13em; color: var(--ink-5); }
.band.corridor { color: rgba(158,110,8,.9); }
.plotno { transform: translate(-50%,-50%); font-size: 12px; letter-spacing: .04em; color: rgba(28,35,51,.5); }
.street { transform: translate(-50%,-50%) rotate(-90deg); font-size: 10px; letter-spacing: .2em; color: var(--ink-8); }

.halo-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(176,124,12,.65);
  pointer-events: none;
  animation: halo 1.9s ease-out infinite;
}
.halo-core {
  position: absolute;
  width: 7px; height: 7px;
  transform: translate(-50%,-50%);
  border-radius: 50%;
  background: #b07c0c;
  box-shadow: 0 0 12px rgba(176,124,12,.45);
  pointer-events: none;
}

.tip {
  position: absolute;
  transform: translate(-50%,-100%);
  display: flex;
  gap: 7px;
  align-items: baseline;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid rgba(176,124,12,.4);
  background: rgba(255,255,255,.95);
  box-shadow: 0 6px 18px rgba(28,35,51,.12);
  white-space: nowrap;
  animation: sweep .13s ease both;
  pointer-events: none;
}
.tip .id { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--amber); }
.tip .dims { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-3); }

.zoombox { position: absolute; top: 44px; right: 14px; display: flex; flex-direction: column; gap: 6px; }
.map-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  border: 1px solid rgba(28,35,51,.16);
  border-radius: 9px;
  background: rgba(255,255,255,.86);
  color: var(--ink);
  backdrop-filter: blur(6px);
  transition: background .16s, border-color .16s;
}
.map-btn.fit { font-size: 7.5px; letter-spacing: 0; color: var(--ink-5); }
.map-btn:hover { background: rgba(242,201,78,.32); border-color: rgba(176,124,12,.5); }

.scalebox {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.scalebar { height: 5px; border: 1px solid rgba(28,35,51,.45); border-top: none; }
.scaletxt { font-size: 10px; color: var(--ink-5); margin-top: 4px; }

/* ---------- overview + hint ---------- */

.overview {
  position: relative;
  flex: 0 0 34px;
  border-top: 1px solid var(--line);
  background: #f4f5f7;
  cursor: pointer;
  overflow: hidden;
}
.ov-mark { position: absolute; height: 4px; border-radius: 2px; opacity: .62; }
.ov-mark.on { opacity: 1; }
.ov-seam { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.ov-win {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border: 1px solid rgba(158,110,8,.85);
  border-radius: 4px;
  background: rgba(242,201,78,.22);
  pointer-events: none;
}

.hint {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  background: #f4f5f7;
  font-size: 11px;
  color: var(--ink-7);
}
.hint span:last-child { margin-left: auto; }

/* ---------- defect card ---------- */

.card { position: absolute; width: 308px; z-index: 6; }
.card-inner {
  background: linear-gradient(180deg, #ffffff, #f7f8fa);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(28,35,51,.16), inset 0 1px 0 #fff;
  overflow: hidden;
  animation: pop .17s cubic-bezier(.2,.8,.25,1) both;
}
.card-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px 10px; }
.card-head h2 { margin: 0; font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.card-head .where { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--ink-6); margin-top: 5px; }
.card-head .right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: .12em;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.close {
  width: 25px; height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(28,35,51,.04);
  color: var(--ink-4);
  font-size: 14px;
  line-height: 1;
  transition: background .15s, color .15s;
}
.close:hover { background: rgba(28,35,51,.1); color: var(--ink); }
.close:active { transform: scale(.93); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.metric { padding: 9px 12px; background: #f7f7f3; }
.metric span { font-size: 9px; letter-spacing: .13em; color: var(--ink-7); }
.metric b {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
  color: var(--amber);
  margin-top: 5px;
}

.rows { padding: 10px 13px 0; display: flex; flex-direction: column; gap: 6px; }
.rows > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.rows .k { color: var(--ink-6); }
.rows .v { font-family: 'IBM Plex Mono', monospace; color: var(--ink-2); }

.note {
  margin: 10px 13px 0;
  padding: 8px 10px;
  border-left: 2px solid rgba(176,124,12,.65);
  background: rgba(242,201,78,.18);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-2);
  text-wrap: pretty;
}

.actions { padding: 10px 13px 12px; display: flex; flex-direction: column; gap: 6px; }
.drive {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1a1206;
  background: linear-gradient(100deg, #f2c94e, #f0952f 60%, #e2653f);
  transition: transform .15s cubic-bezier(.2,.8,.25,1), filter .15s ease;
}
.drive:hover { filter: brightness(1.09); transform: translateY(-1px); color: #1a1206; }
.drive:active { transform: scale(.985); }

.actions .sub-row { display: flex; gap: 7px; }
.ghost {
  padding: 8px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: .11em;
  border: 1px solid rgba(28,35,51,.18);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-5);
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.ghost:hover { background: rgba(242,201,78,.3); color: var(--amber); }
.ghost.wide { flex: 1; }
