/* BrickPages — app UI, built on the Brickware palette. */

:root {
  --bg: #0d0b0a;
  --bg-2: #100e0c;
  --panel: #14110f;
  --panel-2: #181412;
  --panel-3: #1f1a17;
  --line: rgba(255, 236, 220, 0.09);
  --line-2: rgba(255, 236, 220, 0.17);
  --text: #f5ede6;
  --muted: #b3a69b;
  --dim: #7d7168;
  --brick: #e0663f;
  --brick-2: #f08a5d;
  --ok: #3ecf8e;
  --warn: #f5c451;
  --radius: 18px;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 78% -10%, rgba(224, 102, 63, 0.13), transparent 62%),
    radial-gradient(760px 520px at 4% 4%, rgba(140, 125, 255, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: var(--brick); color: #fff; }
:focus-visible { outline: 2px solid var(--brick-2); outline-offset: 2px; }
.wrap { width: min(1180px, 100% - 44px); margin-inline: auto; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 11, 10, 0.82);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  width: min(1180px, 100% - 44px); margin-inline: auto;
  height: 64px; display: flex; align-items: center; gap: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand svg { width: 28px; height: 28px; }
.brand-text small { font-family: var(--mono); font-weight: 400; color: var(--dim); font-size: 12px; }
.brand-sep { color: var(--dim); font-weight: 400; }
.brand-page { color: var(--brick); }
.topnav { display: flex; gap: 4px; margin-left: 6px; }
.topnav a {
  padding: 7px 13px; border-radius: 999px; font-size: 15px; font-weight: 500;
  color: var(--muted); transition: color .18s, background .18s;
}
.topnav a:hover, .topnav a.on { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.who { display: flex; align-items: center; gap: 10px; }
.who .avatar-dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brick), #7c3a22); color: #fff;
  font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.who b { font-size: 14.5px; font-weight: 500; }

/* ---------- buttons + inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  transition: transform .18s, background .18s, border-color .18s, color .18s, opacity .18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.28); }
.btn:active { transform: none; }
.btn.primary { background: var(--brick); border-color: var(--brick); color: #fff; }
.btn.primary:hover { background: var(--brick-2); border-color: var(--brick-2); }
.btn.ghost { color: var(--muted); background: rgba(255, 255, 255, 0.03); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.btn.sm { padding: 8px 13px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
  color: var(--muted); cursor: pointer; transition: color .18s, background .18s, border-color .18s;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: var(--line-2); }
.icon-btn svg { width: 15px; height: 15px; }
.mini {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--muted);
  border-radius: 8px; padding: 4px 9px; font-family: var(--mono); font-size: 11.5px; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.mini:hover { color: var(--text); border-color: var(--line-2); }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-family: var(--mono); letter-spacing: .02em; color: var(--muted); }
.field > small { font-size: 12.5px; color: var(--dim); }
.input, .textarea, .select {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  font-family: inherit; font-size: 15px; transition: border-color .18s, background .18s;
}
.input::placeholder, .textarea::placeholder { color: #6a6058; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--brick); background: #14100e;
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.select { appearance: none; cursor: pointer; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.select option { background: var(--panel-2); color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field-row { display: flex; gap: 9px; align-items: stretch; }
.field-row .input { flex: 1; }

/* ---------- shared shells ---------- */

.view { padding: 0 0 90px; }
.loading-wrap { display: grid; place-items: center; min-height: 50vh; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14); border-top-color: var(--brick);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kicker {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brick-2);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12.5px;
  color: var(--brick-2); padding: 6px 13px; border-radius: 999px;
  border: 1px solid rgba(224, 102, 63, 0.33); background: rgba(224, 102, 63, 0.08);
}
.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--brick); box-shadow: 0 0 10px var(--brick); }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line);
  color: var(--muted); background: rgba(255, 255, 255, 0.04);
}
.pill.ok { color: var(--ok); border-color: rgba(62, 207, 142, 0.32); background: rgba(62, 207, 142, 0.09); }
.pill.draft { color: var(--warn); border-color: rgba(245, 196, 81, 0.3); background: rgba(245, 196, 81, 0.08); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.sec-head h1, .sec-head h2 { margin: 8px 0 0; font-size: clamp(28px, 3.6vw, 42px); letter-spacing: -0.035em; line-height: 1.06; }
.sec-head p { margin: 8px 0 0; color: var(--muted); max-width: 52ch; }
.section { padding-top: 72px; }

.empty {
  padding: 46px 24px; text-align: center; border: 1px dashed var(--line-2);
  border-radius: var(--radius); color: var(--muted); background: rgba(255, 255, 255, 0.015);
}
.empty b { display: block; color: var(--text); margin-bottom: 6px; font-size: 18px; }

/* ---------- landing ---------- */

.hero { position: relative; overflow: hidden; padding: 74px 0 40px; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 46px, 132px 92px;
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 50% 0%, #000 10%, transparent 72%);
          mask-image: radial-gradient(ellipse 72% 70% at 50% 0%, #000 10%, transparent 72%);
  opacity: .8;
}
.hero-grid {
  position: relative; display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: 54px; align-items: center;
}
.hero h1 {
  margin: 22px 0 18px; font-size: clamp(42px, 6.2vw, 74px); line-height: 0.98;
  letter-spacing: -0.05em; font-weight: 700;
}
.hero h1 em { font-style: normal; color: var(--brick); }
.hero .lead { margin: 0 0 28px; font-size: clamp(17px, 1.9vw, 19.5px); color: var(--muted); max-width: 48ch; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-url {
  margin-top: 30px; display: inline-flex; align-items: center; gap: 2px;
  padding: 9px 15px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); font-family: var(--mono); font-size: 13.5px;
}
.hero-url span { color: var(--dim); }
.hero-url b { color: var(--brick-2); font-weight: 500; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hero-points span {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
}

/* decorative profile card */
.mock {
  position: relative; width: min(360px, 100%); margin-inline: auto;
  border-radius: 24px; overflow: hidden; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02));
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(224, 102, 63, 0.08);
  transform: rotate(-1.2deg);
}
.mock-banner {
  height: 116px; position: relative;
  background:
    radial-gradient(120% 130% at 20% 0%, rgba(224, 102, 63, 0.85), transparent 60%),
    radial-gradient(120% 120% at 90% 20%, rgba(140, 125, 255, 0.5), transparent 62%),
    #1b1512;
}
.mock-banner::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 100% 26px, 54px 52px; opacity: .35;
}
.mock-body { padding: 0 22px 22px; text-align: center; }
.mock-avatar {
  width: 68px; height: 68px; margin: -34px auto 0; border-radius: 50%;
  border: 3px solid #191412; background: linear-gradient(140deg, #f08a5d, #7c3a22);
  display: grid; place-items: center; font-family: var(--mono); font-size: 22px; color: #fff;
  position: relative;
}
.mock-name { margin: 11px 0 1px; font-weight: 700; letter-spacing: -0.02em; font-size: 19px; }
.mock-handle { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.mock-bio { margin: 11px 0 15px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.mock-socials { display: flex; justify-content: center; gap: 7px; margin-bottom: 13px; }
.mock-socials span {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; color: var(--muted);
}
.mock-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px; border-radius: 11px; font-size: 13px; font-weight: 600; margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.055); border: 1px solid var(--line);
}
.mock-btn.solid { background: var(--brick); border-color: var(--brick); color: #fff; }
.mock-player {
  display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 9px 11px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); text-align: left;
}
.mock-player i {
  width: 26px; height: 26px; border-radius: 50%; background: var(--brick); flex: none;
  display: grid; place-items: center; color: #fff; font-size: 9px;
}
.mock-player div { min-width: 0; }
.mock-player b { display: block; font-size: 11.5px; font-weight: 600; }
.mock-player span { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--dim); }
.mock-float {
  position: absolute; right: -14px; bottom: 62px; z-index: 2;
  padding: 8px 12px; border-radius: 11px; font-family: var(--mono); font-size: 11px;
  background: rgba(20, 17, 15, 0.94); border: 1px solid var(--line-2); color: var(--ok);
  box-shadow: 0 16px 30px -18px #000; transform: rotate(2deg);
}
.hero-art { position: relative; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); transition: border-color .2s, transform .2s, background .2s;
}
.feature:hover { border-color: var(--line-2); transform: translateY(-2px); background: var(--panel-2); }
.feature .ic {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  color: var(--brick-2); background: rgba(224, 102, 63, 0.1); border: 1px solid rgba(224, 102, 63, 0.24);
  margin-bottom: 14px;
}
.feature .ic svg { width: 19px; height: 19px; }
.feature h3 { margin: 0 0 6px; font-size: 17.5px; letter-spacing: -0.02em; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }

/* ---------- page cards / discover ---------- */

.pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pcard {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
  transition: transform .2s, border-color .2s, background .2s;
}
.pcard:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--panel-2); }
.pcard-banner {
  height: 78px; background: #1b1512 center / cover no-repeat; position: relative;
}
.pcard-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(20, 17, 15, 0.9));
}
.pcard-body { padding: 0 16px 16px; margin-top: -24px; position: relative; }
.pcard-avatar {
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  border: 2.5px solid var(--panel-2); background: linear-gradient(140deg, var(--brick), #6d3320);
  display: grid; place-items: center; font-family: var(--mono); font-size: 16px; color: #fff;
  text-transform: uppercase;
}
.pcard-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pcard-body b { display: block; margin-top: 9px; font-size: 15.5px; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-body .handle { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.pcard-bio {
  margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 38px;
}
.pcard-meta {
  display: flex; gap: 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}

.discover-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.discover-bar .search-wrap { flex: 1 1 260px; position: relative; }
.discover-bar .search-wrap svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--dim); pointer-events: none;
}
.discover-bar .input { padding-left: 37px; }
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 7px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
  transition: background .18s, color .18s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(224, 102, 63, 0.16); color: var(--brick-2); }
.seg.small button { padding: 5px 9px; font-size: 12px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; }
.pager span { font-family: var(--mono); font-size: 12.5px; color: var(--dim); }

/* ---------- auth ---------- */

.auth-wrap { display: grid; place-items: center; padding: 62px 0 40px; }
.auth-card {
  width: min(430px, 100%); padding: 32px; border-radius: 22px;
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 27px; letter-spacing: -0.03em; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 14.5px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 24px; }
.auth-tabs a {
  text-align: center; padding: 8px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background .18s, color .18s;
}
.auth-tabs a.on { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.auth-foot { margin: 18px 0 0; text-align: center; font-size: 13.5px; color: var(--dim); }
.auth-foot a { color: var(--brick-2); }
.form-error {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px;
  color: #ffb4a0; background: rgba(224, 102, 63, 0.1); border: 1px solid rgba(224, 102, 63, 0.3);
}
.form-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  color: var(--muted); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }

/* ---------- dashboard ---------- */

.dash { padding-top: 44px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.dash-head h1 { margin: 6px 0 0; font-size: clamp(28px, 3.6vw, 40px); letter-spacing: -0.035em; line-height: 1.08; }
.dash-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }

.page-row { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.page-row .pav {
  width: 54px; height: 54px; border-radius: 50%; overflow: hidden; flex: none;
  background: linear-gradient(140deg, var(--brick), #6d3320); display: grid; place-items: center;
  font-family: var(--mono); font-size: 18px; color: #fff; text-transform: uppercase;
  border: 1px solid var(--line-2);
}
.page-row .pav img { width: 100%; height: 100%; object-fit: cover; }
.page-row b { display: block; font-size: 17px; letter-spacing: -0.01em; }
.page-row .url { font-family: var(--mono); font-size: 12px; color: var(--dim); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat-box { padding: 14px; border-radius: 13px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.stat-box b { display: block; font-size: 22px; letter-spacing: -0.02em; line-height: 1.2; }
.stat-box span { font-family: var(--mono); font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }

.panel-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px solid var(--line); }
.toggle-row { display: flex; align-items: center; gap: 11px; font-size: 14px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line-2); transition: background .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .2s;
}
.switch input:checked + span { background: var(--ok); border-color: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brick-2); outline-offset: 2px; }

.acct-list { display: grid; gap: 12px; }
.acct-list div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); font-size: 14.5px; }
.acct-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.acct-list span { color: var(--dim); font-family: var(--mono); font-size: 12px; }
.acct-list b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }

/* ---------- editor ---------- */

.ed-bar {
  position: sticky; top: 64px; z-index: 50;
  border-bottom: 1px solid var(--line); background: rgba(13, 11, 10, 0.9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.ed-bar-inner {
  width: min(1400px, 100% - 32px); margin-inline: auto; height: 58px;
  display: flex; align-items: center; gap: 12px;
}
.ed-url {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 8px 6px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.ed-url code { font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { font-family: var(--mono); font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.save-state.saving { color: var(--warn); }
.save-state.error { color: #ff9a80; }
.ed-bar .spacer { flex: 1; }

.ed { width: min(1400px, 100% - 32px); margin: 20px auto 0;
  display: grid; grid-template-columns: 206px minmax(0, 1fr) minmax(330px, 400px); gap: 18px; align-items: start; }

.ed-side { position: sticky; top: 142px; display: grid; gap: 4px; }
.ed-side button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 14.5px; font-weight: 500;
  transition: background .18s, color .18s, border-color .18s;
}
.ed-side button svg { width: 16px; height: 16px; opacity: .8; }
.ed-side button:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.ed-side button.on {
  background: rgba(224, 102, 63, 0.11); border-color: rgba(224, 102, 63, 0.26);
  color: var(--brick-2);
}
.ed-side .side-note { margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px dashed var(--line-2);
  font-size: 12.5px; color: var(--dim); line-height: 1.5; }

.ed-form { min-width: 0; }
.ed-panel {
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.ed-panel[hidden] { display: none; }
.ed-panel-head { margin-bottom: 20px; }
.ed-panel-head h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.02em; }
.ed-panel-head p { margin: 0; color: var(--dim); font-size: 13.5px; }

.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.upload-row .input { flex: 1 1 160px; min-width: 120px; }
.upload-preview {
  width: 46px; height: 46px; border-radius: 11px; flex: none; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--bg-2); display: grid; place-items: center;
  color: var(--dim); font-size: 11px; font-family: var(--mono);
}
.upload-preview.wide { width: 96px; height: 46px; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }

.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 20px; }
.preset {
  position: relative; padding: 8px 8px 9px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-2); text-align: left;
  transition: border-color .18s, transform .18s;
}
.preset:hover { transform: translateY(-1px); border-color: var(--line-2); }
.preset.on { border-color: var(--brick); box-shadow: 0 0 0 1px var(--brick) inset; }
.preset .sw { height: 34px; border-radius: 8px; margin-bottom: 7px; border: 1px solid rgba(255, 255, 255, 0.1); }
.preset span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg-2); }
.color-field input[type="color"] {
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 8px; }
.color-field div { min-width: 0; }
.color-field b { display: block; font-size: 12.5px; font-weight: 500; }
.color-field i { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--dim); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  transition: background .18s, color .18s, border-color .18s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.on { background: rgba(224, 102, 63, 0.14); border-color: rgba(224, 102, 63, 0.4); color: var(--brick-2); }

.list { display: grid; gap: 10px; margin-bottom: 14px; }
.list-item {
  display: flex; gap: 8px; align-items: center; padding: 9px;
  border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
.list-item .select { width: 132px; flex: none; }
.list-item .input { flex: 1; min-width: 0; }
.list-item .grip { color: var(--dim); font-family: var(--mono); font-size: 11px; width: 16px; text-align: center; flex: none; }
.list-empty { padding: 14px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px;
  color: var(--dim); font-size: 13px; }

.ed-preview { position: sticky; top: 142px; display: flex; flex-direction: column; gap: 10px; }
.preview-head { display: flex; align-items: center; gap: 10px; }
.preview-head > span { font-family: var(--mono); font-size: 11.5px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .1em; }
.preview-head .seg { margin-left: auto; }
.preview-close { display: none; }
.device {
  position: relative; width: 100%; height: min(66vh, 620px); border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line-2); background: #080706; box-shadow: var(--shadow);
  transition: width .2s;
}
.device iframe { width: 100%; height: 100%; border: 0; display: block; background: #0d0b0a; }
.ed-preview.phone .device { width: 360px; max-width: 100%; margin-inline: auto; height: min(70vh, 640px); border-radius: 26px; }
.preview-note { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.5; text-align: center; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  z-index: 120; padding: 11px 18px; border-radius: 12px;
  background: rgba(24, 20, 18, 0.97); border: 1px solid var(--line-2);
  color: var(--text); font-size: 14px; box-shadow: 0 24px 48px -24px #000;
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(224, 102, 63, 0.5); color: #ffbfa9; }

/* ---------- account extras: roles, remember me, offline ---------- */

.check-row {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 13px;
  padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025); cursor: pointer;
}
.check-row input { margin-top: 3px; accent-color: var(--brick); flex: none; }
.check-row b { display: block; font-size: 13.5px; font-weight: 500; color: var(--text); }
.check-row i { display: block; font-style: normal; font-size: 12px; color: var(--dim); margin-top: 2px; }
.check-row a { color: var(--brick-2); text-decoration: underline; text-underline-offset: 2px; }

.link-inline {
  background: none; border: 0; padding: 0; margin-left: 4px; cursor: pointer;
  color: var(--brick-2); font: inherit; text-decoration: underline; text-underline-offset: 2px;
}

.offline-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 16px; font-size: 13px; color: #ffcbb8;
  background: rgba(224, 102, 63, 0.12); border-bottom: 1px solid rgba(224, 102, 63, 0.3);
}
.offline-bar .offline-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brick-2);
  animation: bw-pulse 1.4s ease-in-out infinite; flex: none;
}
.offline-bar button {
  margin-left: auto; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(224, 102, 63, 0.4); background: transparent; color: #ffe6dc; font: inherit; font-size: 12.5px;
}
@keyframes bw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.pcard-roles { margin-top: 6px; }
.who .bw-badges { margin-left: 2px; }

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .ed { grid-template-columns: 190px minmax(0, 1fr); }
  .ed-preview {
    position: fixed; inset: 0; z-index: 100; background: rgba(9, 8, 7, 0.97);
    padding: 16px; display: none; flex-direction: column; gap: 10px;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  body.preview-open .ed-preview { display: flex; }
  body.preview-open { overflow: hidden; }
  .preview-close { display: grid; }
  .device { height: auto; flex: 1; }
  .ed-preview.phone .device { height: auto; flex: 1; }
  .pgrid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 980px) {
  .hero { padding: 54px 0 26px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-art { order: -1; }
  .mock { transform: none; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .topnav { gap: 2px; }
  .topnav a { padding: 6px 10px; font-size: 14px; }
}

@media (max-width: 860px) {
  .ed { grid-template-columns: 1fr; }
  .ed-side {
    position: static; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
    scrollbar-width: none;
  }
  .ed-side::-webkit-scrollbar { display: none; }
  .ed-side button { width: auto; white-space: nowrap; padding: 8px 12px; }
  .ed-side .side-note { display: none; }
  .ed-bar { top: 64px; }
  .ed-bar-inner { height: auto; flex-wrap: wrap; padding: 9px 0 10px; gap: 8px; overflow: visible; }
  .ed-bar-inner .spacer { display: none; }
  .ed-url { flex: 1 1 150px; min-width: 0; }
  .ed-bar-inner .btn { flex: none; }
}

@media (max-width: 720px) {
  .wrap, .topbar-inner { width: calc(100% - 32px); }
  .pgrid { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
  .color-grid { grid-template-columns: 1fr; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr 1fr; }
  .brand-text, .brand-sep { display: none; }
  .topnav a[href="/brickpages/editor"] { display: none; }
  .section { padding-top: 52px; }
  .auth-card { padding: 24px; }
  .ed-panel { padding: 18px; }
  .panel { padding: 20px; }
  .list-item { flex-wrap: wrap; }
  .list-item .select { width: 100%; }
  .list-item .input { flex: 1 1 120px; min-width: 0; }
}

@media (max-width: 520px) {
  .topnav a[href="/brickpages/dashboard"] { display: none; }
  .pgrid { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 40px; }
  .who b { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
