/* Patio Planner screen: drawer on the left, plan in the middle, measurement sheet on the right. */
.pl { width: min(1600px, 100% - 1.2rem); margin-inline: auto; }
.pl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1.2rem; }
.pl-head h1 { margin: .35rem 0 .55rem; font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.1rem); }
.pl-head p { margin: 0 0 .55rem; color: var(--soft); font-size: 1.05rem; }
.planner-page .crumbs ol { margin-top: .6rem; }

/* one toolbar: edit on the left, view and checks on the right */
.pl-tools { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; gap: .3rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: .35rem .6rem; box-shadow: var(--lift); margin-bottom: .6rem; }
.pl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; font-size: .9rem; }
.pl-bar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .86rem/1.1 var(--body); background: transparent; color: var(--graph); border: 0; border-radius: 12px; padding: .3rem .55rem; min-width: 3.9rem; min-height: 50px; cursor: pointer; }
.pl-bar button:hover:not(:disabled) { background: #FFF0B8; }
.pl-bar button:disabled { color: #9A9D93; cursor: default; }
.pl-bar button.del:hover:not(:disabled) { background: #FBE3DC; color: #8A1F0E; }
.pl-bar button.round { min-width: 44px; width: 44px; height: 44px; min-height: 44px; border-radius: 50%; padding: 0; background: var(--sand-light); }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pl-bar .sep { width: 1px; height: 2.2rem; background: var(--line); margin: 0 .3rem; }
.pl-bar-view { gap: .35rem; }
.pl-bar label { display: flex; align-items: center; gap: .35rem; font-weight: 600; padding: 0 .3rem; min-height: 44px; }
.pl select, .pl input[type="number"], .pl input[type="text"] { font: 400 1rem var(--body); border: 1.5px solid #A8A28C; border-radius: 10px; padding: .3rem .45rem; background: #fff; color: var(--graph); min-height: 36px; }
.pl input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--grass); }

.pl-files button, .filters button, .pl-layouts button, #photo-controls button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 600 .96rem var(--body); background: #fff; color: var(--graph); border: 1.5px solid #CFC5A4; border-radius: 999px; padding: .35rem .85rem; min-height: 40px; cursor: pointer; }
.pl-files button:hover, .filters button:hover, .pl-layouts button:hover, #photo-controls button:hover { border-color: var(--graph); background: #FFF6D6; }
.pl-files .ico { width: 18px; height: 18px; }

.pl-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 320px; grid-template-areas: "drawer stage sheet"; border: 1px solid var(--line); border-radius: 22px; overflow: clip; background: #fff; align-items: start; box-shadow: var(--lift); }
.pl-drawer { grid-area: drawer; background: var(--sand-light); border-right: 1px solid var(--line); padding: 0 .8rem 1rem; align-self: stretch; }
.pl-sheet { grid-area: sheet; background: var(--paper); border-left: 1px solid var(--line); padding: 0 .8rem 1rem; align-self: stretch; font-size: 1rem; }
.pl-stage { grid-area: stage; position: relative; padding: .5rem; min-width: 0; position: sticky; top: 0; }
/* side columns scroll on their own so the plan stays in view */
@media (min-width: 1251px) { .pl-drawer, .pl-sheet { max-height: max(780px, calc(100vh - 1rem)); overflow-y: auto; } }
@media (min-width: 901px) and (max-width: 1250px) { .pl-drawer { max-height: max(780px, calc(100vh - 1rem)); overflow-y: auto; } }
.planner-page .crumbs { width: min(1600px, 100% - 1.2rem); }
.pl-drawer h2, .pl-sheet h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.12rem; margin: 1.1rem 0 .6rem; }
.pl-drawer h2::before, .pl-sheet h2::before { content: ""; width: 7px; height: 20px; border-radius: 4px; background: var(--grass); flex: none; }
.pl-sheet h3 { font-size: 1rem; margin: .8rem 0 .2rem; }
.pl-scroll { overflow: auto; max-height: 78vh; background: #C7DDA9; border-radius: 16px; min-height: 340px; text-align: center; }
#pl-svg [data-id], #pl-svg [data-handle] { touch-action: none; }
#pl-svg { display: block; max-width: none; margin: 0 auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#pl-svg .pc { cursor: grab; outline: none; }
#pl-svg .pc.is-on { cursor: grabbing; }
#pl-svg .pc .hit { stroke: none; }
#pl-svg .pc:focus-visible .hit { stroke: #17647A; stroke-width: 3px; vector-effect: non-scaling-stroke; }
#pl-svg .handle { cursor: pointer; }
#pl-svg .h-rot { cursor: alias; }
#pl-svg .h-size { cursor: nwse-resize; }
.pl-keys { font-size: .92rem; color: var(--soft); margin: .5rem 0; line-height: 1.4; }
.pl-files { display: flex; flex-wrap: wrap; gap: .35rem; }
.pl-files .danger { border-color: #8A1F0E; color: #8A1F0E; }
.pl-saved { font-size: .92rem; color: var(--soft); margin: .4rem 0 0; }

.pl-empty { position: absolute; inset: .5rem .5rem auto; min-height: 340px; display: flex; align-items: center; justify-content: center; background: rgba(43, 46, 42, .45); border-radius: 8px; padding: .8rem; z-index: 3; }
.pl-empty-card { background: var(--paper); border-radius: 24px; box-shadow: var(--lift-high); padding: .6rem 1.2rem .8rem; max-width: 29rem; font-size: 1.02rem; }
.pl-empty-card h2 { margin: .5rem 0; }
.pl-layouts { display: flex; flex-wrap: wrap; gap: .4rem; }
.pl button.link { background: none; border: 0; padding: .3rem 0; font: 600 1rem var(--body); color: var(--sky-deep); text-decoration: underline; cursor: pointer; margin-right: .8rem; }

.field { display: grid; gap: .15rem; font-weight: 600; font-size: .98rem; margin-bottom: .5rem; }
.field select, .field input { width: 100%; font-weight: 400; }
label.check { display: flex; align-items: center; gap: .45rem; font-weight: 600; margin: .4rem 0; }
.ftin { border: 0; padding: 0; margin: 0 0 .5rem; display: flex; gap: .6rem; }
.ftin legend { font-weight: 600; font-size: .98rem; padding: 0; margin-bottom: .15rem; }
.ftin label { display: flex; align-items: center; gap: .3rem; }
.ftin input { width: 5rem; }
.sub { font-weight: 700; margin: .7rem 0 .3rem; }
.pl details { margin-top: .7rem; }
.pl summary { cursor: pointer; font-weight: 700; padding: .3rem 0; }
.filters { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.filters button[aria-pressed="true"] { background: var(--graph); color: #fff; }
.filters button[aria-pressed="true"]::before { content: "✓ "; }
.shelf-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.shelf-list button { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: .2rem; background: #fff; border: 1.5px solid #E2D8B6; border-radius: 14px; box-shadow: 0 6px 14px -12px rgba(60, 48, 18, .6); transition: transform .12s ease; padding: .4rem .25rem; cursor: pointer; font: 600 .95rem/1.2 var(--body); color: var(--graph); }
.shelf-list button:hover { border-color: var(--grass); background: #FFFBEA; transform: translateY(-2px); }
.shelf-list small { display: block; font-weight: 400; color: var(--soft); font-size: .85rem; }
.shelf-list .icon { display: block; width: 100%; height: 52px; }
.shelf-list .icon svg { width: 100%; height: 100%; display: block; }

.tip { border-left: 6px solid var(--sky); border-radius: 14px; padding: .55rem .85rem; margin-bottom: .6rem; background: #E7F4F8; }
.tip p { margin: .2rem 0; line-height: 1.4; }
.tip-title { font-weight: 700; }
.tip-warn { background: #FFF1C2; border-left: 8px solid #B98300; }
.sel-name { font: 700 1.1rem var(--head); margin: 0 0 .4rem; }
.gaps { margin: .2rem 0; padding-left: 1.1rem; }
.piece-list { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow: auto; }
.piece-list button { width: 100%; text-align: left; display: grid; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: .3rem .5rem; margin-bottom: .3rem; cursor: pointer; font: 400 .96rem/1.35 var(--body); color: var(--graph); }
.piece-list button[aria-current] { border-color: var(--graph); border-width: 3px; background: #FFF6D6; }
.li-name { font-weight: 700; }
.li-pos { color: var(--soft); font-size: .9rem; }
.li-flag { color: #8A1F0E; font-weight: 700; font-size: .92rem; }
.limits { font-size: .95rem; }
.limits ul { padding-left: 1.1rem; }
.planner-after { margin-top: 2rem; }
#pl-print { display: none; }

@media (max-width: 1250px) {
  .pl-grid { grid-template-columns: 270px minmax(0, 1fr); grid-template-areas: "drawer stage" "sheet sheet"; }
  .pl-sheet { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; align-content: start; }
}
@media (max-width: 900px) {
  .pl-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "drawer" "sheet"; }
  .pl-stage { position: relative; }
  .pl-drawer { border-right: 0; border-top: 1px solid var(--line); }
  .shelf-list { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }
  .pl-sheet { grid-template-columns: 1fr; }
  .pl-tools { display: block; padding: .3rem .4rem; }
  .pl-bar { flex-wrap: nowrap; overflow-x: auto; }
  .pl-bar > * { flex: 0 0 auto; }
  .pl-bar button, .pl-files button, .filters button { min-height: 44px; }
  .pl-empty { position: static; background: none; padding: 0 0 .6rem; min-height: 0; }
}

@media print {
  body.planner-page > *:not(main), .planner-after, .pl > *:not(#pl-print) { display: none !important; }
  .pl { width: auto; margin: 0; }
  main { display: block; }
  #pl-print { display: block !important; font-size: 10.5pt; color: #000; }
  #pl-print p { margin: 0 0 3pt; }
  .print-brand { font: 800 13pt var(--head); }
  .print-title { font: 700 15pt var(--head); }
  .print-small { font-size: 9pt; }
  .print-plan, .print-bar { display: block; max-width: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-plan { margin: 6pt 0; break-inside: avoid; }
  #pl-print table { font-size: 10pt; margin-top: 6pt; border-collapse: collapse; }
  #pl-print table.whole { break-inside: avoid; }
  #pl-print thead { display: table-header-group; }
  #pl-print th, #pl-print td { padding: 2pt 6pt; border: 0.5pt solid #555; }
  #pl-print thead th { background: #fff; color: #000; }
  #pl-print tbody tr { background: #fff; break-inside: avoid; }
}
@media (max-width: 900px) { .pl-scroll { min-height: 0; } }
