:root {
    --seat-size: 135px;
    --gap: 10px;
    --accent: #F09E0B;
    --border: #64748b;
    --muted: #cccccc;
}

/* Override main margins for full-width layout */
main {
    margin: 1rem 0;
    padding: 1rem;
    max-width: none;
    overflow-x: auto; /* Enable horizontal scrolling when content is too wide */
}

.layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
    min-width: 400px; /* Minimum width to prevent layout breaking */
}

.panel {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    background: #2C3F4A;
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

input[type="number"], input[type="text"] {
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #1a252f;
    color: #fff;
}

#titleInput {
    width: min(480px, 100%);
}

button {
    border: 1px solid #e5e7eb;
    background: #F09E0B;
    color: #1a252f;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

button.primary {
    background: #F09E0B;
    color: #1a252f;
    border-color: #F09E0B;
}

h3, h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #F09E0B;
    margin-bottom: 12px;
    margin-top: 16px;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
}

h3:first-child, h4:first-child {
    margin-top: 0;
}

input[type="file"] {
    display: none;
}

.file-button {
    display: inline-block;
    background: #F09E0B;
    color: #1a252f;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    border: 1px solid #F09E0B;
    transition: all 0.3s ease;
}

.file-button:hover {
    background: #e89f0b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(240, 158, 11, 0.3);
}

.subtle {
    color: #cccccc;
    font-size: .9rem;
}

#people {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--gap);
    min-height: 50px;
}

.person {
    width: 120px;
    min-height: 120px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    background: #1f3142;
    cursor: grab;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
}

.person img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0;
}

.person .name {
    font-size: .95rem;
    line-height: 1.2;
    word-break: break-word;
    text-align: center;
    width: 100%;
}

#grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(8, var(--seat-size));
}

.seat {
    width: var(--seat-size);
    height: var(--seat-size);
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a252f;
    position: relative;
    overflow: hidden;
}

.seat.dragover {
    border-color: #F09E0B;
    background: #2C3F4A;
}

.seat .hint {
    color: #94a3b8;
    font-size: .9rem;
}

.photoBadge, .unplaceBadge {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
}

.photoBadge {
    bottom: 8px;
    right: 8px;
    background: #F09E0B;
    color: #1a252f;
}

.unplaceBadge {
    top: 8px;
    right: 8px;
    background: #ff0000;
    color: white;
}

.person.male {
    background: #1e3a8a;
    border: 1px solid #3b82f6;
}

.person.female {
    background: #9d174d;
    border: 1px solid #ec4899;
}

.person.neutral {
    background: #0f766e;
    border: 1px solid #10b981;
}

.seat.male {
    border-color: #3b82f6;
    background: #1b2b4f;
}

.seat.female {
    border-color: #ec4899;
    background: #2f1f2f;
}

.seat.neutral {
    border-color: #10b981;
    background: #1f3b36;
}

/* Additional utility classes */
.upload-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.hidden {
    display: none;
}

.mb-12 {
    margin-bottom: 12px;
}

.toolbar-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toolbar-row {
    display: flex;
    gap: 8px;
}

.title-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-title {
    margin: 4px 0 10px;
}

.print-date {
    font-size: 0.9rem;
    color: #64748b;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 12mm;
    }
    body * {
        visibility: hidden !important;
    }
    #planTitle, #printDate, #grid, #grid * {
        visibility: visible !important;
    }
    .photoBadge, .unplaceBadge {
        display: none !important;
        visibility: hidden !important;
    }
    #planTitle {
        position: absolute;
        top: 10mm;
        left: 12mm;
        font-size: 22pt;
    }
    #printDate {
        position: absolute;
        top: 20mm;
        left: 12mm;
        font-size: 12pt;
        color: #444;
    }
    #grid {
        position: absolute;
        top: 35mm;
        left: 12mm;
    }
}