/* BrandPost admin — plain CSS, no build step. */
:root {
  --bg: #f4f5fb; --panel: #ffffff; --text: #1d2033; --muted: #6b7085; --line: #e3e5ef;
  --brand: #4f3bf6; --brand-dark: #3a29c9; --brand-soft: #ece9ff;
  --ok: #138a52; --ok-soft: #e3f6ec; --warn: #a96500; --warn-soft: #fff3dc; --bad: #c42b3b; --bad-soft: #fde8ea;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,22,40,.06), 0 4px 16px rgba(20,22,40,.04);
  --sidebar: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code, pre, textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: #15172a; color: #c9cbe0; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 30; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; }
.sidebar .brand span.logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #4f3bf6, #ec4899); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.sidebar nav a { display: block; padding: 8px 18px; color: #c9cbe0; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: rgba(79,59,246,.22); color: #fff; border-left-color: #8b7dff; }
.sidebar nav .group { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7d80a0; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .who { display: flex; align-items: center; gap: 12px; }
.content { padding: 24px; max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-block; }
  .content { padding: 16px; }
}

/* Panels & grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.stat { padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbff; }
.table tr:hover td { background: #fbfbff; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: #eef0f7; border: 1px solid var(--line); display: block; }
.thumb.lg { width: 100%; height: 140px; object-fit: contain; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field .error { color: var(--bad); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd2e2; border-radius: 8px; background: #fff; font: inherit; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid #cfd2e2; border-radius: 8px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
textarea.code { min-height: 420px; white-space: pre; tab-size: 2; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; cursor: pointer; margin-right: 16px; }
.inline-form { display: inline; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .field { min-width: 150px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: #cfd2e2; }
.btn.secondary:hover { background: #f5f6fb; }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #a11f2d; }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Badges & alerts */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef0f7; color: #4a4e68; }
.badge.published, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.scheduled { background: #e5f0ff; color: #1d5fd1; }
.badge.draft { background: #eef0f7; color: #4a4e68; }
.badge.disabled, .badge.expired, .badge.bad, .badge.error { background: var(--bad-soft); color: var(--bad); }
.badge.warning, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: #e5f0ff; color: #1d5fd1; }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: var(--ok-soft); border-color: #b9e6cf; color: #0d5e38; }
.alert.warn { background: var(--warn-soft); border-color: #f2d59b; color: #7a4a00; }
.alert.bad { background: var(--bad-soft); border-color: #f5bcc3; color: #8d1d29; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

/* Pagination */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px; list-style: none; padding: 0; }
.pagination a, .pagination span { display: inline-block; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
.pagination .active span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled span { color: #aab; }

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.media-item .meta { font-size: 12px; margin-top: 6px; word-break: break-word; }
.checker { background-image: linear-gradient(45deg,#eee 25%,transparent 25%),linear-gradient(-45deg,#eee 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#eee 75%),linear-gradient(-45deg,transparent 75%,#eee 75%); background-size: 14px 14px; background-position: 0 0,0 7px,7px -7px,-7px 0; }

/* Login */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, #15172a, #2b1f73); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }

/* Template editor */
.editor { display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
@media (max-width: 1200px) { .editor { grid-template-columns: 220px minmax(0, 1fr); } .editor .props { grid-column: 1 / -1; } }
@media (max-width: 760px) { .editor { grid-template-columns: 1fr; } }
.editor .panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.layers { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.layers li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.layers li:hover { background: #f4f4fb; }
.layers li.sel { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.layers li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers li .ty { font-size: 10.5px; color: var(--muted); text-transform: uppercase; }
.add-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.add-buttons button { font-size: 11.5px; padding: 3px 7px; border: 1px solid #d5d7e6; border-radius: 6px; background: #fafaff; cursor: pointer; }
.add-buttons button:hover { background: var(--brand-soft); }
.stage-wrap { background: #e6e8f2; border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; overflow: auto; }
.bp-canvas { position: relative; overflow: hidden; box-shadow: 0 6px 30px rgba(0,0,0,.18); background: #fff; flex-shrink: 0; user-select: none; }
.bp-el { position: absolute; transform-origin: center center; }
.bp-el.selected { outline: 2px dashed #4f3bf6; outline-offset: 1px; }
.bp-el .handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #4f3bf6; border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; }
.props .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.props .field { margin-bottom: 8px; }
.props label { font-size: 12px; }
.props input, .props select, .props textarea { padding: 5px 7px; font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { background: none; border: none; padding: 8px 14px; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.validation-box { margin-top: 10px; font-size: 13px; }
.validation-box li { margin-bottom: 2px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,16,30,.55); z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 860px; max-height: 86vh; overflow: auto; padding: 18px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.picker-grid button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; cursor: pointer; font-size: 11px; text-align: center; }
.picker-grid button:hover { border-color: var(--brand); }
.picker-grid img { width: 100%; height: 80px; object-fit: contain; }
.preview-pane { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
pre.json { background: #0f1124; color: #d9dcf5; padding: 14px; border-radius: 8px; overflow: auto; max-height: 520px; font-size: 12px; }
