/* 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; }
.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 28px 60px; max-width: 1240px; width: 100%; }
.admin-wide .adm-content { max-width: 1560px; }
.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 img.is-selected { box-shadow: 0 0 0 3px var(--blue); }
.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; gap: 2px; background: var(--navy); border-radius: 8px; padding: 4px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.img-tools button { color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; display: inline-flex; gap: 5px; align-items: center; }
.img-tools button:hover { background: rgba(255,255,255,.15); }
.img-tools .ico { width: 14px; height: 14px; }
.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 { left: 8px !important; right: 8px; justify-content: space-between; }
  .img-tools button { padding: 8px 10px; }
  .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; }
}
