:root {
  --bg: #f3f5f8; --surface: #fff; --surface-2: #eaeef3; --text: #162033; --muted: #5a6679; --border: #d8dee8;
  --primary: #0f4c75; --primary-contrast: #fff; --accent: #e8a317; --side-bg: #0f2a43; --side-text: #d6e2ee;
  --st-new: #2563eb; --st-pending: #b45309; --st-approved: #0e7490; --st-published: #15803d; --st-rejected: #dc2626; --st-archived: #64748b;
  --radius: 10px; --font-he: "Heebo", system-ui, sans-serif; --font-ar: "Cairo", system-ui, sans-serif; --font-en: "Inter", system-ui, sans-serif;
  --pad: 16px; --gap: 16px; --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05);
  --font-ui: var(--font-he);
}
:root[data-density="compact"] { --pad: 10px; --gap: 10px; }
html[lang="he"] { --font-ui: var(--font-he); } html[lang="ar"] { --font-ui: var(--font-ar); } html[lang="en"] { --font-ui: var(--font-en); }
[lang="he"] { font-family: var(--font-he); } [lang="ar"] { font-family: var(--font-ar); } [lang="en"] { font-family: var(--font-en); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; } h1 { font-size: 1.5rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
a { color: var(--primary); } button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .grow { flex: 1; } .nowrap { white-space: nowrap; }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .spread { justify-content: space-between; }
.mt { margin-top: var(--gap); } .hidden { display: none !important; }

/* shell */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: #fff; text-decoration: none; }
.brand b { font-size: 1.05rem; letter-spacing: .2px; } .brand small { display: block; font-size: .72rem; opacity: .7; font-weight: 400; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: calc(var(--radius) - 2px); color: inherit; text-decoration: none; opacity: .88; }
.nav a:hover { background: rgb(255 255 255 / .08); opacity: 1; }
.nav a[aria-current="page"] { background: var(--primary); color: var(--primary-contrast); opacity: 1; }
.nav .badge-n { margin-inline-start: auto; background: var(--accent); color: #111; border-radius: 99px; padding: 0 7px; font-size: .75rem; font-weight: 700; }
.side-foot { margin-top: auto; padding: 12px 8px 0; font-size: .8rem; opacity: .75; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.top .menu-btn { display: none; }
#view { padding: 24px; max-width: 1400px; width: 100%; margin-inline: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); line-height: 1.2; }
.btn:hover { background: var(--surface-2); } .btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .card-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--primary); color: var(--primary-contrast); border-color: transparent; } .btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--st-rejected); border-color: color-mix(in srgb, var(--st-rejected) 45%, var(--border)); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.sm { padding: 4px 10px; font-size: .85rem; } .btn[disabled] { opacity: .5; pointer-events: none; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--surface); }
textarea { min-height: 84px; resize: vertical; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); } label.f > :not(span) { color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--primary); } .switch input:checked + i::after { inset-inline-start: 19px; } .switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow); }
.card > h2, .card > .card-h { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.grid { display: grid; gap: var(--gap); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stat { display: flex; flex-direction: column; gap: 2px; border-inline-start: 4px solid var(--c, var(--primary)); } .stat b { font-size: 1.9rem; line-height: 1.1; } .stat span { color: var(--muted); font-size: .9rem; }
.pill, .badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge { --c: var(--muted); background: color-mix(in srgb, var(--c) 14%, transparent); color: color-mix(in srgb, var(--c) 78%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); }
.st-new { --c: var(--st-new); } .st-pending { --c: var(--st-pending); } .st-approved { --c: var(--st-approved); } .st-published { --c: var(--st-published); } .st-rejected { --c: var(--st-rejected); } .st-archived { --c: var(--st-archived); }
.ok { --c: var(--st-published); } .err { --c: var(--st-rejected); } .paused { --c: var(--st-archived); } .ai { --c: #7c3aed; } .warn { --c: var(--st-pending); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); font-size: .8rem; margin: 1px 2px 1px 0; margin-inline: 0 4px; }
.imp { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--border); } .imp-3 { background: var(--st-rejected); } .imp-2 { background: var(--accent); } .imp-1 { background: var(--st-archived); }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; display: flex; } .bar > i { display: block; height: 100%; background: var(--c, var(--primary)); }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.notice { padding: 10px 12px; border-radius: calc(var(--radius) - 2px); background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 35%, transparent); font-size: .9rem; }

/* list rows (inbox etc.) */
.filters { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.list { display: flex; flex-direction: column; } .item { display: grid; grid-template-columns: 14px minmax(0, 1fr) 170px 120px 130px; gap: 12px; align-items: center; padding: 11px 6px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.item:last-child { border-bottom: 0; } a.item:hover { background: var(--surface-2); border-radius: 8px; } .item .t { font-weight: 600; } .item .meta { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: start; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; } th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tbl-wrap { overflow-x: auto; }

/* article */
.cmp { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: var(--gap); }
.text-box { white-space: pre-wrap; line-height: 1.8; } .tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { padding: 4px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .85rem; } .tab[aria-selected="true"] { background: var(--primary); color: var(--primary-contrast); border-color: transparent; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.hist { list-style: none; padding: 0; margin: 0; font-size: .85rem; } .hist li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.sticky-actions { position: sticky; top: 56px; z-index: 10; }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgb(8 14 24 / .55); display: grid; place-items: center; z-index: 100; padding: 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius); width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 20px; box-shadow: 0 20px 60px rgb(0 0 0 / .35); } .modal.wide { width: min(860px, 100%); }
.modal h2 { margin-bottom: 14px; } .form { display: grid; gap: 12px; } .form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: grid; gap: 8px; z-index: 200; } .toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow); }

/* design studio */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.preset { border: 2px solid var(--border); border-radius: var(--radius); padding: 8px; cursor: pointer; background: var(--surface); text-align: start; } .preset[aria-pressed="true"] { border-color: var(--primary); }
.preset .sw { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin-bottom: 6px; } .preset .sw i { flex: 1; }
.tok { display: flex; align-items: center; gap: 10px; padding: 4px 0; } .tok span { flex: 1; font-size: .9rem; }
.preview { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-family: var(--font-ui); }
.preview .pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.contrast-row { display: flex; justify-content: space-between; font-size: .85rem; padding: 2px 0; }

/* public site */
.pub-head { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.pub-head .in, .pub-wrap { max-width: 1120px; margin-inline: auto; padding: 12px 20px; }
.pub-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); } .pub-brand b { font-size: 1.15rem; } .pub-brand small { display: block; color: var(--muted); font-size: .78rem; }
.hero { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--accent))); color: var(--primary-contrast); padding: 34px 0; }
.hero .pub-wrap { padding-block: 0; } .hero h1 { font-size: 1.8rem; margin-bottom: 14px; }
.hero input, .hero select { color: var(--text); }
.pub-filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.acard { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; } .acard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgb(0 0 0 / .1); }
.acard h3 { font-size: 1.05rem; } .article-full { max-width: 760px; margin-inline: auto; } .article-full .text-box { font-size: 1.05rem; }
.foot { color: var(--muted); text-align: center; padding: 30px 12px; font-size: .85rem; }

/* responsive */
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } .filters { grid-template-columns: repeat(3, 1fr); } .filters > :first-child { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  html[dir="rtl"] .side { transform: translateX(100%); } body.nav-open .side { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / .4); }
  .top .menu-btn { display: inline-flex; } .top { padding: 8px 14px; } #view { padding: 16px 14px; }
  .g2, .g3, .cmp, .form .two { grid-template-columns: 1fr; }
  .item { grid-template-columns: 14px 1fr; } .item > :nth-child(n+3) { grid-column: 2; }
  .filters, .pub-filters { grid-template-columns: 1fr 1fr; } .filters > :first-child, .pub-filters > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: 1fr 1fr; } .hero h1 { font-size: 1.4rem; } .page-head h1 { font-size: 1.25rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* journey + message bubbles */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.steps li { display: flex; flex-direction: column; gap: 3px; padding: 10px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--surface-2); opacity: .65; }
.steps li.done { opacity: 1; border-color: color-mix(in srgb, var(--st-published) 45%, var(--border)); } .steps li.now { opacity: 1; border-style: dashed; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--border); font-size: .75rem; } .steps li.done .dot { background: var(--st-published); color: #fff; }
.bubble { margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid var(--border); font-size: .9rem; line-height: 1.5; max-width: 420px; }
.bubble.whatsapp { background: color-mix(in srgb, var(--st-published) 14%, var(--surface)); }
.chip.rg { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); font-weight: 600; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login { width: min(420px, 100%); display: grid; gap: 12px; padding: 24px; }
.login-brand { text-align: center; } .login-brand h1 { margin: 8px 0 2px; font-size: 1.4rem; } .login-brand p { margin: 0; }

/* base64 media */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } .shots figure { margin: 0; }
.shots img { width: 100%; height: 110px; object-fit: cover; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); cursor: zoom-in; display: block; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--primary) 18%, var(--surface-2)); color: var(--text); font-weight: 700; }

/* user menu in the side bar */
.side-foot { display: grid; gap: 2px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 4px; border-top: 1px solid rgb(255 255 255 / .14); }
.side-user b { display: block; font-size: .88rem; } .side-user small { display: block; opacity: .7; }
.avatar-ini { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-contrast, #fff); font-weight: 700; font-size: .8rem; flex: none; }
.side-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: transparent; color: inherit; font: inherit; text-decoration: none; text-align: start; cursor: pointer; border-radius: calc(var(--radius) - 3px); opacity: .9; }
.side-link:hover { background: rgb(255 255 255 / .1); opacity: 1; } .side-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-meta { padding: 6px 8px 0; font-size: .72rem; opacity: .65; }

/* picture of a collected item */
.item-thumb { float: inline-end; width: 76px; height: 76px; object-fit: cover; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); margin-inline-start: 12px; background: var(--surface-2); }
.item-photo { display: block; max-width: 100%; max-height: 340px; object-fit: contain; border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); margin-bottom: 10px; background: var(--surface-2); }

/* the bar for working on several selected items stays at the top while scrolling */
#src-bulk, #bulk { position: sticky; top: 56px; z-index: 12; }
#src-bulk > .card, #bulk > .card { box-shadow: 0 6px 16px rgb(0 0 0 / .14); border-color: var(--primary); }
