/* Domisi DP admin */
:root {
  --navy-900: #060d33; --navy-800: #0a1a5c; --navy-700: #1a2b78; --gold: #f2b705;
  --ink: #12152a; --text: #3b3f55; --muted: #6b7088; --line: #e4e3ef; --bg: #f5f6fb; --white: #fff;
  --danger: #c0392b; --ok: #1e7a4a; --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); }
h1, h2, h3 { color: var(--ink); margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
a { color: var(--navy-700); }
.muted { color: var(--muted); margin: 0; }
[hidden] { display: none !important; }

/* Buttons */
.btn-p { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 0; border-radius: 999px; background: var(--navy-800); color: #fff; font: 600 .95rem var(--font); cursor: pointer; white-space: nowrap; }
.btn-p:hover { background: var(--navy-700); }
.btn-p:disabled { opacity: .6; cursor: wait; }
.btn-p--block { width: 100%; margin-top: 8px; }
.btn-s { padding: 7px 14px; border: 1px solid var(--navy-800); border-radius: 999px; background: var(--navy-800); color: #fff; font: 600 .85rem var(--font); cursor: pointer; }
.btn-s:hover { background: var(--navy-700); }
.btn-s--ghost { background: transparent; color: var(--navy-800); }
.btn-s--ghost:hover { background: #eef0fa; }
.icon-btn { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; font-size: .9rem; line-height: 1; }
.icon-btn:hover { border-color: var(--navy-700); color: var(--navy-800); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); }
.link-danger { border: 0; background: none; color: var(--danger); cursor: pointer; font: inherit; padding: 0; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(120% 80% at 50% 0%, #1f3196, var(--navy-900)); }
.auth__box { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 36px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth__logo { height: 64px; display: block; margin: 0 auto 22px; }
.auth h1 { text-align: center; }

/* Shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--navy-900); color: rgba(255,255,255,.75); padding: 20px 14px; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; font-weight: 700; }
.side__brand img { height: 38px; }
.side__brand span { padding: 3px 9px; border-radius: 999px; background: var(--gold); color: var(--navy-900); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: 9px 12px; border-radius: 10px; color: rgba(255,255,255,.78); text-decoration: none; font-size: .93rem; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a.is-active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side__group { margin: 16px 12px 6px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.4); }
.side__foot { margin-top: auto; padding: 16px 12px 4px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.side__foot a, .side__foot button { color: rgba(255,255,255,.8); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; padding: 0; }
.side__foot a:hover, .side__foot button:hover { color: var(--gold); }
.main { padding: 26px clamp(18px, 3vw, 40px) 80px; min-width: 0; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head--sticky { position: sticky; top: 0; z-index: 20; margin: -26px calc(-1 * clamp(18px, 3vw, 40px)) 22px; padding: 18px clamp(18px, 3vw, 40px); background: rgba(245,246,251,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash--ok { background: #e3f5ea; color: var(--ok); }
.flash--error { background: #fdeaea; color: var(--danger); }

/* Dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: block; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .2s, transform .2s, box-shadow .2s; }
.card:hover { border-color: var(--navy-700); transform: translateY(-2px); box-shadow: 0 10px 30px -18px rgba(10,26,92,.4); }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }

/* Editor */
.block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 6px; font-size: .9rem; }
.help { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=number], input[type=password], input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d6d8e6; border-radius: 9px; background: #fff; font: inherit; color: var(--ink);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, .rich__area:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(26,43,120,.12); }
.field--narrow select, .field--narrow input[type=number] { max-width: 280px; }
.bi { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bi__col { position: relative; min-width: 0; }
.flag { display: inline-block; margin-bottom: 4px; padding: 1px 7px; border-radius: 5px; background: #eef0fa; color: var(--navy-700); font-size: .7rem; font-weight: 700; letter-spacing: .06em; }
@media (max-width: 900px) { .bi { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } }

.group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; background: #fbfbfe; }
.group > summary { padding: 12px 16px; font-weight: 700; color: var(--ink); cursor: pointer; }
.group__body { padding: 4px 16px 4px; }

.list { margin: 6px 0 20px; }
.list__head h3 { margin-bottom: 2px; }
.list__head { margin-bottom: 10px; }
.list__items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.item > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; cursor: pointer; list-style: none; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary::before { content: "▸"; color: var(--muted); transition: transform .2s; }
.item[open] > summary::before { transform: rotate(90deg); }
.item__label { font-weight: 700; color: var(--ink); white-space: nowrap; }
.item__title { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__body { padding: 6px 16px 4px; border-top: 1px solid var(--line); }
.item .item { background: #fbfbfe; }
.row-tools { display: inline-flex; gap: 4px; flex-shrink: 0; }
.tlist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tlist__row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 900px) { .tlist__row { grid-template-columns: 1fr; } }

/* Switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input[type=checkbox] { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cfd2e3; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--navy-700); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Image picker */
.imgpick { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.imgpick__preview { width: 150px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #eef0fa; }
.imgpick__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.imgpick__path { color: var(--muted); font-size: .8rem; word-break: break-all; }

/* Rich editor */
.rich { border: 1px solid #d6d8e6; border-radius: 9px; background: #fff; overflow: hidden; }
.rich__bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: #f6f7fc; }
.rich__btn { padding: 4px 9px; border: 1px solid transparent; border-radius: 6px; background: none; font: 600 .8rem var(--font); color: var(--ink); cursor: pointer; }
.rich__btn:hover { background: #fff; border-color: var(--line); }
.rich__area { min-height: 160px; max-height: 520px; overflow-y: auto; padding: 12px 14px; border: 0; }
.rich__area h2, .rich__area h3 { margin: 1em 0 .4em; }
.rich__area p { margin: 0 0 .8em; }
.rich__area ul { padding-left: 1.3em; }
.rich__area .callout { border-left: 4px solid var(--gold); background: #f7f4ec; padding: 8px 12px; border-radius: 0 8px 8px 0; margin: .6em 0; }
.field--wide .bi { grid-template-columns: 1fr 1fr; }

/* Media library */
.media-grid, .modal__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.media { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.media img { width: 100%; height: 120px; object-fit: cover; display: block; }
.media figcaption { padding: 8px 10px 0; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media__meta { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 10px; font-size: .8rem; }
.tag { padding: 2px 8px; border-radius: 999px; background: #eef0fa; color: var(--muted); font-size: .72rem; font-weight: 600; }
.tag--ok { background: #e3f5ea; color: var(--ok); }
.upload-status { margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; background: #eef0fa; color: var(--navy-800); }
.upload-status--error { background: #fdeaea; color: var(--danger); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(6,13,51,.55); backdrop-filter: blur(4px); }
.modal__box { width: min(1000px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: 18px; padding: 20px; }
.modal__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal__head h2 { flex: 1; margin: 0; }
.modal__grid { overflow-y: auto; }
.pick { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: #eef0fa; }
.pick img { width: 100%; height: 110px; object-fit: cover; display: block; }
.pick:hover { border-color: var(--gold); }

/* Tables */
.table .row { display: grid; grid-template-columns: 200px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.narrow { max-width: 460px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }

/* ---- settings */
.block > h2 { margin-bottom: 10px; }
.block > h3, .smtp-only > h3 { margin: 22px 0 6px; display: flex; align-items: center; gap: 8px; }
.block > .muted { margin-bottom: 16px; max-width: 760px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 0 16px; }
.field input:not([type=checkbox]):not([type=radio]), .block--inline input[type=email] { width: 100%; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--navy-700); background: #f6f7fd; }
.radio input { margin-top: 3px; accent-color: var(--navy-800); }
.check { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; font-size: .82rem; color: var(--muted); cursor: pointer; }
.block--inline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.block--inline > div { flex: 1 1 260px; }
.block--inline input[type=email] { flex: 0 1 300px; }
code { background: #eef0fa; padding: 1px 6px; border-radius: 5px; font-size: .85em; color: var(--navy-800); }
.head-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 820px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---- translate buttons */
.bi__col .flag { vertical-align: middle; }
.tr-btn { margin: 0 0 4px 6px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--navy-700); font: 600 .7rem var(--font); cursor: pointer; vertical-align: middle; }
.tr-btn:hover { border-color: var(--navy-700); background: #f6f7fd; }
.tr-btn:disabled { opacity: .6; cursor: wait; }
.bi__col.is-translating input, .bi__col.is-translating textarea, .bi__col.is-translating .rich__area { background: repeating-linear-gradient(-45deg, #f6f7fd 0 10px, #fff 10px 20px); background-size: 28px 28px; animation: tr-stripes .8s linear infinite; }
@keyframes tr-stripes { to { background-position: 28px 0; } }
.bi__col.is-translated input, .bi__col.is-translated textarea, .bi__col.is-translated .rich__area { box-shadow: 0 0 0 2px rgba(242,183,5,.55); }
.tr-note { display: block; margin-top: 4px; font-size: .75rem; color: #8a6a00; }
.tr-error { display: block; margin-top: 4px; font-size: .75rem; color: var(--danger); }
.tlist__row .tr-btn { position: absolute; right: 6px; top: 0; }

/* ==========================================================================
   Admin v2: icons in the sidebar, dashboard, messages, page menu, toasts, mobile
   ========================================================================== */
.ico { width: 18px; height: 18px; flex: none; }
.side nav a { display: flex; align-items: center; gap: 11px; }
.side nav a .ico { opacity: .75; }
.side nav a.is-active .ico, .side nav a:hover .ico { opacity: 1; }
.side nav a span { flex: 1; min-width: 0; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--gold); color: var(--navy-900); font: 700 .75rem var(--font); text-decoration: none; }
.link { background: none; border: 0; padding: 0; font: 600 .86rem var(--font); color: var(--navy-700); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.empty { color: var(--muted); margin: 6px 0; }
.head-actions { flex-wrap: wrap; }
.head-actions form { margin: 0; }
.btn-s { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-s .ico { width: 15px; height: 15px; }
.split-btn { display: inline-flex; }
.split-btn .btn-s:first-child { border-radius: 999px 0 0 999px; }
.split-btn .btn-s:last-child { border-radius: 0 999px 999px 0; margin-left: -1px; padding-left: 10px; padding-right: 12px; }
.js-save.has-changes { position: relative; box-shadow: 0 0 0 3px rgba(242,183,5,.45); }
.js-save.has-changes::after { content: ""; position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; }

/* toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toasts .flash { margin: 0; cursor: pointer; box-shadow: 0 14px 34px -16px rgba(6,13,51,.45); animation: toastIn .45s cubic-bezier(.16,1,.3,1); transition: opacity .4s, transform .4s; }
.toasts .flash.is-gone { opacity: 0; transform: translateX(20px); pointer-events: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s; }
a.stat:hover { border-color: var(--navy-700); transform: translateY(-2px); }
.stat__icon { grid-row: span 3; align-self: start; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #eef0fa; color: var(--navy-700); }
.stat strong { font-size: 1.7rem; color: var(--ink); line-height: 1.1; }
.stat span:not(.stat__icon) { color: var(--muted); font-size: .9rem; }
.stat small { grid-column: 2; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.stat form { grid-column: 2; margin-top: 4px; }
.stat--alert { border-color: var(--gold); background: #fffbea; }
.stat--alert .stat__icon { background: var(--gold); color: var(--navy-900); }
.dash { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.panel__head h2 { margin: 0; font-size: 1.05rem; }
.panel__head a { font-size: .86rem; font-weight: 600; color: var(--navy-700); text-decoration: none; }
.mini-msg { display: flex; gap: 12px; padding: 12px 10px; margin: 0 -10px; border-radius: 10px; text-decoration: none; color: var(--text); }
.mini-msg:hover { background: #f6f7fd; }
.mini-msg__dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; }
.mini-msg.is-unread .mini-msg__dot { background: var(--gold); }
.mini-msg strong { display: block; color: var(--ink); }
.mini-msg small { display: block; color: var(--muted); font-size: .8rem; }
.mini-msg em { display: block; font-style: normal; font-size: .88rem; margin-top: 3px; color: var(--text); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .92rem; }
.quick a:hover { background: #f6f7fd; }
.quick__icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #eef0fa; color: var(--navy-700); flex: none; }
.quick__icon .ico { width: 16px; height: 16px; }

/* search + filter chips (messages, media) */
.msg-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.msg-tools input[type=search] { flex: 1 1 260px; max-width: 420px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; font: inherit; background: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 .84rem var(--font); color: var(--text); cursor: pointer; }
.chip.is-on { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

/* messages */
.msgs { display: grid; gap: 8px; }
.msg { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.msg[hidden] { display: none; }
.msg summary { display: grid; grid-template-columns: 10px minmax(150px, 220px) 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; cursor: pointer; list-style: none; }
.msg summary::-webkit-details-marker { display: none; }
.msg__dot { width: 8px; height: 8px; border-radius: 50%; }
.msg.is-unread .msg__dot { background: var(--gold); }
.msg.is-unread .msg__who strong { font-weight: 800; }
.msg__who strong { display: block; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg__who small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg__snippet { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg__when { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.msg[open] { border-color: var(--navy-700); box-shadow: 0 14px 34px -24px rgba(10,26,92,.4); }
.msg[open] .msg__snippet { visibility: hidden; }
.msg__body { padding: 4px 22px 20px 42px; }
.msg__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 20px; margin: 0 0 14px; }
.msg__meta dt { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.msg__meta dd { margin: 2px 0 0; color: var(--ink); }
.msg__text { background: #f6f7fd; border-radius: 10px; padding: 14px 16px; color: var(--ink); line-height: 1.6; }
.msg__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg__actions form { margin: 0; }

/* media library */
.dropzone { display: flex; align-items: center; gap: 14px; padding: 18px 22px; margin-bottom: 16px; border: 2px dashed #cfd3e6; border-radius: var(--radius); background: #fff; color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone .ico { width: 28px; height: 28px; color: var(--navy-700); }
.dropzone strong { color: var(--ink); }
.dropzone.is-over { border-color: var(--gold); background: #fffbea; }
.media[hidden] { display: none; }
.media figcaption small { display: block; color: var(--muted); font-size: .72rem; margin-top: 2px; }

/* counters */
.bi__col { position: relative; }
.counter { display: block; text-align: right; font-size: .74rem; color: var(--muted); margin-top: 3px; }
.counter.is-near { color: #a77d00; }
.counter.is-over { color: var(--danger); font-weight: 700; }

/* "On this page" menu next to long editors */
@media (min-width: 1280px) {
  .editor.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 230px; column-gap: 24px; align-items: start; }
  .editor.has-toc > .page-head { grid-column: 1 / -1; }
  .editor.has-toc > .block { grid-column: 1; }
  .editor.has-toc > .toc { grid-column: 2; grid-row: 2 / span 20; }
}
.toc { position: sticky; top: 104px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; max-height: calc(100vh - 130px); overflow: auto; }
.toc__title { margin: 0 0 8px; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .86rem; line-height: 1.35; }
.toc a:hover { background: #f6f7fd; color: var(--ink); }
.toc a.is-on { background: #eef0fa; color: var(--navy-800); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.toc__tools { display: flex; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.toc__tools button { background: none; border: 0; padding: 0; font: 600 .78rem var(--font); color: var(--navy-700); cursor: pointer; }
@media (max-width: 1279px) { .toc { display: none; } }

/* mobile: sidebar becomes a drawer behind a top bar */
.topbar { display: none; }
@media (max-width: 900px) {
  .topbar { display: flex; position: sticky; top: 0; z-index: 60; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
  .topbar img { height: 34px; display: block; }
  .shell { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 80; width: min(290px, 85vw); height: 100vh; transform: translateX(-100%); transition: transform .35s cubic-bezier(.16,1,.3,1); box-shadow: 20px 0 50px -20px rgba(0,0,0,.4); }
  body.side-open .side { transform: none; }
  body.side-open::after { content: ""; position: fixed; inset: 0; z-index: 70; background: rgba(6,13,51,.45); }
  .page-head--sticky { top: 55px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .dash { grid-template-columns: 1fr; }
  .msg summary { grid-template-columns: 10px 1fr auto; }
  .msg__snippet { display: none; }
  .msg__body { padding-left: 18px; }
}
@media (max-width: 520px) { .stats, .quick { grid-template-columns: 1fr; } }

/* ---- visitors panel ---- */
.visitors { margin-bottom: 18px; }
.visitors__nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 6px 0 14px; }
.visitors__nums strong { display: block; font-size: 1.5rem; color: var(--ink); line-height: 1.1; }
.visitors__nums span { color: var(--muted); font-size: .84rem; }
.chart { width: 100%; height: 150px; display: block; }
.chart .bar-v { fill: #e3e6f4; }
.chart .bar-u { fill: var(--gold); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart g:hover .bar-v { fill: #cdd2ea; }
.chart__legend { display: flex; gap: 16px; align-items: center; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.chart__legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart__legend .bar-u { background: var(--gold); } .chart__legend .bar-v { background: #e3e6f4; }
.chart__legend .muted { margin-left: auto; }
.visitors__lists { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.visitors__lists h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.visitors__lists ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.visitors__lists li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: .9rem; overflow: hidden; }
.visitors__lists li b { color: var(--ink); font-weight: 600; position: relative; z-index: 1; }
.visitors__lists li span { position: relative; z-index: 1; }
.visitors__lists li i { position: absolute; inset: 0 auto 0 0; z-index: 0; background: #fff7d6; border-radius: 8px; }
.panel--due { margin-bottom: 18px; border-color: var(--gold); background: #fffdf3; }

/* ---- CRM in messages ---- */
.msg summary { grid-template-columns: 10px minmax(150px, 220px) 1fr auto; }
.msg__side { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: #eef0fa; color: var(--navy-700); }
.pill--new { background: #fff3c4; color: #7a5a00; }
.pill--contacted { background: #e5ecff; color: #2a47b8; }
.pill--quote { background: #efe5ff; color: #6b3fbf; }
.pill--won { background: #e3f5ea; color: var(--ok); }
.pill--lost { background: #f1f1f4; color: var(--muted); }
.pill--due { background: var(--gold); color: var(--navy-900); }
.crm { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfe; }
.crm__row { display: grid; grid-template-columns: 160px 170px 1fr auto; gap: 12px; align-items: end; }
.crm__row .field { margin: 0; }
.crm__row select, .crm__row input { width: 100%; }
.crm__notes { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.crm__notes li { padding: 8px 12px; background: #fff; border-left: 3px solid var(--gold); border-radius: 6px; font-size: .9rem; }
.crm__notes time { display: block; font-size: .74rem; color: var(--muted); }
@media (max-width: 900px) { .crm__row { grid-template-columns: 1fr 1fr; } .crm__note { grid-column: 1 / -1; } .msg__side .pill:not(.pill--due) { display: none; } }

/* ---- new project wizard ---- */
.wizard__steps { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; counter-reset: st; margin: 0 0 20px; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
.wizard__steps li { counter-increment: st; color: var(--muted); font-size: .88rem; font-weight: 600; }
.wizard__steps li::before { content: counter(st); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: #eef0fa; color: var(--navy-700); font-size: .75rem; }

/* ---- focal point modal ---- */
.media__meta { flex-wrap: wrap; gap: 6px; }
.media__meta .link { font-size: .78rem; }
.focus { max-width: 980px; }
.focus__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 12px; }
.focus__pick { position: relative; cursor: crosshair; align-self: start; }
.focus__pick img { width: 100%; display: block; border-radius: 10px; user-select: none; }
.focus__dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid #fff; background: rgba(242,183,5,.85); box-shadow: 0 0 0 2px rgba(6,13,51,.5), 0 6px 16px rgba(0,0,0,.35); pointer-events: none; transition: left .2s, top .2s; }
.focus__previews { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.focus__previews figure { margin: 0; }
.focus__previews figure:first-child { grid-column: 1 / -1; }
.focus__previews figcaption { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.pv { overflow: hidden; border-radius: 8px; background: #eee; }
.pv img { width: 100%; height: 100%; object-fit: cover; display: block; transition: object-position .25s; }
.pv--wide { aspect-ratio: 21 / 9; } .pv--square { aspect-ratio: 1; } .pv--tall { aspect-ratio: 3 / 4; }
.focus__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
@media (max-width: 800px) { .focus__grid { grid-template-columns: 1fr; } .visitors__nums { grid-template-columns: 1fr 1fr; } .visitors__nums > div:last-child { grid-column: span 2; } .visitors__lists { grid-template-columns: 1fr; } }

.rich__area blockquote { margin: 1em 0; padding: 6px 0 6px 16px; border-left: 3px solid var(--gold); font-style: italic; color: var(--ink); }
.rich__area h2 { font-size: 1.25rem; }

/* ---- content blocks: palette + drag & drop ---- */
.block-palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px; border: 1px dashed #cfd3e6; border-radius: 12px; background: #fbfbfe; }
.block-palette__label { font-size: .8rem; font-weight: 700; color: var(--muted); margin-right: 4px; }
.block-add { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 .82rem var(--font); color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s; }
.block-add:hover { border-color: var(--navy-700); background: #eef0fa; }
.list--blocks > .list__items > .item > summary { background: #fff; }
.list--blocks > .list__items > .item > summary .item__title { color: var(--ink); font-weight: 600; }
.drag-handle { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 2px; border-radius: 8px; color: var(--muted); cursor: grab; font-size: 1.05rem; user-select: none; }
.drag-handle:hover { background: #eef0fa; color: var(--ink); }
.item.is-dragging, .tlist__row.is-dragging { opacity: .45; outline: 2px dashed var(--gold); outline-offset: 2px; }

/* Notifications: bottom-right, never covering the header buttons; the container itself lets clicks through */
.toasts { top: auto; bottom: 16px; right: 16px; pointer-events: none; }
.toasts .flash { pointer-events: auto; }
.toasts .flash.is-gone { pointer-events: none; }

/* ---- phone menu: backdrop you can tap to close, close button, nicer touch sizes ---- */
.side-backdrop, .side__close { display: none; }
@media (max-width: 900px) {
  body.side-open::after { display: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(6,13,51,.5); opacity: 0; pointer-events: none; transition: opacity .3s; -webkit-tap-highlight-color: transparent; }
  body.side-open .side-backdrop { opacity: 1; pointer-events: auto; }
  body.side-open { overflow: hidden; }
  .side { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .side__brand { position: relative; }
  .side__close { display: grid; place-items: center; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 12px; background: rgba(255,255,255,.1); color: #fff; font-size: 1.1rem; cursor: pointer; }
  .side nav a { padding: 12px 12px; font-size: 1rem; }
  .topbar .icon-btn { width: 44px; height: 44px; }
  /* editor header: buttons wrap neatly and stay reachable */
  .page-head--sticky { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .page-head--sticky .muted { display: none; }
  .page-head--sticky h1 { font-size: 1.25rem; margin: 0; }
  .page-head--sticky .head-actions { justify-content: flex-start; }
  .page-head--sticky .head-actions .btn-p { flex: 1; }
  .main { padding-left: 14px; padding-right: 14px; }
  .block { padding: 16px; }
  .field input, .field select, .field textarea { font-size: 16px; }   /* stops iPhone zooming into fields */
  .block-palette { gap: 5px; }
}
@media (max-width: 900px) {
  .side__close { top: 28px; right: 14px; transform: none; }
  .side__brand { padding-right: 56px; }
  .shell, .main { overflow-x: clip; }
}

/* ---- Phones: text editing ---- */
.lang-mode { display: none; }
@media (max-width: 900px) {
  .lang-mode { display: inline-flex; padding: 3px; border-radius: 999px; background: #eef0fa; }
  .lang-mode button { border: 0; background: none; padding: 7px 12px; border-radius: 999px; font: 700 .8rem var(--font); color: var(--navy-700); cursor: pointer; }
  .lang-mode button.is-on { background: var(--navy-800); color: #fff; }
  /* one language at a time (both stay in the form, so saving and translating work as before) */
  body.lm-el .bi__col[data-lang="en"], body.lm-en .bi__col[data-lang="el"] { display: none; }
  body.lm-el .tlist__row, body.lm-en .tlist__row { grid-template-columns: 1fr auto; }
  body.lm-el .tr-btn, body.lm-en .tr-btn { margin-left: auto; }
  .bi, .field--wide .bi { grid-template-columns: 1fr; }
  .bi__col .flag { font-size: .72rem; }
  /* rich text: one scrollable toolbar row that stays visible while typing; the box grows with the text */
  .rich { overflow: visible; }
  .rich__bar { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; position: sticky; top: var(--stick, 58px); z-index: 5; background: #f6f7fd; border-bottom: 1px solid #e3e5f0; border-radius: 9px 9px 0 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .rich__bar::-webkit-scrollbar { display: none; }
  .rich__btn { flex: none; min-width: 42px; height: 42px; padding: 0 10px; font-size: .9rem; }
  .rich__area { max-height: none; min-height: 140px; font-size: 16px; line-height: 1.6; padding: 14px; }
  .bi textarea { font-size: 16px; line-height: 1.55; resize: none; overflow: hidden; }
  .field__label { font-size: .95rem; }
  .help { font-size: .84rem; }
}

/* phone menu: fits the visible screen (not hidden behind the browser bar) and keeps View site / Sign out always visible */
@media (max-width: 900px) {
  .side { height: 100vh; height: 100dvh; padding-bottom: 0; overscroll-behavior: contain; }
  .side__foot {
    position: sticky; bottom: 0; z-index: 2; margin: auto -14px 0; padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    background: var(--navy-900); border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 -12px 20px -12px rgba(0,0,0,.5);
    display: flex; gap: 10px;
  }
  .side__foot > a, .side__foot form { flex: 1; }
  .side__foot > a, .side__foot button {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 46px; border-radius: 12px;
    background: rgba(255,255,255,.08); color: #fff; font: 600 .95rem var(--font); text-decoration: none; border: 0;
  }
  .side__foot button { background: rgba(192,57,43,.25); }
}

/* ---- dashboard: traffic sources + visitors map ---- */
.dash__col { display: grid; gap: 18px; min-width: 0; }
.geo { margin-bottom: 18px; }
.traffic__bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); margin: 8px 0 16px; }
.traffic__bar i { display: block; height: 100%; min-width: 3px; }
.traffic__bar i + i { box-shadow: inset 2px 0 0 #fff; }
.traffic__groups { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.traffic__groups li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.traffic__groups li:last-child { border-bottom: 0; }
.traffic__dot { width: 12px; height: 12px; border-radius: 4px; }
.traffic__name strong { display: block; font-size: .95rem; color: var(--ink); }
.traffic__name small { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traffic__groups b { color: var(--ink); font-weight: 600; }
.traffic__groups em { font-style: normal; color: var(--muted); font-size: .85rem; text-align: right; }
.traffic__tip { font-size: .8rem; margin: 14px 0 0; line-height: 1.5; }
.traffic__tip code { font-size: .78rem; background: #f1f3f9; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
#visitor-map.geo__map { position: relative; height: 420px; border-radius: 12px; background: #f6f8fc; overflow: hidden; }
.geo__loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.geo__map .jvm-zoom-btn { background: var(--navy-800); border-radius: 6px; width: 22px; height: 22px; line-height: 20px; padding: 0; text-align: center; font-size: 15px; left: 10px; }
.geo__map .jvm-zoom-btn.jvm-zoomin { top: 10px; }
.geo__map .jvm-zoom-btn.jvm-zoomout { top: 36px; }
.jvm-tooltip { background: var(--navy-900) !important; color: #fff; border-radius: 8px !important; padding: 7px 10px !important; font: 400 .85rem/1.35 var(--font) !important; box-shadow: 0 6px 20px rgba(6, 13, 51, .25) !important; }
.jvm-tooltip strong { font-weight: 600; }
.geo__list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 20px; }
.geo__list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 40px; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.geo__swatch { width: 12px; height: 12px; border-radius: 4px; background: #b9cdfb; }
.geo__legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.geo__legend i { width: 110px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #b9cdfb, #4a70d4, #0a1a5c); }
.geo__legend small { margin-left: auto; font-size: .8rem; }
.geo__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo__list b { color: var(--ink); font-weight: 600; }
.geo__list em { font-style: normal; color: var(--muted); font-size: .85rem; text-align: right; }
@media (max-width: 1000px) { #visitor-map.geo__map { height: 320px; } .geo__list { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { #visitor-map.geo__map { height: 220px; } .geo__list { grid-template-columns: 1fr; } }
