.jb-ig-planner {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    color: #111;
}

.jb-ig-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.jb-ig-title {
    font-size: 20px;
    font-weight: 600;
}

.jb-ig-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jb-btn {
    padding: 8px 16px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.jb-btn-primary {
    background: #111;
    color: #fff;
    border-color: #111;
}

.jb-btn:hover {
    opacity: 0.85;
}

.jb-status {
    font-size: 13px;
    color: #666;
    margin-left: 8px;
}

.jb-ig-main {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ===== GRID ===== */
.jb-ig-grid-wrap {
    flex: 1;
    min-width: 0;
}

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

.jb-ig-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.jb-ig-cell {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
}

.jb-ig-cell.filled {
    border-style: solid;
    border-color: #ddd;
    cursor: grab;
}

.jb-ig-cell.posted {
    outline: 3px solid #22c55e;
}

.jb-ig-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.jb-ig-cell-empty-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 13px;
    pointer-events: none;
}

.jb-ig-cell-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
}

.jb-ig-cell:hover .jb-ig-cell-actions {
    display: flex;
}

.jb-ig-cell-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* ===== SIDEBAR ===== */
.jb-ig-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.jb-ig-sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.jb-ig-sidebar-header select,
.jb-ig-sidebar-header input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
}

.jb-ig-source-list {
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-right: 4px;
}

/* Robust 3:4 ratio using padding-bottom */
.jb-ig-source-item {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 133.333%; /* 4/3 = 133.333% for 3:4 portrait */
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
    border: 2px solid transparent;
    background: #eee;
    box-sizing: border-box;
}

.jb-ig-source-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.jb-ig-source-item:hover {
    border-color: #111;
}

/* Drag states */
.jb-ig-cell.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.jb-ig-dragging {
    opacity: 0.5;
}

/* Locked state */
.jb-ig-planner.locked .jb-ig-cell,
.jb-ig-planner.locked .jb-ig-source-item {
    cursor: default;
}

.jb-ig-planner.locked #jb-ig-add-row,
.jb-ig-planner.locked #jb-ig-save {
    display: none;
}

.jb-ig-planner.locked #jb-ig-unlock {
    display: inline-block !important;
}
/* Posted badge */
.jb-posted-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: #22c55e;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.3px;
}

/* Notes Panel */
#jb-notes-panel {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.jb-notes-inner {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.jb-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.jb-notes-header strong {
    font-size: 16px;
}

.jb-notes-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    color: #666;
}

.jb-notes-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
}

#jb-notes-text {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 14px;
}

.jb-notes-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}