/* ═══════════════════════════════════════════════════════════════
   Movie Edit Page  (mep-*)
   ═══════════════════════════════════════════════════════════════ */

.mep {
    display: flex;
    flex-direction: column;
}

/* ── Hero banner ─────────────────────────────────────────────── */
.mep-hero {
    position: relative;
    overflow: visible; /* poster is allowed to overflow downward into the tab bar */
    background: #0d1117;
    /* Pull up to cover the sticky topbar (4rem = 64px) */
    margin-top: -4rem;
    padding: calc(4rem + 16px) 32px 16px;
}

/* Wraps the blurred backdrop so overflow:hidden clips only the blur, not the poster */
.mep-hero-backdrop-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

/* Blurred poster backdrop — provides the dynamic per-movie color tint */
.mep-hero-backdrop {
    position: absolute;
    inset: -10%;
    background-size: cover;
    background-position: center 30%;
    filter: blur(48px) brightness(0.32) saturate(2.2);
    pointer-events: none;
}

/* Bottom gradient inside the backdrop-wrap so it stays clipped with the blur */
.mep-hero-backdrop-wrap::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, #0d1117);
    z-index: 1;
    pointer-events: none;
}

.mep-hero-content {
    position: relative;
    display: flex;
    gap: 24px;
    align-items: flex-end;
    z-index: 2;
}

/* Poster — overflows downward into the tab bar */
.mep-poster {
    flex-shrink: 0;
    width: 130px;
    aspect-ratio: 2/3;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
    display: block;
    border: 2px solid rgba(255,255,255,.15);
    /* Reach down into the tab bar */
    margin-bottom: -32px;
    position: relative;
    z-index: 10;
    align-self: flex-end;
}
.mep-poster--empty {
    flex-shrink: 0;
    width: 130px;
    aspect-ratio: 2/3;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    border: 2px solid rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.3);
    margin-bottom: -32px;
    position: relative;
    z-index: 10;
    align-self: flex-end;
}
.mep-poster--empty .material-icons { font-size: 36px; }

/* Hero info */
.mep-hero-info {
    flex: 1;
    min-width: 0;
    padding-bottom: 20px;
}

.mep-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.45);
    text-decoration: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 10px;
    transition: color 0.15s;
}
.mep-back:hover { color: rgba(255,255,255,.8); }
.mep-back .material-icons { font-size: 13px; }

.mep-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mep-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.mep-meta-text {
    font-size: 13px;
    color: rgba(255,255,255,.6);
    font-weight: 500;
}
.mep-meta-sep { color: rgba(255,255,255,.25); font-size: 13px; }
.mep-mpaa {
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.7);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.06em;
    border: 1px solid rgba(255,255,255,.15);
}
.mep-runtime {
    font-size: 13px;
    color: rgba(255,255,255,.5);
}
.mep-imdb {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    color: #f59e0b;
    font-weight: 700;
}
.mep-imdb .material-icons { font-size: 14px; }

.mep-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}
.mep-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 20px;
}
.mep-badge .material-icons { font-size: 12px; }
.mep-badge--type   { background: rgba(59,130,246,.3); color: #93c5fd; border: 1px solid rgba(59,130,246,.4); }
.mep-badge--draft  { background: rgba(245,158,11,.25); color: #fcd34d; border: 1px solid rgba(245,158,11,.35); }
.mep-badge--manual { background: rgba(139,92,246,.25); color: #c4b5fd; border: 1px solid rgba(139,92,246,.35); }

/* Hero right panel — audit + quick stats */
.mep-hero-aside {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-bottom: 20px;
}
.mep-audit {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255,255,255,.35);
    text-align: right;
}
.mep-audit .material-icons { font-size: 13px; }
.mep-audit strong { color: rgba(255,255,255,.55); font-weight: 600; }

/* ── Co-editors presence avatars ────────────────────────────────── */
.mep-coeditors {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: flex-end;
}
.mep-coeditor-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 2px solid rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    cursor: default;
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
    transition: transform .15s, border-color .15s;
}
.mep-coeditor-avatar:hover {
    transform: scale(1.1);
    border-color: rgba(255,255,255,.6);
}
.mep-coeditor-avatar--me {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    border-color: rgba(255,255,255,.5);
    cursor: default;
}
.mep-coeditor-avatar__dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid #0d1117;
    box-shadow: 0 0 6px rgba(74,222,128,.7);
    animation: mep-pulse 2s ease-in-out infinite;
}
@keyframes mep-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* ── Tab bar — continues the hero's dark atmosphere ────────────── */
.mep-tabs {
    position: relative;
    display: flex;
    gap: 2px;
    /* left padding accounts for poster (130px) + hero gap (24px) + hero left padding (32px) */
    padding: 0 32px 0 calc(32px + 130px + 24px);
    background: #0d1117;
    border-bottom: 1px solid rgba(255,255,255,.08);
    overflow: visible;
}
.mep-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,.45);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
    font-family: inherit;
}
.mep-tab .material-icons { font-size: 16px; }
.mep-tab:hover { color: rgba(255,255,255,.8); }
.mep-tab--active {
    color: #fff;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}
.mep-tab__count {
    background: rgba(59,130,246,.35);
    color: #93c5fd;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
}
.mep-tab--active .mep-tab__count { background: #3b82f6; color: #fff; }

/* ── Section nav (jump bar below tab bar) ─────────────────────── */
.mep-secnav {
    position: sticky;
    top: 4rem; /* sticks right below the sticky topbar (4rem = 64px) */
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 32px;
    background: #f4f5f7;
    border-bottom: 1px solid rgba(0,0,0,.06);
    overflow-x: auto;
    scrollbar-width: none;
}
.mep-secnav::-webkit-scrollbar { display: none; }
.mep-secnav-item {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    cursor: pointer;
    margin-bottom: -1px;
    line-height: 1;
}
.mep-secnav-item:hover { color: #334155; }
.mep-secnav-item--active {
    color: #2563eb;
    border-bottom-color: #3b82f6;
    font-weight: 600;
}

/* ── Content area ─────────────────────────────────────────────── */
.mep-body {
    padding: 28px 32px 48px;
    background: #f4f5f7;
    flex: 1;
}

/* ── Loading / not-found ──────────────────────────────────────── */
.mep-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
    color: #64748b;
    font-size: 15px;
}
.mep-loading__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: mep-spin 0.8s linear infinite;
}
.mep-not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 12px;
    color: #64748b;
    text-align: center;
}
.mep-not-found .material-icons { font-size: 56px; color: #cbd5e1; }
.mep-not-found h2 { font-size: 20px; color: #334155; margin: 0; }
.mep-not-found a  { color: #3b82f6; text-decoration: none; font-size: 14px; }

/* ── Toast ────────────────────────────────────────────────────── */
.mep-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 1000;
    animation: mep-slidein 0.25s ease;
    white-space: nowrap;
}
.mep-toast button { background: none; border: none; cursor: pointer; padding: 0; display: flex; opacity: 0.7; color: inherit; }
.mep-toast button:hover { opacity: 1; }
.mep-toast .material-icons { font-size: 18px; }
.mep-toast--error   { background: #1e1e2e; color: #f87171; }
.mep-toast--success { background: #1e1e2e; color: #4ade80; }

@keyframes mep-spin { to { transform: rotate(360deg); } }
@keyframes mep-slidein {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   General Section  (meg-*)
   ═══════════════════════════════════════════════════════════════ */

.meg { display: flex; flex-direction: column; gap: 20px; }

/* Section card */
.meg-section {
    background: #fff;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.meg-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}
.meg-section-header .material-icons { font-size: 16px; color: #3b82f6; }
.meg-section-header h2 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin: 0;
}
.meg-section-title-hint {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    flex: 1;
}

/* Grid */
.meg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.meg-field { display: flex; flex-direction: column; }
.meg-field--full { grid-column: 1 / -1; }
.meg-field--check { align-self: center; }
.meg-field-row { display: flex; align-items: stretch; gap: 8px; }

/* Floating label input */
.meg-input-wrap { position: relative; flex: 1; }
.meg-input-wrap--disabled { opacity: 0.6; pointer-events: none; }
.meg-input-wrap--disabled .meg-input-copy-btn { pointer-events: all; opacity: 1; }

.meg-input {
    width: 100%;
    padding: 18px 14px 6px;
    font-size: 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    height: 50px;
    font-family: inherit;
}
.meg-input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.meg-input--select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}
.meg-label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #94a3b8;
    pointer-events: none;
    transition: all 0.15s;
}
.meg-label--icon { left: 52px; }
.meg-label--select { top: 50%; }

.meg-input:focus + .meg-label,
.meg-input:not(:placeholder-shown) + .meg-label,
.meg-input--select + .meg-label {
    top: 10px;
    transform: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #3b82f6;
    text-transform: uppercase;
}

/* Icon prefix */
.meg-input-wrap--icon { position: relative; }
.meg-input-icon {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #94a3b8;
    background: #f1f5f9;
    border-right: 1.5px solid #e2e8f0;
    border-radius: 8px 0 0 8px;
    pointer-events: none;
    overflow: hidden;
}
.meg-input-icon--logo { padding: 0 8px; }
.meg-input--with-icon { padding-left: 60px; border-radius: 0 8px 8px 0; }
.meg-label--icon { left: 60px !important; }

/* Official checkbox — replaces the old button toggle */
.meg-official-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0 4px;
}
.meg-official-check input { display: none; }
.meg-official-check__box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #cbd5e1;
    transition: all 0.15s;
}
.meg-official-check__box .material-icons { font-size: 15px; }
.meg-official-check:hover .meg-official-check__box { border-color: #10b981; color: #10b981; }
.meg-official-check input:checked ~ .meg-official-check__box {
    border-color: #10b981;
    background: #ecfdf5;
    color: #059669;
}
.meg-official-check__label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.04em;
}
.meg-official-check input:checked ~ .meg-official-check__box ~ .meg-official-check__label { color: #059669; }
.meg-official-check--inline { padding: 0; }

/* Toggle switch */
.meg-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.meg-toggle input { display: none; }
.meg-toggle__track {
    width: 36px; height: 20px;
    background: #e2e8f0;
    border-radius: 20px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.meg-toggle__track::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.meg-toggle input:checked ~ .meg-toggle__track { background: #10b981; }
.meg-toggle input:checked ~ .meg-toggle__track::after { transform: translateX(16px); }
.meg-toggle__label { font-size: 14px; color: #334155; font-weight: 500; }

/* Genre chips */
.meg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.meg-chips--selected { margin-bottom: 16px; }
.meg-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.meg-chip .material-icons { font-size: 12px; }
.meg-chip:hover { border-color: #3b82f6; color: #3b82f6; background: #eff6ff; }
.meg-chip--on { border-color: #2563eb; background: #2563eb; color: #fff; cursor: default; }
.meg-chip-remove {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    margin-left: 2px;
    cursor: pointer;
    color: rgba(255,255,255,.7);
    line-height: 1;
    transition: color 0.15s;
}
.meg-chip-remove:hover { color: #fff; }
.meg-chip-remove .material-icons { font-size: 13px; }
.meg-genre-add-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin-bottom: 8px;
    margin-top: 4px;
}
.meg-empty-hint {
    font-size: 13px;
    color: #94a3b8;
    margin: 4px 0 0;
}

/* Genre typeahead */
.meg-genre-search {
    position: relative;
    margin-top: 12px;
}
.meg-genre-search-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    font-size: 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.meg-genre-search-input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.meg-genre-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #94a3b8;
    pointer-events: none;
}
.meg-genre-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
}
.meg-genre-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background 0.1s;
}
.meg-genre-option:hover { background: #f1f5f9; }
.meg-genre-option .material-icons { font-size: 14px; color: #3b82f6; }
.meg-genre-no-results {
    padding: 12px 14px;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
}

/* Overviews */
.meg-overviews { display: flex; flex-direction: column; gap: 16px; }
.meg-overview-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.meg-overview { display: flex; flex-direction: column; gap: 8px; }
.meg-overview-header { display: flex; align-items: center; justify-content: space-between; }
.meg-overview-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}
.meg-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.meg-textarea:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

/* Save bar */
.meg-savebar { display: flex; align-items: center; gap: 16px; padding: 20px 0 4px; }
.meg-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}
.meg-save-btn:hover:not(:disabled) { background: #1d4ed8; }
.meg-save-btn:active:not(:disabled) { transform: scale(0.98); }
.meg-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.meg-save-btn .material-icons { font-size: 18px; }

.meg-spinner {
    width: 15px; height: 15px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mep-spin 0.7s linear infinite;
    flex-shrink: 0;
}
.meg-saved-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #10b981;
    font-size: 13px;
    font-weight: 600;
}
.meg-saved-badge .material-icons { font-size: 16px; }

/* ═══════════════════════════════════════════════════════════════
   Localized Section  (mel-*)
   ═══════════════════════════════════════════════════════════════ */

.mel {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
    align-items: start;
}

.mel-langs {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: calc(4rem + 16px); /* below topbar */
}
.mel-langs-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    padding: 4px 8px 8px;
}
.mel-lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    border: none;
    background: none;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
}
.mel-lang-btn:hover { background: #f1f5f9; }
.mel-lang-btn--active { background: #eff6ff; color: #2563eb; font-weight: 600; }
.mel-lang-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #e2e8f0;
    flex-shrink: 0;
}
.mel-lang-btn--active .mel-lang-dot { background: #3b82f6; }

.mel-add {
    padding: 8px 0 0;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}
.mel-add-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1.5px dashed #cbd5e1;
    background: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mel-add-trigger:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}
.mel-add-trigger .material-icons { font-size: 15px; }

/* Language picker overlay */
.mel-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,.25);
    backdrop-filter: blur(2px);
    animation: mep-fadein 0.15s ease;
}
.mel-picker {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    width: 320px;
    max-height: 480px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mel-picker-in 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes mel-picker-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes mep-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.mel-picker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}
.mel-picker-header .material-icons { font-size: 18px; color: #3b82f6; }
.mel-picker-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.15s;
}
.mel-picker-close:hover { color: #475569; }
.mel-picker-close .material-icons { font-size: 18px; }
.mel-picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.mel-picker-search .material-icons { font-size: 16px; color: #94a3b8; flex-shrink: 0; }
.mel-picker-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #0f172a;
    background: none;
    font-family: inherit;
}
.mel-picker-input::placeholder { color: #cbd5e1; }
.mel-picker-list {
    overflow-y: auto;
    flex: 1;
    padding: 6px;
}
.mel-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: #0f172a;
    font-family: inherit;
    transition: background 0.1s;
    text-align: left;
}
.mel-picker-option:hover { background: #f1f5f9; }
.mel-picker-code {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}
.mel-picker-empty {
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

.mel-empty {
    background: #fff;
    border-radius: 10px;
    padding: 48px;
    text-align: center;
    color: #94a3b8;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.mel-empty .material-icons { font-size: 40px; display: block; margin-bottom: 12px; }
.mel-empty p { font-size: 14px; margin: 0; }

.mel-form { display: flex; flex-direction: column; gap: 16px; }
.mel-form-header {
    background: #fff;
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mel-form-title { font-size: 15px; font-weight: 700; color: #0f172a; }
.mel-form-subtitle { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════
   Participants  (meg-participants-*)
   ═══════════════════════════════════════════════════════════════ */

.meg-participants-group { margin-bottom: 20px; }
.meg-participants-group:last-child { margin-bottom: 0; }
.meg-participants-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.meg-participants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.meg-participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    position: relative;
    gap: 6px;
}

.meg-participant__photo {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid #e2e8f0;
    background: #f1f5f9;
}
.meg-participant__photo--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}
.meg-participant__photo--fallback .material-icons { font-size: 32px; }

.meg-participant__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
}
.meg-participant__name {
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    max-width: 80px;
}
.meg-participant__official {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 2px;
}
.meg-participant__official input { display: none; }
.meg-participant__official .material-icons {
    font-size: 16px;
    color: #e2e8f0;
    transition: color 0.15s;
}
.meg-participant__official input:checked ~ .material-icons { color: #10b981; }
.meg-participant__official:hover .material-icons { color: #10b981; }

.meg-participant__remove {
    position: absolute;
    top: -4px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    border: none;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
    line-height: 1;
}
.meg-participant__remove .material-icons { font-size: 11px; }
.meg-participant:hover .meg-participant__remove { opacity: 1; }

/* ── ConeticID row ── */
.meg-conetic-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}
.meg-conetic-row .meg-input-wrap { flex: 1; min-width: 0; }
.meg-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meg-generate-btn, .meg-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 42px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
    flex-shrink: 0;
}
.meg-generate-btn {
    background: #6366f1;
    color: #fff;
}
.meg-generate-btn:hover:not(:disabled) { background: #4f46e5; }
.meg-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.meg-generate-btn .material-icons { font-size: 18px; }
.meg-copy-btn {
    background: #334155;
    color: #cbd5e1;
}
.meg-copy-btn:hover { background: #475569; }
.meg-copy-btn .material-icons { font-size: 18px; }
/* Inline copy button inside an input wrap */
.meg-input-wrap--copyable { position: relative; }
.meg-input-copy-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity .15s, color .15s;
}
.meg-input-wrap--copyable:hover .meg-input-copy-btn,
.meg-input-wrap--copyable:focus-within .meg-input-copy-btn { opacity: 1; }
.meg-input-copy-btn:hover { color: #3b82f6; }
.meg-input-copy-btn .material-icons { font-size: 15px; }

.meg-conetic-lock {
    display: inline-flex;
    align-items: center;
    color: rgba(255,255,255,.3);
    padding: 0 4px;
}
.meg-conetic-lock .material-icons { font-size: 16px; }

/* ── Participant add ── */
.meg-participant-add {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Confirm row — shown after selecting a person */
.meg-participant-confirm-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
}
.meg-participant-confirm-person {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    flex-shrink: 0;
}
.meg-participant-confirm-photo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e2e8f0;
}
.meg-participant-confirm-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.meg-participant-confirm-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.meg-participant-confirm-cancel:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }
.meg-participant-confirm-cancel .material-icons { font-size: 16px; }

/* ── Localized delete button ──────────────────────────────────── */
.mel-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 7px;
    border: 1.5px solid #fca5a5;
    background: #fff5f5;
    color: #ef4444;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.mel-delete-btn:hover:not(:disabled) { background: #fee2e2; border-color: #f87171; }
.mel-delete-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mel-delete-btn .material-icons { font-size: 18px; }

/* ── Delete confirmation dialog ───────────────────────────────── */
.mel-confirm {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    width: 360px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    padding: 28px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: mel-picker-in 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
.mel-confirm-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fee2e2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.mel-confirm-icon .material-icons { font-size: 26px; color: #ef4444; }
.mel-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}
.mel-confirm-body {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 20px;
}
.mel-confirm-body strong { color: #0f172a; }
.mel-confirm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}
.mel-confirm-cancel {
    flex: 1;
    padding: 9px 0;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.mel-confirm-cancel:hover:not(:disabled) { background: #f8fafc; }
.mel-confirm-cancel:disabled { opacity: 0.5; cursor: not-allowed; }
.mel-confirm-delete {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 0;
    border-radius: 8px;
    border: none;
    background: #ef4444;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.mel-confirm-delete:hover:not(:disabled) { background: #dc2626; }
.mel-confirm-delete:disabled { opacity: 0.6; cursor: not-allowed; }
.mel-confirm-delete .material-icons { font-size: 16px; }
.meg-spinner--light { border-top-color: #fff; }

/* ── Tables (distributors / ratings / versions) ── */
.meg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 12px;
}
.meg-table th {
    text-align: left;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}
.meg-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.meg-table tr:last-child td { border-bottom: none; }
.meg-table-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #0f172a;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.meg-table-input:focus { outline: none; border-color: #6366f1; }
.meg-table-input--sm { max-width: 90px; }
.meg-table-select {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    box-sizing: border-box;
}
.meg-table-select:focus { outline: none; border-color: #6366f1; }
.meg-table-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #94a3b8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.meg-table-remove:hover { color: #ef4444; background: #fee2e2; }
.meg-table-remove .material-icons { font-size: 16px; }

/* ── Add row button ── */
.meg-add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1.5px dashed #cbd5e1;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.meg-add-row-btn:hover { border-color: #6366f1; color: #6366f1; background: #eef2ff; }
.meg-add-row-btn .material-icons { font-size: 15px; }

/* ── Subsection label ── */
.meg-subsection-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

/* ── Advisories grid ── */
.meg-advisory-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 4px;
}
.meg-advisory-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    user-select: none;
}
.meg-advisory-check input[type=checkbox] { accent-color: #6366f1; width: 15px; height: 15px; cursor: pointer; }
.meg-advisory-name { font-weight: 500; }
.meg-advisory-desc { color: #94a3b8; display: flex; align-items: center; }
.meg-advisory-desc .material-icons { font-size: 14px; }

/* ── Language type editors ── */
.meg-lang-types {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.meg-lang-type {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
}
.meg-lang-type-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.meg-lang-type-header .material-icons { font-size: 17px; color: #64748b; }
.meg-lang-type-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 1;
}
.meg-lang-type-add {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px;
    color: #94a3b8;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.meg-lang-type-add:hover { color: #6366f1; background: #eef2ff; }
.meg-lang-type-add .material-icons { font-size: 18px; }
