/* KAU Theme Variables */
:root {
    /* Primary Colors */
    --primary-01: #055934;
    --primary-02: #208D44;
    --primary-03: #86C242;
    --primary-04: #D3E6BE;
    --primary-05: #F2F7ED;

    /* Secondary Colors */
    --secondary-01: #0A353E;
    --secondary-02: #2BB673;
    --secondary-03: #A7E0C5;
    --secondary-04: #EEF8F5;

    /* Neutral Colors */
    --neutral-01: #1D2921;
    --neutral-02: #5C6660;
    --neutral-03: #8D9991;
    --neutral-04: #C2CCC6;
}

/* Font Faces — all weights loaded locally from static/fonts/ */
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-ExtraBold.otf') format('opentype');
    font-weight: 800;
    font-display: swap;
}
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-Bold.otf') format('opentype');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-Medium.otf') format('opentype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-Regular.otf') format('opentype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-Light.otf') format('opentype');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-ExtraLight.otf') format('opentype');
    font-weight: 200;
    font-display: swap;
}
@font-face {
    font-family: 'The Year of The Camel';
    src: url('../fonts/TheYearofTheCamel/TheYearofTheCamel-Thin.otf') format('opentype');
    font-weight: 100;
    font-display: swap;
}

@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-Thin.ttf') format('truetype');
    font-weight: 100;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-Light.ttf') format('truetype');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-display: swap;
}
@font-face {
    font-family: 'Alexandria';
    src: url('../fonts/Alexandria/Alexandria-Black.ttf') format('truetype');
    font-weight: 900;
    font-display: swap;
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Alexandria', sans-serif;
    background-color: var(--neutral-04);
    color: var(--neutral-01);
}

/* App Layout */
.app-container {
    display: flex;
    height: calc(100vh - 48px);
    overflow: hidden;
}

/* =====================================================
   TOP APP BAR  +  TOOLBAR
   Single unified grammar: every tool is a .tbar-btn with
   a variant modifier (--primary, --toggle, --ghost,
   --icon-only). Groups separated by thin dividers;
   .app-toolbar__spacer pushes status to the end, leaving
   room in the middle for future tools.
   ===================================================== */
.app-top-bar {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 1rem;
    gap: 1rem;
    background-color: white;
    border-bottom: 1px solid var(--primary-05);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 20;
}
.app-top-bar__brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.app-top-bar__title {
    font-family: 'The Year of The Camel', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-01);
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.app-top-bar__title-ar {
    font-family: 'Alexandria', sans-serif;
    font-weight: 500;
    color: var(--neutral-02);
    font-size: 13px;
}

/* ── Toolbar container ─────────────────────────────────── */
.app-toolbar {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 4px;
}
.app-toolbar__group {
    display: flex;
    align-items: center;
    gap: 2px;
}
.app-toolbar__divider {
    width: 1px;
    height: 22px;
    background: var(--primary-04);
    margin: 0 6px;
    flex-shrink: 0;
}
.app-toolbar__spacer {
    flex: 1;
}

/* ── Toolbar button (unified grammar) ──────────────────── */
.tbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--neutral-01);
    font-family: 'Alexandria', sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.tbar-btn:hover {
    background: var(--primary-05);
    border-color: var(--primary-04);
}
.tbar-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-05);
    border-color: var(--primary-02);
}
.tbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.tbar-btn__icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}
.tbar-btn__label {
    line-height: 1;
}

/* Icon-only variant — square 32×32 */
.tbar-btn--icon-only {
    width: 32px;
    padding: 0;
    justify-content: center;
}
.tbar-btn--icon-only .tbar-btn__label { display: none; }

/* Primary — the one filled CTA in the toolbar */
.tbar-btn--primary {
    background: var(--primary-01);
    color: white;
    border-color: var(--primary-01);
    font-weight: 600;
}
.tbar-btn--primary:hover {
    background: var(--primary-02);
    border-color: var(--primary-02);
    color: white;
}

/* Ghost — low-emphasis conditional actions (e.g. Reset) */
.tbar-btn--ghost {
    color: var(--neutral-02);
}
.tbar-btn--ghost:hover {
    color: var(--neutral-01);
}

/* Toggle — a <label> wrapping a hidden checkbox */
.tbar-btn--toggle {
    position: relative;
}
.tbar-btn__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.tbar-btn--toggle:has(.tbar-btn__input:checked) {
    background: #e8f5ed;
    border-color: var(--primary-02);
    color: var(--primary-01);
}
.tbar-btn__state {
    font-family: 'Alexandria', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--neutral-04);
    color: var(--neutral-02);
    line-height: 1;
    transition: background-color 0.15s, color 0.15s;
}
.tbar-btn--toggle:has(.tbar-btn__input:checked) .tbar-btn__state {
    background: var(--primary-02);
    color: white;
}

/* Design Mode hint as a thin banner below the top bar */
.design-mode-hint--banner {
    margin: 0;
    padding: 8px 1rem;
    font-size: 12px;
    color: var(--primary-01);
    background: var(--primary-05);
    border-bottom: 1px solid var(--primary-04);
    border-right: none;
    border-radius: 0;
    text-align: center;
}

/* ── Save-state pill (status indicator, not a button) ── */
.save-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 28px;
    padding: 0 0.75rem;
    border-radius: 999px;
    font-family: 'Alexandria', sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.save-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.save-pill--saved {
    background-color: var(--primary-05);
    color: var(--primary-01);
    border: 1px solid var(--primary-04);
}
.save-pill--unsaved {
    background-color: #fff8e6;
    color: #8b6914;
    border: 1px solid #f0d787;
}

/* =====================================================
   SECTION CARDS (runtime-wrapped around each section)
   ===================================================== */
.section-card {
    background-color: white;
    border: 1px solid var(--primary-05);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.section-card:focus-within {
    border-color: var(--primary-04);
    box-shadow: 0 2px 8px rgba(5, 89, 52, 0.06);
}
.section-card > *:last-child {
    margin-bottom: 0;
}
.section-card .section-header {
    margin-top: 0;
    margin-bottom: 1rem;
    background-color: transparent;
    border-right: none;
    border-bottom: 1px solid var(--primary-05);
    border-radius: 0;
    padding: 0 0 0.5rem 0;
    font-size: 14px;
    color: var(--primary-01);
}

/* =====================================================
   LEFT PANEL: Controls
   ===================================================== */
.controls-panel {
    width: 420px;
    min-width: 420px;
    background-color: var(--primary-05);
    padding: 1.5rem 1.25rem;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    z-index: 10;
}

.controls-panel h1 {
    font-family: 'The Year of The Camel', sans-serif;
    color: var(--primary-01);
    margin-bottom: 1.5rem;
    font-size: 22px;
}

/* Section Headers */
.section-header {
    font-family: 'Alexandria', sans-serif;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-01);
    background-color: var(--primary-05);
    border-right: 3px solid var(--primary-02);
    padding: 0.5rem 0.75rem;
    margin: 1.5rem 0 1rem;
    border-radius: 0 4px 4px 0;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--neutral-02);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--primary-04);
    border-radius: 8px;
    font-family: 'Alexandria', sans-serif;
    font-size: 14px;
    color: var(--neutral-01);
    background-color: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-02);
    box-shadow: 0 0 0 3px var(--primary-05);
    background-color: white;
}

/* File input */
.file-input {
    font-size: 13px !important;
    padding: 0.5rem !important;
    cursor: pointer;
}

/* Logos preview in control panel */
.logos-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.logos-preview img {
    height: 40px;
    width: auto;
    object-fit: contain;
    border: 1px solid var(--neutral-04);
    border-radius: 4px;
    padding: 4px;
    background: white;
}
.logos-preview .logo-preview-item {
    position: relative;
}
.logos-preview .remove-logo-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e53e3e;
    color: white;
    border: none;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Add button */
.add-btn {
    width: 100%;
    padding: 0.6rem;
    background-color: transparent;
    color: var(--primary-02);
    border: 1.5px dashed var(--primary-03);
    border-radius: 999px;
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
    margin-bottom: 1rem;
}
.add-btn:hover {
    background-color: var(--primary-05);
    border-color: var(--primary-02);
    transform: translateY(-1px);
}

/* Speaker entry card in controls */
.speaker-entry {
    background: var(--primary-05);
    border: 1px solid var(--primary-04);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
}
.speaker-entry .remove-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}
.speaker-entry .form-group {
    margin-bottom: 0.5rem;
}
.speaker-entry label {
    font-size: 12px;
}
.speaker-entry input {
    font-size: 13px;
    padding: 0.4rem 0.6rem;
}
.speaker-photo-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0.5rem auto;
    border: 2px solid var(--primary-03);
}

/* List item entry in controls */
.list-item-entry {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 0.5rem;
}
.list-item-entry input {
    flex: 1;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--neutral-03);
    border-radius: 4px;
    font-family: 'Alexandria', sans-serif;
    font-size: 13px;
}
.list-item-entry input:focus {
    outline: none;
    border-color: var(--primary-02);
}
.list-item-entry .remove-btn {
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Save / Load button group */
.save-load-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Secondary action button (Save / Load) */
.secondary-btn {
    flex: 1;
    padding: 0.7rem 0.9rem;
    background-color: white;
    color: var(--primary-01);
    border: 1.5px solid var(--primary-02);
    border-radius: 999px;
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
    text-align: center;
}
.secondary-btn:hover {
    background-color: var(--primary-05);
    border-color: var(--primary-01);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(5, 89, 52, 0.08);
}

/* Primary export button */
.primary-btn {
    width: 100%;
    padding: 0.9rem 1.25rem;
    background-color: var(--primary-01);
    color: white;
    border: none;
    border-radius: 999px;
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s, box-shadow 0.2s;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}
.primary-btn:hover {
    background-color: var(--primary-02);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 89, 52, 0.2);
}
.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Export button group: PNG + PDF side by side */
.export-btn-group {
    display: flex;
    gap: 8px;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}
.export-btn-group .primary-btn {
    flex: 1;
    width: auto;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 14px;
}
/* PDF button: distinct teal accent */
.export-btn-group .export-pdf-btn {
    background-color: var(--secondary-01);
}
.export-btn-group .export-pdf-btn:hover {
    background-color: #0c4b58;
}

/* =====================================================
   RIGHT PANEL: Preview
   ===================================================== */
.preview-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--neutral-04);
    padding: 2rem;
    overflow: auto;
}

.preview-wrapper {
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
}

/* =====================================================
   POSTER CANVAS (1080 x 1350)
   ===================================================== */
.poster {
    width: 1080px;
    height: 1350px;
    background-color: var(--primary-05);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(134, 194, 66, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(5, 89, 52, 0.10) 0%, transparent 55%);
    position: relative;
    overflow: visible; /* allow box-shadow / filter effects on children to paint outside bounds */
    display: flex;
    flex-direction: column;
    padding-bottom: 70px; /* equal bottom gutter to match the 70px header top padding */
}

/* Background Pattern (inactive — kept for future use) */
.bg-pattern {
    display: none;
}

/* Poster Header — default: left-aligned solo IEC-KAU logo */
.poster-header {
    padding: 70px 80px 40px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;           /* prevent logos from bleeding outside header bounds */
    min-width: 0;
}

/* Poster Header — when partner logos are present: centered row */
.poster-header.has-partners {
    padding: 50px 80px 30px;
    justify-content: center;
}

/* =====================================================
   POSTER CONTENT
   ===================================================== */
.poster-content {
    flex: 1;
    padding: 0 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    min-height: 0;
    overflow: visible;
}

/* Pre-title */
.pretitle {
    font-family: 'Alexandria', sans-serif;
    font-weight: 400;
    font-size: 28px;
    line-height: 1.5;
    color: var(--neutral-02);
    margin-bottom: 8px;
}

/* Main Title */
.main-title {
    font-family: 'The Year of The Camel', sans-serif;
    font-weight: 800;
    font-size: 80px;
    line-height: 1.1;
    color: var(--primary-01);
    margin-bottom: 6px;
    text-shadow: 0 1px 3px rgba(5, 89, 52, 0.20);
}

/* Tighter gap in speaker layout */
.layout-speaker .main-title {
    margin-bottom: 4px;
}
.main-title.long {
    font-weight: 700;
    font-size: 56px;
    line-height: 1.2;
}
.main-title.very-long {
    font-weight: 700;
    font-size: 44px;
    line-height: 1.25;
}

/* Subtitle */
.subtitle {
    font-family: 'Alexandria', sans-serif;
    font-weight: 500;
    font-size: 32px;
    line-height: 1.4;
    color: var(--neutral-01);
    max-width: 880px;
    margin-bottom: 16px;
}
.subtitle:empty {
    display: none;
}

/* =====================================================
   SPEAKER(S) SECTION
   ===================================================== */
.poster-speakers {
    margin-top: 24px;
}

/* Single speaker (speaker layout) */
.layout-speaker .poster-speakers {
    display: flex !important;
    align-items: center;
    gap: 40px;
    margin-top: 16px;
}

/* Single speaker card */
.speaker-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}
.speaker-photo {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 6px solid var(--primary-03);
    background-color: var(--primary-04);
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(5, 89, 52, 0.28);
}
.speaker-photo-placeholder {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background-color: var(--primary-04);
    border: 6px solid var(--primary-03);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}
.speaker-name {
    font-family: 'The Year of The Camel', sans-serif;
    font-weight: 700;
    font-size: 36px;
    line-height: 1.2;
    color: var(--primary-01);
}
.speaker-title {
    font-family: 'Alexandria', sans-serif;
    font-weight: 400;
    font-size: 22px;
    line-height: 1.4;
    color: var(--neutral-02);
    max-width: 400px;
}

/* Multi-speaker layout: row of cards, centered horizontally */
.layout-multi-speaker .poster-speakers {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 28px;
    justify-content: center;
    align-items: flex-start;
    margin-top: 24px;
    width: 100%;
}
.layout-multi-speaker .speaker-card {
    flex: 0 1 auto;
    min-width: 180px;
    max-width: 240px;
    align-items: center;
}
.layout-multi-speaker .speaker-photo,
.layout-multi-speaker .speaker-photo-placeholder {
    width: 190px;
    height: 190px;
    min-width: 190px;
    min-height: 190px;
    border-width: 5px;
}
.layout-multi-speaker .speaker-name {
    font-size: 30px;
}
.layout-multi-speaker .speaker-title {
    font-size: 21px;
}

/* Speaker layout: put photo to side */
.layout-speaker .speaker-card {
    gap: 16px;
}

/* =====================================================
   CONTENT LIST SECTION
   ===================================================== */
.poster-list-section {
    margin-top: 20px;
    background: rgba(5, 89, 52, 0.06);
    border-radius: 16px;
    padding: 24px 32px;
    overflow: visible;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(5, 89, 52, 0.18);
}

.list-heading {
    font-family: 'Alexandria', sans-serif;
    font-weight: 700;
    font-size: 30px;
    color: var(--primary-01);
    margin-bottom: 20px;
}

.list-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Two-column grid when more than 2 items */
.list-items.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 36px;
}

.list-items li {
    font-family: 'Alexandria', sans-serif;
    font-weight: 400;
    font-size: 24px;
    line-height: 1.5;
    color: var(--neutral-01);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.list-items li::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary-03);
    flex-shrink: 0;
    margin-top: 8px;
}

/* =====================================================
   POSTER FOOTER
   ===================================================== */
.poster-footer {
    flex-shrink: 0;
    padding: 0 60px 20px;
    background: transparent;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
}

/* Partner logos strip — lives inside .poster-header */
.partner-logos-strip {
    display: flex;
    flex-wrap: nowrap;          /* keep all logos on a single line */
    align-items: center;
    gap: 36px;
    min-width: 0;               /* allow strip to shrink within header */
    flex-shrink: 1;
    overflow: hidden;           /* clip any overflow — never bleed outside header */
}

/* When partners exist, stretch strip and center contents */
.poster-header.has-partners .partner-logos-strip {
    justify-content: center;
    width: 100%;
    min-width: 0;
}

/* IEC-KAU logo wrapper — display inline-flex so it aligns with partner logos */
.partner-logos-strip .iec-kau-logo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;             /* allow shrinking when many logos are present */
    min-width: 0;
}

/* IEC-KAU logo — solo mode (no partners): original size */
.partner-logos-strip .iec-kau-logo {
    height: 160px;
    min-height: 0;              /* allow shrinking */
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* IEC-KAU logo — when partners are present: slightly reduced to harmonize */
.poster-header.has-partners .partner-logos-strip .iec-kau-logo {
    height: 135px;
}

/* Uploaded partner logos */
.partner-logos-strip .partner-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    max-width: 240px;
    flex-shrink: 1;             /* allow shrinking when many logos are present */
    min-width: 0;
}
.partner-logos-strip .partner-logo-wrapper img {
    max-height: 100px;
    max-width: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    min-width: 0;               /* allow img to compress */
    flex-shrink: 1;
}

/* Vertical divider between logos */
.logo-divider {
    width: 2px;
    height: 80px;
    background-color: var(--primary-03);
    border-radius: 2px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Footer unified panel — KAU dark green */
.footer-top-row {
    flex: 1;
    background: var(--primary-01);
    border-radius: 20px;
    padding: 22px 28px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -3px 8px rgba(5, 89, 52, 0.28), 0 5px 10px rgba(0, 0, 0, 0.22);
}

/* Details area: single row, items scale to fit available width */
.details {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: center;
    align-content: center;
    justify-content: center;
    min-width: 0;
}

/* Each detail item: icon above, text below */
.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--primary-04);
    background: transparent;
    padding: 0 8px;
    box-shadow: none;
    min-width: 0;
    max-width: none;
    flex: 0 1 300px;
}

/* SVG icon */
.detail-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: transparent;
    color: var(--primary-04);
    flex-shrink: 0;
}

.detail-icon svg {
    width: 56px;
    height: 56px;
    stroke: var(--primary-04);
    stroke-width: 1.5;
}

/* Badge variant — transparent on dark green */
.detail-badge {
    background: transparent;
    border: none;
}

.detail-badge .detail-icon {
    background: transparent;
}

/* Date text — matches the inline text style of other detail items */
.date-text {
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    color: var(--primary-04);
    text-align: center;
    line-height: 1.3;
}

/* =====================================================
   CONTROLS PANEL: Checkbox styling
   ===================================================== */
.checkbox-group {
    margin-bottom: 0.75rem;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--neutral-02);
    font-size: 13px;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-02);
    cursor: pointer;
    flex-shrink: 0;
}

/* QR Code Wrapper — sits beside the footer panel on the same line */
.qr-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--primary-04);
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 240px;
    flex-shrink: 0;
    box-shadow: 0 3px 6px rgba(5, 89, 52, 0.20);
}

/* QR Code Box */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#qrcode {
    width: 200px;
    height: 200px;
    min-width: 200px;
    min-height: 200px;
    flex-shrink: 0;
}

/* Allow JS to override size for complex QR codes */
#qrcode img,
#qrcode canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* URL text inside QR box */
.qr-url-text {
    font-family: 'Alexandria', sans-serif;
    font-weight: 400;
    font-size: 10px;
    color: var(--neutral-02);
    text-align: center;
    word-break: break-all;
    max-width: 120px;
    line-height: 1.3;
    direction: ltr;
}

.qr-label {
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-01);
}

/* Disclaimer text inside QR wrapper (shown for simple URLs) */
.qr-inline-disclaimer {
    font-family: 'Alexandria', sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: var(--neutral-02);
    text-align: center;
    max-width: 200px;
    line-height: 1.5;
    direction: rtl;
}

/* Disclaimer text below the footer (shown for complex URLs) */
.poster-disclaimer {
    font-family: 'Alexandria', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: var(--neutral-03);
    text-align: center;
    width: 100%;
    padding: 0 60px 10px;
    line-height: 1.4;
    direction: rtl;
    z-index: 1;
}

/* =====================================================
   LANGUAGE SPECIFIC LAYOUTS
   ===================================================== */
.poster.ar {
    direction: rtl;
}
.poster.ar .poster-header {
    justify-content: flex-start;
}
.poster.ar .poster-header.has-partners {
    justify-content: center;
}
.poster.ar .section-header {
    border-right: 3px solid var(--primary-02);
    border-left: none;
}

/* In Arabic (RTL) mode, place QR wrapper on the left side */
.poster.ar .poster-footer .qr-wrapper {
    order: 1;
}
.poster.ar .poster-footer .footer-top-row {
    order: -1;
}

.poster.en {
    direction: ltr;
}
.poster.en .poster-header {
    justify-content: flex-start;
}
.poster.en .poster-header.has-partners {
    justify-content: center;
}
.poster.en .section-header {
    border-left: 3px solid var(--primary-02);
    border-right: none;
}

/* =====================================================
   LAYOUT VARIATIONS
   ===================================================== */

/* Standard: content block centered vertically */
.layout-standard .poster-content {
    justify-content: center;
}

/* Speaker layout: title spans full width, then speaker photo + content in row below */
.layout-speaker .poster-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

/* Text block: stacks pretitle + title above the side-by-side area */
.layout-speaker .poster-text-block {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Side row: speaker photo on one side, subtitle/list on the other */
.layout-speaker .poster-speaker-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
    margin-top: 20px;
}

.layout-speaker .poster-speakers {
    flex-shrink: 0;
    width: 260px;
    margin-top: 0;
}

/* List: vertically centered, with a little extra top breathing room */
.layout-list .poster-content {
    justify-content: center;
    padding-top: 20px;
}
.layout-list .main-title {
    font-size: 60px;
}

/* Multi-speaker: vertically center content when sparse; overflow clips when content is heavy */
.layout-multi-speaker .poster-content {
    justify-content: center;
    align-items: stretch; /* children stretch full width so speakers row can be centered */
    padding-top: 4px;   /* tighter top padding */
    overflow: hidden;   /* content-area is the clip boundary; footer is always safe below */
}

/* Multi-speaker: flip order — list section appears above the speaker cards.
   Default HTML order is: pretitle(1) → title(2) → subtitle(3) → speakers(4) → list(5).
   When .speakers-above is active, swap speakers and list using explicit order values. */
.layout-multi-speaker.speakers-above .poster-speakers {
    order: 5; /* push speakers after the list */
}
.layout-multi-speaker.speakers-above .poster-list-section {
    order: 4; /* pull list before speakers */
}

/* Multi-speaker: compress all title elements to free vertical space for the list */
.layout-multi-speaker .main-title {
    font-size: 48px;    /* was 60px — saves ~30px */
    margin-bottom: 8px; /* was 16px */
}
.layout-multi-speaker .pretitle {
    font-size: 20px;    /* was 28px */
    margin-bottom: 4px;
}
.layout-multi-speaker .subtitle {
    font-size: 22px;    /* was 32px */
    margin-bottom: 8px; /* was 16px */
}

/* Multi-speaker: list section — allow compression but don't clip items inside the box */
.layout-multi-speaker .poster-list-section {
    flex-shrink: 1;      /* allow compression when space is tight */
    min-height: 0;       /* allow shrink to minimum */
    overflow: visible;   /* items are never clipped inside the section box */
    padding: 16px 24px;  /* tighter than default 24px 32px */
    margin-top: 12px;    /* tighter gap */
}
.layout-multi-speaker .list-heading {
    font-size: 24px;     /* smaller than default 30px */
    margin-bottom: 12px; /* tighter than default 20px */
}
.layout-multi-speaker .list-items li {
    font-size: 20px;     /* smaller than default 24px */
    line-height: 1.4;
}
.layout-multi-speaker .list-items {
    gap: 10px;           /* tighter than default 14px */
}

/* Multi-speaker: compress footer to free ~80px of vertical space.
   .layout-multi-speaker is set on .poster itself, so .poster-footer
   is a direct descendant reachable via the layout class. */
.layout-multi-speaker .poster-footer {
    padding: 0 60px 10px; /* was 0 60px 20px */
    gap: 10px;            /* was 16px */
}
.layout-multi-speaker .footer-top-row {
    padding: 14px 20px;   /* was 22px 28px */
    border-radius: 16px;  /* was 20px */
}
.layout-multi-speaker .detail-item {
    flex: 0 1 300px;
}
.layout-multi-speaker .qr-wrapper {
    min-width: 190px;
    padding: 10px 14px;   /* was 16px 20px */
    gap: 8px;
    border-radius: 12px;
}
.layout-multi-speaker #qrcode {
    width: 160px;
    height: 160px;
    min-width: 160px;
    min-height: 160px;
}
.layout-multi-speaker .qr-label {
    font-size: 12px;
}
.layout-multi-speaker .qr-url-text {
    font-size: 9px;
}
.layout-multi-speaker .qr-inline-disclaimer {
    font-size: 11px;
    max-width: 160px;
}

/* =====================================================
   CONTROLS PANEL SIDEBAR SECTION HEADER (RTL fix)
   ===================================================== */
.controls-panel .section-header {
    border-right: 3px solid var(--primary-02);
    border-left: none;
}

/* =====================================================
   SQUARE FORMAT OVERRIDES (1080×1080 — X.com / Twitter)
   All rules scoped to .poster.format-square so the
   existing portrait format is completely unaffected.
   ===================================================== */

/* Canvas size */
.poster.format-square {
    height: 1080px;
    padding-bottom: 44px; /* equal bottom gutter to match the 44px header top padding */
}

/* Header — less vertical padding */
.poster.format-square .poster-header {
    padding: 44px 64px 26px;
}
.poster.format-square .poster-header.has-partners {
    padding: 32px 64px 20px;
}

/* Content area — symmetric horizontal padding only; vertical centering is handled by flex */
.poster.format-square .poster-content {
    padding: 0 64px;
}

/* Pre-title */
.poster.format-square .pretitle {
    font-size: 22px;
    margin-bottom: 6px;
}

/* Main title */
.poster.format-square .main-title {
    font-size: 64px;
}
.poster.format-square .main-title.long {
    font-size: 44px;
}
.poster.format-square .main-title.very-long {
    font-size: 36px;
}

/* Subtitle */
.poster.format-square .subtitle {
    font-size: 24px;
    margin-bottom: 12px;
}

/* Logos */
.poster.format-square .partner-logos-strip .iec-kau-logo {
    height: 120px;
}
.poster.format-square .poster-header.has-partners .partner-logos-strip .iec-kau-logo {
    height: 100px;
}
.poster.format-square .partner-logos-strip .partner-logo-wrapper {
    height: 75px;
    max-width: 180px;
}
.poster.format-square .partner-logos-strip .partner-logo-wrapper img {
    max-height: 75px;
    max-width: 180px;
}
.poster.format-square .logo-divider {
    height: 65px;
}

/* Speaker photos */
.poster.format-square .speaker-photo,
.poster.format-square .speaker-photo-placeholder {
    width: 170px;
    height: 170px;
    min-width: 170px;
    min-height: 170px;
    border-width: 4px;
}
.poster.format-square .speaker-name {
    font-size: 28px;
}
.poster.format-square .speaker-title {
    font-size: 17px;
}

/* Multi-speaker layout */
.poster.format-square .layout-multi-speaker .speaker-photo,
.poster.format-square .layout-multi-speaker .speaker-photo-placeholder {
    width: 120px;
    height: 120px;
}
.poster.format-square .layout-multi-speaker .speaker-name {
    font-size: 20px;
}
.poster.format-square .layout-multi-speaker .speaker-title {
    font-size: 14px;
}

/* Content list */
.poster.format-square .poster-list-section {
    padding: 16px 24px;
    margin-top: 14px;
}
.poster.format-square .list-heading {
    font-size: 22px;
    margin-bottom: 14px;
}
.poster.format-square .list-items li {
    font-size: 18px;
}
.poster.format-square .list-items {
    gap: 10px;
}
.poster.format-square .list-items.two-col {
    gap: 10px 28px;
}

/* Footer */
.poster.format-square .poster-footer {
    padding: 0 48px 14px;
    gap: 12px;
}
.poster.format-square .footer-top-row {
    padding: 14px 20px;
    border-radius: 16px;
}
.poster.format-square .details {
    gap: 10px 12px;
}
.poster.format-square .detail-item {
    font-size: 17px;
    gap: 6px;
    min-width: 0;
    max-width: none;
    flex: 0 1 240px;
}
.poster.format-square .detail-icon {
    width: 50px;
    height: 50px;
}
.poster.format-square .detail-icon svg {
    width: 42px;
    height: 42px;
}
/* QR code */
.poster.format-square .qr-wrapper {
    min-width: 190px;
    padding: 12px 14px;
    gap: 8px;
    border-radius: 12px;
}
.poster.format-square #qrcode {
    width: 160px;
    height: 160px;
    min-width: 160px;
    min-height: 160px;
}
.poster.format-square .qr-label {
    font-size: 12px;
}
.poster.format-square .qr-url-text {
    font-size: 9px;
}
.poster.format-square .qr-inline-disclaimer {
    font-size: 11px;
    max-width: 160px;
}
.poster.format-square .poster-disclaimer {
    padding: 0 48px 8px;
    font-size: 11px;
}

/* =====================================================
   DESIGN MODE — Drag & Resize
   ===================================================== */

/* Design mode group in controls panel */
.design-mode-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* ── Toggle switch row ─────────────────────────────────────── */
.design-mode-toggle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--primary-05);
    border: 1.5px solid var(--primary-04);
    cursor: pointer;
    transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s;
    user-select: none;
}

.design-mode-toggle-row:hover {
    background: var(--primary-04);
    border-color: var(--primary-03);
    box-shadow: 0 2px 8px rgba(5, 89, 52, 0.12);
}

/* Row tint when active (checkbox is checked) */
.design-mode-toggle-row:has(.toggle-input:checked) {
    background: #e8f5ed;
    border-color: var(--primary-02);
    box-shadow: 0 2px 10px rgba(32, 141, 68, 0.18);
}

/* ── Toggle track (the pill) ───────────────────────────────── */
.toggle-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

/* Hide the real checkbox */
.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Pill background via ::before on the track */
.toggle-track::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: var(--neutral-04);
    transition: background-color 0.25s;
}

.toggle-track:has(.toggle-input:checked)::before {
    background: var(--primary-02);
}

/* ── Toggle thumb (the sliding circle) ────────────────────── */
.toggle-thumb {
    position: absolute;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
    z-index: 1;
}

.toggle-track:has(.toggle-input:checked) .toggle-thumb {
    transform: translateX(22px);
    box-shadow: 0 1px 6px rgba(5, 89, 52, 0.3);
}

/* ── Label content beside the track ───────────────────────── */
.toggle-label-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.toggle-label-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toggle-label-text {
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--neutral-01);
    flex: 1;
}

/* ── ON / OFF status badge ─────────────────────────────────── */
.toggle-status-badge {
    font-family: 'Alexandria', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--neutral-04);
    color: var(--neutral-02);
    transition: background-color 0.25s, color 0.25s;
    flex-shrink: 0;
}

.design-mode-toggle-row:has(.toggle-input:checked) .toggle-status-badge {
    background: var(--primary-02);
    color: white;
}

.reset-layout-btn {
    color: #c05000 !important;
    border-color: #c05000 !important;
}
.reset-layout-btn:hover {
    background-color: #fff5ee !important;
}

/* Hard Refresh button — amber/warning tint to signal a destructive action */
.hard-refresh-btn {
    color: #b45309 !important;
    border-color: #d97706 !important;
    /* Force onto its own row inside the flex save-load-group */
    flex: 1 1 100% !important;
    width: 100%;
}
.hard-refresh-btn:hover {
    background-color: #fffbeb !important;
    border-color: #b45309 !important;
}

.design-mode-hint {
    font-size: 12px;
    color: var(--neutral-02);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    padding: 8px 10px;
    background: var(--primary-05);
    border-radius: 6px;
    border-right: 3px solid var(--primary-03);
}

/* Poster in design mode — cursor indicates interactive */
.poster.design-mode {
    cursor: default;
}

/* Any draggable element on the poster */
.poster.design-mode [data-editable] {
    position: relative;
    cursor: grab;
    outline: 2px dashed transparent;
    outline-offset: 4px;
    transition: outline-color 0.15s;
    user-select: none;
    overflow: visible !important;  /* allow resize handle & badge to overflow */
}

.poster.design-mode [data-editable]:hover {
    outline-color: var(--primary-03);
}

/* Selected element */
.poster.design-mode [data-editable].selected {
    outline: 2px solid var(--primary-02);
    outline-offset: 4px;
    cursor: grab;
    z-index: 100;
}

/* While actually dragging */
.poster.design-mode [data-editable].dragging {
    cursor: grabbing;
    outline-color: var(--primary-01);
    opacity: 0.85;
}

/* Resize handles — 8 around each selected element (corners + edges).
   Hidden by default; shown when the element is .selected in design mode. */
.resize-handle {
    display: none;
    position: absolute;
    background: var(--primary-01);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    z-index: 200;
}

/* Corner handles — round, slightly larger */
.resize-handle.h-nw,
.resize-handle.h-ne,
.resize-handle.h-se,
.resize-handle.h-sw {
    width: 14px;
    height: 14px;
}

/* Edge handles — pill-shaped, sit flush along the edge */
.resize-handle.h-n,
.resize-handle.h-s,
.resize-handle.h-e,
.resize-handle.h-w {
    border-radius: 4px;
    width: 22px;
    height: 10px;
}
.resize-handle.h-e,
.resize-handle.h-w {
    width: 10px;
    height: 22px;
}

/* Positions (corners) */
.resize-handle.h-nw { top: -7px;    left: -7px;    cursor: nwse-resize; }
.resize-handle.h-ne { top: -7px;    right: -7px;   cursor: nesw-resize; }
.resize-handle.h-se { bottom: -7px; right: -7px;   cursor: nwse-resize; }
.resize-handle.h-sw { bottom: -7px; left: -7px;    cursor: nesw-resize; }

/* Positions (edges) */
.resize-handle.h-n  { top: -5px;    left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.h-s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.h-w  { left: -5px;   top: 50%;  transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.h-e  { right: -5px;  top: 50%;  transform: translateY(-50%); cursor: ew-resize; }

/* Show handles only when element is selected in design mode */
.poster.design-mode [data-editable].selected .resize-handle {
    display: block;
}

/* Font-size control badge (appears above selected text elements) */
.font-size-badge {
    display: none;
    position: absolute;
    top: -30px;
    right: 0;
    background: var(--primary-01);
    color: white;
    font-size: 11px;
    font-family: 'Alexandria', monospace;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 300;
}
.poster.ar .font-size-badge {
    right: auto;
    left: 0;
}

.poster.design-mode [data-editable].selected .font-size-badge {
    display: block;
}

/* =====================================================
   IMAGE CROP MODAL
   ===================================================== */

/* Fullscreen overlay */
.crop-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Alexandria', sans-serif;
    direction: ltr; /* Cropper.js controls look best LTR */
}

/* Semi-transparent dark backdrop */
.crop-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 30, 18, 0.80);
    backdrop-filter: blur(4px);
}

/* Dialog box */
.crop-modal-dialog {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    width: min(90vw, 760px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.crop-modal-header {
    background: var(--primary-01);
    padding: 18px 24px 14px;
    flex-shrink: 0;
}

.crop-modal-header h2 {
    color: #ffffff;
    font-family: 'The Year of The Camel', sans-serif;
    font-weight: 700;
    font-size: 22px;
    margin: 0 0 4px;
}

.crop-modal-hint {
    color: var(--primary-04);
    font-size: 12px;
    font-weight: 400;
    margin: 0;
}

/* Body — contains the cropper canvas */
.crop-modal-body {
    flex: 1;
    overflow: hidden;
    background: #1a1a1a;
    position: relative;
}

/* The img Cropper.js is applied to */
.crop-image-container {
    width: 100%;
    height: 100%;
    max-height: calc(92vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-image-container img {
    /* Cropper.js manages display; just prevent default stretching */
    display: block;
    max-width: 100%;
}

/* Footer: action buttons */
.crop-modal-footer {
    flex-shrink: 0;
    background: var(--primary-05);
    border-top: 1px solid var(--primary-04);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Override width so the buttons inside the modal don't span 100% */
.crop-modal-footer .secondary-btn,
.crop-modal-footer .primary-btn {
    width: auto;
    flex: none;
    margin: 0;
    padding: 0.65rem 1.4rem;
    font-size: 14px;
}

/* Queue indicator — shown when multiple files are being cropped */
.crop-queue-indicator {
    flex: 1;
    font-size: 13px;
    color: var(--neutral-02);
}

/* =====================================================
   STORY FORMAT OVERRIDES (1080×1920 — 9:16)
   Snapchat / Instagram Stories / WhatsApp Status / TikTok
   All rules scoped to .poster.format-story so the
   existing portrait and square formats are unaffected.
   ===================================================== */

/* Canvas size */
.poster.format-story {
    height: 1920px;
    padding-bottom: 110px; /* generous bottom gutter to match taller canvas */
}

/* Header — more vertical padding for tall canvas */
.poster.format-story .poster-header {
    padding: 100px 80px 50px;
}
.poster.format-story .poster-header.has-partners {
    padding: 80px 80px 40px;
}

/* Pre-title */
.poster.format-story .pretitle {
    font-size: 34px;
    margin-bottom: 10px;
}

/* Main title */
.poster.format-story .main-title {
    font-size: 96px;
}
.poster.format-story .main-title.long {
    font-size: 70px;
}
.poster.format-story .main-title.very-long {
    font-size: 56px;
}

/* Subtitle */
.poster.format-story .subtitle {
    font-size: 40px;
    margin-bottom: 24px;
}

/* Logos — proportionally larger for 9:16 tall canvas */
.poster.format-story .partner-logos-strip .iec-kau-logo {
    height: 220px;
}
.poster.format-story .poster-header.has-partners .partner-logos-strip .iec-kau-logo {
    height: 190px;
}
.poster.format-story .partner-logos-strip .partner-logo-wrapper {
    height: 150px;
    max-width: 360px;
}
.poster.format-story .partner-logos-strip .partner-logo-wrapper img {
    max-height: 150px;
    max-width: 360px;
}
.poster.format-story .logo-divider {
    height: 130px;
}

/* Speaker photos */
.poster.format-story .speaker-photo,
.poster.format-story .speaker-photo-placeholder {
    width: 260px;
    height: 260px;
    min-width: 260px;
    min-height: 260px;
    border-width: 7px;
}
.poster.format-story .speaker-name {
    font-size: 44px;
}
.poster.format-story .speaker-title {
    font-size: 28px;
}

/* Multi-speaker layout */
.poster.format-story .layout-multi-speaker .speaker-photo,
.poster.format-story .layout-multi-speaker .speaker-photo-placeholder {
    width: 210px;
    height: 210px;
    min-width: 210px;
    min-height: 210px;
}
.poster.format-story .layout-multi-speaker .speaker-name {
    font-size: 34px;
}
.poster.format-story .layout-multi-speaker .speaker-title {
    font-size: 22px;
}

/* Content list */
.poster.format-story .poster-list-section {
    padding: 32px 44px;
    margin-top: 28px;
}
.poster.format-story .list-heading {
    font-size: 38px;
    margin-bottom: 24px;
}
.poster.format-story .list-items li {
    font-size: 30px;
    line-height: 1.5;
}
.poster.format-story .list-items {
    gap: 20px;
}
.poster.format-story .list-items.two-col {
    gap: 20px 44px;
}

/* Footer */
.poster.format-story .poster-footer {
    padding: 0 60px 40px;
    gap: 20px;
}
.poster.format-story .footer-top-row {
    padding: 32px 36px;
    border-radius: 24px;
}
.poster.format-story .details {
    gap: 0;
}
.poster.format-story .detail-item {
    font-size: 28px;
    gap: 10px;
    flex: 0 1 340px;
}
.poster.format-story .detail-icon {
    width: 80px;
    height: 80px;
}
.poster.format-story .detail-icon svg {
    width: 68px;
    height: 68px;
}

/* QR code */
.poster.format-story .qr-wrapper {
    min-width: 280px;
    padding: 24px 28px;
    gap: 14px;
    border-radius: 20px;
}
.poster.format-story #qrcode {
    width: 240px;
    height: 240px;
    min-width: 240px;
    min-height: 240px;
}
.poster.format-story .qr-label {
    font-size: 18px;
}
.poster.format-story .qr-url-text {
    font-size: 12px;
    max-width: 160px;
}
.poster.format-story .qr-inline-disclaimer {
    font-size: 16px;
    max-width: 240px;
}
.poster.format-story .poster-disclaimer {
    padding: 0 60px 14px;
    font-size: 14px;
}

/* =====================================================
   MOBILE TAB BAR
   Appears only on small screens (≤ 650px) to toggle
   between the edit form and the poster preview.
   ===================================================== */
.mobile-tab-bar {
    display: none; /* hidden on desktop */
    flex-direction: row;
    background: var(--primary-01);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    border-bottom: 2px solid var(--primary-02);
}

.mobile-tab {
    flex: 1;
    padding: 14px 8px;
    background: transparent;
    color: var(--primary-04);
    border: none;
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    min-height: 48px;
}

.mobile-tab.active {
    background: var(--primary-02);
    color: white;
}

.mobile-tab:not(.active):hover {
    background: rgba(255,255,255,0.1);
}

/* =====================================================
   CSS CUSTOM PROPERTY FOR POSTER SCALE
   Set by JS (scalePreview) on every resize.
   ===================================================== */
:root {
    --poster-scale: 1;
}

/* =====================================================
   TABLET BREAKPOINT  (≤ 900px)
   Narrow the controls panel; poster still visible.
   ===================================================== */
@media (max-width: 900px) {
    .controls-panel {
        width: 320px;
        min-width: 280px;
        padding: 1.5rem;
    }

    .controls-panel h1 {
        font-size: 18px;
    }

    .preview-panel {
        padding: 1rem;
        align-items: flex-start;
    }

    /* Top bar gets tighter at tablet widths */
    .app-top-bar__title-ar {
        display: none;
    }
}

/* =====================================================
   STACKED / LARGE-MOBILE BREAKPOINT  (≤ 650px)
   Panels stack vertically; tab bar is shown.
   ===================================================== */
@media (max-width: 650px) {

    /* Show the mobile tab bar */
    .mobile-tab-bar {
        display: flex;
        /* Sit below the fixed top app bar (≈ 48px tall on mobile) */
        top: 48px;
    }

    /* Mobile top app bar: fixed, keeps toolbar reachable */
    .app-top-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: 0 0.5rem;
        gap: 0.5rem;
        z-index: 201; /* above mobile-tab-bar */
    }
    .app-top-bar__brand {
        /* Brand takes too much room on narrow widths; collapse it */
        display: none;
    }
    /* Collapse text labels on toolbar buttons; keep icons + status */
    .app-toolbar .tbar-btn__label {
        display: none;
    }
    /* Hide dividers on mobile to save space */
    .app-toolbar__divider {
        display: none;
    }

    /* Allow html + body to scroll; the fixed bars sit on top */
    html {
        height: auto;
        overflow-x: hidden;
    }

    body {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        /* Push content below both fixed bars: top bar (48px) + tab bar (≈ 50px) */
        padding-top: 100px;
    }

    /* Stack panels vertically and each fills full width */
    .app-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    /* Controls panel: full width, auto height, scrolling handled by body */
    .controls-panel {
        width: 100%;
        min-width: 0;
        height: auto;
        overflow-y: visible;
        padding: 1rem;
        box-shadow: none;
        border-bottom: 1px solid var(--neutral-04);
    }

    /* Hidden panel in tab mode */
    .controls-panel.mobile-hidden,
    .preview-panel.mobile-hidden {
        display: none;
    }

    /* Preview panel: full width, center content, auto height */
    /* direction:ltr ensures flex-start = visual left edge, matching
       transform-origin:top left used by scalePreview() on mobile.
       The poster's own .ar/.en class still controls internal content direction. */
    .preview-panel {
        width: 100%;
        direction: ltr;
        padding: 1rem 0.5rem 2rem;
        align-items: flex-start;
        justify-content: flex-start;
        overflow: visible;
        min-height: 60vw;
    }

    /* Enlarge touch targets for all form controls */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
        font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
        padding: 0.6rem 0.75rem;
    }

    .form-group label {
        font-size: 14px;
    }

    /* Buttons */
    .add-btn,
    .secondary-btn {
        min-height: 44px;
        font-size: 14px;
    }

    .primary-btn {
        min-height: 52px;
        font-size: 16px;
    }

    /* Larger checkboxes */
    .checkbox-label input[type="checkbox"] {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .checkbox-label {
        font-size: 14px;
        gap: 12px;
    }

    /* Speaker / list item remove buttons — bigger tap area */
    .speaker-entry .remove-btn,
    .list-item-entry .remove-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* List item row — keep remove button reachable */
    .list-item-entry input {
        font-size: 15px;
        min-height: 44px;
    }

    /* Save/Load button group: stack vertically */
    .save-load-group {
        flex-direction: column;
        gap: 10px;
    }

    .save-load-group .secondary-btn {
        flex: none;
        width: 100%;
    }

    /* Export button group: keep side-by-side but reduce font size */
    .export-btn-group {
        gap: 6px;
    }
    .export-btn-group .primary-btn {
        font-size: 13px;
        padding: 0.75rem 0.5rem;
    }

    /* Design mode buttons: full width each */
    .design-mode-group {
        flex-direction: column;
    }
    .design-mode-group .secondary-btn {
        width: 100%;
    }

    /* Crop modal: full-screen on mobile */
    .crop-modal-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .crop-modal-footer {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }

    .crop-modal-footer .secondary-btn,
    .crop-modal-footer .primary-btn {
        flex: 1;
        min-height: 48px;
        font-size: 15px;
        padding: 0.75rem 1rem;
    }

    /* Speaker photo preview in controls: smaller on mobile */
    .speaker-photo-preview {
        width: 48px;
        height: 48px;
    }
}

/* =====================================================
   SMALL PHONE BREAKPOINT  (≤ 420px)
   Extra breathing room on very narrow screens.
   ===================================================== */
@media (max-width: 420px) {
    .controls-panel {
        padding: 0.75rem;
    }

    .controls-panel h1 {
        font-size: 16px;
        margin-bottom: 1rem;
    }

    .section-header {
        font-size: 12px;
        padding: 0.4rem 0.6rem;
        margin: 1rem 0 0.75rem;
    }

    .mobile-tab {
        font-size: 13px;
        padding: 12px 6px;
    }

    .preview-panel {
        padding: 0.75rem 0.25rem 2rem;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   Server Save UI (Save to Server / Update / Save as New / Copy Link)
   ───────────────────────────────────────────────────────────────────────── */
.server-save-btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Post-save server actions live inline in the toolbar */
.server-save-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.server-save-status {
    font-size: 0.72rem;
    padding: 0.4rem 0.55rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    background: var(--secondary-04);
    color: var(--neutral-01);
    word-break: break-all;
    border: 1px solid var(--neutral-04);
}
.server-save-status.status-ok  { background: var(--primary-05); border-color: var(--primary-03); }
.server-save-status.status-err { background: #fdecec; border-color: #e88; color: #a12020; }
.server-save-status.status-info{ background: var(--secondary-04); border-color: var(--secondary-03); }

.form-hint {
    font-size: 0.72rem;
    color: var(--neutral-02);
    margin-top: 0.35rem;
    line-height: 1.35;
}

/* ─────────────────────────────────────────────────────────────────────────
   Design Mode Toolbar — shown above the poster when an element is selected
   ───────────────────────────────────────────────────────────────────────── */
.design-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.8rem;
    padding: 0.45rem 0.75rem 0.45rem 0.35rem;
    max-width: calc(100vw - 32px);
    background: var(--neutral-01);
    color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
    font-size: 0.82rem;

    /* Floating over the canvas — initial position top-center of viewport */
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    user-select: none;
    touch-action: none;
}

/* When the user has dragged the toolbar, JS sets explicit left/top and
   clears the initial transform by adding this class. */
.design-toolbar.tb-dragged {
    transform: none;
}

.design-toolbar.tb-dragging {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    opacity: 0.95;
}

.tb-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.45rem;
    margin-inline-end: 0.15rem;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
    cursor: grab;
    font-size: 0.9rem;
    line-height: 1;
    letter-spacing: -2px;
    align-self: stretch;
}
.tb-drag-handle:hover { color: rgba(255, 255, 255, 0.95); }
.design-toolbar.tb-dragging .tb-drag-handle { cursor: grabbing; }
.tb-grip { pointer-events: none; }

.design-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0 0.45rem;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.design-toolbar-group:last-child { border-right: none; }
/* When no element is selected, only the Add group is visible — hide its
   trailing divider so the toolbar doesn't render a dangling line. */
.design-toolbar.tb-no-selection .tb-add-group { border-right: none; }

.design-toolbar .tb-add-btn { font-weight: 600; }

.design-toolbar .tb-label {
    font-size: 0.72rem;
    color: var(--neutral-04);
    margin-right: 0.25rem;
    white-space: nowrap;
}

.design-toolbar .tb-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 5px;
    padding: 0.32rem 0.55rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.design-toolbar .tb-btn:hover {
    background: var(--primary-02);
    border-color: var(--primary-02);
}
.design-toolbar .tb-btn.tb-danger:hover {
    background: #c94040;
    border-color: #c94040;
}

.design-toolbar .tb-select {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 0.28rem 0.4rem;
    font-size: 0.78rem;
    max-width: 140px;
}
.design-toolbar .tb-select option { color: var(--neutral-01); }

.design-toolbar .tb-num {
    width: 56px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 0.28rem 0.35rem;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.design-toolbar .tb-num::-webkit-outer-spin-button,
.design-toolbar .tb-num::-webkit-inner-spin-button {
    opacity: 1;
}

.design-toolbar .tb-color {
    width: 32px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
}
.design-toolbar .tb-color::-webkit-color-swatch-wrapper { padding: 2px; }
.design-toolbar .tb-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.design-toolbar .tb-color::-moz-color-swatch     { border: none; border-radius: 3px; }

/* Disabled toolbar buttons (Undo/Redo when their stacks are empty) */
.design-toolbar .tb-btn:disabled,
.design-toolbar .tb-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Copy-style button — solid highlight when armed (waiting for target) */
.design-toolbar .tb-btn.active {
    background: var(--primary-02);
    border-color: var(--primary-03);
    color: #fff;
}

/* While format painter is armed, every editable text shows a crosshair
   cursor as a visual cue that the next click will paste the style. */
body.design-style-pick .poster.design-mode [data-editable] { cursor: crosshair !important; }

.design-toolbar input[type="range"] {
    width: 110px;
    accent-color: var(--primary-03);
}

.design-toolbar .tb-value {
    font-variant-numeric: tabular-nums;
    min-width: 38px;
    text-align: end;
    color: var(--primary-04);
}

/* ─────────────────────────────────────────────────────────────────────────
   Free-floating Custom Layer (images / duplicates added in Design Mode)
   ───────────────────────────────────────────────────────────────────────── */
.poster-custom-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* No z-index here — the layer is the last child of .poster so it paints
       on top by document order, while remaining in the same stacking context
       as built-in elements so z-order works across both. */
}

.poster-custom-layer .custom-element {
    pointer-events: auto;
}

.poster-custom-layer .custom-image {
    overflow: visible;
}
.poster-custom-layer .custom-image > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none; /* clicks go to the wrapper so drag/resize works */
}

.poster-custom-layer .custom-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    box-sizing: border-box;
    text-align: center;
    line-height: 1.2;
    font-family: 'Alexandria', sans-serif;
    color: var(--neutral-01);
    overflow: hidden;
}

/* Free-floats are block containers — resize adjusts w+h directly */
.poster.design-mode .poster-custom-layer .custom-element {
    cursor: move;
}


/* ─────────────────────────────────────────────────────────────────────────
   Shape buttons (circle / rounded / square) in the design toolbar
   ───────────────────────────────────────────────────────────────────────── */
.design-toolbar .tb-shape-btn {
    min-width: 32px;
    padding: 0.32rem 0.45rem;
    font-size: 0.95rem;
    line-height: 1;
}
.design-toolbar .tb-shape-btn.active {
    background: var(--primary-02);
    border-color: var(--primary-03);
    color: #fff;
}

/* ─────────────────────────────────────────────────────────────────────────
   Free-elements side-by-side row (Add Image / Add Text)
   ───────────────────────────────────────────────────────────────────────── */
.free-elements-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.free-elements-row .form-hint {
    grid-column: 1 / -1;
    margin-top: 0.2rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   In-canvas text editing — contenteditable state
   ───────────────────────────────────────────────────────────────────────── */
.poster.design-mode [data-editable].tb-editing {
    outline: 2px dashed var(--primary-02) !important;
    outline-offset: 2px;
    background: rgba(208, 228, 168, 0.35);
    cursor: text !important;
    user-select: text;
    min-width: 40px;   /* so an empty text element stays clickable */
    min-height: 1em;
}
.poster.design-mode [data-editable].tb-editing * {
    pointer-events: none;  /* keep clicks on the editable element itself */
}

/* Suppress the resize handle + font badge while editing to keep the UI clean */
.poster.design-mode [data-editable].tb-editing .resize-handle,
.poster.design-mode [data-editable].tb-editing .font-size-badge {
    display: none;
}

/* Free-text default look */
.poster-custom-layer .custom-text {
    cursor: grab;
}
.poster.design-mode .poster-custom-layer .custom-text.tb-editing {
    cursor: text;
}

/* =====================================================
   BROWSE DESIGNS MODAL
   ===================================================== */
.browse-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.browse-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}
.browse-modal__dialog {
    position: relative;
    background: white;
    border-radius: 16px;
    width: min(640px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}
.browse-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--primary-05);
    gap: 1rem;
}
.browse-modal__header h2 {
    font-family: 'The Year of The Camel', sans-serif;
    font-weight: 700;
    font-size: 17px;
    color: var(--primary-01);
    margin: 0;
}
.browse-modal__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--neutral-02);
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.browse-modal__close:hover {
    background: var(--primary-05);
    color: var(--neutral-01);
}
.browse-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Password screen */
.browse-auth {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
}
.browse-auth__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--neutral-02);
}
.browse-auth__row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.browse-auth__input {
    flex: 1;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--primary-04);
    border-radius: 8px;
    font-family: 'Alexandria', sans-serif;
    font-size: 14px;
    background-color: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.browse-auth__input:focus {
    outline: none;
    border-color: var(--primary-02);
    box-shadow: 0 0 0 3px var(--primary-05);
    background-color: white;
}
.browse-auth__row .tbar-btn--primary {
    flex-shrink: 0;
    padding: 0 1rem;
}
.browse-auth__error {
    font-size: 12px;
    color: #a12020;
    background: #fdecec;
    border: 1px solid #e88;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

/* Designs list */
.browse-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.browse-list__empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--neutral-02);
    font-size: 13px;
}
.browse-list__empty--error {
    color: #a12020;
}
.browse-list__item {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    border: 1px solid var(--primary-05);
    border-radius: 10px;
    background: white;
    color: var(--neutral-01);
    transition: background-color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.browse-list__item:hover {
    background: var(--primary-05);
    border-color: var(--primary-03);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(5, 89, 52, 0.08);
}
.browse-list__item-link {
    flex: 1;
    min-width: 0; /* allow the title to truncate */
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.browse-list__delete {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    align-self: center;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--neutral-02);
    font-family: 'Alexandria', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, min-width 0.2s;
}
.browse-list__delete:hover {
    background: #fdecec;
    color: #a12020;
    border-color: #f2c0c0;
}
.browse-list__delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.browse-list__delete-icon {
    font-size: 15px;
    line-height: 1;
}
.browse-list__delete-confirm {
    display: none;
    font-size: 12px;
    letter-spacing: 0.02em;
}
.browse-list__delete--armed {
    min-width: 82px;
    background: #a12020;
    color: white;
    border-color: #a12020;
    animation: browse-delete-pulse 1s ease-in-out infinite;
}
.browse-list__delete--armed:hover {
    background: #801818;
    border-color: #801818;
    color: white;
}
.browse-list__delete--armed .browse-list__delete-icon { display: none; }
.browse-list__delete--armed .browse-list__delete-confirm { display: inline; }
@keyframes browse-delete-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(161, 32, 32, 0.35); }
    50%      { box-shadow: 0 0 0 4px rgba(161, 32, 32, 0);    }
}
.browse-list__title {
    font-family: 'Alexandria', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-01);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.browse-list__title--empty {
    color: var(--neutral-02);
    font-weight: 500;
    font-style: italic;
}
.browse-list__meta {
    display: flex;
    gap: 0.75rem;
    font-size: 12px;
    color: var(--neutral-02);
    align-items: center;
}
.browse-list__slug {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--primary-05);
    color: var(--primary-01);
}
.browse-list__date {
    flex: 1;
    text-align: end;
}

@media (max-width: 650px) {
    .browse-modal__dialog {
        width: 96vw;
        max-height: 92vh;
    }
    .browse-auth__row {
        flex-direction: column;
    }
    .browse-auth__row .tbar-btn--primary {
        width: 100%;
    }
}
