/* ───────── Content Plans · dashboard ───────── */
@font-face { font-family: 'Somaya'; src: url('../fonts/itfSomayaArabic-Light.otf') format('opentype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Somaya'; src: url('../fonts/itfSomayaArabic-Regular.otf') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Somaya'; src: url('../fonts/itfSomayaArabic-Medium.otf') format('opentype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Somaya'; src: url('../fonts/itfSomayaArabic-Bold.otf') format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Somaya'; src: url('../fonts/itfSomayaArabic-Black.otf') format('opentype'); font-weight: 900; font-style: normal; font-display: swap; }

:root {
    --bg: #f4efe8;
    --surface: #fffdfa;
    --surface-2: #faf6f0;
    --ink: #1c1814;
    --ink-2: #4a423a;
    --muted: #8b8176;
    --line: #e6dccf;
    --line-2: #efe7dc;
    --accent: #9b5a3a;
    --accent-ink: #7c4125;
    --accent-soft: #f3e3d7;
    --navy: #161b33;
    --ok: #3c7a52;
    --danger: #b3412f;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 8px 24px -12px rgba(60, 40, 20, .18);
    --font: 'Somaya', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --serif: var(--font);
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

/* ───────── Buttons & inputs ───────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
    font-weight: 500; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--ink); color: #f7f1e8; }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); border-color: #d5c7b6; color: var(--ink); }
.btn-danger { background: transparent; border-color: #e7c2ba; color: var(--danger); }
.btn-danger:hover { background: #fbeeea; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }

.input, .field input, .field textarea, .field select, textarea {
    width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); color: var(--ink); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea, .field textarea { height: auto; padding: 10px 13px; resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field textarea:focus, textarea:focus { border-color: #c9a58c; box-shadow: 0 0 0 3px rgba(155, 90, 58, .12); }
.input-sm { height: 32px; font-size: 13px; padding: 0 10px; border-radius: 8px; width: auto; }
.input-num { width: 58px; }
.input-inline { width: 44px; height: 24px; border: 1px solid var(--line); border-radius: 6px; text-align: center; font: inherit; background: var(--surface); }
.input-narrow { max-width: 160px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--muted); font-weight: 400; margin-inline-start: 6px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.field-sm { margin: 8px 0 0; }
.field-sm input { height: 34px; font-size: 13px; }
.error { color: var(--danger); font-size: 12.5px; font-style: normal; margin: 0 0 12px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { position: relative; width: 32px; height: 18px; border-radius: 99px; background: #d9cfc3; transition: background .15s; flex: none; }
.toggle span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(14px); }
.toggle input:focus-visible + span { box-shadow: 0 0 0 3px rgba(155, 90, 58, .25); }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line-2); gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 500; }
.segmented-sm button { padding: 4px 9px; font-size: 12px; }

.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: 13px; background: var(--surface); }
.chip.is-active { background: var(--ink); color: #f7f1e8; border-color: var(--ink); }

.eyebrow { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.display { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.02em; line-height: 1.08; }
.lead { color: var(--muted); font-size: 15px; margin: 10px 0 26px; }
.muted { color: var(--muted); }

/* ───────── Shell ───────── */
.topbar {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
    display: flex; align-items: center; gap: 18px; height: 60px; padding: 0 24px;
    background: rgba(244, 239, 232, .86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font-family: var(--serif); font-size: 16px; background: radial-gradient(circle at 25% 35%, #fff4e0 0, #caa183 35%, #8a4b31 70%, #1a1a33 100%); }
.brand-name { font-weight: 600; letter-spacing: -.01em; }
.topbar-slot { flex: 1; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.container { max-width: 1240px; margin: 0 auto; padding: 36px 24px 80px; }
.narrow { max-width: 620px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--ink); }

.flash, .toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90;
    background: var(--ink); color: #f7f1e8; padding: 10px 18px; border-radius: 99px; font-size: 13.5px; box-shadow: var(--shadow);
}

/* ───────── Plans index ───────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 26px; }
.filters .input { max-width: 280px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.plan-card { background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.plan-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(60,40,20,.05), 0 18px 40px -18px rgba(60,40,20,.3); }
.plan-card-art { position: relative; display: block; aspect-ratio: 16 / 10; background: #d9c4b0; overflow: hidden; }
.plan-card-cover { width: 100%; height: 100%; object-fit: cover; }
.mosaic { display: grid; width: 100%; height: 100%; gap: 2px; background: var(--surface); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.mosaic-1 { grid-template-columns: 1fr; }
.mosaic-2 { grid-template-columns: 1fr 1fr; }
.mosaic-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic-3 img:first-child { grid-row: span 2; }
.mosaic-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic-5, .mosaic-6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.mosaic-5 img:first-child { grid-row: span 2; }
.status { position: absolute; top: 12px; inset-inline-start: 12px; padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 500; background: rgba(255,253,250,.92); backdrop-filter: blur(6px); }
.status-draft { color: var(--ink-2); }
.status-sent { color: #2f5aa8; }
.status-approved { color: var(--ok); }
.plan-card-body { padding: 16px 18px 6px; flex: 1; }
.plan-card-client { margin: 0; font-size: 12px; color: var(--accent); font-weight: 500; }
.plan-card-body h3, .plan-card-client { text-align: start; unicode-bidi: plaintext; }
.plan-card-body h3 { font-size: 17px; font-weight: 600; margin: 2px 0 4px; letter-spacing: -.01em; }
.plan-card-body h3 a { text-decoration: none; }
.plan-card-dates { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; }
.stats { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.stats strong { color: var(--ink); font-weight: 600; font-size: 14px; margin-inline-end: 2px; }
.plan-card-actions { display: flex; gap: 6px; padding: 12px 14px 14px; border-top: 1px solid var(--line-2); margin-top: 12px; flex-wrap: wrap; }
.plan-card-actions form { margin: 0; }

.empty { text-align: center; max-width: 440px; margin: 60px auto; }
.empty h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 26px 0 8px; }
.empty p { color: var(--muted); margin: 0 0 22px; }
.empty-art { display: flex; justify-content: center; gap: 8px; }
.empty-art span { width: 64px; height: 80px; border-radius: 10px; background: linear-gradient(160deg, #e8d7c6, #b98a6c 60%, #3a2d3b); box-shadow: var(--shadow); }
.empty-art span:nth-child(2) { transform: translateY(-10px); background: linear-gradient(160deg, #f7eee3, #d0ab90 55%, #7b4a33); }

/* ───────── Forms ───────── */
.form-card { background: var(--surface); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* ───────── Login ───────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { display: grid; grid-template-columns: 1.1fr 1fr; width: min(880px, 100%); background: var(--surface); border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px -30px rgba(60, 35, 15, .45); }
.login-art { position: relative; min-height: 460px; }
.login-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.login-art-text { position: absolute; inset-inline-start: 32px; bottom: 34px; color: #fff; }
.login-art-text .eyebrow { color: rgba(255,255,255,.75); }
.login-art-text h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.1; letter-spacing: -.02em; }
.login-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin-bottom: 24px; }
@media (max-width: 720px) {
    .login-card { grid-template-columns: 1fr; }
    .login-art { min-height: 200px; }
    .login-form { padding: 30px 24px; }
}

/* ───────── Editor ───────── */
.editor-main { padding: 0; }
.editor { display: flex; flex-direction: column; }
.editor-head {
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--line-2);
}
.editor-title { flex: 1; min-width: 240px; }
.title-input { text-align: start; unicode-bidi: plaintext; width: 100%; border: 0; background: transparent; font-size: 26px; font-weight: 600; letter-spacing: -.01em; padding: 2px 0; outline: none; color: var(--ink); font-family: var(--font); }
.title-input:focus { box-shadow: inset 0 -2px 0 var(--accent-soft); }
.editor-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.status-select { border: 1px solid var(--line); border-radius: 99px; background: var(--surface); padding: 3px 10px; font: inherit; font-size: 12.5px; }
.status-select.status-sent { color: #2f5aa8; }
.status-select.status-approved { color: var(--ok); }
.save-state { font-size: 12px; color: var(--muted); }
.save-state.is-saving { color: var(--accent); }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.editor-content { padding: 18px 24px 80px; min-width: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); cursor: pointer; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; white-space: nowrap; }
.tabs button b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 99px; background: var(--line-2); font-size: 11px; font-weight: 600; color: var(--ink-2); }
.tabs button.is-active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.tabs button.is-active b { background: var(--ink); color: #f7f1e8; }

.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-label { font-size: 12.5px; color: var(--muted); }
.toolbar-note { margin: 0; font-size: 13px; color: var(--muted); }

.drop-hint { display: flex; flex-direction: column; gap: 4px; padding: 30px; border: 1.5px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }
.drop-hint strong { color: var(--ink); font-size: 15px; }

.item-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 14px; }
.item-card { position: relative; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; background: var(--surface); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); border: 1px solid transparent; }
.item-card.is-ad { border-color: #e2c3ae; background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; }
.item-card.is-ghost { opacity: .35; }
.item-media { position: relative; }
.item-index { position: absolute; bottom: 6px; inset-inline-end: 6px; min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 99px; background: rgba(28,24,20,.72); color: #fff; font-size: 11px; font-weight: 600; padding: 0 6px; pointer-events: none; }
.drag-handle { position: absolute; top: 6px; inset-inline-end: 6px; z-index: 2; width: 24px; height: 24px; border: 0; border-radius: 6px; background: rgba(255,253,250,.9); cursor: grab; font-size: 11px; letter-spacing: -2px; color: var(--ink-2); }
.drag-handle:active { cursor: grabbing; }

.thumb { position: relative; overflow: hidden; border-radius: 10px; background: #ebe3d9; cursor: zoom-in; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-square { width: 132px; aspect-ratio: 1; }
.thumb-tall { width: 100%; aspect-ratio: 9 / 16; cursor: grab; }
.thumb-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; color: var(--muted); text-align: center; padding: 8px; }
.thumb-empty.is-loading { background: linear-gradient(100deg, #ebe3d9 30%, #f6f0e8 50%, #ebe3d9 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.badge-carousel { position: absolute; top: 6px; left: 8px; color: #fff; font-weight: 700; letter-spacing: -1px; text-shadow: 0 0 3px rgba(0,0,0,.6); font-size: 15px; }
.badge-play { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.18); pointer-events: none; }
.badge-play svg { width: 18px; height: 18px; margin-left: 2px; }

.item-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.item-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.caption { min-height: 64px; font-size: 13.5px; border-radius: 10px; resize: none; overflow: hidden; background: var(--surface-2); }
.item-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-name { font-size: 11.5px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-footer .icon-btn { margin-inline-start: auto; }
.item-links { width: 100%; }

.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.story-card { background: var(--surface); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); border: 1px solid transparent; }
.story-card.is-ad { border-color: #e2c3ae; }
.story-card.is-ghost { opacity: .35; }
.story-actions { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px 0; }

/* Ads tab */
.ads-summary { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; margin-bottom: 22px; }
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; background: var(--surface); padding: 18px; border-radius: 18px; box-shadow: var(--shadow); align-content: start; }
.price-grid .field { margin: 0; }
.money { position: relative; }
.money input { padding-inline-end: 50px; }
.money em { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 12px; }
.budget-card { background: var(--navy); color: #eee6da; border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.budget-line { display: flex; justify-content: space-between; font-size: 13px; color: #c9c0b4; }
.budget-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid rgba(255,255,255,.12); padding-top: 10px; margin: 4px 0 10px; }
.budget-total b { font-family: var(--serif); font-size: 26px; font-weight: 500; color: #fff; }
.budget-card .toggle { color: #c9c0b4; }
.ad-group { margin-top: 18px; }
.ad-group h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.ad-picks { display: grid; gap: 10px; }
.ad-picks-square { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.ad-picks-tall { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.ad-pick { position: relative; padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: #ebe3d9; cursor: pointer; aspect-ratio: 1; transition: border-color .15s, opacity .15s; opacity: .6; }
.ad-picks-tall .ad-pick { aspect-ratio: 9 / 16; }
.ad-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ad-pick.on { border-color: var(--accent); opacity: 1; }
.ad-pick:hover { opacity: 1; }
.ad-check { position: absolute; top: 6px; inset-inline-end: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; display: none; place-items: center; }
.ad-pick.on .ad-check { display: grid; }
.ad-pick small { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 4px; font-size: 10px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.55)); text-align: start; }

/* Settings */
.settings { max-width: 760px; }
.choice-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; margin-bottom: 16px; }
.choice-label { width: 100%; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.choice { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { font-weight: 600; font-size: 15px; }
.choice small { color: var(--muted); font-size: 12px; }
.choice.on { border-color: var(--ink); background: var(--surface-2); }
.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 8px; }
.danger-zone form { margin: 0; }
.danger-zone form:last-child { margin-inline-start: auto; }

/* ───────── Dropbox panel ───────── */
.dropbox-panel {
    position: sticky; top: 60px; height: calc(100vh - 60px); display: flex; flex-direction: column;
    background: var(--surface); border-inline-start: 1px solid var(--line-2);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #0061fe; }
.panel-title svg { flex: none; }
.panel-link { display: flex; gap: 6px; padding: 0 18px 10px; }
.panel-link .input { flex: 1; width: auto; min-width: 0; }
.panel-crumbs { padding: 0 18px 8px; flex-wrap: wrap; gap: 2px; }
.panel-crumbs button { border: 0; background: none; padding: 2px 4px; border-radius: 5px; color: var(--ink-2); cursor: pointer; font-size: 12.5px; }
.panel-crumbs button:hover { background: var(--line-2); }
.panel-crumbs .sep { color: var(--line); }
.panel-filter { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 18px 10px; flex-wrap: wrap; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 4px 18px 18px; }
.panel-message { color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel-message.error { color: var(--danger); }

.file-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.file-tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #efe8df; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .12s, transform .12s; }
.file-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file-tile:hover { transform: scale(.98); }
.file-tile.is-selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.file-tile.is-other { opacity: .4; cursor: default; }
.file-tile.is-dir { background: var(--surface-2); color: #7aa7f5; display: grid; place-items: center; outline: 1px solid var(--line-2); }
.folder-icon { margin-top: -16px; }
.tile-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 10.5px; color: #fff; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.is-dir .tile-name { color: var(--ink-2); background: none; text-align: center; }
.tile-play { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center; }
.tile-play svg { width: 11px; height: 11px; margin-left: 1px; }
.tile-used { position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 99px; background: rgba(60, 122, 82, .92); color: #fff; font-size: 9.5px; font-weight: 500; }
.tile-check { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; display: grid; place-items: center; box-shadow: 0 0 0 3px rgba(255,255,255,.85); }
.is-selected img { filter: brightness(.82); }

.panel-actions { border-top: 1px solid var(--line-2); padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--surface); box-shadow: 0 -10px 24px -18px rgba(60,40,20,.35); }
.panel-actions-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel-actions-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }

/* ───────── Modals ───────── */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(28, 24, 20, .5); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }
.modal-card { width: min(560px, 100%); background: var(--surface); border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
.modal-card h3 { font-size: 18px; margin-bottom: 4px; }
.modal-card textarea { margin: 14px 0; font-size: 13px; }
.modal-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .segmented { margin-inline-end: auto; }
.viewer { background: rgba(12, 10, 8, .88); }
.viewer-body { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 92vw; }
.viewer-body img, .viewer-body video { max-width: 92vw; max-height: 80vh; border-radius: 12px; background: #000; }
.viewer-bar { display: flex; gap: 10px; align-items: center; color: #eee; font-size: 13px; flex-wrap: wrap; justify-content: center; }
.viewer-bar .btn-ghost { color: #eee; border-color: rgba(255,255,255,.25); }
.viewer-bar .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.viewer-note { margin: 0; font-size: 13px; max-width: 460px; text-align: center; }
.viewer .viewer-note { color: #eee; }

/* ───────── Responsive ───────── */
@media (max-width: 1080px) {
    .editor-body { grid-template-columns: 1fr; }
    .dropbox-panel { position: relative; top: 0; height: auto; max-height: 620px; border-inline-start: 0; border-top: 1px solid var(--line-2); order: -1; }
    .ads-summary { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .topbar { padding: 0 16px; gap: 10px; }
    .brand-name { display: none; }
    .container { padding: 24px 16px 60px; }
    .editor-head, .editor-content { padding-left: 16px; padding-right: 16px; }
    .item-card { grid-template-columns: 1fr; }
    .thumb-square { width: 100%; }
    .price-grid { grid-template-columns: 1fr; }
    .danger-zone form:last-child { margin-inline-start: 0; }
}

/* ───────── Language switch & right-to-left ───────── */
.lang-switch { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--line-2); gap: 2px; }
.lang-switch a { padding: 3px 10px; border-radius: 99px; font-size: 12.5px; text-decoration: none; color: var(--muted); line-height: 1.5; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.is-active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lang-switch a[lang="ar"] { font-family: var(--font); }
.login-lang { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); inset-inline-end: 16px; z-index: 5; }
.field-top { margin-top: 16px; }
.remember { margin: 0 0 16px; }
.field-note { margin: -6px 0 16px; font-size: 12.5px; }
@media (max-width: 640px) { .topbar .lang-switch a { padding: 3px 7px; } .topbar .btn-sm { padding: 0 10px; } }

[dir="rtl"] .display,
[dir="rtl"] .empty h2,
[dir="rtl"] .login-form h2,
[dir="rtl"] .login-art-text h1 { font-family: var(--font); font-weight: 600; letter-spacing: 0; line-height: 1.3; }
[dir="rtl"] .budget-total b { font-family: var(--font); font-weight: 600; }
[dir="rtl"] .eyebrow { letter-spacing: 0; font-size: 12.5px; }
[dir="rtl"] .brand-name, [dir="rtl"] .title-input { letter-spacing: 0; }
[dir="rtl"] .arrow-back, [dir="rtl"] .arrow-forward { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .toggle span::after { left: auto; right: 2px; }
[dir="rtl"] .toggle input:checked + span::after { transform: translateX(-14px); }
[dir="rtl"] .tabs button b { font-family: var(--font); }
[dir="rtl"] input[type="date"], [dir="rtl"] input[type="number"] { direction: ltr; text-align: right; }
[dir="ltr"] .title-input, [dir="ltr"] .plan-card-body h3, [dir="ltr"] .plan-card-client { text-align: left; }
[dir="rtl"] .title-input, [dir="rtl"] .plan-card-body h3, [dir="rtl"] .plan-card-client { text-align: right; }

/* ───────── Client replies in the editor ───────── */
.review-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.review-chip b { font-weight: 600; color: var(--ink); }
.review-chip i { font-style: normal; color: var(--danger); }
.item-review, .story-note { border-radius: 10px; padding: 8px 10px; font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.item-review.is-approved, .story-note.is-approved { background: #eef4ef; color: #2c5c3e; }
.item-review.is-changes, .story-note.is-changes { background: #fbeee9; color: #8f3324; }
.item-review p, .story-note p { flex: 1 0 100%; margin: 0; color: var(--ink); }
.item-review-tag { font-weight: 600; }
.story-note { margin-top: 8px; font-size: 11.5px; }
.item-card.is-changes, .story-card.is-changes { border-color: #e7c2ba; }
.rounds { list-style: none; margin: 0 0 14px; padding: 0; }
.rounds li { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.rounds time { color: var(--muted); font-size: 12px; }

/* ───────── Release 2: selection, calendar, library, covers ───────── */
.pick { position: absolute; top: 6px; left: 6px; z-index: 2; width: 22px; height: 22px; border-radius: 6px; background: rgba(255,253,250,.92); display: grid; place-items: center; cursor: pointer; }
.pick input { margin: 0; cursor: pointer; }
.pick.on { background: var(--accent); }
.badge-missing { position: absolute; bottom: 6px; left: 6px; padding: 2px 7px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 500; }

.bulk-bar { position: sticky; top: 64px; z-index: 12; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 12px; border-radius: 14px; background: var(--ink); color: #f7f1e8; box-shadow: var(--shadow); }
.bulk-bar .btn-ghost { border-color: rgba(255,255,255,.25); color: #f7f1e8; }
.bulk-bar .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.bulk-bar .btn-danger { border-color: rgba(255,255,255,.3); color: #ffb9ac; }
.bulk-bar .link-btn { color: #d8cec2; }
.bulk-bar .segmented { background: rgba(255,255,255,.12); }
.bulk-bar .segmented button { color: #e9e0d4; }
.bulk-shift { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #d8cec2; }

.calendar { display: flex; flex-direction: column; gap: 22px; margin-bottom: 20px; }
.cal-month h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekday { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-cell { min-height: 74px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); padding: 4px; }
.cal-cell.is-empty { background: transparent; border-color: transparent; }
.cal-cell.has-items { border-color: var(--line); }
.cal-day { font-size: 11px; color: var(--muted); }
.cal-items { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.cal-item { position: relative; width: 30px; height: 30px; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: #ebe3d9; cursor: pointer; }
.cal-item img { width: 100%; height: 100%; object-fit: cover; }
.cal-kind { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: #fff; background: rgba(0,0,0,.35); }

.snippets { list-style: none; margin: 0 0 16px; padding: 0; max-height: 40vh; overflow-y: auto; }
.snippets li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-2); padding: 6px 0; }
.snippet { flex: 1; text-align: start; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 8px; min-width: 0; }
.snippet:hover { background: var(--surface-2); }
.snippet b { display: block; font-size: 13px; }
.snippet span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snippet-scope { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; }
.snippet-form { border-top: 1px solid var(--line); padding-top: 14px; }
.cover-card video { width: 100%; max-height: 50vh; background: #000; border-radius: 12px; margin: 12px 0; }
.next-month .field { margin-bottom: 10px; }

/* ───────── Release 3: navigation, clients, reports, to-do ───────── */
.mainnav { display: flex; gap: 2px; }
.mainnav a { padding: 7px 12px; border-radius: 99px; text-decoration: none; color: var(--ink-2); font-size: 13.5px; }
.mainnav a:hover { background: var(--surface); }
.mainnav a.is-on { background: var(--ink); color: #f7f1e8; }

.narrow-wide { max-width: 980px; margin: 0 auto; }
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.client-card { display: block; background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); text-decoration: none; }
.client-card:hover { transform: translateY(-2px); }
.client-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.client-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; align-items: start; }

.plan-rows { list-style: none; margin: 0 0 18px; padding: 0; }
.plan-rows li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.plan-rows form { margin: 0; }
.user-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; }
.user-row input, .user-row select { height: 34px; font-size: 13px; width: auto; min-width: 120px; flex: 1 1 130px; }

.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table thead th { font-size: 12px; color: var(--muted); font-weight: 500; }
.table tfoot th { font-weight: 600; }
.table a { text-decoration: none; }

.todo-group { margin-bottom: 18px; }
.todo-group h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.todo-group h3 b { min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; background: var(--line-2); font-size: 11px; }
.todo-group ul { list-style: none; margin: 0; padding: 0; }
.todo-group li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.todo-thumb { width: 34px; height: 34px; border-radius: 8px; overflow: hidden; background: #ebe3d9; flex: none; }
.todo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.todo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 860px) {
    .client-columns { grid-template-columns: 1fr; }
    .mainnav a { padding: 6px 9px; font-size: 12.5px; }
}

/* Caption drafts */
.drafts { flex: 1 0 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.draft { display: flex; gap: 10px; align-items: flex-start; text-align: start; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.draft:hover { border-color: var(--accent); }
.draft span { flex: 1; white-space: pre-line; }
.draft b { color: var(--accent); font-size: 12px; }

.metrics { display: inline-flex; gap: 8px; font-size: 11.5px; color: var(--muted); }
.metrics b { color: var(--ink); }
/* Crop editor */
.crop-card { width: min(560px, 100%); }
.crop-card > .muted { font-size: 12.5px; }
.crop-shapes { margin-top: 12px; }
.crop-stage { position: relative; margin: 14px auto 12px; overflow: hidden; border-radius: 10px; background: #1c1814; user-select: none; touch-action: none; direction: ltr; }
.crop-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(20, 16, 12, .6); outline: 2px solid #fff; cursor: move; touch-action: none; }
.crop-grid { position: absolute; inset: 0; pointer-events: none; background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.crop-handle { position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.4); touch-action: none; }
.crop-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.crop-zoom { display: flex; align-items: center; gap: 8px; flex: 1 1 160px; font-size: 12.5px; color: var(--ink-2); }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-preview { position: relative; flex: none; height: 64px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #ebe3d9; border: 1px solid var(--line); }
.crop-preview-tall { aspect-ratio: 9 / 16; }
.crop-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
