/* ==========================================================
   بوصلة الفتح — admin panel
   ========================================================== */
:root {
    --maroon: #7a1e3a;
    --maroon-600: #92284a;
    --navy: #1d3461;
    --navy-800: #13233f;
    --ink: #1c2638;
    --muted: #6b778c;
    --line: #e3e8f0;
    --bg: #f3f6fa;
    --ok: #157a4a;
    --ok-bg: #e7f6ee;
    --warn: #9a6a00;
    --warn-bg: #fff6df;
    --danger: #b42318;
    --danger-bg: #fdecea;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(20, 38, 71, .06);
    --shadow: 0 10px 30px -12px rgba(20, 38, 71, .25);
    --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
    --sidebar: 260px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 15px; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(29, 52, 97, .3); outline-offset: 2px; }
.icon { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-800) 100%);
    color: rgba(255, 255, 255, .85);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; margin-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.sidebar__brand svg { width: 48px; height: 48px; }
.sidebar__brand strong { display: block; color: #fff; font-size: 19px; font-weight: 800; line-height: 1.2; }
.sidebar__brand small { font-size: 12px; opacity: .7; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu__label { font-size: 11.5px; letter-spacing: .5px; opacity: .5; padding: 12px 12px 4px; }
.menu a, .menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: inherit;
    font-weight: 500;
    text-align: start;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.menu a.is-active { background: #fff; color: var(--navy); font-weight: 700; box-shadow: inset -4px 0 0 var(--maroon); }
.sidebar__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.who { display: flex; align-items: center; gap: 10px; padding: 8px 12px 12px; font-size: 13.5px; }
.who__avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--maroon); color: #fff; font-weight: 800; }
.who small { display: block; opacity: .6; font-size: 12px; direction: ltr; text-align: end; }

.main { min-width: 0; padding: 26px 32px 40px; }
.topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.topline h1 { margin: 0; font-size: 24px; font-weight: 800; color: var(--navy); }
.topline p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.icon-btn.menu-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, border-color .2s, box-shadow .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--maroon); color: #fff; box-shadow: 0 6px 16px -8px var(--maroon); }
.btn--primary:hover { background: var(--maroon-600); }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover { background: #26427a; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #9a1c13; }
.btn--block { width: 100%; }
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: all .2s;
}
.icon-btn:hover { color: var(--navy); border-color: var(--navy); }
.icon-btn--danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

/* ---------- alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500; animation: drop .35s ease; }
.alert--ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6d0; }
.alert--err { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c2bd; }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); }
.stat__num { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.stat__label { font-size: 13px; color: var(--muted); }

/* ---------- card / table ---------- */
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search input { padding-inline-start: 40px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.segmented a { padding: 6px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.segmented a.is-active { background: #fff; color: var(--navy); font-weight: 700; box-shadow: var(--shadow-sm); }

.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 16px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: start; background: #f9fbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #fafcff; }
.n-item { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.n-thumb { width: 64px; height: 46px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.n-thumb img { width: 100%; height: 100%; object-fit: cover; }
.n-thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--cat, var(--navy)), color-mix(in srgb, var(--cat, var(--navy)) 65%, #000)); }
.n-title { font-weight: 700; line-height: 1.45; }
.n-title a:hover { color: var(--maroon); }
.n-cat { font-size: 12.5px; color: var(--muted); }
.cat-general { --cat: #1d3461; } .cat-events { --cat: #7a1e3a; } .cat-cyber { --cat: #5a2c58; }
.cat-ai { --cat: #5e6646; } .cat-learning { --cat: #22558f; } .cat-achievements { --cat: #8a5a1e; }
.date { direction: ltr; text-align: end; white-space: nowrap; color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; border: 0; cursor: pointer; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--draft { background: var(--warn-bg); color: var(--warn); }
.pill--sched { background: #e8eefb; color: var(--navy); }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty-row { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-row .icon { width: 48px; height: 48px; color: #c0c9d6; margin: 0 auto 10px; }
.table-foot { padding: 6px 16px 14px; }

.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.pager a, .pager span { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: 13.5px; }
.pager a:hover { border-color: var(--navy); }
.pager .is-current { background: var(--navy); border-color: var(--navy); color: #fff; }
.pager .is-disabled { opacity: .4; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.box__body { padding: 22px; }
.box__title { margin: 0 0 16px; font-size: 16px; font-weight: 800; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-weight: 700; font-size: 14px; }
.label .req { color: var(--maroon); margin-inline: 4px auto; }
.label small { font-weight: 400; color: var(--muted); }
.input, .select, .textarea {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #d5dce7;
    border-radius: 10px;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.8; resize: vertical; }
.textarea--lg { min-height: 340px; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(29, 52, 97, .1); }
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.title-input { height: 52px; font-size: 18px; font-weight: 700; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.switch__text strong { display: block; font-size: 14.5px; }
.switch__text small { color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { position: relative; width: 46px; height: 26px; border-radius: 26px; background: #cfd6e2; transition: background .2s; flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: inset-inline-start .2s; }
.switch input:checked + .switch__track { background: var(--ok); }
.switch input:checked + .switch__track::after { inset-inline-start: 23px; }
.switch input:focus-visible + .switch__track { outline: 3px solid rgba(29, 52, 97, .3); outline-offset: 2px; }

.drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 170px;
    padding: 16px;
    border: 2px dashed #cdd5e1;
    border-radius: 12px;
    background: #f9fbfd;
    color: var(--muted);
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s, background .2s;
}
.drop:hover, .drop.is-over { border-color: var(--navy); background: #f1f5fb; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop strong { color: var(--navy); }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop.has-image .drop__hint { display: none; }
.drop__change { position: absolute; bottom: 10px; inset-inline-start: 10px; z-index: 2; display: none; padding: 4px 12px; border-radius: 8px; background: rgba(15, 25, 45, .75); color: #fff; font-size: 12.5px; pointer-events: none; }
.drop.has-image .drop__change { display: block; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--danger); cursor: pointer; }
.check input { accent-color: var(--danger); width: 16px; height: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.form-actions .btn { flex: 1; }
.counter { font-size: 12px; color: var(--muted); }
.counter.is-over { color: var(--danger); font-weight: 700; }

/* ---------- dialog ---------- */
dialog { border: 0; padding: 0; border-radius: 16px; width: min(420px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15, 25, 45, .5); backdrop-filter: blur(2px); }
.dialog__body { padding: 26px 24px 10px; text-align: center; }
.dialog__icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: var(--danger-bg); color: var(--danger); }
.dialog__body h2 { margin: 0 0 6px; font-size: 19px; }
.dialog__body p { margin: 0; color: var(--muted); }
.dialog__actions { display: flex; gap: 10px; padding: 18px 24px 22px; }
.dialog__actions > * { flex: 1; }
.dialog__actions form { display: flex; }
.dialog__actions form .btn { flex: 1; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__art {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #fff;
    text-align: center;
    background:
        radial-gradient(circle at 20% 15%, rgba(122, 30, 58, .55), transparent 45%),
        linear-gradient(160deg, var(--navy) 0%, var(--navy-800) 100%);
    overflow: hidden;
}
.auth__art svg { width: 190px; height: 190px; margin-bottom: 20px; }
.auth__art h2 { margin: 0; font-size: 44px; font-weight: 800; }
.auth__art p { margin: 4px 0 0; opacity: .8; font-size: 18px; }
.auth__art::after { content: ""; position: absolute; inset: auto -10% -60px -10%; height: 140px; background: var(--maroon); border-radius: 50% 50% 0 0; opacity: .5; }
.auth__panel { display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: #fff; }
.auth__form { width: 100%; max-width: 400px; }
.auth__form h1 { margin: 0 0 4px; font-size: 26px; color: var(--navy); }
.auth__form > p { margin: 0 0 26px; color: var(--muted); }
.with-icon { position: relative; }
.with-icon .icon { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.with-icon .input { padding-right: 42px; padding-left: 14px; }
.remember { display: flex; align-items: center; gap: 8px; margin: -4px 0 20px; font-size: 14px; color: var(--muted); }
.remember input { accent-color: var(--navy); width: 16px; height: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px; color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--maroon); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 50;
        width: 280px;
        transform: translateX(100%);
        transition: transform .25s ease;
        box-shadow: var(--shadow);
    }
    body.menu-open .sidebar { transform: none; }
    body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(15, 25, 45, .45); }
    .icon-btn.menu-toggle { display: inline-grid; }
    .main { padding: 18px 16px 30px; }
    .auth { grid-template-columns: 1fr; }
    .auth__art { min-height: 220px; padding: 30px 20px 50px; }
    .auth__art svg { width: 90px; height: 90px; margin-bottom: 8px; }
    .auth__art h2 { font-size: 30px; }

    /* table becomes cards */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--line); }
    .table td { padding: 0; border: 0; }
    .table td + td { margin-top: 8px; }
    .table td[data-label] { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
    .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; }
    .n-item { min-width: 0; }
    .actions { justify-content: flex-start; margin-top: 10px; }
}
@media (max-width: 520px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 12px; gap: 10px; }
    .stat__icon { width: 40px; height: 40px; }
    .stat__num { font-size: 21px; }
    .topline .btn { width: 100%; }
    .toolbar .search { max-width: none; }
}

/* ---------- buttons editor (menu tiles + quick links) ---------- */
.links-tabs { margin-bottom: 16px; }
.links-list { list-style: none; margin: 0; padding: 0; }
.link-row {
    display: grid;
    grid-template-columns: 36px 96px minmax(0, 1fr) minmax(0, 1.5fr) 36px;
    gap: 14px;
    align-items: end;
    padding: 16px 20px;
    background: #fff;
    transition: background .3s;
}
.link-row--tiles { grid-template-columns: 36px 96px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) 36px; }
.link-row + .link-row { border-top: 1px solid var(--line); }
.link-row.is-new { background: #f6fbf8; }
.link-row.is-moved { background: #f3f6fb; }
.link-row .field { margin: 0; }
.link-row__order { display: grid; gap: 4px; align-self: center; }
.icon-btn--sm { width: 32px; height: 26px; border-radius: 7px; }
.link-row:first-child [data-up], .link-row:last-child [data-down] { opacity: .35; pointer-events: none; }
.link-row__look { display: flex; align-items: center; gap: 8px; align-self: center; }
.icon-pick {
    display: grid; place-items: center;
    width: 52px; height: 48px;
    border: 1px solid color-mix(in srgb, var(--c) 25%, #fff);
    border-radius: 12px;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 12%, #fff);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.icon-pick:hover, .icon-pick[aria-expanded="true"] { transform: translateY(-1px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.color-pick { position: relative; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); cursor: pointer; }
.color-pick input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; }
.link-row__remove { align-self: end; margin-bottom: 4px; }
.links-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.links-empty .icon { color: #c0c9d6; }
.links-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); }
.links-foot .hint { margin: 0; flex: 1; min-width: 240px; }
.links-save { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.links-save .btn { min-width: 200px; }
.links-save__note { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); font-weight: 700; font-size: 13.5px; }

.icon-pop {
    position: absolute; z-index: 50;
    width: 312px; padding: 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow);
}
.icon-pop__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-height: 260px; overflow-x: hidden; overflow-y: auto; }
.icon-pop button { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--ink); cursor: pointer; }
.icon-pop button:hover { background: #f1f5fb; color: var(--navy); }
.icon-pop button.is-current { border-color: var(--navy); background: #eef2f9; color: var(--navy); }

@media (max-width: 1100px) {
    .link-row, .link-row--tiles { grid-template-columns: 36px 96px minmax(0, 1fr) 36px; }
    .link-row > .field { grid-column: 3; }
    .link-row > .field:first-of-type { grid-row: 1; }
    .link-row__order { grid-row: 1 / span 3; }
    .link-row__look { grid-row: 1 / span 3; }
    .link-row__remove { grid-column: 4; grid-row: 1; align-self: start; margin: 26px 0 0; }
}
@media (max-width: 560px) {
    .link-row, .link-row--tiles { grid-template-columns: 36px minmax(0, 1fr) 36px; padding: 14px; }
    .link-row__look { grid-column: 2; grid-row: 1; }
    .link-row > .field { grid-column: 2 / span 2; }
    .link-row__remove { grid-column: 3; grid-row: 1; margin: 0; align-self: center; }
    .link-row__order { grid-row: 1 / span 4; align-self: start; }
}

/* ---------- gallery manager ---------- */
.upload-box { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: stretch; margin-bottom: 26px; }
.upload-box__side { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.drop--multi { min-height: 190px; }
.drop__empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop__empty small { font-size: 12.5px; }
.drop__previews { display: none; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; width: 100%; }
.drop--multi.has-files .drop__empty { display: none; }
.drop--multi.has-files .drop__previews { display: grid; }
.drop__previews img { position: static; width: 100%; aspect-ratio: 1; height: auto; object-fit: cover; border-radius: 8px; }
.drop__previews .more { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; background: #e6ebf3; color: var(--navy); font-weight: 800; }

.gallery-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.gallery-head h2 { margin: 0; font-size: 17px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.gallery-head .count { padding: 1px 10px; border-radius: 999px; background: #e6ebf3; font-size: 13px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo-card { margin: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.photo-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.photo-card__img { display: block; aspect-ratio: 4 / 3; background: #eef2f7; }
.photo-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card figcaption { display: flex; gap: 8px; padding: 10px; }
.photo-card__caption { display: flex; gap: 6px; flex: 1; min-width: 0; }
.photo-card__caption .input { height: 36px; padding: 0 10px; font-size: 13.5px; }
.btn.is-loading { opacity: .7; pointer-events: none; }

@media (max-width: 860px) {
    .upload-box { grid-template-columns: 1fr; }
}

/* ---------- files manager ---------- */
.file-upload { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 16px; align-items: end; margin-bottom: 20px; }
.file-upload .field { margin: 0; }
.file-pick {
    position: relative; display: flex; align-items: center; gap: 12px;
    height: 44px; padding: 0 14px;
    border: 2px dashed #cdd5e1; border-radius: 10px; background: #f9fbfd; color: var(--muted);
    cursor: pointer; overflow: hidden; transition: border-color .2s, background .2s;
}
.file-pick:hover { border-color: var(--navy); background: #f1f5fb; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-pick span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.file-pick strong { color: var(--navy); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-pick small { font-size: 11.5px; }
.file-pick.has-file { border-style: solid; border-color: var(--ok); background: var(--ok-bg); }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.file-row + .file-row { border-top: 1px solid var(--line); }
.file-badge { flex: 0 0 auto; min-width: 74px; padding: 4px 10px; border-radius: 8px; text-align: center; font-size: 12px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); }
.file-row__title { display: flex; gap: 6px; flex: 1; min-width: 0; }
.file-row__title .input { height: 38px; }
.file-row__meta { flex: 0 0 auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
@media (max-width: 860px) {
    .file-upload { grid-template-columns: 1fr; }
    .file-row { flex-wrap: wrap; }
    .file-row__title { flex-basis: 100%; order: 3; }
}
