/* TMLOG Admin – desktop dashboard, mobile app-like */
:root {
  --navy: #0b2a5b; --navy-900: #071c3f; --blue: #1f5fbf; --blue-light: #4a9cf5;
  --text: #223354; --muted: #5d6b85; --line: #e2e8f2; --bg: #f4f7fb; --white: #fff;
  --danger: #c0392b; --ok: #1d9a6c; --radius: 12px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: clip; }
body.admin { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.muted { color: var(--muted); }
.mb { margin-bottom: 16px; }
.mt { margin-top: 18px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }

/* layout */
.adm { display: flex; min-height: 100dvh; }
.adm-side { width: 240px; background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: calc(22px + var(--sat)) 16px 22px; position: sticky; top: 0; height: 100dvh; flex-shrink: 0; }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.adm-brand img { height: 34px; width: auto; max-width: none; flex: 0 0 auto; object-fit: contain; }
.adm-brand span { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .7; font-weight: 600; }
.adm-nav { display: flex; flex-direction: column; gap: 2px; }
.adm-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: rgba(255,255,255,.8); font-weight: 500; transition: background .2s, color .2s; }
.adm-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.adm-nav a.is-active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.adm-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.adm-side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.7); text-align: left; width: 100%; }
.adm-side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.adm-side-backdrop { display: none; }
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-top { display: flex; align-items: center; gap: 14px; padding: calc(14px + var(--sat)) 28px 14px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.adm-top h1 { font-size: 20px; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.adm-user { font-size: 13px; color: var(--muted); }
.adm-burger { display: none; width: 40px; height: 40px; border-radius: 8px; align-items: center; justify-content: center; color: var(--navy); }
.adm-content { padding: 24px 32px 60px; max-width: none; width: 100%; }
.admin-wide .adm-content { max-width: none; }
.adm-tabs { display: none; }
.save-state { font-size: 12px; color: var(--muted); }

/* components */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 13.5px; white-space: nowrap; border: 1.5px solid transparent; transition: transform .2s, box-shadow .2s, background .2s; line-height: 1.2; }
.btn .ico { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(11,42,91,.2); }
.btn-outline { border-color: #c9d5e6; color: var(--navy); background: #fff; }
.btn-outline:hover { border-color: var(--navy); }
.btn-danger { border-color: #f1c8c3; color: var(--danger); background: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.badge { display: inline-block; min-width: 20px; padding: 2px 7px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 11px; text-align: center; }
.badge-muted { background: var(--muted); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel-flush { padding: 6px 12px; }
.panel h2 { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.panel h2 small { font-weight: 500; }
.panel-link { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--blue); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.span-2 { grid-column: 1 / -1; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi strong { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: -.02em; }
.kpi em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi em.up { color: var(--ok); } .kpi em.down { color: var(--danger); }
.input, .form input, .form select, .form textarea, .lbl input, .lbl select, .lbl textarea { width: 100%; padding: 10px 12px; border: 1px solid #cfd8e6; border-radius: 10px; font: inherit; color: var(--text); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus, .form input:focus, .form textarea:focus, .lbl input:focus, .lbl select:focus, .lbl textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,191,.12); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .lbl { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--navy); }
.lbl small { font-weight: 500; }
.lbl small.over { color: var(--danger); }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin: 6px 0 10px; }
.form-error { color: var(--danger); font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { max-width: 320px; }
.toolbar .muted { flex: 1; font-size: 13px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button.is-active { background: var(--navy); color: #fff; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f8fafd; }
.table .t-title { font-weight: 600; color: var(--navy); }
.table .t-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.table .t-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-actions { text-align: right; white-space: nowrap; }
.table .t-actions a, .table .t-actions button { display: inline-flex; padding: 6px; border-radius: 8px; color: var(--muted); }
.table .t-actions a:hover, .table .t-actions button:hover { background: var(--bg); color: var(--navy); }
.table .t-thumb { width: 64px; }
.table .t-thumb img, .thumb-ph { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.thumb-ph { display: flex; align-items: center; justify-content: center; color: #c9d5e6; }
.table tr.is-clickable { cursor: pointer; }
.status { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.status-published, .status-closed { background: #e3f6ee; color: var(--ok); }
.status-draft { background: #eef2f8; color: var(--muted); }
.status-scheduled { background: #efe8fd; color: #6b3fd6; }
.status-new { background: #e6f0fd; color: var(--blue); }
.status-contacted { background: #fff3dc; color: #a56b00; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; position: relative; }
.chart-tall { height: 220px; }
.chart .bar { flex: 1; background: #dbe6f6; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: height .6s cubic-bezier(.22,1,.36,1); display: flex; align-items: flex-end; }
.chart .bar i { display: block; width: 100%; background: linear-gradient(180deg, var(--blue-light), var(--blue)); border-radius: 4px 4px 0 0; }
.chart .bar:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; z-index: 2; }
.chart-hours { height: 120px; padding-bottom: 18px; }
.chart-hours .bar { background: linear-gradient(180deg, var(--blue-light), var(--blue)); }
.chart .axis { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 4px; }
.legend .l-views { background: #dbe6f6; } .legend .l-visitors { background: var(--blue); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bars .row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 70px; align-items: center; gap: 10px; font-size: 13px; }
.bars .row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .row i { display: block; height: 8px; background: var(--blue); border-radius: 4px; min-width: 2px; }
.bars .row b { text-align: right; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.bars .row b small { font-weight: 500; color: var(--muted); }
.shortcuts { display: flex; flex-wrap: wrap; gap: 10px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; position: relative; }
.editor-main { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.title-input { width: 100%; font: inherit; font-size: 28px; font-weight: 700; color: var(--navy); border: 0; outline: none; padding: 4px 0; letter-spacing: -.02em; background: transparent; }
.title-input::placeholder { color: #b7c2d4; }
.excerpt-input { width: 100%; font: inherit; font-size: 14px; color: var(--text); border: 0; border-bottom: 1px solid var(--line); outline: none; padding: 8px 0 14px; resize: vertical; background: transparent; margin-bottom: 14px; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px 10px 0 0; position: sticky; top: 72px; z-index: 5; }
.rte-group { display: inline-flex; gap: 2px; padding-right: 6px; border-right: 1px solid var(--line); }
.rte-group:last-child { border-right: 0; }
.rte-bar button { padding: 6px 9px; border-radius: 6px; font-size: 13px; color: var(--navy); font-weight: 500; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; min-height: 32px; }
.rte-bar button .ico { width: 15px; height: 15px; }
.rte-bar button:hover { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.rte-body { min-height: 460px; padding: 18px 22px; border: 1px solid var(--line); border-top: 0; outline: none; font-size: 16px; line-height: 1.7; color: var(--text); }
.rte-body:empty::before { content: attr(data-placeholder); color: #b7c2d4; }
.rte-body:focus { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.rte-body h2 { font-size: 24px; color: var(--navy); margin: 24px 0 10px; line-height: 1.25; }
.rte-body h3 { font-size: 19px; color: var(--navy); margin: 20px 0 8px; }
.rte-body p { margin: 0 0 14px; }
.rte-body ul, .rte-body ol { margin: 0 0 14px; padding-left: 24px; }
.rte-body blockquote { margin: 16px 0; padding: 10px 18px; border-left: 3px solid var(--blue); background: var(--bg); color: var(--navy); font-style: italic; border-radius: 0 8px 8px 0; }
.rte-body img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 8px 0; cursor: pointer; transition: box-shadow .2s; }
.rte-body figure { margin: 16px 0; }
.rte-body figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }
.rte-body .gallery { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
.rte-body .gallery-3 { grid-template-columns: repeat(3, 1fr); }
.rte-body .gallery img { margin: 0; aspect-ratio: 4/3; object-fit: cover; }
.rte-body .video-wrap, .rte-body .embed { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; margin: 16px 0; }
.rte-body .video-wrap iframe, .rte-body .video-wrap video, .rte-body .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rte-body .callout { padding: 14px 18px; border-radius: 10px; background: #e9f1fd; border-left: 4px solid var(--blue); margin: 16px 0; }
.rte-body .callout p:last-child { margin: 0; }
.rte-body .callout-warn { background: #fff5e0; border-color: #e0a100; }
.rte-body .callout-ok { background: #e6f7ef; border-color: var(--ok); }
.rte-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.rte-body th, .rte-body td { border: 1px solid var(--line); padding: 8px 10px; }
.rte-body th { background: var(--bg); text-align: left; }
.rte-body .file-card { display: inline-flex; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--navy); font-weight: 600; }
.rte-body a { color: var(--blue); text-decoration: underline; }
.rte-body .btn { display: inline-block; padding: 12px 22px; border-radius: 999px; background: var(--navy); color: #fff; text-decoration: none; }
.rte-body .align-center { text-align: center; }
.rte-body mark { background: #fff2a8; padding: 0 3px; border-radius: 3px; }
.rte-body.is-dragover { box-shadow: inset 0 0 0 2px var(--blue); }
.rte-foot { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: var(--bg); flex-wrap: wrap; }
.img-tools { position: absolute; z-index: 6; display: flex; align-items: center; gap: 2px; max-width: calc(100% - 16px); background: var(--navy); border-radius: 10px; padding: 4px; box-shadow: 0 10px 26px rgba(4,16,40,.32); animation: pop .18s ease-out; }
.img-tools[hidden] { display: none; }
.img-tools-t { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.6); padding: 0 8px 0 6px; }
.img-tools button { color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 7px; display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.img-tools button:hover { background: rgba(255,255,255,.15); }
.img-tools .ico { width: 14px; height: 14px; }
.img-tools-x { display: none; color: rgba(255,255,255,.65); }
.rte-body img.is-selected { outline: 3px solid var(--blue); outline-offset: 2px; }
.editor-side .panel + .panel { margin-top: 16px; }
.editor-side .lbl { margin-bottom: 12px; }
.editor-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.cover-box { aspect-ratio: 16/9; border: 1.5px dashed #c9d5e6; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; overflow: hidden; cursor: pointer; background: var(--bg); margin-bottom: 10px; transition: border-color .2s; text-align: center; padding: 10px; }
.cover-box:hover, .cover-box.is-dragover { border-color: var(--blue); }
.cover-box img { width: 100%; height: 100%; object-fit: cover; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.author-preview { margin: -4px 0 10px; }
.author-mini, .author-edit { display: flex; gap: 12px; align-items: center; }
.author-mini img, .author-mini .avatar-ph, .avatar-box { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; color: var(--navy); font-weight: 700; flex-shrink: 0; }
.author-mini strong { display: block; font-size: 13.5px; color: var(--navy); }
.author-mini span { font-size: 12px; color: var(--muted); }
.avatar-box { width: 84px; height: 84px; cursor: pointer; border: 1.5px dashed #c9d5e6; overflow: hidden; font-size: 12px; font-weight: 500; color: var(--muted); }
.avatar-box img { width: 100%; height: 100%; object-fit: cover; }
.author-edit .grow { display: flex; flex-direction: column; gap: 10px; }
.serp { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-family: Arial, sans-serif; background: #fff; }
.serp-url { display: block; font-size: 12px; color: #1a7f37; margin-bottom: 2px; word-break: break-all; }
.serp-title { display: block; font-size: 17px; color: #1a0dab; font-weight: 400; line-height: 1.3; }
.serp-desc { font-size: 13px; color: #4d5156; margin-top: 4px; line-height: 1.45; }
.editor-mobile-bar { display: none; }

/* authors page */
.authors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.author-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 16px; text-align: center; cursor: pointer; transition: box-shadow .2s, transform .2s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.author-tile:hover { box-shadow: 0 10px 24px rgba(11,42,91,.1); transform: translateY(-2px); }
.author-tile img, .author-tile .avatar-ph { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--navy); }
.author-tile strong { color: var(--navy); }
.author-tile span { font-size: 12.5px; color: var(--muted); }
.author-tile small { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-grid-sm { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 55dvh; overflow: auto; }
.media-item { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--bg); cursor: pointer; border: 2px solid transparent; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item.is-selected { border-color: var(--blue); }
.media-item > span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 4px 8px; background: rgba(7,28,63,.7); color: #fff; opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item:hover > span { opacity: 1; }
.media-file { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--navy); padding: 10px; text-align: center; }
.media-file .ico { width: 30px; height: 30px; }
.media-file b { font-size: 11px; font-weight: 600; word-break: break-all; }
.media-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 6px; background: rgba(7,28,63,.7); color: #fff; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.media-item:hover .media-del { opacity: 1; }
.media-del .ico { width: 14px; height: 14px; }
.dropzone.is-dragover { outline: 2px dashed var(--blue); outline-offset: -8px; }

/* drawer / modal */
.drawer { position: fixed; inset: 0; z-index: 50; background: rgba(4,16,40,.45); display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.drawer-panel { width: min(520px, 100%); background: #fff; height: 100dvh; overflow: auto; padding: calc(28px + var(--sat)) 28px calc(28px + var(--sab)); position: relative; box-shadow: -20px 0 50px rgba(0,0,0,.2); animation: slideIn .35s cubic-bezier(.22,1,.36,1); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-close, .modal-close { position: absolute; top: calc(14px + var(--sat)); right: 14px; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.drawer-close:hover, .modal-close:hover { background: var(--bg); }
.lead-detail h2 { font-size: 20px; color: var(--navy); margin-bottom: 4px; }
.lead-detail dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 18px 0; font-size: 13.5px; }
.lead-detail dt { color: var(--muted); }
.lead-detail dd { margin: 0; word-break: break-word; }
.lead-detail .msg { background: var(--bg); padding: 14px; border-radius: 10px; white-space: pre-wrap; margin-bottom: 18px; }
.lead-detail textarea { width: 100%; min-height: 90px; }
.lead-detail .row-btns { margin-top: 12px; }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(4,16,40,.5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-panel { width: min(760px, 100%); max-height: 90dvh; overflow: auto; background: #fff; border-radius: 16px; padding: 26px; position: relative; animation: pop .3s cubic-bezier(.22,1,.36,1); }
.modal-title { font-size: 18px; color: var(--navy); margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-900) 100%); padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 34px 32px; box-shadow: 0 30px 60px rgba(0,0,0,.3); animation: pop .5s cubic-bezier(.22,1,.36,1); }
@keyframes pop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.auth-logo { height: 44px; margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; color: var(--navy); margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 20px; font-size: 13.5px; }
.auth-back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 100; animation: pop .3s; max-width: calc(100% - 32px); }
.toast.is-error { background: var(--danger); }
.toast[hidden] { display: none; }

@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } .editor { grid-template-columns: 1fr; } .editor-side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .editor-side .panel + .panel { margin-top: 0; } }
/* ---------- mobile: app-like ---------- */
@media (max-width: 800px) {
  .adm-side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .3s cubic-bezier(.22,1,.36,1); z-index: 70; width: min(280px, 84vw); }
  .adm-side.is-open { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,.3); }
  .adm-side-backdrop { display: block; position: fixed; inset: 0; background: rgba(4,16,40,.5); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .adm-side-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .adm-burger { display: inline-flex; }
  .adm-user { display: none; }
  .adm-top { padding: calc(10px + var(--sat)) 14px 10px; gap: 10px; }
  .adm-top h1 { font-size: 17px; }
  .adm-top .btn span { display: none; }
  .adm-top .btn { padding: 10px; border-radius: 50%; }
  .adm-top .seg { display: none; }
  .adm-content { padding: 14px 14px calc(96px + var(--sab)); }
  .adm-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--sab)); justify-content: space-around; align-items: center; }
  .adm-tabs a, .adm-tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-radius: 10px; min-width: 56px; }
  .adm-tabs .ico { width: 22px; height: 22px; }
  .adm-tabs a.is-active { color: var(--navy); }
  .adm-tabs .tab-fab { background: var(--navy); color: #fff; width: 50px; height: 50px; border-radius: 50%; justify-content: center; margin-top: -22px; box-shadow: 0 8px 20px rgba(11,42,91,.35); min-width: 0; padding: 0; }
  .adm-tabs .tab-fab .ico { width: 24px; height: 24px; }
  .grid-2, .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi strong { font-size: 22px; }
  .panel { padding: 16px; border-radius: 14px; }
  .toolbar .input { max-width: none; }
  .toolbar .muted { flex: 1 0 100%; order: 10; }
  .toolbar .seg { max-width: 100%; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; border-bottom: 1px solid var(--line); padding: 10px 4px; align-items: center; }
  .table td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .table .t-sub { white-space: normal; }
  .table td:empty { display: none; }
  .table-posts td:nth-child(3), .table-posts td:nth-child(5), .table-posts td:nth-child(6) { display: none; }
  .table-posts td:nth-child(2) { grid-column: 2; }
  .table-posts td:nth-child(4) { grid-column: 2; }
  .table-posts .t-actions { grid-column: 3; grid-row: 1 / span 2; }
  .table-leads td:nth-child(3), .table-leads td:nth-child(4) { display: none; }
  .table .t-num { text-align: left; }
  .rte-bar { position: sticky; top: calc(58px + var(--sat)); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 6px; }
  .rte-bar::-webkit-scrollbar { display: none; }
  .rte-group { flex-shrink: 0; }
  .rte-body { min-height: 50dvh; padding: 14px; font-size: 16px; }
  .editor-main { padding: 14px; }
  .title-input { font-size: 22px; }
  .editor-side { grid-template-columns: 1fr; }
  .editor-mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: calc(64px + var(--sab)); padding: 8px 14px; background: rgba(255,255,255,.95); border-top: 1px solid var(--line); z-index: 55; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
  .editor-mobile-bar .btn { padding: 10px 18px; }
  .admin-wide .adm-content { padding-bottom: calc(150px + var(--sab)); }
  .modal { padding: 0; align-items: flex-end; }
  .modal-panel { border-radius: 18px 18px 0 0; max-height: 92dvh; padding: 22px 16px calc(22px + var(--sab)); }
  .drawer-panel { width: 100%; }
  .bars .row { grid-template-columns: minmax(70px, 38%) 1fr 60px; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr 1fr; } .grid-2 { grid-template-columns: 1fr; } .shortcuts .btn { width: 100%; justify-content: center; } }

/* =========================================================
   Touch / small screens polish (iPhone 15 and similar)
   ========================================================= */
@media (hover: none), (max-width: 800px) {
  .media-item > span { opacity: 1; font-size: 11px; padding: 6px 8px; background: linear-gradient(180deg, rgba(7,28,63,0) 0%, rgba(7,28,63,.85) 100%); padding-top: 18px; }
  .media-del { opacity: 1; width: 34px; height: 34px; border-radius: 8px; background: rgba(7,28,63,.8); }
  .media-del .ico { width: 16px; height: 16px; }
  .media-item { border-radius: 12px; }
  .media-item .media-file b { font-size: 12px; }
}
@media (max-width: 800px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .media-grid-sm { grid-template-columns: repeat(3, 1fr); }
  .row-btns { gap: 8px; }
  .row-btns .btn { flex: 1 1 calc(50% - 8px); justify-content: center; min-height: 42px; }
  .row-btns .btn-block { flex-basis: 100%; }
  .editor-actions .row-btns .btn { flex-basis: calc(50% - 8px); }
  .cover-box { aspect-ratio: 16/9; }
  .author-edit { flex-direction: column; align-items: center; text-align: center; }
  .author-edit .grow { width: 100%; text-align: left; }
  .avatar-box { width: 96px; height: 96px; }
  .lead-detail dl { grid-template-columns: 1fr; gap: 2px 0; }
  .lead-detail dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-top: 8px; }
  .lead-detail .row-btns .btn { flex-basis: calc(50% - 8px); }
  .modal-panel .form .btn { min-height: 44px; }
  .modal-foot { flex-direction: column; gap: 10px; align-items: stretch; }
  .modal-foot .btn { justify-content: center; }
  .toast { left: 14px; right: 14px; transform: none; max-width: none; text-align: center; }
  .rte-bar button { min-height: 38px; padding: 6px 11px; }
  .img-tools { position: fixed; z-index: 62; left: 10px; right: 10px; top: auto !important; bottom: calc(72px + var(--sab, 0px)); max-width: none; padding: 6px; gap: 4px; justify-content: space-between; }
  .img-tools-t { display: none; }
  .img-tools button { flex: 1 1 auto; justify-content: center; padding: 10px 8px; font-size: 12.5px; min-height: 40px; }
  .img-tools button[data-img="remove"], .img-tools-x { flex: 0 0 auto; }
  .img-tools-x { display: inline-flex; }
  .kpi em { font-size: 10.5px; }
  .adm-top .btn.btn-outline { border-width: 1.5px; }
  .adm-top .btn .ico { width: 18px; height: 18px; }
  .seg button { padding: 8px 14px; min-height: 38px; }
  .table .t-actions a, .table .t-actions button { padding: 9px; }
  .panel-flush { padding: 4px 8px; }
  .authors-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .author-tile { padding: 16px 10px; }
  .author-tile img, .author-tile .avatar-ph { width: 60px; height: 60px; }
  .shortcuts .btn { width: 100%; justify-content: center; }
  .dropzone { padding: 10px; }
  .empty { padding: 20px 10px; font-size: 13px; }
}
@media (max-width: 400px) {
  .row-btns .btn, .editor-actions .row-btns .btn, .lead-detail .row-btns .btn { flex-basis: 100%; }
  .media-grid-sm { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .editor-side .row-btns .btn { flex: 1 1 0; flex-basis: 0; padding-left: 8px; padding-right: 8px; }
  .table-leads tr { grid-template-columns: minmax(0, 1fr) auto; }
  .table-leads td:first-child { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); order: -1; }
  .table-leads td:nth-child(2) { grid-column: 1; }
  .table-leads td:nth-child(5) { grid-column: 1; }
  .table-leads .t-actions { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
}

/* =========================================================
   Sheets (Vaul-like) + mobile layout v2
   ========================================================= */
.modal, .drawer { transition: background-color .32s cubic-bezier(.32,.72,0,1); }
.modal:not(.is-open), .drawer:not(.is-open) { background-color: rgba(4,16,40,0); }
.modal.is-open, .drawer.is-open { background-color: rgba(4,16,40,.5); }
.modal-panel, .drawer-panel { animation: none; transition: transform .38s cubic-bezier(.32,.72,0,1), opacity .3s; will-change: transform; }
.modal:not(.is-open) .modal-panel { transform: translateY(16px) scale(.98); opacity: 0; }
.modal.is-open .modal-panel { transform: none; opacity: 1; }
.drawer:not(.is-open) .drawer-panel { transform: translateX(40px); opacity: 0; }
.drawer.is-open .drawer-panel { transform: none; opacity: 1; }
.sheet-handle { display: none; }
/* bottom sheet mode */
.is-sheet { align-items: flex-end !important; justify-content: stretch !important; padding: 0 !important; }
.is-sheet .modal-panel, .is-sheet .drawer-panel {
  width: 100%; max-width: none; height: auto; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 8px 16px calc(24px + var(--sab));
  box-shadow: 0 -20px 60px rgba(0,0,0,.28); overscroll-behavior: contain; animation: none;
  transition: transform .42s cubic-bezier(.32,.72,0,1), opacity .2s; touch-action: pan-y;
}
.is-sheet:not(.is-open) .modal-panel, .is-sheet:not(.is-open) .drawer-panel { transform: translateY(100%); opacity: 1; }
.is-sheet.is-closing .modal-panel, .is-sheet.is-closing .drawer-panel { transform: translateY(100%); }
.is-sheet .sheet-handle { display: flex; justify-content: center; padding: 6px 0 14px; cursor: grab; touch-action: none; position: sticky; top: 0; background: #fff; z-index: 2; margin: 0 -16px; }
.is-sheet .sheet-handle span { width: 44px; height: 5px; border-radius: 999px; background: #d3dbe8; }
.is-sheet .modal-close, .is-sheet .drawer-close { top: 12px; right: 12px; }
.is-sheet .modal-title { padding-right: 40px; }
/* background recedes like Vaul */
html.sheet-open .adm { transform: scale(.965) translateY(6px); border-radius: 18px; overflow: hidden; }
.adm { transition: transform .42s cubic-bezier(.32,.72,0,1), border-radius .42s; transform-origin: 50% 0; }
@media (min-width: 801px) { html.sheet-open .adm { transform: none; border-radius: 0; } }
/* mobile layout v2 */
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; gap: 12px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .toolbar { justify-content: center; gap: 10px; margin-bottom: 14px; }
  .toolbar .seg { margin: 0 auto; }
  .toolbar .input { order: 5; }
  .adm-top { flex-wrap: wrap; row-gap: 8px; }
  .adm-top .seg { display: inline-flex; order: 10; flex-basis: 100%; margin: 0 auto; width: max-content; max-width: 100%; }
  .panel { padding: 14px; }
  .panel h2 { font-size: 13.5px; }
  .chart-tall { height: 170px; }
  .table td { padding: 1px 4px; }
  .kpi span { font-size: 11.5px; }
  .kpi strong { font-size: 24px; }
  .editor-mobile-bar { box-shadow: 0 -8px 24px rgba(11,42,91,.08); }
}

.is-sheet.is-dragging, .is-sheet.is-dragging * { user-select: none; -webkit-user-select: none; }
.is-sheet .sheet-handle { -webkit-user-select: none; user-select: none; }

/* =========================================================
   All dialogs are drawers: right-side on desktop, bottom sheet on mobile
   ========================================================= */
@media (min-width: 801px) {
  .modal { align-items: stretch; justify-content: flex-end; padding: 0; }
  .modal-panel { width: min(600px, 100%); max-height: none; height: 100dvh; border-radius: 0; padding: 28px 30px calc(28px + var(--sab)); box-shadow: -20px 0 50px rgba(0,0,0,.2); }
  .modal:not(.is-open) .modal-panel { transform: translateX(48px); opacity: 0; }
  .modal.is-open .modal-panel { transform: none; opacity: 1; }
  .modal.is-closing .modal-panel { transform: translateX(48px); opacity: 0; }
  .modal .media-grid-sm { max-height: none; }
  .modal .modal-foot { position: sticky; bottom: 0; background: #fff; padding-top: 12px; border-top: 1px solid var(--line); }
}

/* =========================================================
   Dashboard AAA: greeting, KPI cards with sparklines, SVG area chart, donut, ranked lists
   ========================================================= */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 4px 0 20px; }
.hello-kicker { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.hello h2 { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: -.02em; margin-bottom: 4px; }
.hello .muted { font-size: 13.5px; }
.hello-actions { display: flex; gap: 10px; flex-shrink: 0; }
.kpis { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { position: relative; overflow: hidden; padding: 18px 18px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(11,42,91,.04); transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s; min-height: 132px; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(11,42,91,.10); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.kpi-head span { font-size: 12.5px; color: var(--muted); font-weight: 500; margin: 0; }
.kpi-ico { width: 30px; height: 30px; border-radius: 9px; background: #edf3fc; color: var(--blue); display: inline-flex; align-items: center; justify-content: center; }
.kpi-ico .ico { width: 15px; height: 15px; }
.kpi strong { font-size: 30px; letter-spacing: -.03em; line-height: 1; }
.kpi em { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.kpi em b { font-weight: 700; }
.kpi em.up b { color: var(--ok); } .kpi em.down b { color: var(--danger); } .kpi em.flat b { color: var(--blue); }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 44px; color: var(--blue); opacity: .55; pointer-events: none; }
.kpi strong, .kpi em { position: relative; z-index: 1; }
.kpi-accent { background: linear-gradient(135deg, var(--navy) 0%, #12356e 100%); border-color: transparent; color: #fff; }
.kpi-accent .kpi-head span, .kpi-accent em, .kpi-accent strong { color: #fff; }
.kpi-accent em { color: rgba(255,255,255,.75); }
.kpi-accent .kpi-ico { background: rgba(255,255,255,.14); color: #fff; }
.kpi-accent .spark { color: #8fbcf7; }
.kpi-accent em.up b { color: #7de2b3; } .kpi-accent em.down b { color: #ff9f95; } .kpi-accent em.flat b { color: #c5e1ff; }
.grid-dash { gap: 16px; }
.panel { border-radius: 16px; box-shadow: 0 1px 2px rgba(11,42,91,.04); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head .legend { margin: 0; }
.panel-chart { padding-bottom: 12px; }
.area { position: relative; }
.area-svg { width: 100%; height: 200px; display: block; }
.area-tall .area-svg { height: 260px; }
.area .grid { stroke: #edf1f7; stroke-width: 1; }
.area .ylab { font-size: 10px; fill: #98a6bf; text-anchor: end; }
.area .xlab { font-size: 10px; fill: #98a6bf; text-anchor: middle; }
.area .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.area .line-views { stroke: var(--blue); }
.area .line-visitors { stroke: var(--navy); stroke-dasharray: 4 5; stroke-width: 2; }
.area .area-fill { animation: rise .9s cubic-bezier(.22,1,.36,1) both; transform-origin: bottom; }
@keyframes rise { from { transform: scaleY(0); opacity: 0; } to { transform: none; opacity: 1; } }
.area .cursor { stroke: #c9d5e6; stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.area .dot { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.area .dot-views { fill: var(--blue); } .area .dot-visitors { fill: var(--navy); }
.area .tip { position: absolute; top: 8px; background: var(--navy); color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.area .tip b { display: block; font-size: 11px; opacity: .75; }
.legend .l-views { background: var(--blue); } .legend .l-visitors { background: var(--navy); }
.ranked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ranked li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; }
.ranked .rk { width: 22px; height: 22px; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.ranked li:nth-child(-n+3) .rk { background: #edf3fc; color: var(--blue); }
.rk-body { min-width: 0; }
.rk-body a { display: block; font-size: 13px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.rk-body a:hover { color: var(--blue); }
.rk-body i { display: block; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--blue), #7fb0f5); min-width: 3px; transition: width .8s cubic-bezier(.22,1,.36,1); }
.ranked b { font-size: 13px; color: var(--navy); font-variant-numeric: tabular-nums; }
.ranked .empty, .lead-list .empty { padding: 14px; }
.lead-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lead-list li a { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.lead-list li:last-child a { border-bottom: 0; }
.lead-list .avatar-ph { width: 36px; height: 36px; border-radius: 50%; background: #edf3fc; color: var(--blue); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.lead-list strong { display: block; font-size: 13.5px; color: var(--navy); }
.lead-list div > span { font-size: 12px; color: var(--muted); }
.lead-list em { font-style: normal; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.lead-list em small { font-size: 11px; color: var(--muted); }
.donut-wrap { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.donut svg { width: 120px; height: 120px; display: block; }
.donut circle { transition: stroke-dasharray .9s cubic-bezier(.22,1,.36,1); }
.donut .donut-n { font-size: 16px; font-weight: 700; fill: var(--navy); text-anchor: middle; }
.donut .donut-l { font-size: 8px; fill: var(--muted); text-anchor: middle; letter-spacing: .08em; text-transform: uppercase; }
.bars .row i { background: linear-gradient(90deg, var(--blue), #7fb0f5); height: 8px; transition: width .8s cubic-bezier(.22,1,.36,1); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-stats a { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--bg); transition: background .2s, transform .3s; }
.mini-stats a:hover { background: #edf3fc; transform: translateY(-2px); }
.mini-stats strong { font-size: 22px; color: var(--navy); letter-spacing: -.02em; }
.mini-stats span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-bottom: 18px; position: relative; }
.hours .hbar { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; }
.hours .hbar i { display: block; width: 100%; height: calc(var(--v) * 100%); min-height: 3px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, #7fb0f5, var(--blue)); transition: height .8s cubic-bezier(.22,1,.36,1); }
.hours .hbar:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; z-index: 2; }
.hours .axis { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) {
  .hello { flex-direction: column; align-items: stretch; margin-bottom: 14px; }
  .hello h2 { font-size: 22px; }
  .hello-actions .btn { flex: 1; justify-content: center; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { min-height: 112px; padding: 14px; }
  .kpi strong { font-size: 24px; }
  .kpi .spark { height: 34px; }
  .area-svg { height: 170px; } .area-tall .area-svg { height: 200px; }
  .donut-wrap { grid-template-columns: 100px 1fr; }
  .donut svg { width: 100px; height: 100px; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .panel-head { flex-wrap: wrap; }
}

/* recent visits list */
.visits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.visit { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: 0; }
.v-dev { width: 36px; height: 36px; border-radius: 10px; background: #edf3fc; color: var(--blue); display: inline-flex; align-items: center; justify-content: center; }
.v-main { min-width: 0; }
.v-path { display: block; font-weight: 600; color: var(--navy); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-path:hover { color: var(--blue); }
.v-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-badges { display: flex; align-items: center; gap: 6px; }
.v-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--text); white-space: nowrap; }
.v-badge.os-ios { background: #eef2f8; color: #1f2d4b; } .v-badge.os-android { background: #e6f7ef; color: #1d7a55; } .v-badge.os-win { background: #e6f0fd; color: #1a4fa3; } .v-badge.os-mac { background: #f0eefb; color: #4b3fa3; } .v-badge.os-linux { background: #fff3dc; color: #a56b00; }
.vflag { width: 18px; height: 14px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(11,42,91,.12); }
.vflag-ph { font-size: 10px; color: var(--muted); }
.v-time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) {
  .visit { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; }
  .v-badges { grid-column: 2; }
  .v-time { grid-column: 3; grid-row: 1; }
  .v-dev { width: 32px; height: 32px; border-radius: 8px; }
}

/* ===== AUTH v2: centered brand, glass card, ambient background ===== */
.auth-body { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 50% -10%, #17408f 0%, var(--navy) 45%, #061a3d 100%); padding: 28px 20px calc(28px + var(--sab, 0px)); }
.auth-bg { position: absolute; inset: 0; pointer-events: none; }
.auth-orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: orb 14s ease-in-out infinite alternate; }
.auth-orb-1 { width: 420px; height: 420px; left: -120px; top: -140px; background: #1f5fbf; }
.auth-orb-2 { width: 360px; height: 360px; right: -120px; bottom: -160px; background: #5aa9ff; animation-delay: -7s; }
.auth-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%); -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%); }
@keyframes orb { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(30px,40px,0) scale(1.12); } }
.auth-wrap { position: relative; width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.auth-logo { height: auto; width: min(280px, 72vw); margin: 0 auto; filter: drop-shadow(0 10px 30px rgba(0,0,0,.35)); animation: pop .6s cubic-bezier(.22,1,.36,1); }
.auth-card { width: 100%; max-width: none; padding: 30px 28px 26px; border-radius: 20px; background: rgba(255,255,255,.97); box-shadow: 0 40px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.35) inset; animation-delay: .08s; }
.auth-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.auth-badge { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f5fbf, #0b2a5b); color: #fff; box-shadow: 0 8px 18px rgba(31,95,191,.35); }
.auth-badge .ico { width: 20px; height: 20px; }
.auth-card h1 { font-size: 21px; margin: 2px 0 4px; letter-spacing: -.01em; }
.auth-card .auth-head .muted { margin: 0; font-size: 13.5px; line-height: 1.45; }
.auth-card .form label { font-weight: 600; font-size: 12.5px; color: var(--navy); }
.auth-card .form input { margin-top: 6px; padding: 13px 14px; border-radius: 12px; font-size: 15px; }
.auth-card .btn-block { margin-top: 6px; padding: 14px; border-radius: 12px; font-size: 15px; }
.auth-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--muted); }
.auth-back .ico { width: 14px; height: 14px; transform: rotate(180deg); }
.auth-back:hover { color: var(--navy); }
.auth-foot { font-size: 12px; color: rgba(255,255,255,.55); margin: 0; }
.auth-foot a { color: rgba(255,255,255,.8); }
@media (max-width: 480px) { .auth-card { padding: 24px 20px 22px; border-radius: 18px; } .auth-wrap { gap: 22px; } }
@media (prefers-reduced-motion: reduce) { .auth-orb { animation: none; } }

/* ===== TOASTS: slide in from the top (mobile: top center, desktop: top right) ===== */
.toast { top: calc(14px + env(safe-area-inset-top, 0px)); bottom: auto; left: 50%; transform: translateX(-50%); animation: toastIn .45s cubic-bezier(.22,1,.36,1); border-radius: 12px; }
@keyframes toastIn { from { transform: translate(-50%, -24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (min-width: 1024px) {
  .toast { left: auto; right: 24px; top: 24px; transform: none; animation: toastInRight .45s cubic-bezier(.22,1,.36,1); }
  @keyframes toastInRight { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ===== INSTALL PANEL + BANNER ===== */
.install-panel { padding: 0; overflow: hidden; }
.install-hero { display: flex; gap: 20px; align-items: flex-start; padding: 26px; background: radial-gradient(120% 140% at 0% 0%, #17408f 0%, var(--navy) 60%, #061a3d 100%); color: #fff; }
.install-icon { flex: 0 0 auto; width: 72px; height: 72px; border-radius: 18px; overflow: hidden; box-shadow: 0 14px 30px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.15); }
.install-icon img { display: block; width: 100%; height: 100%; }
.install-kicker { display: inline-block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #c5e1ff; font-weight: 700; margin-bottom: 6px; }
.install-hero h2 { color: #fff; font-size: 20px; margin: 0 0 6px; }
.install-hero .muted { color: rgba(255,255,255,.78); margin: 0 0 14px; max-width: 56ch; }
.install-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.install-actions .btn-primary { background: #fff; color: var(--navy); box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.install-actions .btn-primary:hover { background: #e9f1ff; }
.install-state { font-size: 13px; color: rgba(255,255,255,.75); }
.install-state.is-ok { color: #9ff0c3; font-weight: 600; }
.install-state a { color: #c5e1ff; text-decoration: underline; }
.install-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.install-step { padding: 18px 20px; border-right: 1px solid var(--line); font-size: 13.5px; }
.install-step:last-child { border-right: 0; }
.install-step strong { display: block; color: var(--navy); margin-bottom: 8px; font-size: 14px; }
.install-step ol { margin: 0; padding-left: 18px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.install-step b { color: var(--text); font-weight: 600; }
.install-step.is-current { background: #eef4ff; }
.install-step.is-current strong::after { content: "este aparelho"; margin-left: 8px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); background: #fff; border: 1px solid #cfe0ff; border-radius: 999px; padding: 2px 7px; vertical-align: middle; }
.install-panel.is-installed .install-steps { display: none; }
@media (max-width: 767px) { .install-hero { flex-direction: column; padding: 22px 18px; } .install-icon { width: 64px; height: 64px; } .install-steps { grid-template-columns: 1fr; } .install-step { border-right: 0; border-bottom: 1px solid var(--line); } .install-step:last-child { border-bottom: 0; } .install-step:not(.is-current) { display: none; } }
.install-banner { position: fixed; z-index: 95; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,.98); color: var(--text); box-shadow: 0 18px 40px rgba(11,42,91,.25), 0 0 0 1px rgba(11,42,91,.08); animation: toastIn .5s cubic-bezier(.22,1,.36,1); }
.install-banner[hidden] { display: none; }
.install-banner img { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; }
.install-banner > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.install-banner strong { font-size: 13.5px; color: var(--navy); }
.install-banner span { font-size: 12px; color: var(--muted); }
.install-banner .btn-sm { padding: 8px 12px; font-size: 12.5px; border-radius: 10px; }
.install-banner-x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
@media (min-width: 1024px) { .install-banner { left: auto; right: 24px; top: 24px; width: 380px; animation: toastInRight .5s cubic-bezier(.22,1,.36,1); } }

/* drawers and sheets must sit above the mobile tab bar (z 60) and the side menu (z 70) */
.drawer, .sheet, .overlay { z-index: 80; }

.auth-body { background: radial-gradient(120% 90% at 50% -10%, #123a80 0%, #0b2a5b 45%, #051634 100%); }
.auth-orb { opacity: .28; }
.auth-orb-2 { background: #1f5fbf; }
.auth-grid { opacity: .6; }

body.admin.auth-body { background: radial-gradient(120% 90% at 50% -10%, #123a80 0%, #0b2a5b 45%, #051634 100%) !important; }

/* ===== EDITOR AAA (mobile): wrapping title, single save action in the top bar, no floating bar ===== */
.title-input { resize: none; overflow: hidden; line-height: 1.2; min-height: 0; display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.excerpt-input { resize: none; overflow: hidden; line-height: 1.5; }
.editor-mobile-bar { display: none !important; }
@media (max-width: 1023px) {
  .adm-top { gap: 10px; padding-left: 14px; padding-right: 14px; }
  .adm-top h1 { flex: 1 1 auto; min-width: 0; font-size: 16px; }
  .adm-top-actions { gap: 8px; flex: 0 0 auto; }
  .adm-top-actions .save-state { display: none; }
  .adm-top-actions .btn { padding: 9px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; gap: 6px; }
  .adm-top-actions .btn span { display: inline; }
  .adm-top-actions .btn .ico { width: 15px; height: 15px; }
  .title-input { font-size: 22px; padding: 2px 0 6px; }
  .excerpt-input { font-size: 14px; padding: 6px 0 12px; }
  .adm-content { padding-bottom: calc(96px + var(--sab)); }
}

/* ===== ADMIN SIDE MENU v2: desktop keeps the compact sidebar, mobile gets the landing-style drawer from the right ===== */
.adm-side-head { display: flex; align-items: center; justify-content: space-between; }
.adm-side-close { display: none; }
.adm-nav a .num, .adm-nav a .arr, .adm-side-link .arr { display: none; }
.adm-side-bar { display: flex; flex-direction: column; gap: 2px; }
.adm-side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.1); }
.adm-side-user .avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.adm-side-user div { display: flex; flex-direction: column; min-width: 0; }
.adm-side-user strong { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-side-user span:last-child { font-size: 11.5px; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.side-locked, html.side-locked body { overflow: hidden !important; touch-action: none; }
html.side-locked body { position: fixed; left: 0; right: 0; width: 100%; }
@media (max-width: 800px) {
  .adm-side {
    left: auto; right: 0; top: 0; bottom: 0; height: 100dvh; width: 100%; max-width: 480px; z-index: 90;
    transform: translateX(100%); transition: transform .55s cubic-bezier(.16,1,.3,1);
    background: linear-gradient(180deg, var(--navy) 0%, #081f4a 100%);
    padding: calc(14px + var(--sat)) 20px calc(16px + var(--sab)); gap: 14px; overflow-y: auto; overscroll-behavior: contain;
    box-shadow: -30px 0 60px rgba(0,0,0,.35);
  }
  .adm-side.is-open { transform: none; box-shadow: -30px 0 60px rgba(0,0,0,.35); }
  .adm-side.is-closing { transform: translateX(100%); transition: transform .4s cubic-bezier(.16,1,.3,1); }
  .adm-side-backdrop { z-index: 85; background: rgba(4,16,40,.55); transition: opacity .45s cubic-bezier(.16,1,.3,1); }
  .adm-side-head { padding: 4px 0 10px; }
  .adm-brand { padding: 0; }
  .adm-brand img { height: 30px; }
  .adm-side-close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
  .adm-side-close .ico { width: 20px; height: 20px; }
  .adm-nav { gap: 0; }
  .adm-nav a { display: flex; align-items: center; gap: 12px; padding: min(13px, 1.5dvh) 0; border-radius: 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: clamp(17px, 2.3dvh, 20px); font-weight: 600; letter-spacing: -.01em; color: #fff; background: none; opacity: 0; transform: translateX(28px); transition: opacity .5s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1), padding-left .3s; }
  .adm-nav a > .ico:not(.arr) { display: none; }
  .adm-nav a .num { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .12em; color: rgba(255,255,255,.45); width: 24px; }
  .adm-nav a .arr { display: inline-block; margin-left: auto; width: 18px; height: 18px; opacity: .5; transition: transform .3s, opacity .3s; }
  .adm-nav a.is-active { background: none; color: #fff; }
  .adm-nav a.is-active .num { color: #c5e1ff; }
  .adm-nav a.is-active .arr { opacity: 1; color: #c5e1ff; }
  .adm-nav a:active { padding-left: 6px; }
  .adm-nav a:active .arr { transform: translateX(4px); opacity: 1; }
  .adm-side.is-open .adm-nav a { opacity: 1; transform: none; }
  .adm-side.is-open .adm-nav a:nth-child(1) { transition-delay: .10s; }
  .adm-side.is-open .adm-nav a:nth-child(2) { transition-delay: .15s; }
  .adm-side.is-open .adm-nav a:nth-child(3) { transition-delay: .20s; }
  .adm-side.is-open .adm-nav a:nth-child(4) { transition-delay: .25s; }
  .adm-side.is-open .adm-nav a:nth-child(5) { transition-delay: .30s; }
  .adm-side.is-open .adm-nav a:nth-child(6) { transition-delay: .35s; }
  .adm-side.is-open .adm-nav a:nth-child(7) { transition-delay: .40s; }
  .adm-side-foot { margin-top: auto; gap: 10px; opacity: 0; transform: translateY(16px); transition: opacity .5s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1); }
  .adm-side.is-open .adm-side-foot { opacity: 1; transform: none; transition-delay: .5s; }
  .adm-side.is-closing .adm-nav a, .adm-side.is-closing .adm-side-foot { opacity: 0; transition-duration: .25s; transition-delay: 0s; }
  .adm-side-site { justify-content: center; padding: 14px 18px; border-radius: 999px; background: #fff; color: var(--navy) !important; font-weight: 700; font-size: 15px; gap: 10px; }
  .adm-side-site .ico:not(.arr) { display: none; }
  .adm-side-site .arr { display: inline-block; margin-left: 0; width: 16px; height: 16px; }
  .adm-side-bar { flex-direction: row; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
  .adm-side-bar .adm-side-link { flex: 1 1 0; justify-content: center; padding: 11px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); font-size: 13px; font-weight: 500; }
  .adm-side-bar .adm-side-link .ico { width: 16px; height: 16px; color: #c5e1ff; }
  .adm-side-bar .adm-side-link[hidden] { display: none; }
  .adm-side-user { border-top: 0; padding: 2px 4px 0; margin-top: 0; }
}
@media (max-width: 800px) and (max-height: 700px) { .adm-nav a { padding: 9px 0; font-size: 16px; } .adm-side-user { display: none; } }

.adm-side-user { margin-top: 18px; padding-top: 16px; }
@media (max-width: 800px) { .adm-side-user { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); } }

/* ===== SEO previews: Google (with thumbnail) + social card ===== */
.panel .small { font-size: 12px; margin: 14px 0 6px; }
.serp { display: flex; gap: 14px; align-items: flex-start; }
.serp-main { flex: 1 1 auto; min-width: 0; }
.serp-site { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #202124; margin-bottom: 2px; }
.serp-site img { width: 18px; height: 18px; border-radius: 50%; background: #f1f3f4; padding: 2px; }
.serp-site .serp-url { display: inline; margin: 0; color: #4d5156; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-thumb { flex: 0 0 auto; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: #f1f3f4; }
.serp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.og-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; max-width: 420px; }
.og-img { aspect-ratio: 1.91 / 1; background: #eef2f8 center / cover no-repeat; display: flex; align-items: center; justify-content: center; }
.og-ph { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-align: center; padding: 12px; }
.og-ph .ico { width: 22px; height: 22px; }
.og-img.has-img .og-ph { display: none; }
.og-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.og-domain { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.og-title { font-size: 14px; color: var(--navy); line-height: 1.3; }
.og-desc { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== push notifications panel ===== */
.notif-panel { display: flex; flex-direction: column; gap: 14px; }
.notif-head { display: flex; gap: 14px; align-items: flex-start; }
.notif-icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f5fbf, #0b2a5b); color: #fff; }
.notif-icon .ico { width: 20px; height: 20px; }
.notif-head h2 { margin: 2px 0 4px; }
.notif-head .muted { margin: 0; max-width: 62ch; }
.notif-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.notif-state { font-size: 13px; color: var(--muted); }
.notif-state.is-ok { color: #1a7f37; font-weight: 600; }
.notif-state a { color: var(--blue); text-decoration: underline; }
@media (max-width: 767px) { .notif-actions .btn { flex: 1 1 auto; justify-content: center; } .notif-state { flex-basis: 100%; } }

.notif-actions .btn[hidden], .install-actions .btn[hidden] { display: none !important; }

/* ===== milestones panel ===== */
.ms-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.ms-head h2 { margin: 0 0 4px; }
.ms-head .muted { margin: 0; max-width: 62ch; }
.ms-total { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; background: #eef4ff; color: var(--blue); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.ms-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ms-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.ms-card.is-on { border-color: #cfe0ff; background: linear-gradient(180deg, #f7faff, #fff); }
.ms-card-top { display: flex; align-items: center; gap: 10px; }
.ms-card-top > div { display: flex; flex-direction: column; min-width: 0; }
.ms-card-top strong { font-size: 13px; color: var(--navy); }
.ms-val { font-size: 12px; color: var(--muted); }
.ms-ico { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: #eef4ff; color: var(--blue); }
.ms-card.is-on .ms-ico { background: linear-gradient(135deg, #1f5fbf, #0b2a5b); color: #fff; }
.ms-ico .ico { width: 18px; height: 18px; }
.ms-bar { height: 6px; border-radius: 999px; background: #e8edf5; overflow: hidden; }
.ms-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #1f5fbf, #5aa9ff); transition: width .8s cubic-bezier(.22,1,.36,1); }
.ms-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.ms-sub { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.ms-posts { display: flex; flex-direction: column; gap: 6px; }
.ms-post { position: relative; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); overflow: hidden; background: #fff; }
.ms-post:hover { border-color: #cfe0ff; }
.ms-post-kind { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ms-post-title { font-size: 13.5px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-post-num { font-size: 13px; font-weight: 700; color: var(--navy); }
.ms-post-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eef2f8; color: var(--muted); }
.ms-post-badge.is-on { background: linear-gradient(135deg, #1f5fbf, #0b2a5b); color: #fff; }
.ms-post-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #1f5fbf, #5aa9ff); }
.ms-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ms-timeline li a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--text); }
.ms-timeline li:last-child a { border-bottom: 0; }
.ms-timeline li.muted { padding: 8px 4px; }
.ms-dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, #1f5fbf, #5aa9ff); box-shadow: 0 0 0 4px #eef4ff; }
.ms-timeline strong { display: block; font-size: 13.5px; color: var(--navy); }
.ms-timeline div span { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-timeline time { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 1100px) { .ms-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 767px) { .ms-cards { grid-template-columns: 1fr 1fr; gap: 8px; } .ms-card { padding: 12px; } .ms-meta { flex-direction: column; gap: 2px; } .ms-post { grid-template-columns: 1fr auto auto; } .ms-post-kind { display: none; } .ms-head { flex-direction: column; } }
@media (max-width: 420px) { .ms-cards { grid-template-columns: 1fr; } }

/* ===== AI page ===== */
.ai-page { display: flex; flex-direction: column; gap: 16px; }
.ai-hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.ai-hero-main { display: flex; gap: 14px; align-items: flex-start; }
.ai-hero-ico { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f5fbf, #0b2a5b); color: #fff; }
.ai-hero-ico .ico { width: 21px; height: 21px; }
.ai-hero h2 { margin: 2px 0 4px; }
.ai-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-budget { grid-column: 1 / -1; }
.ai-budget-bar { height: 8px; border-radius: 999px; background: #e8edf5; overflow: hidden; margin-bottom: 6px; }
.ai-budget-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1f5fbf, #5aa9ff); transition: width .6s; }
.ai-budget-bar i.is-hot { background: linear-gradient(90deg, #e2711d, #d64545); }
.ai-budget-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.pill { background: #eef4ff; color: var(--blue); font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.ai-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.ai-item-img { width: 64px; height: 48px; border-radius: 8px; object-fit: cover; background: #eef2f8; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.ai-item-body { min-width: 0; display: flex; flex-direction: column; }
.ai-item-body strong { font-size: 14px; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-item-body span { font-size: 12px; color: var(--muted); }
.ai-item-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ai-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.ai-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.ai-kpi span { font-size: 11.5px; color: var(--muted); }
.ai-kpi strong { font-size: 19px; color: var(--navy); }
.ai-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 8px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ai-bar { flex: 1 0 14px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.ai-bar i { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #5aa9ff, #1f5fbf); }
.ai-bar span { font-size: 9.5px; color: var(--muted); }
.ai-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-kind { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.ai-kind-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--navy); margin-bottom: 8px; }
.ai-kind-bar { height: 6px; border-radius: 999px; background: #e8edf5; overflow: hidden; }
.ai-kind-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1f5fbf, #5aa9ff); }
.ai-kind-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.ai-log-row { display: grid; grid-template-columns: 150px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ai-log-row.is-err { color: var(--danger); }
.ai-log-kind { font-weight: 600; color: var(--navy); }
.ai-log-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-log-label em { font-style: normal; color: var(--danger); }
.ai-log-cost { font-weight: 700; color: var(--navy); }
.ai-log-row time { color: var(--muted); font-size: 11.5px; }
.ai-news-item { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ai-news-item div { min-width: 0; display: flex; flex-direction: column; }
.ai-news-item a { font-size: 13px; color: var(--navy); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-news-item span { font-size: 11.5px; color: var(--muted); }
.chk-lg { font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ai-actions { display: flex; flex-direction: column; gap: 8px; }
.ai-action { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .2s, background .2s; }
.ai-action:hover { border-color: var(--blue); background: #f7faff; }
.ai-action.is-busy { opacity: .6; }
.ai-action strong { font-size: 14px; color: var(--navy); }
.ai-action span { font-size: 12px; color: var(--muted); }
.ai-sheet-note { margin: 0 0 12px; font-size: 12.5px; }
.aiimg-result { margin-top: 12px; }
.aiimg-result img { width: 100%; border-radius: 12px; display: block; margin-bottom: 10px; }
.aiimg-skel { width: 100%; aspect-ratio: 3/2; border-radius: 12px; background: linear-gradient(90deg, #eef2f8, #e2e9f4, #eef2f8); background-size: 200% 100%; animation: mktSkel 1.3s linear infinite; }
@keyframes mktSkel { to { background-position: -200% 0; } }
.rte-ai-btn { background: linear-gradient(135deg, #1f5fbf, #0b2a5b) !important; color: #fff !important; border-color: transparent !important; }
@media (max-width: 900px) {
  .ai-hero { grid-template-columns: 1fr; }
  .ai-kpis { grid-template-columns: 1fr 1fr; }
  .ai-kinds { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .ai-item { grid-template-columns: 48px 1fr; }
  .ai-item-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .ai-log-row { grid-template-columns: 1fr auto; }
  .ai-log-row time { display: none; }
}

/* editor toolbar: one line at every width, scrolls sideways instead of wrapping */
.rte-bar { flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 8px; }
.rte-bar::-webkit-scrollbar { display: none; }
.rte-bar > .rte-group { flex: 0 0 auto; }
.rte-bar button { flex: 0 0 auto; white-space: nowrap; }
.rte { position: relative; }
.rte::before { content: ""; position: absolute; top: 0; right: 0; width: 34px; height: 44px; pointer-events: none; z-index: 6; border-radius: 0 10px 0 0; background: linear-gradient(90deg, rgba(247,249,252,0), var(--bg)); }
@media (min-width: 1400px) { .rte::before { display: none; } }

/* ===== translations panel ===== */
.tr-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.tr-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.tr-row.is-done { border-color: #cfe0ff; background: #f7faff; }
.tr-row.is-stale { border-color: #f0d3a0; background: #fffaf1; }
.tr-code { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; }
.tr-row.is-stale .tr-code { color: #9a5a06; }
.tr-name { display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; color: var(--navy); font-weight: 600; }
.tr-name em { font-style: normal; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.tr-view, .tr-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; }
.tr-view:hover, .tr-btn:hover { border-color: var(--blue); color: var(--blue); }
.tr-btn.tr-del:hover { border-color: var(--danger); color: var(--danger); }
.tr-view .ico, .tr-btn .ico { width: 14px; height: 14px; }
.tr-row .btn-sm { padding: 6px 12px; font-size: 12.5px; }
/* translation rows are one line even in the narrow sidebar */
.tr-row { grid-template-columns: 30px minmax(0,1fr) auto; gap: 8px; padding: 7px 9px; }
.tr-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-name em { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-row > :nth-child(n+3) { grid-row: 1; }
.tr-row .tr-view, .tr-row .tr-btn { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
.tr-row .tr-view .ico, .tr-row .tr-btn .ico { width: 12px; height: 12px; }
.tr-row .btn-sm { padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.tr-acts { display: inline-flex; gap: 4px; align-items: center; }
/* place each part in its own column instead of relying on source order */
.tr-row > :nth-child(n+3) { grid-row: auto; }
.tr-row { align-items: center; }
.tr-row .tr-code { grid-column: 1; grid-row: 1; }
.tr-row .tr-name { grid-column: 2; grid-row: 1; }
.tr-row .tr-acts, .tr-row > .btn-sm { grid-column: 3; grid-row: 1; justify-self: end; }

/* ===== AI page on small screens ===== */
@media (max-width: 767px) {
  .ai-page { gap: 12px; }
  .ai-hero { gap: 12px; }
  .ai-hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .ai-item { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .ai-item-img { width: 44px; height: 44px; }
  .ai-item-body { min-width: 0; }
  .ai-item-body strong { font-size: 13.5px; line-height: 1.3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ai-item-body span { font-size: 11.5px; }
  .ai-item-acts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
  .ai-item-acts .btn { justify-content: center; padding: 9px 8px; font-size: 12.5px; }
  .ai-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ai-kpi:last-child { grid-column: 1 / -1; }
  .ai-kpi { padding: 10px; }
  .ai-kpi strong { font-size: 17px; }
  .ai-chart { justify-content: flex-start; gap: 6px; height: 96px; }
  .ai-bar { flex: 0 0 26px; }
  .ai-kind-top { flex-wrap: wrap; gap: 2px 8px; }
  .ai-kind-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
  .ai-log-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 4px; }
  .ai-log-kind { grid-column: 1; font-size: 12px; }
  .ai-log-cost { grid-column: 2; grid-row: 1; }
  .ai-log-label { grid-column: 1 / -1; grid-row: 2; min-width: 0; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
  .ai-news-item { gap: 8px; }
  .ai-news-item a { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ai-news-item .btn-sm { flex: 0 0 auto; padding: 7px 10px; font-size: 12px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head .seg { width: 100%; display: flex; }
  .panel-head .seg button { flex: 1 1 0; }
  .ms-head { gap: 8px; }
}
@media (max-width: 400px) {
  .ai-item-acts { grid-template-columns: 1fr 1fr; }
  .ai-item-acts .btn-ghost { grid-column: 1 / -1; }
}

/* numbers never overflow their card */
.kpi, .ai-kpi, .ms-card { min-width: 0; }
.kpi-value, .kpi strong, .ai-kpi strong, .ms-card .ms-val { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kpi-head span, .kpi-note, .ai-kpi span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kpi strong { font-size: clamp(20px, 2.1vw, 30px); line-height: 1.1; display: block; }
/* the same guarantee for the other card grids */
.ms-cards > :last-child:nth-child(4n + 1) { grid-column: 1 / -1; }
@media (max-width: 1100px) { .ms-cards > :last-child:nth-child(4n + 1) { grid-column: auto; } .ms-cards > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 420px) { .ms-cards > :last-child { grid-column: auto; } }
.grid-2 > :last-child:nth-child(odd):not(.span-2) { grid-column: 1 / -1; }
@media (max-width: 900px) { .grid-2 > :last-child:nth-child(odd):not(.span-2) { grid-column: auto; } }

/* =========================================================
   GRID DE CARDS (regra final)
   Column count follows the number of cards; whatever is left on the last
   row stretches to fill it. A row is never partially empty.
   ========================================================= */
.kpis, .ai-kpis { display: grid; gap: 14px; }

/* ---- wide: one row when the cards fit ---- */
@media (min-width: 1500px) {
  .kpis, .ai-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis:has(> :nth-child(4):last-child), .ai-kpis:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis:has(> :nth-child(5):last-child), .ai-kpis:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis > :last-child:nth-child(6n + 1), .ai-kpis > :last-child:nth-child(6n + 1) { grid-column: 1 / -1; }
}
/* ---- medium: three across, two when the count does not divide by three ---- */
@media (min-width: 901px) and (max-width: 1499px) {
  .kpis, .ai-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis:has(> :nth-child(4):last-child), .ai-kpis:has(> :nth-child(4):last-child),
  .kpis:has(> :nth-child(5):last-child), .ai-kpis:has(> :nth-child(5):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* leftovers fill the last row */
  .kpis:not(:has(> :nth-child(4):last-child)):not(:has(> :nth-child(5):last-child)) > :last-child:nth-child(3n + 1),
  .ai-kpis:not(:has(> :nth-child(4):last-child)):not(:has(> :nth-child(5):last-child)) > :last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
  .kpis:not(:has(> :nth-child(4):last-child)):not(:has(> :nth-child(5):last-child)) > :last-child:nth-child(3n + 2),
  .ai-kpis:not(:has(> :nth-child(4):last-child)):not(:has(> :nth-child(5):last-child)) > :last-child:nth-child(3n + 2) { grid-column: span 2; }
  .kpis:has(> :nth-child(5):last-child) > :last-child,
  .ai-kpis:has(> :nth-child(5):last-child) > :last-child { grid-column: 1 / -1; }
}
/* ---- small: two across, the odd one out fills the row ---- */
@media (min-width: 421px) and (max-width: 900px) {
  .kpis, .ai-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > :last-child:nth-child(odd), .ai-kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* ---- phone: single column, nothing to balance ---- */
@media (max-width: 420px) {
  .kpis, .ai-kpis { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .kpis > *, .ai-kpis > * { grid-column: auto !important; }
}
