/* ═══════════════════════════════════════════════════════════
   REGTRIX FLOOR PLAN — Visual Table Map
   ═══════════════════════════════════════════════════════════ */

/* ── Container ── */
.fp-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    min-height: 500px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-xl, 16px);
    overflow: hidden;
    position: relative;
}

/* Body row holds canvas + optional side panel */
.fp-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative; /* anchor for absolute side panel on mobile */
}

/* ── Toolbar ── */
.fp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-elevated, #f9fafb);
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
    /* Never wrap — scroll horizontally instead to preserve canvas height */
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    z-index: 10;
}
.fp-toolbar::-webkit-scrollbar { display: none; }

.fp-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fp-toolbar-right {
    /* Don't use margin-left:auto inside a scrollable toolbar — it breaks wrapping on mobile.
       Elements go to the right naturally when toolbar scrolls. */
    margin-left: 0;
}

/* Second toolbar row (viewer status filters) */
.fp-toolbar-row2 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: var(--bg-elevated, #f9fafb);
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.fp-toolbar-row2::-webkit-scrollbar { display: none; }

.fp-toolbar-label {
    font-size: 13px;
    color: var(--text-muted, #9ca3af);
    margin-right: 4px;
}

.fp-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    min-width: 34px;
    padding: 0 10px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--bg-surface, #fff);
    color: var(--text-secondary, #4b5563);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all .15s ease;
}
.fp-tb-btn:hover {
    background: var(--bg-hover, #f3f4f6);
    border-color: var(--text-muted, #9ca3af);
}

.fp-tb-save {
    background: var(--gradient-main, linear-gradient(135deg, #f59e0b, #f97316));
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}
.fp-tb-save:hover {
    /* Explicitly keep the gradient so bg-hover from fp-tb-btn:hover doesn't bleed through */
    background: var(--gradient-main, linear-gradient(135deg, #f59e0b, #f97316));
    filter: brightness(1.08);
    box-shadow: 0 6px 20px rgba(245, 158, 11, .4);
}

.fp-zoom-label {
    font-size: 12px;
    font-weight: 700;
    min-width: 44px;
    text-align: center;
    color: var(--text-secondary, #4b5563);
    font-variant-numeric: tabular-nums;
}

.fp-filter-btn {
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--bg-surface, #fff);
    color: var(--text-secondary, #4b5563);
    border-radius: var(--radius-full, 9999px);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all .15s ease;
    white-space: nowrap;
}
.fp-filter-btn:hover {
    background: var(--bg-hover, #f3f4f6);
}
.fp-filter-btn.active {
    /* Uses text-primary as bg → near-white in dark mode, near-black in light mode.
       bg-surface as text color → ensures contrast in both themes. */
    background: var(--text-primary, #111827);
    color: var(--bg-surface, #fff);
    border-color: transparent;
}
.fp-filter-btn[data-section]:not([data-section=""]).active {
    background: var(--sec-color, var(--text-primary));
    color: #fff;
}
.fp-filter-btn[data-status]:not([data-status=""]).active {
    background: var(--stat-color, var(--text-primary));
    color: #fff;
}

.fp-status-filters {
    display: flex;
    gap: 4px;
}

/* ── Canvas Wrapper ── */
.fp-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: default;
    touch-action: none;
}

.fp-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    transform-origin: center center;
    transition: transform .1s ease;
    background: var(--bg-surface, #fff);
}

/* ── Grid ── */
/* Dark mode (default :root) — light lines on dark canvas */
.fp-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,.08) .6px, transparent .6px);
    background-size:
        10% 10%,
        10% 10%,
        5% 5%;
    background-position: 0 0;
}
/* Light mode — dark lines on white canvas */
[data-theme="light"] .fp-grid {
    background-image:
        linear-gradient(to right, rgba(0,0,0,.07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,.07) 1px, transparent 1px),
        radial-gradient(circle, rgba(0,0,0,.09) .6px, transparent .6px);
}

/* Center crosshair origin */
.fp-grid::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 24px; height: 24px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1.5px dashed rgba(245,158,11,.3);
    pointer-events: none;
}
.fp-grid::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    width: 0; height: 100%;
    border-left: 1px dashed rgba(245,158,11,.12);
    pointer-events: none;
}

/* ── Section Zones ── */
.fp-section-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.fp-zone {
    position: absolute;
    border: 2px dashed var(--zone-color, #6b7280);
    border-radius: 16px;
    background: color-mix(in srgb, var(--zone-color, #6b7280) 5%, transparent);
    transition: all .3s ease;
}

.fp-zone-label {
    position: absolute;
    top: -12px;
    left: 12px;
    background: var(--zone-color, #6b7280);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: var(--radius-full, 9999px);
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

/* ── Table Layer ── */
.fp-table-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
}

/* ── Table Element ── */
.fp-table {
    position: absolute;
    cursor: pointer;
    user-select: none;
    transition: box-shadow .2s ease, transform .1s ease, opacity .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--table-bg, #6b7280);
    color: var(--table-text, #fff);
    box-shadow: 0 4px 16px var(--table-glow, rgba(0,0,0,.15));
    z-index: 10;
}

.fp-table:hover {
    z-index: 20;
    box-shadow:
        0 6px 24px var(--table-glow, rgba(0,0,0,.2)),
        0 0 0 3px rgba(255,255,255,.5);
    transform: scale(1.03);
}

.fp-table.fp-selected {
    z-index: 25;
    box-shadow:
        0 0 0 3px #fff,
        0 0 0 5px var(--table-bg, #6b7280),
        0 8px 30px var(--table-glow, rgba(0,0,0,.25));
}

.fp-table.fp-dragging-active {
    opacity: .8;
    cursor: grabbing;
    z-index: 30;
}

.fp-table.fp-dimmed {
    opacity: .2;
    filter: grayscale(.6);
    pointer-events: none;
}

/* Shapes */
.fp-shape-circle { border-radius: 50%; }
.fp-shape-square { border-radius: 12px; }
.fp-shape-rectangle { border-radius: 12px; }
.fp-shape-oval { border-radius: 50%; }

/* Force 1:1 aspect ratio for circle and square so they stay round/square
   regardless of canvas aspect ratio on any screen size */
.fp-shape-circle,
.fp-shape-square {
    aspect-ratio: 1 / 1;
    height: auto !important;
}

/* ── Table Content ── */
.fp-table-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
    padding: 4px;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.fp-table-name {
    font-size: clamp(9px, 1.2vw, 13px);
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0,0,0,.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.fp-table-cap {
    font-size: clamp(8px, 1vw, 11px);
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 3px;
}

.fp-table-guest {
    font-size: clamp(7px, .85vw, 10px);
    font-weight: 600;
    font-style: normal;
    color: #fff;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(4px);
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 88%;
    line-height: 1.5;
    text-shadow: none;
    border: 1px solid rgba(255,255,255,.15);
}

/* ── Chairs ── */
.fp-chairs {
    position: absolute;
    inset: -12%;
    pointer-events: none;
    z-index: 1;
}

.fp-chair {
    position: absolute;
    width: 14%;
    height: 14%;
    background: rgba(0,0,0,.15);
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: background .2s ease;
}

.fp-table:hover .fp-chair {
    background: rgba(0,0,0,.25);
    border-color: rgba(255,255,255,.5);
}

/* ── Selection Ring ── */
.fp-select-ring {
    position: absolute;
    inset: -4px;
    border: 2px dashed transparent;
    border-radius: inherit;
    pointer-events: none;
    transition: border-color .2s ease;
}
.fp-selected .fp-select-ring {
    border-color: var(--table-bg, #6b7280);
    animation: fp-pulse 1.5s infinite;
}

@keyframes fp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* ── Resize Handle ── */
.fp-resize-handle {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid var(--table-bg, #6b7280);
    border-radius: 3px;
    cursor: se-resize;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 30;
}
.fp-selected .fp-resize-handle {
    opacity: 1;
}

/* ── Popover ── */
.fp-popover {
    position: absolute;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 20px 60px rgba(0,0,0,.15), 0 4px 16px rgba(0,0,0,.08);
    min-width: 260px;
    max-width: 320px;
    z-index: 100;
    overflow: hidden;
    animation: fp-pop-in .15s ease;
}

@keyframes fp-pop-in {
    from { opacity: 0; transform: translateY(6px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.fp-pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.fp-pop-header strong {
    font-size: 15px;
    color: var(--text-primary, #111);
}
.fp-pop-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full, 9999px);
    color: #fff;
}

.fp-pop-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}
.fp-pop-details i {
    margin-right: 3px;
    width: 14px;
    text-align: center;
}

.fp-pop-reservations {
    padding: 0 16px 10px;
}
.fp-pop-res-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 6px;
}
.fp-pop-res {
    display: block;
    padding: 8px 10px;
    background: var(--bg-elevated, #f9fafb);
    border-radius: var(--radius, 8px);
    margin-bottom: 4px;
    text-decoration: none;
    transition: background .15s ease;
}
.fp-pop-res:hover {
    background: var(--bg-hover, #f3f4f6);
}
.fp-pop-res-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111);
}
.fp-pop-res-info {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    margin-top: 2px;
}
.fp-code {
    font-family: var(--font-mono, monospace);
    background: rgba(245, 158, 11, .1);
    color: var(--accent, #f59e0b);
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

.fp-pop-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted, #9ca3af);
}
.fp-pop-empty i {
    margin-right: 6px;
}

.fp-pop-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-elevated, #f9fafb);
    border-top: 1px solid var(--border, #e5e7eb);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent, #f59e0b);
    text-decoration: none;
    transition: background .15s ease;
}
.fp-pop-action:hover {
    background: var(--bg-hover, #f3f4f6);
}

/* ── Side Panel ── */
.fp-side-panel {
    width: 280px;
    min-width: 280px;
    background: var(--bg-elevated, #f9fafb);
    border-left: 1px solid var(--border, #e5e7eb);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.fp-sp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
}
.fp-sp-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #111);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.fp-sp-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #9ca3af);
    background: var(--bg-surface, #fff);
    padding: 2px 8px;
    border-radius: var(--radius-full, 9999px);
    border: 1px solid var(--border, #e5e7eb);
}

/* Accordion sections */
.fp-sp-sections {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fp-sp-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-bottom: 1px solid var(--border, #e5e7eb);
    transition: flex .2s ease;
}

/* Collapsed: only show title */
.fp-sp-section.fp-collapsed {
    flex: 0 0 auto;
}
.fp-sp-section.fp-collapsed .fp-sp-section-body {
    display: none;
}
.fp-sp-section.fp-collapsed .fp-sp-chevron {
    transform: rotate(-90deg);
}

/* Expanded: take proportional space */
.fp-sp-section:not(.fp-collapsed) {
    flex: 1 1 0;
}

.fp-sp-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted, #9ca3af);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    transition: background .1s ease;
}
.fp-sp-section-title:hover {
    background: rgba(0,0,0,.03);
}
.fp-sp-section-title i {
    font-size: 11px;
}
.fp-sp-section-badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    color: var(--text-muted, #9ca3af);
    padding: 1px 6px;
    border-radius: var(--radius-full, 9999px);
    margin-left: auto;
}
.fp-sp-chevron {
    font-size: 9px;
    margin-left: auto;
    transition: transform .2s ease;
    color: var(--text-muted, #9ca3af);
}

.fp-sp-section-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 10px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border, #e5e7eb) transparent;
}
.fp-sp-section-body::-webkit-scrollbar {
    width: 4px;
}
.fp-sp-section-body::-webkit-scrollbar-track {
    background: transparent;
}
.fp-sp-section-body::-webkit-scrollbar-thumb {
    background: var(--border, #e5e7eb);
    border-radius: 2px;
}

.fp-sp-hint {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    font-style: italic;
    margin-bottom: 6px;
    padding: 0;
}

/* Unplaced table cards */
.fp-sp-table-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 8px);
    margin-bottom: 6px;
    cursor: grab;
    transition: all .15s ease;
}
.fp-sp-table-card:hover {
    border-color: var(--accent, #f59e0b);
    box-shadow: 0 2px 8px rgba(245, 158, 11, .15);
}
.fp-sp-table-card.fp-dragging {
    opacity: .5;
}

.fp-sp-table-icon {
    width: 32px;
    height: 32px;
    background: var(--text-muted, #9ca3af);
    flex-shrink: 0;
}
.fp-sp-table-icon.fp-shape-circle { border-radius: 50%; }
.fp-sp-table-icon.fp-shape-square { border-radius: 6px; }
.fp-sp-table-icon.fp-shape-rectangle { border-radius: 6px; width: 40px; height: 26px; }
.fp-sp-table-icon.fp-shape-oval { border-radius: 50%; width: 40px; height: 26px; }

.fp-sp-table-info strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary, #111);
}
.fp-sp-table-info small {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
}

/* Placed table rows */
.fp-sp-placed { display: flex; flex-direction: column; gap: 2px; }

.fp-sp-table-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: background .1s ease;
}
.fp-sp-table-row:hover {
    background: var(--bg-surface, #fff);
}

.fp-sp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fp-sp-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111);
    flex: 1;
}

.fp-sp-sec {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
}

.fp-sp-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    border-radius: 4px;
    font-size: 11px;
    transition: all .1s ease;
    opacity: 0;
}
.fp-sp-table-row:hover .fp-sp-remove {
    opacity: 1;
}
.fp-sp-remove:hover {
    background: rgba(239, 68, 68, .1);
    color: #ef4444;
}

/* ── Properties Panel ── */
.fp-sp-props {
    background: rgba(245, 158, 11, .04);
}

.fp-prop-group {
    margin-bottom: 12px;
}
.fp-prop-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted, #9ca3af);
    margin-bottom: 6px;
    display: block;
}

.fp-shape-picker {
    display: flex;
    gap: 6px;
}
.fp-shape-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border, #e5e7eb);
    background: var(--bg-surface, #fff);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    transition: all .15s ease;
}
.fp-shape-opt:hover {
    border-color: var(--text-muted, #9ca3af);
}
.fp-shape-opt.active {
    border-color: var(--accent, #f59e0b);
    background: rgba(245, 158, 11, .08);
}

.fp-shape-preview {
    display: block;
    background: var(--text-muted, #9ca3af);
}
.fp-shape-preview.fp-shape-circle { width: 20px; height: 20px; border-radius: 50%; }
.fp-shape-preview.fp-shape-square { width: 20px; height: 20px; border-radius: 4px; }
.fp-shape-preview.fp-shape-rectangle { width: 28px; height: 16px; border-radius: 4px; }
.fp-shape-preview.fp-shape-oval { width: 28px; height: 16px; border-radius: 50%; }

.fp-shape-opt.active .fp-shape-preview {
    background: var(--accent, #f59e0b);
}

.fp-rotation-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fp-rotation-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--border, #e5e7eb);
    outline: none;
}
.fp-rotation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent, #f59e0b);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.fp-rotation-val {
    font-size: 12px;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
    color: var(--text-secondary, #4b5563);
    font-variant-numeric: tabular-nums;
}

.fp-size-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fp-size-val {
    font-size: 14px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    color: var(--text-primary, #111);
}

/* ── Panel toggle (shows only on mobile) ── */
.fp-tb-panel-toggle {
    display: none;
}

/* ── Panel handle (shows only on mobile) ── */
.fp-sp-handle {
    display: none;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .fp-container {
        height: 75vh;
        min-height: 420px;
    }

    /* Canvas wrapper fills the entire body — panel overlays it */
    .fp-body {
        position: relative;
        /* Keep flex-direction: row (default) — canvas always fills the space */
    }

    /* Side panel: slide-up overlay from the bottom of the map body */
    .fp-side-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        min-width: auto;
        height: auto;
        max-height: 65%;
        border-left: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 40px rgba(0,0,0,.3);
        z-index: 40;
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    }

    .fp-side-panel.fp-panel-open {
        transform: translateY(0);
    }

    /* Drag handle at top of panel */
    .fp-sp-handle {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 10px 0 6px;
        flex-shrink: 0;
        cursor: grab;
    }
    .fp-sp-handle::after {
        content: '';
        width: 44px;
        height: 4px;
        background: var(--border-strong, rgba(128,128,128,.3));
        border-radius: 2px;
    }

    /* Panel toggle button visible on mobile */
    .fp-tb-panel-toggle {
        display: inline-flex;
    }

    /* Compact toolbar items */
    .fp-toolbar {
        padding: 8px 12px;
        gap: 8px;
    }

    .fp-toolbar-group {
        flex-shrink: 0;
        gap: 4px;
    }

    .fp-filter-btn {
        font-size: 11px;
        padding: 0 10px;
        height: 30px;
        white-space: nowrap;
    }

    .fp-tb-btn {
        height: 32px;
        min-width: 32px;
        padding: 0 8px;
    }

    .fp-popover {
        min-width: 220px;
        max-width: min(320px, calc(100vw - 24px));
    }
}

@media (max-width: 600px) {
    .fp-container {
        height: 72vh;
        min-height: 380px;
        border-radius: 12px;
    }

    .fp-toolbar {
        padding: 6px 10px;
        gap: 6px;
    }

    .fp-tb-btn {
        height: 30px;
        min-width: 30px;
        padding: 0 6px;
        font-size: 12px;
    }

    .fp-zoom-label {
        min-width: 36px;
        font-size: 11px;
    }

    /* Popover full width on very small screens */
    .fp-popover {
        left: 8px !important;
        right: 8px !important;
        max-width: none !important;
        min-width: auto;
    }
}

/* ── Dark mode support ── */
@media (prefers-color-scheme: dark) {
    .fp-chair {
        background: rgba(255,255,255,.12);
        border-color: rgba(255,255,255,.2);
    }
    .fp-table:hover .fp-chair {
        background: rgba(255,255,255,.2);
    }
}

/* Dark mode via class (if your app uses it) */
.dark .fp-chair,
[data-theme="dark"] .fp-chair {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.2);
}
