* { box-sizing: border-box; }

:root{
  --bg:#ece7de;
  --panel:#ffffff;
  --text:#162132;
  --muted:#667085;
  --line:#202938;
  --accent:#d7ff4d;
  --grave:#ffffff;
  --grave-border:#3dcf18;
  --aisle:#f2f2f2;
  --selected:#ef4444;
  --selected-border:#b91c1c;
  --shadow:0 20px 50px rgba(15,23,42,.08);
  --radius:24px;
}

html,body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:Inter, Arial, Helvetica, sans-serif;
}

.container{
  width:min(1500px, calc(100% - 28px));
  margin:0 auto;
}

.topbar{
  padding:24px 0 10px;
}

.topbar-inner{
  display:flex;
  gap:24px;
  justify-content:space-between;
  align-items:flex-end;
  flex-wrap:wrap;
}

.eyebrow{
  margin:0 0 8px;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.18em;
  font-weight:800;
  color:var(--muted);
}

h1,h2,h3,p{margin-top:0;}
h1{
  margin-bottom:10px;
  font-size:clamp(30px, 4vw, 52px);
  line-height:1;
}
.subtitle{
  max-width:920px;
  color:var(--muted);
  margin-bottom:0;
}

.legend{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  padding:12px 16px;
  background:rgba(255,255,255,.92);
  border-radius:999px;
  box-shadow:var(--shadow);
}
.legend span{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:700;
  font-size:14px;
}
.box{
  width:16px;
  height:16px;
  display:inline-block;
  border:2px solid var(--line);
}
.box.grave{background:#fff;border-color:var(--grave-border);}
.box.aisle{background:var(--aisle);}
.box.selected{background:var(--selected);border-color:var(--selected-border);}

.panel{
  background:var(--panel);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
  margin-bottom:18px;
}

.controls{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:center;
  flex-wrap:wrap;
}

.controls-right{
  display:flex;
  gap:16px;
  align-items:center;
  flex-wrap:wrap;
}

.stats{
  display:grid;
  grid-template-columns:repeat(2,minmax(110px,1fr));
  gap:10px;
}

.stat{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:18px;
  padding:14px 16px;
}
.stat span{
  display:block;
  font-size:28px;
  line-height:1;
  font-weight:900;
}
.stat small{
  color:var(--muted);
}

.btn{
  border:0;
  background:var(--text);
  color:#fff;
  padding:14px 18px;
  border-radius:999px;
  font-weight:800;
  cursor:pointer;
}

.meta-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(280px,1fr));
  gap:24px;
}
.meta-grid ul{
  margin:0;
  padding-left:18px;
  color:var(--muted);
}
.meta-grid li{ margin-bottom:8px; }

.schematic-wrap{
  overflow:auto;
}

.schematic-toolbar{
  margin-bottom:14px;
}

.road-label{
  display:inline-block;
  background:var(--accent);
  border:2px solid var(--line);
  border-radius:16px;
  padding:12px 18px;
  font-weight:900;
  letter-spacing:.03em;
}

#app{
  min-width:1200px;
}

.master-layout{
  display:grid;
  grid-template-columns:120px 1fr 70px;
  gap:12px;
  align-items:start;
}

.side-access{
  height:100%;
  min-height:300px;
  border:3px solid var(--line);
  background:#f6f3ee;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:10px;
  padding:10px;
  font-weight:900;
}
.side-access .vertical{
  writing-mode:vertical-rl;
  transform:rotate(180deg);
  letter-spacing:.08em;
}

.rows{
  border:3px solid var(--line);
  background:#fff;
}

.row{
  display:grid;
  grid-template-columns:72px 1fr;
  border-bottom:2px solid var(--line);
}
.row:last-child{ border-bottom:0; }

.row-size{
  border-right:2px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  padding:8px;
}

.row-main{
  background:#fff;
}

.top-zone{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  font-weight:900;
  min-height:82px;
  background:#fffef6;
}

.parcel-head{
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px 16px;
  border-bottom:2px solid var(--line);
  background:#f8fafc;
}
.parcel-index{
  font-size:28px;
  line-height:1;
  font-weight:900;
  min-width:42px;
}
.parcel-title{
  font-size:18px;
  font-weight:900;
  text-transform:uppercase;
}
.parcel-sub{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
  margin-top:4px;
}

.parcel-body{
  display:grid;
  grid-template-columns:3fr 4fr 5.5fr;
  min-height:260px;
}

.zone-col{
  border-right:2px solid var(--line);
  display:flex;
  flex-direction:column;
}
.zone-col:last-child{ border-right:0; }

.zone-title{
  text-align:center;
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.05em;
  border-bottom:2px solid var(--line);
  padding:8px 6px;
  background:#fffef7;
}

.zone-svg{
  display:block;
  width:100%;
  height:100%;
  background:#fff;
}

.right-index{
  border:3px solid var(--line);
  background:#fff;
}

.index-cell{
  border-bottom:2px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  font-weight:900;
  color:#253a5e;
}
.index-cell:last-child{ border-bottom:0; }

.note{
  margin-top:12px;
  color:var(--muted);
  font-size:14px;
}

@media (max-width: 900px){
  .meta-grid{grid-template-columns:1fr;}
}


.segment-stack{
  display:flex;
  flex-direction:column;
  width:100%;
}

.custom-segment{
  border-bottom:2px solid var(--line);
  background:#fff;
  overflow:hidden;
}
.custom-segment:last-child{
  border-bottom:0;
}

.custom-segment-label{
  display:flex;
  gap:10px;
  align-items:center;
  padding:8px 12px;
  border-bottom:2px solid var(--line);
  background:#f8fafc;
  font-size:13px;
}
.custom-segment-label strong{
  font-size:15px;
}
.custom-segment-label span{
  font-weight:800;
}
.custom-segment-label small{
  color:var(--muted);
  margin-left:auto;
  font-weight:700;
}

.occupied-block{
  display:flex;
  align-items:center;
  justify-content:center;
  height:calc(100% - 42px);
  min-height:120px;
  font-size:28px;
  font-weight:900;
  color:#334155;
  background:repeating-linear-gradient(
    -45deg,
    #f3f4f6,
    #f3f4f6 16px,
    #e5e7eb 16px,
    #e5e7eb 32px
  );
}


.grave-type-counts{
  display:grid;
  grid-template-columns:repeat(2,minmax(160px,1fr));
  gap:10px;
  margin-top:12px;
}

.count-chip{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:14px;
  padding:10px 12px;
  font-size:14px;
  font-weight:700;
}

.count-chip strong{
  color:var(--text);
}


.topbar{
  padding: 28px 0 6px;
}

.topbar-inner{
  align-items:center;
}

.topbar h1{
  margin:0;
  font-size:clamp(34px, 4.4vw, 60px);
  letter-spacing:-0.03em;
}

.controls-clean{
  padding:24px;
}

.counts-hero{
  width:100%;
}

.counts-hero-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
  flex-wrap:wrap;
}

.counts-hero-head h2{
  margin:0;
  font-size:28px;
  line-height:1;
}

.stats-main{
  grid-template-columns:repeat(2,minmax(180px,220px));
  margin-bottom:16px;
}

.stat{
  padding:18px 18px;
  border-radius:20px;
}

.stat span{
  font-size:36px;
}

.grave-type-counts-hero{
  grid-template-columns:repeat(5,minmax(140px,1fr));
  gap:12px;
  margin-top:0;
}

.count-chip{
  padding:14px 14px;
  border-radius:16px;
  background:linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:0 8px 20px rgba(15,23,42,.04);
}

.count-chip strong{
  display:block;
  margin-bottom:4px;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--muted);
}

.count-chip{
  font-size:24px;
  line-height:1.1;
  font-weight:900;
  color:var(--text);
}

.meta-grid h3{
  margin-bottom:10px;
}

@media (max-width: 1100px){
  .grave-type-counts-hero{
    grid-template-columns:repeat(3,minmax(140px,1fr));
  }
}

@media (max-width: 760px){
  .grave-type-counts-hero{
    grid-template-columns:repeat(2,minmax(120px,1fr));
  }

  .counts-hero-head h2{
    font-size:24px;
  }
}


.parcel-body-segment{
  min-height: unset !important;
  height: calc(100% - 42px);
}

.custom-segment{
  display:flex;
  flex-direction:column;
}

.custom-segment.is-free .parcel-body-segment{
  flex:1 1 auto;
}

.custom-segment.is-occupied{
  background:#fff;
}

.occupied-block{
  height:auto;
  flex:1 1 auto;
  min-height:0;
}

.custom-segment-label{
  min-height:42px;
}

.segment-stack{
  background:#fff;
}

.custom-segment + .custom-segment{
  border-top:0;
}
