/* Plan sală: lista de participanți în stânga, mesele în dreapta. Temă luminoasă. */

.plan { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1600px; margin: 0 auto; padding: 24px 24px 96px; }

/* Stânga: participanții */
.pl-side { position: sticky; top: 88px; max-height: calc(100vh - 112px); max-height: calc(100dvh - 112px); display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.pl-side-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.pl-side-h h2 { font-size: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid #C2CBC3; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { border-color: var(--pine); background: var(--pine); color: #F4F7F3; font-weight: 700; }
.pl-list { flex: 1; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0 -8px; padding: 0; }
.pl-list > li + li { border-top: 1px solid var(--line-2); }
.prow { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 6px 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.prow:hover { background: var(--surface-2); }
.pmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pn { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 15px; }
.pn b { font-weight: 600; overflow-wrap: anywhere; }
.ps { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ps.none { color: var(--bad); font-weight: 600; }

/* Inițialele, în culoarea globului */
.av { width: 28px; height: 28px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--tc); color: var(--tct); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.av.light { box-shadow: inset 0 0 0 1px #AEB8B1; }
.av.none { background: transparent; border: 1.5px dashed #8A968F; color: var(--muted); }
.mem { flex: none; color: #9A7414; font-size: 13px; line-height: 1; }
.okm { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); }
.okm .ic { width: 12px; height: 12px; }

/* Dreapta: mesele */
.pl-floor { min-width: 0; display: flex; flex-direction: column; gap: 32px; }
.pl-alerts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: -8px; }
.alert { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid #EBD3A6; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 600; text-align: left; }
.alert:hover { border-color: #D9B46E; }
.alert i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #C9861F; }
.sec-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.sec-h h2 { font-size: 22px; }
.pl-grid { display: grid; gap: 16px; align-items: start; }
.pl-grid.vip { grid-template-columns: repeat(auto-fill, minmax(192px, 1fr)); }
.pl-grid.com { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }

/* Cardul mesei. Conturul se colorează când tragi pe el: albastru primește, roșu nu. */
.tcard, .pl-party { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); outline: 2px solid transparent; outline-offset: -1px; transition: background .15s, outline-color .15s, opacity .15s; }
.tcard.is-empty { background: var(--surface-2); }
.tc-h { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.tc-h .glob { --s: 22px; margin-top: 4px; }
.tc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tc-t b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-family: var(--display); font-size: 18px; font-weight: 700; line-height: 1.15; }
.tc-t > span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.occ { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--line-2); color: #3D4A43; font-family: var(--display); font-size: 15px; font-weight: 700; }
.occ.full { background: var(--ok-bg); color: var(--ok); }
.occ.over { background: var(--bad-bg); color: var(--bad); }
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.seat { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.25; text-align: left; }
button.seat:hover { background: #EDF1EC; }
.seat .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.seat.free { border: 1.5px dashed #C7CFC8; background: transparent; color: var(--muted); }
.seat.free .av, .seat.pending .av { background: transparent; border: 1.5px dashed #C7CFC8; }
.seat.pending { border: 1.5px dashed #D9BE73; background: #FBF5E6; color: #5E470B; }
.seat.pending .av { border-color: #D9BE73; }
.tc-f { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding-top: 8px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.tc-f > span { min-width: 0; overflow-wrap: anywhere; }
.tc-edit { min-height: 32px; padding: 0 2px; font-size: 13px; }

.tcard.is-over, .pl-party.is-over { outline-color: var(--blue); background: var(--blue-bg); }
.tcard.is-bad, .pl-party.is-bad { outline-color: var(--bad); background: var(--bad-bg); }
.tcard.is-dim, .pl-party.is-dim { opacity: 0.45; }
.tcard.flash, .pl-party.flash { animation: flash 1.2s ease-out; }
.tcard.shake, .pl-party.shake { outline-color: var(--bad); animation: shake .4s ease-in-out; }
@keyframes flash { 0%, 40% { outline-color: var(--blue); background: var(--blue-bg); } }
@keyframes shake { 15%, 85% { translate: -2px 0; } 30%, 70% { translate: 4px 0; } 45% { translate: -5px 0; } 60% { translate: 5px 0; } }

/* Party (în picioare) și Bradul Comunității */
.pl-bottom { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.pl-parties { flex: 2 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ppills { display: flex; flex-wrap: wrap; gap: 8px; }
.ppill { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 14px; }
.ppill:hover { background: #EDF1EC; }
.ppill .av { width: 28px; height: 28px; }
.pl-tree { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--pine); color: #F4F7F3; }
.pl-tree h2 { font-size: 20px; }
.tr-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 14px; color: #B9C9BF; }
.tr-row b { font-family: var(--display); font-size: 24px; color: #F4F7F3; }
.pl-tree .dbar { height: 8px; border-radius: 999px; background: #1F4136; overflow: hidden; }
.pl-tree .dbar > i { display: block; height: 100%; border-radius: 999px; background: var(--d-ok); transition: width .25s; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; }
.legend li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: #DCE6DF; }
.legend li > span { min-width: 0; overflow-wrap: anywhere; }
.legend b { font-weight: 600; color: #F4F7F3; }
.legend .glob { --s: 14px; }
.legend .glob.light { border-color: transparent; }

/* Comutatorul Hartă / Carduri și „Așază mesele” */
.pl-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: -8px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--line-2); }
.seg-b { min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; }
.seg-b[aria-pressed="true"] { background: var(--surface); color: var(--pine); box-shadow: inset 0 0 0 1px var(--line); }
.pl-edit { min-height: 40px; }
.pl-edit[aria-pressed="true"] { border-color: var(--pine); background: var(--pine); color: #F4F7F3; }
.pl-main { display: flex; flex-direction: column; gap: 32px; min-width: 0; }

/* Harta: desenul sălii în stânga, masa aleasă în dreapta */
.pl-mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.pl-map { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.pl-detail { position: sticky; top: 88px; min-width: 0; }
.pl-detail-empty { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1.5px dashed #C7CFC8; border-radius: 16px; color: var(--muted); font-size: 15px; }
.pl-detail-empty b { color: var(--ink); }
.map-hint { padding: 8px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 600; }
.map { display: block; width: 100%; height: auto; overflow: visible; -webkit-user-select: none; user-select: none; }
@media (max-width: 1280px) {
  .pl-mapgrid { grid-template-columns: minmax(0, 1fr); }
  .pl-detail { position: static; }
}

/* Decorul: bar, canapele, zona DJ, recepția, intrările */
.m-bar { fill: var(--pine); }
.m-bar-t { fill: #F4F7F3; font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: 0.3em; text-anchor: middle; }
.m-sofa { fill: none; stroke: #C9D2CA; stroke-width: 12; stroke-linecap: round; }
.m-zone { fill: none; stroke: #AEB8B1; stroke-width: 1.5; stroke-dasharray: 6 6; }
.m-zone-t, .m-rec-t, .m-acc-t { fill: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; }
.m-rec { fill: var(--surface-2); stroke: #AEB8B1; stroke-width: 1; }
.m-rec-t { font-size: 12px; text-anchor: middle; }
.m-counter { fill: #8A968F; }
.m-acc, .m-acc-t { fill: #2E7D55; }
.m-acc-t { text-anchor: middle; }

/* Mesele de pe hartă. Locurile nefolosite rămân doar un contur subțire. */
.mt-shape { fill: var(--surface); stroke: #D3DAD4; stroke-width: 1; transition: fill .15s, stroke .15s; }
.mt.free .mt-shape { fill: transparent; }
.mt.edit { cursor: pointer; }
.mt.used.edit { cursor: grab; }
.mt.free.edit .mt-shape { stroke: #9AA59D; stroke-dasharray: 5 5; }
.mt.free.edit:hover .mt-shape { fill: var(--blue-bg); stroke: var(--blue); }
.mt.used { cursor: pointer; }
.mt.used .mt-shape { stroke: var(--pine); stroke-width: 1.5; }
.mt.used:hover .mt-shape { fill: var(--surface-2); }
.mt.sel .mt-shape { stroke-width: 3.5; }
.mt text, .mt-glob, .mt-cap { pointer-events: none; }
.mt-glob { fill: var(--tc); }
.mt-glob.light { stroke: #AEB8B1; stroke-width: 1; }
.mt-cap { fill: #B9A980; }
.mt-label { fill: var(--ink); font-family: var(--display); font-size: 21px; font-weight: 700; text-anchor: middle; }
.mt-occ { fill: var(--muted); font-size: 15px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
.mt.full .mt-occ { fill: var(--ok); }
.mt-org { fill: var(--pine); font-weight: 800; }
.mt-id { fill: #7A867E; font-size: 14px; font-weight: 600; text-anchor: middle; }
.mt:focus { outline: none; }
.mt:focus-visible .mt-shape { stroke: var(--blue); stroke-width: 3.5; }
.mt.is-over .mt-shape { fill: var(--blue-bg); stroke: var(--blue); stroke-width: 3.5; }
.mt.is-bad .mt-shape { fill: var(--bad-bg); stroke: var(--bad); stroke-width: 3.5; }
.mt.is-dim { opacity: 0.45; }
.mt.shake { animation: shake .4s ease-in-out; }
.mt.shake .mt-shape { stroke: var(--bad); stroke-width: 3.5; }
.mt.flash .mt-shape { animation: mflash 1.2s ease-out; }
@keyframes mflash { 0%, 40% { fill: var(--blue-bg); stroke: var(--blue); } }

/* Zona Party pe ring: contur punctat, în nuanța globului argintiu */
.ma.used .ma-shape { fill: #F1F3F5; stroke: #8F989F; stroke-width: 1.5; stroke-dasharray: 7 5; }
.ma.used:hover .ma-shape { fill: #E8ECEF; }

/* Bulinele din jurul mesei: inițialele celor așezați, în culoarea globului; punct verde = a sosit */
.ms-g { cursor: pointer; }
.ms-taken { fill: var(--tc); stroke: #FFFFFF; stroke-width: 1.5; }
.ms-g.light .ms-taken { stroke: #AEB8B1; }
.ms-g:hover .ms-taken { stroke: var(--ink); }
.ms-t { fill: var(--tct); font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; text-anchor: middle; }
.ms-free { fill: none; stroke: #B5BFB8; stroke-width: 1.2; stroke-dasharray: 3 3; }
.ms-pending { fill: #FBF5E6; stroke: #D9BE73; stroke-width: 1.2; stroke-dasharray: 3 3; }
.ms-ok { fill: #2E7D55; stroke: #FFFFFF; stroke-width: 1.2; pointer-events: none; }
.ms-okp { fill: none; stroke: #FFFFFF; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ms-g.just .ms-taken { animation: msjust .9s ease-out; }
@keyframes msjust { 0%, 30% { stroke: var(--blue); stroke-width: 4; } }

/* Mărimea hărții: −, +, Toată sala. Mărită, harta se deplasează în cutia ei. */
.map-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.map-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.lg-dot, .lg-ok { display: inline-block; flex: none; border-radius: 50%; }
.lg-dot { width: 14px; height: 14px; background: #7A867E; }
.lg-ok { width: 10px; height: 10px; margin-left: 8px; background: #2E7D55; }
.zoom { display: inline-flex; align-items: center; gap: 4px; }
.z-b { min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid #C2CBC3; border-radius: 10px; background: var(--surface); font-size: 19px; font-weight: 700; line-height: 1; }
.z-b:hover:not(:disabled) { background: var(--surface-2); }
.z-b:disabled { opacity: 0.4; }
.z-fit { font-size: 14px; font-weight: 600; }
.z-v { min-width: 48px; text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.map-scroll { width: 100%; overflow: hidden; border-radius: 10px; touch-action: pan-x pan-y; }
.map-scroll.zoomed { overflow: auto; overscroll-behavior: contain; }

/* Mesele care nu sunt (încă) pe hartă */
.offmap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.om { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; outline: 2px solid transparent; outline-offset: -1px; }
.om .glob { --s: 16px; margin-top: 3px; }
.om .num { color: var(--muted); }
.om.sel { border-color: var(--pine); }
.om.is-over { outline-color: var(--blue); background: var(--blue-bg); }
.om.is-bad, .om.shake { outline-color: var(--bad); background: var(--bad-bg); }
.om.is-dim { opacity: 0.45; }
.om.edit { cursor: grab; }
/* „Așază mesele”: zona de sub hartă primește mesele scoase de pe hartă */
.offmap.edit { padding: 12px; border: 2px dashed #B5BFB8; border-radius: 14px; outline: 2px solid transparent; outline-offset: -2px; transition: background .15s, border-color .15s; }
.offmap.edit > .meta { flex: 1 1 100%; }
.offmap.edit.is-over { border-color: var(--blue); background: var(--blue-bg); }

/* Ștergerea unei mese goale: întâi întrebăm */
.link-btn.danger { align-self: flex-start; color: var(--bad); }
.btn-danger { min-height: 48px; border: 0; border-radius: 12px; background: var(--bad); color: #FFFFFF; font-size: 15px; font-weight: 700; padding: 0 12px; }
.del-confirm { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid #F0C3C6; border-radius: 14px; background: var(--bad-bg); color: #5C1218; font-size: 15px; }

/* Fișa unui loc (adminul așază mesele) */
.slot-h { padding-top: 8px; font-size: 26px; }
.sub-h { margin-bottom: -8px; font-family: var(--body); font-size: 13px; font-weight: 600; color: var(--muted); }
.slot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; font-size: 15px; font-weight: 600; }
.sheet .seg-b { min-height: 44px; }

/* Locurile, gazda și nota mesei */
.tform { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.st-b { width: 48px; height: 48px; border: 1px solid #C2CBC3; border-radius: 12px; background: var(--surface); font-size: 22px; font-weight: 700; line-height: 1; }
.st-b:hover:not(:disabled) { background: var(--surface-2); }
.st-b:disabled { opacity: 0.4; }
.st-v { min-width: 44px; text-align: center; font-family: var(--display); font-size: 24px; }
.tf-f { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.tf-f input { height: 48px; padding: 0 12px; border: 1px solid #C2CBC3; border-radius: 12px; background: var(--surface); font-size: 16px; font-weight: 400; }
.tf-f input:focus { outline: 2px solid var(--pine); outline-offset: 1px; }

/* Tragerea: numele „ridicat” urmează cursorul sau degetul. Singurul loc cu umbră, în afară de fișă. */
[data-drag] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (pointer: fine) { [data-drag] { cursor: grab; } }
body.dragging, body.dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; display: flex; align-items: center; gap: 8px; max-width: 280px; padding: 4px 16px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: 0 12px 32px rgba(10, 18, 15, 0.22); rotate: -2deg; }
.drag-ghost > span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* Ce s-a schimbat pe alt ecran clipește o dată. */
.prow.just, .seat.just, .ppill.just { animation: just .9s ease-out; }
@keyframes just { 0%, 30% { background: #CFE3FA; } }

/* Pe telefon și tabletă: o singură coloană, ținte de minimum 48 px */
/* Când o masă e adusă în față, să nu rămână sub bara de sus. */
#pl-mapbox, [data-drop], #pl-detail { scroll-margin-top: 136px; scroll-margin-bottom: 24px; }

@media (max-width: 900px) {
  .plan { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 96px; }
  .pl-map { padding: 8px; }
  .pl-side { position: static; max-height: none; }
  .pl-list { max-height: 50vh; }
}
@media (pointer: coarse) {
  .chip, .alert, .ppill, .om, .seg-b, .pl-edit, .z-b { min-height: 48px; }
  .z-b { min-width: 48px; }
  .prow, .seat { min-height: 48px; }
}
