:root { --navy: #0b3d91; --navy-900: #06214f; --accent: #ff7a00; --ink: #14213d; --muted: #667085; --line: #e3e8f0; --bg: #f4f6fb; --ok: #117a3d; --err: #b42318; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
h1 { font-size: 1.6rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: .95rem; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a { color: var(--navy); }
code { background: #eef2f8; padding: 1px 6px; border-radius: 4px; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { font-size: .82rem; color: var(--muted); margin: 6px 0 0; }
.err { color: var(--err); min-height: 1.2em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 12px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
input:not([type=checkbox]):not([type=radio]), select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; border: 1px solid #cfd6e4; border-radius: 8px; background: #fff; color: var(--ink); }
.row input, .row select { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d7f5; border-color: var(--navy); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid #cfd6e4; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--navy); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-900); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); border-color: #f1c4c0; }
.btn.danger:hover { background: #fdecea; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.linkish { background: none; border: 0; color: var(--navy); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; text-decoration: underline; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, var(--navy-900), var(--navy)); }
.login-card { width: min(400px, 100%); background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); text-align: left; }
.login-card h1 { margin: 12px 0 0; }

.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--navy-900); color: #c9d6f2; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; text-decoration: none; font-size: 1.05rem; padding: 0 8px; }
.side nav { display: grid; gap: 4px; }
.side nav a { color: #c9d6f2; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; }
.side-foot .btn { color: #fff; border-color: rgba(255, 255, 255, .3); }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: .75rem; padding: 1px 8px; }
.main { padding: 28px clamp(16px, 3vw, 40px); min-width: 0; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { display: flex; flex-wrap: wrap; }
  .side-foot { margin: 0; flex-direction: row; display: flex; align-items: center; }
}

.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h1 { margin: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stat span { display: block; font-size: 2rem; font-weight: 800; color: var(--navy); }
.stat small { color: var(--muted); }
.links a { font-weight: 600; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { white-space: nowrap; text-align: right; }
.leads-table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eef2f8; color: var(--muted); text-transform: capitalize; }
.pill-published, .pill-success, .pill-booked { background: #e3f6ea; color: var(--ok); }
.pill-draft, .pill-closed, .pill-cancelled, .pill-skipped { background: #eef2f8; color: #475467; }
.pill-scheduled, .pill-in_progress, .pill-queued, .pill-quoted { background: #fff4e0; color: #9a5b00; }
.pill-new { background: #ffe9d6; color: #b54b00; }
.pill-contacted { background: #e5edfb; color: var(--navy); }
.pill-failure, .pill-spam { background: #fdecea; color: var(--err); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor-grid { grid-template-columns: 1fr; } }
.title-input { font-size: 1.6rem !important; font-weight: 800; border: 0 !important; background: transparent !important; padding: 4px 0 !important; outline: none !important; }
.slug-row { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; font-size: .9rem; }
.slug-row input { width: auto; flex: 1; margin: 0; padding: 5px 8px; }
.editor-toggle { text-align: right; margin-bottom: 6px; }
.editor-main .ql-toolbar { background: #fff; border-radius: 10px 10px 0 0; border-color: #cfd6e4; position: sticky; top: 0; z-index: 5; }
.editor-main .ql-container { background: #fff; border-radius: 0 0 10px 10px; border-color: #cfd6e4; font: 17px/1.7 system-ui, sans-serif; }
.editor-main .ql-editor { min-height: 480px; }
.editor-main .ql-editor img { max-width: 100%; }
.html-source { min-height: 540px; font: 13px/1.5 ui-monospace, Menlo, monospace; }
.cover-preview img { width: 100%; aspect-ratio: 1200/630; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.counter { float: right; color: var(--muted); font-weight: 500; }
.counter.over { color: var(--err); }
.serp { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; font-family: arial, sans-serif; }
.serp-url { font-size: 12px; color: #4d5156; }
.serp-title { font-size: 18px; color: #1a0dab; margin: 2px 0; }
.serp-desc { font-size: 13px; color: #4d5156; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 420px; }
.toast.err { background: var(--err); }

.dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, 100% - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.dialog::backdrop { background: rgba(6, 33, 79, .45); }
.dialog-body { padding: 22px; }
.details { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 16px; font-size: .92rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
