/* assets/css/admin.css — admin panel shell and tables. */

.ad-body { background: var(--bg-soft); }

.ad-top {
    position: sticky; top: 0; z-index: 60;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.ad-top-inner {
    max-width: 1400px; margin: 0 auto;
    height: 60px; padding: 0 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ad-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.ad-brand img { border-radius: 50%; }
.ad-brand b { font-size: 15px; display: block; line-height: 1.1; letter-spacing: -.01em; }
.ad-brand small { font-size: 9.5px; color: var(--ink-3); letter-spacing: .1em; }
.ad-top-right { display: flex; align-items: center; gap: 8px; }

.ad-role {
    font-size: 10.5px; font-weight: 800; letter-spacing: .08em;
    padding: 4px 10px; border-radius: 999px;
    background: var(--bg-sky); color: var(--sky-d); border: 1px solid var(--line-strong);
}
.ad-role-ceo { background: #fff3d6; color: #a06f00; border-color: #f0dba8; }
html.theme-dark .ad-role-ceo { background: #3a2c12; color: #e8bd70; border-color: #5a451f; }

.ad-shell {
    max-width: 1400px; margin: 0 auto;
    padding: 16px 14px 40px;
    display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 16px;
    align-items: start;
}

/* ---------- sidebar ---------- */
.ad-side {
    display: grid; gap: 3px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
    position: sticky; top: 76px;
}
.ad-side a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 11px;
    border-radius: 11px;
    font-size: 13px; font-weight: 500;
    color: var(--ink-2); text-decoration: none;
    transition: background-color .14s var(--ease), color .14s var(--ease);
}
.ad-side a:hover { background: var(--bg-sky); color: var(--sky-d); }
.ad-side a.is-on { background: var(--sky); color: #fff; font-weight: 600; }
.ad-side-ico svg { width: 17px; height: 17px; display: block; }

.ad-main { min-width: 0; }
.ad-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.ad-head h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.ad-who { font-size: 11.5px; color: var(--ink-3); }

/* ---------- cards / stats ---------- */
.ad-grid { display: grid; gap: 12px; }
.ad-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ad-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.ad-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}
.ad-stat-k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; display: block; margin-bottom: 4px; }
.ad-stat-v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.ad-stat-v.is-money { color: var(--sky-d); }

/* ---------- tables ---------- */
.ad-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}
table.ad-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ad-tbl th, table.ad-tbl td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap; vertical-align: middle;
}
table.ad-tbl th {
    background: var(--bg-soft);
    font-weight: 700; font-size: 11px; color: var(--ink-2);
    position: sticky; top: 0; z-index: 1;
}
table.ad-tbl tr:last-child td { border-bottom: 0; }
table.ad-tbl tbody tr:hover { background: var(--bg-soft); }
.ad-tbl .is-mono { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.ad-empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* ---------- forms ---------- */
.ad-field { display: grid; gap: 5px; margin-bottom: 12px; }
.ad-label { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.ad-input, .ad-select, .ad-textarea {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--line-strong); border-radius: 10px;
    background: var(--surface); color: var(--ink);
    font-size: 13px; font-family: inherit;
    transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.ad-input:focus, .ad-select:focus, .ad-textarea:focus {
    outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(58,167,232,.14);
}
.ad-textarea { min-height: 90px; resize: vertical; }
.ad-hint { font-size: 11px; color: var(--ink-3); }

.ad-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.ad-row > * { flex: 1 1 140px; }

/* drop zone for image uploads */
.ad-drop {
    border: 1.5px dashed var(--line-strong);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    background: var(--bg-soft);
    cursor: pointer;
    transition: border-color .14s var(--ease), background-color .14s var(--ease);
}
.ad-drop:hover { border-color: var(--sky); background: var(--bg-sky); }
.ad-drop input[type=file] { display: none; }
.ad-drop-preview { max-width: 100%; max-height: 96px; border-radius: 8px; margin: 8px auto 0; display: none; }
.ad-drop-preview.is-on { display: block; }
.ad-drop-text { font-size: 12px; color: var(--ink-3); }

/* member card */
.ad-mem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.ad-mem {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 14px; padding: 14px;
    display: grid; gap: 10px;
}
.ad-mem.is-ceo { border-color: #f0dba8; background: #fffdf6; }
html.theme-dark .ad-mem.is-ceo { border-color: #5a451f; background: #241d10; }
.ad-mem-top { display: flex; align-items: center; gap: 10px; }
.ad-mem-av {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(140deg, #7cc4f0, #3aa7e8);
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px;
    overflow: hidden; flex: 0 0 auto;
}
.ad-mem-av img { width: 100%; height: 100%; object-fit: cover; }
.ad-mem-name { font-size: 13.5px; font-weight: 700; margin: 0; }
.ad-mem-mail { font-size: 11px; color: var(--ink-3); margin: 0; word-break: break-all; }
.ad-mem-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 11.5px; }
.ad-mem-stats span { color: var(--ink-3); }
.ad-mem-stats b { color: var(--ink); display: block; font-size: 13px; }
.ad-mem-acts { display: flex; gap: 6px; flex-wrap: wrap; }

.ad-badge {
    font-size: 10px; font-weight: 800; letter-spacing: .05em;
    padding: 2px 7px; border-radius: 999px;
    background: var(--bg-sky); color: var(--sky-d); border: 1px solid var(--line-strong);
}
.ad-badge.is-admin { background: #e8f0ff; color: #3a5fb8; border-color: #c7d6f5; }
.ad-badge.is-ceo { background: #fff3d6; color: #a06f00; border-color: #f0dba8; }
.ad-badge.is-banned { background: #fdeeee; color: #c04242; border-color: #f3cccc; }
.ad-badge.is-ok { background: #e8f9f0; color: #1f8a56; border-color: #c4ecd9; }

/* PIN pad */
.ad-pin-card {
    max-width: 380px; margin: 40px auto;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 20px; padding: 26px 22px;
    text-align: center;
}
.ad-pin-dots { display: flex; justify-content: center; gap: 10px; margin: 18px 0; }
.ad-pin-dots i {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--line-strong); background: transparent;
    transition: background-color .12s var(--ease), border-color .12s var(--ease), transform .12s var(--ease);
}
.ad-pin-dots i.is-on { background: var(--sky); border-color: var(--sky); transform: scale(1.1); }
.ad-pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ad-pin-pad button {
    height: 52px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); color: var(--ink);
    font-size: 19px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: transform .1s var(--ease), background-color .14s var(--ease);
}
.ad-pin-pad button:hover { background: var(--bg-sky); }
.ad-pin-pad button:active { transform: scale(.95); }
.ad-pin-warn {
    margin-top: 14px; padding: 10px 12px; border-radius: 11px;
    background: #fff8ea; border: 1px solid #f3dfb8; color: #96610e; font-size: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
    .ad-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .ad-shell { grid-template-columns: minmax(0, 1fr); }
    .ad-side {
        position: static;
        display: flex; gap: 6px; overflow-x: auto;
        padding: 8px; scrollbar-width: none;
    }
    .ad-side::-webkit-scrollbar { display: none; }
    .ad-side a { white-space: nowrap; flex: 0 0 auto; }
    .ad-grid-3, .ad-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    /* การ์ดสถิติ 2 คอลัมน์บนมือถือ — ไม่ให้กินพื้นที่ทั้งแถวต่อใบ */
    .ad-grid-3, .ad-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    /* the three headline metrics (users / stock / sold) stay one row of three:
       stacked 2+1 they read as four numbers with a stray box under them.
       No :has() — older WebViews drop the whole rule. */
    .ad-grid-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .ad-grid-metrics .ad-metric { padding: 12px 6px; }
    .ad-grid-metrics .ad-stat-v { font-size: 19px; }
    .ad-grid-metrics .ad-stat-k { font-size: 10.5px; }
    .ad-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .ad-card { padding: 14px; border-radius: 14px; }
    .ad-stat-v { font-size: 18px; }
    .ad-stat-k { font-size: 11px; }
    .ad-role { display: none; }
    .ad-tabs-bar { top: 62px; }
    .ad-tabs-scroll { padding: 7px 12px; }
    .ad-tabs-scroll a { padding: 6px 11px; font-size: 12px; }
}

/* ---------- admin tab strip (replaces the old sidebar) ---------- */
.ad-tabs-bar {
    position: sticky; top: 70px; z-index: 40;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
}
.ad-tabs-scroll {
    display: flex; gap: 4px;
    overflow-x: auto; scrollbar-width: none;
    padding: 8px 16px;
}
.ad-tabs-scroll::-webkit-scrollbar { display: none; }
.ad-tabs-scroll a {
    flex: 0 0 auto;
    padding: 7px 13px;
    border-radius: 10px;
    font-size: 12.5px; font-weight: 600;
    color: var(--ink-2); text-decoration: none;
    white-space: nowrap;
    transition: background-color .13s var(--ease), color .13s var(--ease);
}
.ad-tabs-scroll a:hover { background: var(--bg-sky); color: var(--sky-d); }
.ad-tabs-scroll a.is-on { background: var(--sky); color: #fff; }

.ad-shell-page { padding: 0 0 40px; }
.ad-shell-page > .wrap { max-width: 1240px; }

/* ================= ความสวยงามเพิ่มเติม — กรอบ เงา ปุ่ม ฟอร์ม ================= */

/* Card สวย ๆ */
.ad-card {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    box-shadow: 0 4px 16px -8px rgba(0,0,0,0.06);
    padding: 20px;
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.ad-card:hover {
    box-shadow: 0 8px 24px -12px rgba(0,0,0,0.1);
    border-color: var(--sky-l);
}

/* Panel สำหรับ section ต่าง ๆ */
.ad-panel {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    box-shadow: 0 4px 16px -8px rgba(0,0,0,0.06);
    padding: 20px;
    margin-bottom: 16px;
}
.ad-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.ad-panel-head h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--ink);
}
.ad-hint {
    font-size: 11.5px;
    color: var(--ink-3);
}

/* Input / Select / Textarea สวย ๆ */
.ad-input, .ad-select, .ad-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    background: var(--bg-soft);
    color: var(--ink);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
.ad-input:focus, .ad-select:focus, .ad-textarea:focus {
    outline: none;
    border-color: var(--sky);
    box-shadow: 0 0 0 4px rgba(58, 167, 232, 0.12);
    background: var(--surface);
}

/* Label สวย ๆ */
.ad-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-2);
    letter-spacing: 0.02em;
    margin-bottom: 6px;
    display: block;
}

/* ปุ่ม สวย ๆ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    text-decoration: none;
}
.btn:active {
    transform: scale(0.97);
}
.btn-primary {
    background: var(--sky);
    color: #fff;
    border-color: var(--sky);
}
.btn-primary:hover {
    background: #2e9adb;
    box-shadow: 0 4px 12px -6px rgba(58, 167, 232, 0.4);
}
.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border-color: var(--line-strong);
}
.btn-ghost:hover {
    background: var(--bg-soft);
    border-color: var(--sky);
}
.btn-danger {
    background: #fdeeee;
    color: #c04242;
    border-color: #f3cccc;
}
.btn-danger:hover {
    background: #fddddd;
    border-color: #e8b5b5;
}
.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}
.btn-block {
    width: 100%;
}

/* Dropdown select สวย ๆ */
.ad-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d7285' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Table สวย ๆ */
table.ad-tbl {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
}
table.ad-tbl th {
    background: var(--bg-soft);
    font-weight: 700;
    font-size: 11px;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}
table.ad-tbl td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink);
    vertical-align: middle;
}
table.ad-tbl tbody tr:last-child td {
    border-bottom: 0;
}
table.ad-tbl tbody tr:hover {
    background: var(--bg-soft);
}

/* Badge สวย ๆ */
.ad-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.ad-badge.is-admin { background: #e8f0ff; color: #3a5fb8; border-color: #c7d6f5; }
.ad-badge.is-ceo { background: #fff3d6; color: #a06f00; border-color: #f0dba8; }
.ad-badge.is-banned { background: #fdeeee; color: #c04242; border-color: #f3cccc; }
.ad-badge.is-ok { background: #e8f9f0; color: #1f8a56; border-color: #c4ecd9; }

/* Field group */
.ad-field {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

/* Row layout */
.ad-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.ad-row > * { flex: 1 1 160px; }

/* Toast สวยขึ้น */
.toast {
    border: 1px solid var(--line-strong);
    box-shadow: 0 20px 60px -24px rgba(0,0,0,0.35);
}

/* ปุ่มใน drawer */
.drawer .btn {
    font-size: 13px;
}

/* Role badge ใน drawer */
.ad-badge.is-ceo { background: #fff3d6; color: #a06f00; border-color: #f0dba8; }
.ad-badge.is-admin { background: #e8f0ff; color: #3a5fb8; border-color: #c7d6f5; }

html.theme-dark .ad-card { background: #16202b; border-color: #26343f; box-shadow: 0 4px 16px -8px rgba(0,0,0,0.4); }
html.theme-dark .ad-panel { background: #16202b; border-color: #26343f; box-shadow: 0 4px 16px -8px rgba(0,0,0,0.4); }
html.theme-dark table.ad-tbl { background: #16202b; }
html.theme-dark table.ad-tbl tbody tr:hover { background: #1b2a37; }

/* ================= Modal สำหรับจัดการสมาชิก ================= */

.ad-modal {
    position: fixed;
    inset: 0;
    z-index: 260;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.ad-modal.is-open { display: flex; }

.ad-modal-scrim {
    position: absolute;
    inset: 0;
    background: rgba(14, 26, 36, .5);
    backdrop-filter: blur(2px);
}

.ad-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    box-shadow: 0 30px 70px -24px rgba(0,0,0,.5);
    padding: 24px 22px 20px;
    animation: adModalIn .24s cubic-bezier(.22,.61,.36,1) both;
}
.ad-modal-sm { max-width: 360px; }

@keyframes adModalIn {
    from { opacity: 0; transform: translateY(14px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ad-modal-x {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    border: 0; border-radius: 9px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    display: grid; place-items: center;
    transition: background-color .14s var(--ease);
}
.ad-modal-x:hover { background: var(--bg-sky); color: var(--ink-2); }

.ad-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 5px;
    letter-spacing: -.01em;
}
.ad-modal-sub {
    font-size: 12.5px;
    color: var(--ink-3);
    margin: 0 0 16px;
}
.ad-modal-body { display: grid; gap: 2px; }
.ad-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 20px;
}

/* ================= PIN boxes (6 ช่อง) ================= */

.ad-pin-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 6px;
}
.ad-pin-box {
    width: 46px; height: 56px;
    border: 2px solid var(--line-strong);
    border-radius: 14px;
    background: var(--bg-soft);
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--sky-d);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.ad-pin-box.is-on {
    border-color: var(--sky);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(58,167,232,.13);
}

html.theme-dark .ad-modal-card { background: #16202b; border-color: #26343f; }
html.theme-dark .ad-pin-box { background: #1b2733; border-color: #2c3c4c; color: #74c3ee; }
html.theme-dark .ad-pin-box.is-on { border-color: #3aa7e8; background: #1e2c39; }

@media (max-width: 420px) {
    .ad-pin-box { width: 40px; height: 50px; font-size: 21px; border-radius: 12px; }
    .ad-pin-boxes { gap: 7px; }
    .ad-modal-actions { grid-template-columns: 1fr; }
}

/* product table grouping + stock columns */
.ad-tbl .ad-group-row td {
    background: var(--bg-sky, #f0f7fd); font-weight: 700; font-size: 12.5px;
    padding: 8px 12px; color: var(--sky-d, #1c6ea4);
}
html.theme-dark .ad-tbl .ad-group-row td { background: #1c2733; color: #7ec3ef; }
.ad-group-count { margin-left: 8px; font-weight: 500; font-size: 11.5px; color: var(--ink-3, #7b8794); }
.ad-tbl .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.ad-stock-ok { color: #178a4c; }
.ad-stock-none { color: #b3392e; }
.ad-stock-drift { color: #b3770e; font-weight: 700; cursor: help; }
html.theme-dark .ad-stock-ok { color: #4ecb8b; }
html.theme-dark .ad-stock-none { color: #ff8a7e; }
html.theme-dark .ad-stock-drift { color: #f0b95a; }
.ad-cat-sub { opacity: .75; }
.ad-tbl-acts { white-space: nowrap; }
.ad-tbl-acts .btn + .btn { margin-left: 4px; }

/* dashboard metric frames */
.ad-metric { text-align: center; padding: 18px 12px; }
.ad-metric .ad-stat-k { display: block; font-size: 12px; color: var(--ink-3, #7b8794); margin-bottom: 6px; }
.ad-metric .ad-stat-v { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

/* The product table carries 11 columns; on a phone they were being squeezed to a
   few pixels each. Give it a floor width so the wrapper's overflow-x actually
   scrolls instead of shrinking every cell into unreadable slivers. */
.ad-table-wrap { -webkit-overflow-scrolling: touch; }
table.ad-tbl-prod { min-width: 920px; }
table.ad-tbl-prod th,
table.ad-tbl-prod td { white-space: nowrap; }
table.ad-tbl-prod .ad-tbl-acts { white-space: nowrap; }
/* name column may wrap, everything numeric stays on one line */
table.ad-tbl-prod td:nth-child(2) { white-space: normal; min-width: 140px; }

/* ---------- image drop previews (fixed) ----------
   Was: display:none unless .is-on was added by JS on change — so a picture that was
   already saved never appeared, and a fresh pick was invisible until the handler ran.
   Now: the box shows whatever it has, and the JS only swaps the source. */
.ad-drop-preview { max-width: 100%; max-height: 120px; border-radius: 8px; margin: 8px auto 0; display: block; }
.ad-drop-preview[hidden],
.ad-drop-preview:not([src]) { display: none; }
.ad-drop.has-img { border-style: solid; border-color: var(--sky-l, #93c5fd); background: var(--bg-sky, #eff6ff); }
.ad-drop-new {
    display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px;
    background: #eefaf4; color: #12855a; font-size: 10.5px; font-weight: 600;
}
.ad-drop-preview { cursor: zoom-in; }
