:root {
    --gsb-primary: #0f172a;
    /* Dark branding */
    --gsb-accent: #2563eb;
    /* Blue action */
    --gsb-bg: #f8fafc;
    --gsb-panel-bg: #ffffff;
    --gsb-border: #e2e8f0;
    --gsb-text: #334155;
    --gsb-text-light: #64748b;
    --gsb-toolbar-h: 50px;
    --gsb-header-h: 60px;
    --font-inter: 'Inter', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.gsb-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--gsb-bg);
    color: var(--gsb-text);
    font-family: var(--font-inter);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    font-size: 13px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.gsb-wrapper img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Allow pointer events for specific interactive images if any, but the builder usually handles these via canvas or buttons */
.gsb-logo {
    pointer-events: auto !important;
}

/* WordPress Admin Bar Fix */
body.admin-bar .gsb-wrapper {
    top: 32px;
    height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .gsb-wrapper {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

.hidden {
    display: none !important;
}

/* 1. Global Header */
.gsb-global-header {
    height: var(--gsb-header-h);
    background: #fff;
    border-bottom: 1px solid var(--gsb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.gsb-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gsb-logo {
    height: auto;
    max-height: 50px; /* Header is 60px */
}

.gsb-separator {
    color: var(--gsb-border);
}

.gsb-app-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gsb-primary);
    margin: 0;
    white-space: nowrap;
}

.gsb-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gsb-lang-selector {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    cursor: pointer;
}

.gsb-price-display {
    background: #eff6ff;
    color: var(--gsb-accent);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
}

/* Buttons */
.gsb-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.gsb-btn-primary {
    background: var(--gsb-accent);
    color: #fff;
    border-color: var(--gsb-accent);
}

.gsb-btn-primary:hover {
    background: #1d4ed8;
}

.gsb-btn-secondary {
    background: var(--gsb-primary);
    color: #fff;
}

.gsb-btn-secondary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.gsb-btn-outline {
    background: transparent;
    border-color: var(--gsb-border);
    color: var(--gsb-text);
}

.gsb-btn-outline:hover {
    border-color: var(--gsb-text-light);
}

.gsb-btn-icon {
    padding: 8px;
    background: transparent;
    font-size: 16px;
}

/* Main Layout */
.gsb-main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 2. Left Sidebar */
.gsb-left-sidebar {
    width: 400px;
    /* Increased from 320px */
    background: var(--gsb-panel-bg);
    border-right: 1px solid var(--gsb-border);
    display: flex;
    flex-shrink: 0;
}

.gsb-vertical-nav {
    width: 60px;
    border-right: 1px solid var(--gsb-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px;
    background: #f1f5f9;
}

.nav-item {
    width: 100%;
    padding: 15px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--gsb-text-light);
    cursor: pointer;
}

.nav-item.active {
    color: var(--gsb-accent);
    background: #fff;
    border-left: 3px solid var(--gsb-accent);
}

.nav-item .icon {
    font-size: 20px;
}

.nav-item .label {
    font-size: 10px;
    font-weight: 500;
}

.gsb-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gsb-panel-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
}

.upload-area-container {
    text-align: center;
    margin-bottom: 20px;
}

.full-width {
    width: 100%;
    justify-content: center;
}

.upload-hint {
    font-size: 11px;
    color: var(--gsb-text-light);
    margin-top: 5px;
    margin-bottom: 2px;
}

.upload-limit {
    font-size: 11px;
    color: var(--gsb-text-light);
    font-weight: 600;
    margin-bottom: 15px;
}

.gsb-drop-zone {
    margin-top: 15px;
    border: 2px dashed var(--gsb-border);
    border-radius: 8px;
    padding: 20px;
    color: var(--gsb-text-light);
    transition: all 0.2s;
}

.gsb-drop-zone:hover {
    border-color: var(--gsb-accent);
    color: var(--gsb-accent);
    background: #eff6ff;
}

.gsb-drop-zone .icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

/* Library Browser */
.gsb-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.gsb-library-item {
    background: #fff;
    border: 1px solid var(--gsb-border);
    border-radius: 6px;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gsb-library-item:hover {
    border-color: var(--gsb-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.gsb-library-item.bg-black {
    background: #000 !important;
    color: #fff;
}

.gsb-library-item.bg-transparent {
    background-image: linear-gradient(45deg, #eee 25%, transparent 25%),
        linear-gradient(-45deg, #eee 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eee 75%),
        linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
}

.gsb-library-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gsb-library-loader {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--gsb-text-light);
    font-size: 12px;
}

.gsb-pdf-preview-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--gsb-text-light);
    font-size: 20px;
}

.gsb-search-bar {
    position: relative;
    margin-bottom: 15px;
}

.gsb-search-bar input {
    width: 100%;
    padding: 8px 10px 8px 30px;
    border: 1px solid var(--gsb-border);
    border-radius: 6px;
    font-size: 13px;
}

.gsb-search-bar i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gsb-text-light);
}

/* Asset Cards (Detailed) */
.gsb-asset-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    padding-bottom: 20px;
}

.gsb-asset-card {
    background: #fff;
    border: 1px solid var(--gsb-border);
    border-radius: 8px;
    padding: 10px;
    position: relative;
    transition: all 0.2s;
}

.gsb-asset-card:hover {
    border-color: var(--gsb-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-actions-bottom {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
    justify-content: center;
}

.action-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--gsb-border);
    background: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    color: var(--gsb-text-light);
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f1f5f9;
    border-color: var(--gsb-text-light);
}

.action-btn.dup-btn:hover {
    color: var(--gsb-primary);
}

.action-btn.delete-btn {
    color: #ef4444;
    /* Permanent Red */
}

.action-btn.delete-btn:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

.card-inner {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

/* Left Col: Thumb + Name */
.card-left {
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.thumb-wrapper {
    width: 60px;
    height: 60px;
    background: #fff;
    border: 1px solid var(--gsb-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gsb-checkerboard {
    background-image:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

.asset-card-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.asset-name-sub {
    font-size: 11px;
    color: #475569;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right Col: Inputs */
.card-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-meta {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dotted #f1f5f9;
    opacity: 0.7;
}

.stat-item {
    font-size: 9px;
    color: var(--gsb-text-light);
}

.stat-item .val {
    font-weight: 600;
    color: var(--gsb-text);
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.grid-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grid-col .label {
    font-size: 10px;
    font-weight: 500;
    color: var(--gsb-text-light);
    text-transform: uppercase;
}

.bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-control .label {
    font-size: 10px;
    font-weight: 500;
    color: var(--gsb-text-light);
}

.dpi-indicator {
    text-align: left;
}

.dpi-status {
    font-size: 10px;
    font-weight: 700;
}

/* Compact Input Styles */
.input-wrapper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--gsb-accent);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dim-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--gsb-text);
    padding: 2px 0;
    text-align: left;
    outline: none;
}

.input-wrapper .unit {
    font-size: 10px;
    font-weight: 700;
    color: var(--gsb-text-light);
    margin-left: 4px;
}

.dim-input::-webkit-inner-spin-button,
.dim-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dpi-status.good {
    color: #15803d;
    /* Green */
}

.dpi-status.warn {
    color: #d97706;
    /* Yellow/Orange */
}

.dpi-status.min {
    color: #000000;
    /* Black */
}

.dpi-status.low {
    color: #dc2626;
    /* Red */
}

/* Quantity Compact */
.qty-row-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.qty-row-compact .label {
    width: auto;
    font-size: 12px;
}

.right-aligned {
    justify-content: flex-end;
}

.qty-stepper {
    display: flex;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    height: 24px;
}

.qty-val {
    width: 40px;
    text-align: center;
    border: none;
    font-size: 11px;
    font-weight: 700;
    color: var(--gsb-text);
    padding: 0;
    appearance: none;
    -moz-appearance: textfield;
}

.qty-val::-webkit-outer-spin-button,
.qty-val::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-btns {
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e2e8f0;
}

.step-btn {
    width: 18px;
    height: 12px;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    font-size: 8px;
    color: var(--gsb-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-btn:hover {
    background: #e2e8f0;
    color: var(--gsb-primary);
}

/* Buttons */
.card-buttons-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    /* Align right */
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.btn-pill {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 20px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #475569;
}

.btn-pill.primary {
    background: #006eb6;
    color: #fff;
    border-color: #006eb6;
    font-weight: 600;
}

.btn-pill.primary:hover {
    background: #005a96;
}

/* 3. Center Workspace */
.gsb-center-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

/* Top Toolbar */
.gsb-top-toolbar {
    height: var(--gsb-toolbar-h);
    background: #fff;
    border-bottom: 1px solid var(--gsb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    flex-shrink: 0;
    position: relative;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-section.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.toolbar-section.center>* {
    pointer-events: auto;
}

.toolbar-section.center .gsb-btn {
    padding: 5px 20px;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 110, 182, 0.2);
}

.tool-btn {
    background: none;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--gsb-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.tool-btn:hover {
    background: #f1f5f9;
}

.tool-btn svg {
    display: block;
}

.tool-btn.active {
    color: var(--gsb-accent);
    background: #eff6ff;
    border: 1px solid var(--gsb-accent);
    font-weight: 500;
}

#gsb-pan-btn.active {
    border: 2px solid var(--gsb-accent);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--gsb-border);
    margin: 0 5px;
}

.tool-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.tool-input-group select {
    padding: 4px 8px;
    border: 1px solid var(--gsb-border);
    border-radius: 4px;
    font-size: 12px;
}

.small-input {
    width: 50px;
    padding: 4px;
    border: 1px solid var(--gsb-border);
    border-radius: 4px;
}

.unit {
    color: var(--gsb-text-light);
}

.toolbar-section.right {
    gap: 12px;
}

.canvas-bg-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
}

.canvas-bg-controls label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gsb-text-light);
    margin-right: -2px;
}

.swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

.swatch:hover {
    transform: scale(1.15);
}

.swatch.transparent {
    background-image:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 6px 6px;
    background-position: 0 0, 3px 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#canvas-bg-picker {
    width: 24px;
    height: 24px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

.zoom-controls {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px 6px;
    gap: 6px;
}

#zoom-slider {
    width: 140px;
    /* Increased slightly for better control */
    height: 4px;
    cursor: pointer;
    accent-color: var(--gsb-accent);
}

.mini-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gsb-text);
}

.mini-btn:hover {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#zoom-display {
    font-size: 11px;
    min-width: 40px;
    text-align: center;
}

/* 4. Canvas Area */
.gsb-canvas-area {
    flex: 1;
    background: #e2e8f0;
    /* Back to gray */
    overflow: hidden;
    position: relative;
    /* Ruler Grid */
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: 40px 1fr;
}

#gang-sheet-canvas {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 160px 160px;
    background-position: 0 0, 80px 80px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
}

.gsb-ruler-corner {
    grid-column: 1;
    grid-row: 1;
    background: #fff;
    border-right: 1px solid var(--gsb-border);
    border-bottom: 1px solid var(--gsb-border);
    z-index: 10;
}

.gsb-ruler-top {
    grid-column: 2;
    grid-row: 1;
    background: #fff;
    border-bottom: 1px solid var(--gsb-border);
    position: relative;
    overflow: hidden;
}

.gsb-ruler-left {
    grid-column: 1;
    grid-row: 2;
    background: #fff;
    border-right: 1px solid var(--gsb-border);
    position: relative;
    overflow: hidden;
}

/* DPI Canvas Legend */
.gsb-canvas-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--gsb-border);
    padding: 12px;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-item .dot.optimal {
    background: #15803d;
}

.legend-item .dot.good {
    background: #d97706;
}

.legend-item .dot.minimum {
    background: #000000;
}

.legend-item .dot.bad {
    background: #dc2626;
}

.legend-item .label {
    font-size: 11px;
    font-weight: 500;
    color: var(--gsb-text);
}

.gsb-ruler-top canvas,
.gsb-ruler-left canvas {
    display: block;
}

#gsb-canvas-container {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    overflow: hidden;
    display: block;
}

#gsb-warnings-container {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
    pointer-events: none;
}

.gsb-warning-toast {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

.gsb-warning-toast.hidden {
    display: none;
}

.gsb-end-warning {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    color: #9a3412;
}

.gsb-nesting-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.gsb-nesting-overlay.hidden {
    display: none;
}

.nest-progress-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-width: 250px;
}

.nest-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--gsb-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.nest-text {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.nest-progress-bar {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}

.nest-progress-fill {
    width: 30%;
    height: 100%;
    background: var(--gsb-accent);
    border-radius: 3px;
    animation: pulse-progress 1.5s ease-in-out infinite;
}

@keyframes pulse-progress {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(300%);
    }
}

/* 6. Context Menu */
.gsb-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 4px;
    z-index: 1000;
    min-width: 140px;
    display: flex;
    flex-direction: column;
}

.context-menu-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #334155;
}

.context-menu-item:hover {
    background: #f1f5f9;
    color: var(--gsb-accent);
}

.context-menu-item.delete {
    color: #dc2626;
}

.context-menu-item.delete:hover {
    background: #fef2f2;
}

.gsb-right-sidebar {
    width: 280px;
    background: var(--gsb-panel-bg);
    border-left: 1px solid var(--gsb-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.gsb-sidebar-header {
    height: 40px;
    padding: 0 15px;
    border-bottom: 1px solid var(--gsb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gsb-sidebar-header h3 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.gsb-icon-btn {
    border: none;
    background: none;
    color: var(--gsb-accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.gsb-sheets-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.gsb-sheet-card {
    border: 1px solid var(--gsb-border);
    border-radius: 8px;
    padding: 12px 16px 12px 12px;
    /* Increased right padding */
    margin-bottom: 12px;
    background: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
}

.gsb-sheet-card.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

.card-top-row {
    display: flex;
    gap: 12px;
}

.preview-column {
    width: 90px;
    /* Reduced from 120px to give more room to info section */
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    /* Center preview thumbnail */
}

.sheet-thumb-preview {
    width: 70px;
    /* Narrower to match 55x100 aspect ratio better */
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Removed background: #f1f5f9; to avoid grey strips */
}

.preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sheet-info-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.sheet-name-display {
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-dots {
    border: none;
    background: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    font-size: 16px;
}

.menu-dots:hover {
    color: #dc2626;
}

.sheet-meta {
    font-size: 11px;
    color: #64748b;
}

.sheet-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Spaced out label and input */
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
}

.qty-input {
    width: 45px;
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
}

.sheet-price-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.sheet-name-edit {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    background: #f8fafc;
}

.sheet-name-edit:focus {
    outline: 1px solid #2563eb;
    background: #fff;
}

/* Global Loader Overlay */
.gsb-global-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    /* Dark semi-transparent backdrop */
    backdrop-filter: blur(4px);
    /* Modern blur effect */
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.gsb-global-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    background: #ffffff;
    padding: 32px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 340px;
    text-align: center;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f1f5f9;
    border-top: 4px solid var(--gsb-accent);
    border-radius: 50%;
    animation: gsb-spin 1s linear infinite;
}

@keyframes gsb-spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.loader-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gsb-primary);
    margin: 0;
}

.loader-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--gsb-text-light);
}

.loader-progress-bar {
    width: 200px;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.loader-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--gsb-accent);
    transition: width 0.1s linear;
    /* Smooths out JS updates */
}


/* Modal Overlay */
.gsb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200000;
    /* Higher than wrapper */
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

.gsb-modal-card {
    background: #fff;
    width: 420px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 10, 0.2), 0 10px 10px -5px rgba(0, 0, 10, 0.1);
    overflow: hidden;
    animation: gsbModalSlideUp 0.3s ease-out;
    position: relative;
    border: 1px solid var(--gsb-border);
}

@keyframes gsbModalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gsb-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--gsb-primary);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gsb-text-light);
    line-height: 1;
}

.modal-body {
    padding: 30px 20px;
    text-align: center;
}

.overflow-illustration {
    font-size: 52px;
    margin-bottom: 15px;
}

.overflow-message {
    font-size: 15px;
    color: var(--gsb-text);
    margin-bottom: 20px;
    line-height: 1.5;
    font-weight: 500;
}

.overflow-calc {
    background: #eff6ff;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--gsb-accent);
    font-weight: 600;
    border: 1px solid #dbeafe;
}

.modal-footer {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--gsb-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Custom Confirmation Modal Styling */
.confirm-modal {
    width: 400px;
    padding: 24px;
    text-align: center;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: #dc2626;
    /* Red for danger/confirm */
}

.confirm-modal h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--gsb-primary);
}

.confirm-modal p {
    margin: 0 20px 32px 20px;
    font-size: 14px;
    color: var(--gsb-text-light);
    line-height: 1.6;
}

.confirm-modal .modal-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0;
    background: none;
    border: none;
}

.confirm-modal .modal-footer .gsb-btn {
    min-width: 130px;
    padding: 10px 20px;
}

/* Auto Nesting Toggle */
.gsb-auto-nest-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid var(--gsb-border);
}

.gsb-auto-nest-toggle .toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--gsb-text);
}

/* Switch Styles */
.gsb-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.gsb-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gsb-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 18px;
}

.gsb-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.gsb-slider {
    background-color: var(--gsb-accent);
}

input:focus+.gsb-slider {
    box-shadow: 0 0 1px var(--gsb-accent);
}

input:checked+.gsb-slider:before {
    transform: translateX(16px);
}

/* Context Menu */
.gsb-context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid var(--gsb-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 100000;
    min-width: 160px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.context-menu-item {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--gsb-text);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.context-menu-item:hover {
    background: #f1f5f9;
}

.context-menu-item.delete {
    color: #ef4444;
}

.context-menu-item.delete:hover {
    background: #fef2f2;
}

.context-menu-item .icon {
    font-size: 14px;
    opacity: 0.8;
}

/* Sheet Size Picker Modal */
.gsb-size-picker-card {
    width: 560px;
    padding: 24px;
    text-align: center;
}

.gsb-size-picker-card h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--gsb-primary);
}

.gsb-size-picker-card p {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: var(--gsb-text-light);
    line-height: 1.6;
}

.gsb-size-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.gsb-size-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 12px;
    border: 2px solid var(--gsb-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
}

.gsb-size-option:hover {
    border-color: var(--gsb-accent);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

.gsb-size-option .size-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gsb-accent);
    background: #eff6ff;
    border-radius: 12px;
    transition: all 0.25s ease;
}

.gsb-size-option:hover .size-icon {
    background: var(--gsb-accent);
    color: #fff;
}

.gsb-size-option .size-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--gsb-primary);
}

.gsb-size-option .size-dimensions {
    font-size: 11px;
    color: var(--gsb-text-light);
    font-weight: 500;
}

.gsb-size-option .size-price {
    font-size: 13px;
    color: var(--gsb-accent);
    font-weight: 700;
    margin: 2px 0;
}

.gsb-size-option .gsb-size-select-btn {
    width: 100%;
    padding: 8px 16px;
    font-size: 12px;
    margin-top: 4px;
}

.gsb-size-picker-card .modal-footer {
    display: flex;
    justify-content: center;
    padding: 16px 0 0 0;
    background: none;
    border: none;
}

.gsb-size-picker-card .modal-footer .gsb-btn {
    min-width: 130px;
    padding: 10px 20px;
}

/* Pricing Legend (Bottom Right) */
.gsb-pricing-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--gsb-border);
    padding: 12px;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    min-width: 140px;
}

.gsb-pricing-legend.hidden {
    display: none;
}

.gsb-pricing-legend h4 {
    margin: 0 0 4px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--gsb-primary);
    border-bottom: 1px solid var(--gsb-border);
    padding-bottom: 4px;
}

.pricing-tiers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pricing-item {
    font-size: 11px;
    font-weight: 500;
    color: var(--gsb-text);
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.pricing-item span {
    color: var(--gsb-text-light);
}

.pricing-item strong {
    color: var(--gsb-accent);
}

/* =====================================================
   Mobile Notice Overlay
   ===================================================== */

.gsb-mobile-notice {
    position: absolute;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    padding: 24px;
    animation: gsb-notice-fade-in 0.4s ease;
}

@keyframes gsb-notice-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gsb-mobile-notice.hidden {
    display: none !important;
}

.gsb-mobile-notice-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 32px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    animation: gsb-card-slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gsb-card-slide-up {
    from { opacity: 0; transform: translateY(40px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gsb-mobile-notice-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
    line-height: 1;
}

.gsb-mobile-notice-title {
    font-family: var(--font-inter);
    font-size: 22px;
    font-weight: 700;
    color: var(--gsb-primary);
    margin: 0 0 16px;
    line-height: 1.3;
}

.gsb-mobile-notice-message {
    font-family: var(--font-inter);
    font-size: 14px;
    color: var(--gsb-text-light);
    line-height: 1.7;
    margin-bottom: 28px;
}

.gsb-mobile-notice-message p {
    margin: 0 0 10px;
}

.gsb-mobile-notice-message p:last-child {
    margin-bottom: 0;
}

.gsb-mobile-notice-divider {
    width: 48px;
    height: 3px;
    background: var(--gsb-accent);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.gsb-mobile-notice-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gsb-mobile-notice-actions .gsb-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 10px;
    justify-content: center;
}

.gsb-mobile-notice-actions .gsb-btn-primary {
    background: var(--gsb-accent);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

.gsb-mobile-notice-actions .gsb-btn-outline {
    border-color: var(--gsb-border);
    color: var(--gsb-text-light);
}
