/* YourBrand back office — one stylesheet, no build step. */
:root {
  --accent: #0b5fff;
  --accent-soft: #e8efff;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #16181d;
  --muted: #6b7280;
  --good: #15803d; --good-soft: #dcfce7;
  --bad: #b91c1c; --bad-soft: #fee2e2;
  --warn: #b45309; --warn-soft: #fef3c7;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --sidebar: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* layout */
#app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: #101828; color: #cbd5e1; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; color: #fff; font-weight: 700; font-size: 16px; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 13px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; color: #cbd5e1; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(11,95,255,.25); color: #fff; }
.nav .count { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.nav .count.zero { display: none; }
.sidebar-foot { margin-top: 18px; padding: 10px; font-size: 12px; color: #94a3b8; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot button { margin-top: 8px; }
main { padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* cards & stats */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { #app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } main { padding: 18px; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat.warn .stat-value { color: var(--bad); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { color: var(--muted); text-align: center; padding: 26px; }

/* badges & buttons */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef0f3; color: #374151; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.btn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 9px; padding: 7px 12px; font: inherit; font-weight: 550; cursor: pointer; box-shadow: var(--shadow); }
.btn:hover { background: #f8fafc; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #094fd6; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn-ghost:hover { background: #eef0f3; }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-label { font-size: 12.5px; font-weight: 600; color: #374151; }
.field-hint { font-size: 12px; color: var(--muted); }
.input { border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font: inherit; background: #fff; width: 100%; }
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea.input { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 6px 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.switch input { width: 36px; height: 20px; appearance: none; background: #cbd5e1; border-radius: 999px; position: relative; cursor: pointer; transition: .15s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked { background: var(--good); }
.switch input:checked::after { left: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #eef0f3; border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.chip.on { background: var(--good-soft); color: var(--good); }
.chip.off { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }
.chip.unknown { background: var(--warn-soft); color: var(--warn); }

/* misc */
.loading { color: var(--muted); padding: 30px; text-align: center; }
.error-box { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.notice-info { background: var(--info-soft); color: var(--info); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.overlay { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #101828; color: #fff; padding: 10px 14px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: none; }
.toast-good { background: var(--good); }
.toast-bad { background: var(--bad); }
.login { min-height: 100vh; display: grid; place-items: center; background: #101828; }
.login .card { width: min(380px, 92vw); padding: 28px; }
.login h1 { margin-bottom: 14px; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar .input { width: auto; }
.bar { height: 8px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.attention { border-left: 4px solid var(--bad); }

/* studio */
.studio { display: grid; grid-template-columns: 200px minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
/* Narrow windows: never bury the editor under a sticky phone. The phone goes last and stops sticking. */
@media (max-width: 1000px) { .studio { grid-template-columns: 1fr; } .studio > :nth-child(2) { order: 3; } .studio .phone { position: static; } }
.phone { width: 330px; height: 690px; margin: 0 auto; border-radius: 46px; background: #0b1020; padding: 10px; box-shadow: 0 30px 60px rgba(0,0,0,.28), inset 0 0 0 2px #2a3242; position: sticky; top: 20px;
  --m-accent: #0B5FFF; --m-secondary: #00C2A8; --m-on: #fff; --m-radius: 18px; --m-font: -apple-system, "SF Pro", system-ui, sans-serif; --m-card-bg: #f6f7fb; --m-card-shadow: 0 6px 18px rgba(15,23,42,.06); --m-card-border: transparent; }
.phone-screen { background: #fff; border-radius: 38px; height: 100%; overflow-y: auto; overflow-x: hidden; padding: 54px 14px 90px; position: relative; font-family: var(--m-font); color: #0f172a; scrollbar-width: none; }
.phone-screen::-webkit-scrollbar { display: none; }
.phone-status { position: absolute; top: 10px; left: 10px; right: 10px; height: 54px; z-index: 3; display: flex; justify-content: space-between; padding: 8px 20px 0; border-radius: 38px 38px 0 0; background: linear-gradient(#fff 70%, rgba(255,255,255,0)); font-size: 12px; font-weight: 600; color: #0f172a; pointer-events: none; }
.phone-island { position: absolute; top: 14px; z-index: 3; left: 50%; transform: translateX(-50%); width: 96px; height: 26px; background: #0b1020; border-radius: 999px; }
.phone-tabbar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-top: 1px solid #eceef3; padding: 8px 4px 16px; border-radius: 0 0 38px 38px; }
.phone-tabbar > div { flex: 1; text-align: center; font-size: 10px; font-weight: 600; color: #8a94a6; cursor: pointer; }
.phone-tabbar > div.on { color: var(--m-accent); }
.phone-tabbar .ic { font-size: 19px; line-height: 22px; }
.mock-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.mock-sub { color: #64748b; font-size: 14px; line-height: 1.35; }
.mock-hero { background: linear-gradient(135deg, var(--m-accent), var(--m-secondary)); color: var(--m-on); border-radius: var(--m-radius); padding: 22px 18px 20px; margin: 0 0 6px; box-shadow: 0 12px 28px rgba(15,23,42,.18); }
.mock-hero .mock-title { font-size: 28px; }
.mock-hero .mock-sub { color: rgba(255,255,255,.88); margin-top: 6px; }
.mock-search { background: #f1f3f8; border-radius: 14px; padding: 12px 14px; color: #8a94a6; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.mock-h { font-weight: 700; font-size: 17px; letter-spacing: -.01em; margin: 4px 0 10px; }
.mock-row { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid #eef0f4; font-size: 14.5px; }
.mock-row .r { margin-left: auto; color: #8a94a6; font-size: 12.5px; }
.mock-card { background: var(--m-card-bg); border: 1px solid var(--m-card-border); box-shadow: var(--m-card-shadow); border-radius: var(--m-radius); padding: 14px; margin-bottom: 10px; }
.mock-btn { border-radius: var(--m-radius); padding: 13px; text-align: center; color: var(--m-on); font-weight: 700; font-size: 15px; background: var(--m-accent); box-shadow: 0 8px 20px rgba(15,23,42,.14); }
.mock-btn.secondary { background: #fff; color: var(--m-accent); box-shadow: none; border: 1.5px solid var(--m-accent); }
.mock-btn.link { background: none; box-shadow: none; color: var(--m-accent); padding: 6px; }
.mock-chip { display: inline-block; padding: 7px 13px; border-radius: 999px; background: #f1f3f8; font-size: 13px; font-weight: 600; margin: 0 6px 6px 0; color: #334155; }
.mock-chip.on { color: var(--m-on); background: var(--m-accent); }
.mock-qr { width: 130px; height: 130px; margin: 6px auto; background: repeating-conic-gradient(#0f172a 0 25%, #fff 0 50%) 0 0/16px 16px; border: 6px solid #fff; outline: 1px solid #e2e8f0; }
.mock-notice { background: #fef3c7; color: #92400e; border-radius: 14px; padding: 11px 13px; font-size: 13px; line-height: 1.4; }
.mock-dest { flex: 0 0 104px; text-align: center; padding: 14px 6px 12px; margin: 0; }
.mock-dest .flag { font-size: 30px; line-height: 1; display: inline-block; width: 52px; height: 52px; line-height: 52px; border-radius: 999px; background: #fff; box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.mock-dest .name { font-size: 12.5px; font-weight: 700; margin-top: 8px; }
.mock-dest .meta { font-size: 11px; color: #8a94a6; }
.mock-scroll { display: flex; gap: 10px; overflow: hidden; padding: 4px 2px 6px; }
.mock-plan { display: flex; align-items: center; gap: 12px; }
.mock-plan .data { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.mock-plan .meta { color: #64748b; font-size: 12.5px; }
.mock-plan .price { margin-left: auto; background: var(--m-accent); color: var(--m-on); font-weight: 700; padding: 6px 11px; border-radius: 999px; font-size: 13px; }
.mock-feat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mock-feat > div { background: var(--m-card-bg); border: 1px solid var(--m-card-border); border-radius: calc(var(--m-radius) - 4px); padding: 12px; font-size: 12.5px; line-height: 1.35; }
.mock-feat .ic { font-size: 20px; margin-bottom: 6px; color: var(--m-accent); }
.mock-banner { background: linear-gradient(135deg, var(--m-accent), var(--m-secondary)); color: var(--m-on); border-radius: var(--m-radius); padding: 16px; box-shadow: 0 10px 24px rgba(15,23,42,.16); }
.mock-faq { padding: 12px 2px; border-bottom: 1px solid #eef0f4; font-size: 14px; font-weight: 600; display: flex; }
.mock-faq .r { margin-left: auto; color: var(--m-accent); }
.preset { border: 2px solid var(--border); border-radius: 12px; padding: 10px; cursor: pointer; background: #fff; }
.preset.on { border-color: var(--accent); }
.preset .swatch-bar { height: 34px; border-radius: 8px; margin-bottom: 8px; }
.block-list { list-style: none; margin: 0; padding: 0; }
.block-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; background: #fff; cursor: grab; }
.block-list li.dragging { opacity: .4; }
.block-list li.selected { border-color: var(--accent); background: var(--accent-soft); }
.block-list li .grip { color: #cbd5e1; cursor: grab; }
.block-list li .name { flex: 1; font-weight: 550; }
.block-list li.hidden-block .name { color: #9ca3af; text-decoration: line-through; }
.screen-tabs { display: flex; flex-direction: column; gap: 4px; }
.screen-tabs button { text-align: left; background: none; border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; font: inherit; font-weight: 550; cursor: pointer; color: var(--text); }
.screen-tabs button.active { background: var(--accent-soft); color: var(--accent); }
.props { display: flex; flex-direction: column; gap: 10px; }
.copy-grid { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 6px 10px; align-items: center; }
.copy-grid .key { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); padding: 0; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 0; display: flex; gap: 8px; justify-content: flex-end; }

/* Editing directly on the phone: hover tools, insert lines, add-at-end. */
.blk-tools { position: absolute; top: -11px; left: 6px; display: none; gap: 2px; z-index: 2; }
.blk.selected .blk-tools, .blk:hover .blk-tools { display: flex; }
.blk-tools button { font: inherit; font-size: 11px; line-height: 18px; padding: 0 6px; border: 0; border-radius: 6px; background: #0f172a; color: #fff; cursor: pointer; }
.blk-tools button:hover { background: var(--accent); }
.blk.trying { border-color: transparent !important; background: inherit; }
.blk-insert { height: 10px; margin: -4px -8px; position: relative; cursor: pointer; }
.blk-insert::before { content: ''; position: absolute; left: 8px; right: 8px; top: 4px; border-top: 2px dashed transparent; }
.blk-insert:hover::before { border-color: var(--accent); }
.blk-insert span { display: none; position: absolute; left: 50%; top: 5px; transform: translate(-50%, -50%); width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.blk-insert:hover span { display: block; }
.blk-add-end { display: block; width: 100%; margin: 6px 0 10px; padding: 8px; border: 1px dashed #cbd5e1; border-radius: 10px; background: transparent; color: #64748b; font: inherit; font-size: 12px; cursor: pointer; }
.blk-add-end:hover { border-color: var(--accent); color: var(--accent); }

/* Blocks on the phone: editing affordances (the tools/insert rules are above). */
.blk { border-radius: 10px; padding: 6px; margin: 0 -6px 8px; border: 1px dashed transparent; cursor: pointer; position: relative; }
.blk:hover { border-color: #cbd5e1; }
.blk.selected { border-color: var(--accent); background: var(--accent-soft); }
.blk.hidden-block { opacity: .45; filter: grayscale(.6); }
.blk-tag { position: absolute; top: -9px; right: 6px; font-size: 10px; background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 6px; display: none; z-index: 2; }
.blk.selected .blk-tag, .blk:hover .blk-tag { display: block; }

/* --- Format: direct manipulation on the phone preview ------------------------------------ */
.blk.selected { overflow: visible; }
.blk-body { min-height: 4px; }
.blk.on-canvas { margin: 0; padding: 0; border: 1px solid transparent; }
.blk.on-canvas:hover { border-color: #cbd5e1; }
.blk.on-canvas.selected { border-color: var(--accent); background: transparent; }
.mock-canvas { background: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(15,23,42,.035) 19px, rgba(15,23,42,.035) 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(15,23,42,.035) 19px, rgba(15,23,42,.035) 20px), #fbfcfe; border: 1px dashed #dbe2ea; }
.mock-canvas.drop-here { outline: 2px solid var(--accent); outline-offset: -2px; }
.blk-handle { position: absolute; width: 10px; height: 10px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; z-index: 4; display: none; }
.blk.selected > .blk-handle { display: block; }
.blk-handle.n { top: -6px; left: 50%; transform: translateX(-50%); }
.blk-handle.s { bottom: -6px; left: 50%; transform: translateX(-50%); }
.blk-handle.e { right: -6px; top: 50%; transform: translateY(-50%); }
.blk-handle.w { left: -6px; top: 50%; transform: translateY(-50%); }
.blk-handle.ne { top: -6px; right: -6px; }
.blk-handle.nw { top: -6px; left: -6px; }
.blk-handle.se { bottom: -6px; right: -6px; }
.blk-handle.sw { bottom: -6px; left: -6px; }
.blk-mini { position: absolute; top: -40px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; align-items: center; background: #0f172a; color: #fff; border-radius: 10px; padding: 4px 6px; z-index: 5; box-shadow: 0 8px 20px rgba(15,23,42,.25); white-space: nowrap; }
.blk-mini button { font: inherit; font-size: 12px; font-weight: 700; line-height: 22px; min-width: 24px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: #fff; cursor: pointer; }
.blk-mini button:hover, .blk-mini button.on { background: var(--accent); }
.blk-mini select { font: inherit; font-size: 11px; padding: 2px 4px; border-radius: 6px; border: 0; background: #1e293b; color: #fff; max-width: 92px; }
.blk-mini input[type=color] { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer; }
.inline-editing { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; background: rgba(255,255,255,.85); color: #0f172a; min-width: 20px; cursor: text; }
.props input[type=range] { accent-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
