/* Meta Studio — light, Apple-inspired
   خلفية رمادية فاتحة #F5F5F7، بطاقات بيضاء، زجاج مضبب، أزرق Apple كلون أساسي، وألوان iOS للحالات */
:root {
  --bg: #f5f5f7; --panel: #ffffff; --panel-2: #f2f2f5; --line: #e4e4e9; --line-2: #d2d2d8;
  --text: #1d1d1f; --muted: #6e6e73; --soft: #86868b;
  --blue: #0071e3; --blue-2: #0a84ff; --blue-soft: #e8f1fd;
  --purple: #af52de; --pink: #ff2d55; --orange: #ff9500; --green: #34c759; --teal: #30b0c7; --indigo: #5856d6;
  --fb: #1877f2; --ok: #248a3d; --warn: #c93400; --err: #d70015;
  --r: 18px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.05);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.14);
  --gold: var(--blue);
}
* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  display: flex; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #cfe3fb; }

/* sidebar — glass */
.side {
  width: 236px; flex-shrink: 0; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; align-self: flex-start;
  background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-left: 1px solid var(--line);
}
.logo { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; padding: 0 8px; direction: ltr; justify-content: flex-end; letter-spacing: -.2px; }
.dot { width: 22px; height: 22px; border-radius: 7px; background: conic-gradient(from 200deg, var(--blue-2), var(--purple), var(--pink), var(--orange), var(--blue-2)); box-shadow: 0 4px 12px rgba(88,86,214,.35); }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { padding: 9px 12px; border-radius: 10px; color: var(--text); transition: background .15s; font-weight: 500; }
nav a:hover { background: rgba(0,0,0,.04); }
nav a.active { background: var(--blue); color: #fff; }
nav a.primary-link { color: var(--blue); }
nav a.primary-link.active { color: #fff; }
.side-status { margin-top: auto; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.side-status .pill { align-self: flex-start; }

main { flex: 1; padding: 30px 36px 60px; min-width: 0; }
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.3px; font-weight: 700; }
h3 { font-size: 16px; }
.sub { color: var(--muted); margin: 0 0 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--panel); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.btn {
  background: var(--panel); border: 1px solid var(--line-2); padding: 8px 18px; border-radius: 999px; cursor: pointer;
  transition: .15s; white-space: nowrap; font-weight: 500; color: var(--text);
}
.btn:hover { background: var(--panel-2); }
.btn.gold, .btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.gold:hover, .btn.primary:hover { background: #0077ed; }
.btn.danger { color: var(--err); }
.btn.sm { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0,113,227,.35); outline-offset: 1px; }

input[type=text], input[type=datetime-local], input[type=password], select, textarea {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; width: 100%; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,113,227,.12); }
textarea { resize: vertical; min-height: 150px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 18px 0 6px; font-weight: 500; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); white-space: nowrap; font-weight: 500; color: var(--muted); }
.pill.draft { color: var(--muted); }
.pill.scheduled { color: var(--blue); background: var(--blue-soft); }
.pill.publishing { color: var(--indigo); background: #eeeefc; }
.pill.published { color: var(--ok); background: #e6f6ea; }
.pill.partial { color: var(--warn); background: #fff1e5; }
.pill.failed { color: var(--err); background: #ffe8ea; }
.pill.dry { color: #9a5b00; background: #fff4de; }
.plat { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; color: #fff; }
.plat.facebook { background: var(--fb); }
.plat.instagram { background: linear-gradient(45deg,#f58529,#dd2a7b,#8134af); }

/* calendar */
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; color: var(--muted); font-size: 13px; margin: 18px 0 8px; text-align: center; font-weight: 500; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--panel); border-radius: 14px; min-height: 118px; padding: 8px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; transition: .15s; box-shadow: var(--shadow); border: 1px solid transparent; }
.day:hover { border-color: var(--line-2); }
.day.out { opacity: .45; box-shadow: none; background: transparent; }
.day.today { border-color: var(--blue); }
.day.today .n { background: var(--blue); color: #fff; border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.day .n { font-size: 13px; color: var(--muted); font-weight: 600; }
.chip { font-size: 12px; background: var(--panel-2); border-radius: 8px; padding: 4px 6px; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; border-right: 3px solid var(--soft); }
.chip.scheduled { border-color: var(--blue); background: var(--blue-soft); }
.chip.published { border-color: var(--green); background: #ecf8ef; }
.chip.failed { border-color: var(--err); background: #fff0f1; }
.chip.partial { border-color: var(--orange); background: #fff5e8; }
.chip img, .chip video { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.chip span { overflow: hidden; text-overflow: ellipsis; }

/* posts list */
.plist { display: flex; flex-direction: column; gap: 10px; }
.pitem { display: grid; grid-template-columns: 74px 1fr auto; gap: 16px; align-items: center; background: var(--panel); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); transition: transform .15s; }
.pitem:hover { transform: translateY(-1px); }
.thumb { width: 74px; height: 74px; border-radius: 12px; object-fit: cover; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); font-size: 12px; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.pcap { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-line; }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.err-text { color: var(--err); font-size: 12.5px; margin-top: 4px; }
.tabs { display: inline-flex; gap: 2px; background: #e8e8ed; padding: 3px; border-radius: 10px; }
.tabs button { background: none; border: none; padding: 5px 14px; border-radius: 8px; color: var(--text); cursor: pointer; font-weight: 500; font-size: 13.5px; }
.tabs button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* composer */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.types { display: inline-flex; gap: 2px; flex-wrap: wrap; background: #e8e8ed; padding: 3px; border-radius: 11px; }
.types label { cursor: pointer; }
.types input { display: none; }
.types span { display: inline-block; padding: 6px 14px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: 14px; }
.types input:checked + span { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.acc-list { display: flex; flex-wrap: wrap; gap: 8px; }
.acc-opt { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; background: var(--panel); }
.acc-opt input { accent-color: var(--blue); width: 16px; height: 16px; }
.acc-opt img { width: 22px; height: 22px; border-radius: 50%; }
.sel-media { display: flex; gap: 8px; flex-wrap: wrap; }
.sel-media .m { position: relative; width: 86px; height: 86px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.sel-media .m img, .sel-media .m video { width: 100%; height: 100%; object-fit: cover; }
.sel-media .m button { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); border: none; color: #fff; border-radius: 999px; cursor: pointer; width: 22px; height: 22px; font-size: 11px; }
.sel-media .m .ord { position: absolute; bottom: 4px; right: 6px; font-size: 12px; background: rgba(255,255,255,.85); padding: 0 7px; border-radius: 999px; font-weight: 600; }
.add-media { width: 86px; height: 86px; border: 1.5px dashed var(--line-2); border-radius: 12px; display: grid; place-items: center; color: var(--blue); cursor: pointer; background: var(--panel); font-weight: 500; }
.counter { font-size: 12px; color: var(--soft); text-align: left; direction: ltr; }

/* phone preview */
.preview { position: sticky; top: calc(var(--tb, 60px) + 16px); }
.phone { background: #fff; border-radius: 38px; padding: 14px; box-shadow: 0 0 0 10px #1d1d1f, var(--shadow-lg); margin: 10px; }
.ph-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; font-weight: 600; font-size: 14px; }
.ph-head .av { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--orange), var(--pink), var(--purple), var(--orange)); padding: 2px; overflow: hidden; }
.ph-head .av img { width: 100%; height: 100%; border-radius: 50%; }
.ph-media { aspect-ratio: 4/5; background: var(--panel-2); border-radius: 4px; overflow: hidden; display: grid; place-items: center; color: var(--muted); position: relative; }
.ph-media.story { aspect-ratio: 9/16; border-radius: 12px; }
.ph-media img, .ph-media video { width: 100%; height: 100%; object-fit: cover; }
.ph-media .dots { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.ph-cap { white-space: pre-line; padding: 10px 4px 4px; font-size: 13.5px; max-height: 220px; overflow: auto; }

/* media grid */
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 28px; text-align: center; color: var(--muted); margin-bottom: 18px; transition: .15s; background: var(--panel); }
.drop.over { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border-radius: 16px; overflow: hidden; position: relative; cursor: pointer; box-shadow: var(--shadow); border: 2px solid transparent; }
.tile .im { aspect-ratio: 1; background: var(--panel-2); }
.tile .im img, .tile .im video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .cap { padding: 8px 10px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.tile.sel { border-color: var(--blue); }
.badge { position: absolute; top: 8px; right: 8px; font-size: 11px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); padding: 2px 8px; border-radius: 999px; font-weight: 600; }

/* accounts */
.accs { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.acc { display: flex; gap: 12px; align-items: center; }
.acc img { width: 46px; height: 46px; border-radius: 50%; background: var(--panel-2); }
.steps { color: var(--muted); padding-right: 18px; margin: 8px 0 0; }
.steps li { margin: 4px 0; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; direction: ltr; unicode-bidi: embed; }

/* logs */
.log { font-size: 13px; padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 160px 60px 1fr; gap: 10px; }
.log:last-child { border-bottom: none; }
.log .error { color: var(--err); } .log .info { color: var(--ok); }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.28); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 20; padding: 30px; }
.modal.hidden { display: none; }
.modal-card { background: var(--panel); border-radius: 22px; padding: 24px; width: min(1000px, 100%); max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 10px); background: rgba(29,29,31,.92); color: #fff; backdrop-filter: blur(12px); padding: 11px 20px; border-radius: 999px; opacity: 0; transition: .25s; pointer-events: none; z-index: 30; max-width: 520px; white-space: pre-line; font-weight: 500; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); border-radius: 16px; }
.empty { color: var(--muted); text-align: center; padding: 50px; }

/* ============ chat ============ */
main.chat-mode { padding: 0; display: flex; height: 100vh; }
.chat { display: flex; flex-direction: column; flex: 1; min-width: 0; height: 100vh; }
.chat-top { display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: rgba(245,245,247,.8); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.chat-top h1 { font-size: 20px; margin: 0; }
.chat-top select { width: auto; max-width: 260px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
.msgs { flex: 1; overflow-y: auto; padding: 28px max(28px, calc((100% - 820px) / 2)); display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg .av { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-size: 15px; color: #fff; font-weight: 700; }
.msg.ai .av { background: conic-gradient(from 200deg, var(--blue-2), var(--purple), var(--pink), var(--orange), var(--blue-2)); }
.msg.user { flex-direction: row-reverse; }
.msg.user .av { display: none; }
.bubble { padding: 11px 16px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; max-width: 680px; line-height: 1.7; }
.msg.user .bubble { background: var(--blue); color: #fff; border-bottom-left-radius: 6px; }
.msg.ai .bubble { background: var(--panel); box-shadow: var(--shadow); border-bottom-right-radius: 6px; }
.bubble .att { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bubble .att img, .bubble .att video { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; }
.ai-stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; max-width: 720px; flex: 1; }
.tool-line { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.tool-line .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.tool-line.done .spin { animation: none; border-color: var(--green); background: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
.render-img { width: 220px; border-radius: 14px; box-shadow: var(--shadow); display: block; }

.proposal { background: var(--panel); border-radius: 22px; box-shadow: var(--shadow), 0 0 0 1px var(--line); overflow: hidden; }
.proposal .ph { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.proposal .ph strong { font-size: 15px; }
.proposal .body { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; padding: 18px; }
.proposal .media-strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 14px; }
.proposal .media-strip > * { flex: 0 0 100%; scroll-snap-align: start; }
.proposal .media-strip img, .proposal .media-strip video { width: 100%; border-radius: 14px; display: block; background: var(--panel-2); }
.proposal .cap { white-space: pre-wrap; font-size: 14.5px; line-height: 1.75; }
.proposal .why { font-size: 13px; color: var(--muted); margin-top: 10px; }
.proposal .foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; background: #fafafc; border-top: 1px solid var(--line); }
.proposal .foot input[type=datetime-local] { width: auto; padding: 7px 12px; border-radius: 999px; font-size: 14px; }
.proposal .state { padding: 12px 18px; font-size: 14px; font-weight: 500; }
.proposal .state.ok { background: #e6f6ea; color: var(--ok); }
.proposal .state.err { background: #ffe8ea; color: var(--err); }
.proposal .state.sched { background: var(--blue-soft); color: var(--blue); }
.proposal .state.rej { background: var(--panel-2); color: var(--muted); }

.composer { padding: 14px max(28px, calc((100% - 820px) / 2)) 22px; background: linear-gradient(transparent, var(--bg) 30%); }
.composer-box { background: var(--panel); border-radius: 24px; box-shadow: var(--shadow), 0 0 0 1px var(--line); padding: 10px 12px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.composer-box:focus-within { box-shadow: var(--shadow), 0 0 0 2px var(--blue); }
.composer textarea { border: none; min-height: 26px; max-height: 200px; resize: none; padding: 6px 8px; box-shadow: none !important; background: transparent; }
.composer .bar { display: flex; align-items: center; gap: 8px; }
.composer .ic { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--panel-2); cursor: pointer; display: grid; place-items: center; font-size: 17px; color: var(--text); }
.composer .send { background: var(--blue); color: #fff; }
.composer .send:disabled { background: var(--line-2); }
.composer .atts { display: flex; gap: 6px; flex-wrap: wrap; }
.composer .atts .m { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; }
.composer .atts .m img, .composer .atts .m video { width: 100%; height: 100%; object-fit: cover; }
.composer .atts .m button { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; cursor: pointer; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.suggest button { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-size: 14px; }
.suggest button:hover { border-color: var(--blue); color: var(--blue); }
.hello { text-align: center; margin: auto; padding: 40px 0; }
.hello .orb { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 18px; background: conic-gradient(from 200deg, var(--blue-2), var(--purple), var(--pink), var(--orange), var(--blue-2)); box-shadow: 0 12px 34px rgba(175,82,222,.35); }
.hello h2 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.4px; }
.hello p { color: var(--muted); margin: 0 0 22px; }
.chat-side { width: 260px; border-right: 1px solid var(--line); background: rgba(255,255,255,.5); padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.chat-side .it { padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-side .it:hover { background: rgba(0,0,0,.04); }
.chat-side .it.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 1100px) { .compose { grid-template-columns: 1fr; } .preview { position: static; } .chat-side { display: none; } .proposal .body { grid-template-columns: 1fr; } .proposal .media-strip { max-width: 320px; } }
@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; border-left: none; border-bottom: 1px solid var(--line); }
  nav { flex-direction: row; overflow-x: auto; } nav a { white-space: nowrap; flex: none; }
  .side-status { display: none; } main { padding: 18px; } main.chat-mode { height: auto; }
  .chat { height: calc(100vh - 140px); } .msgs, .composer { padding-inline: 14px; }
  .cal-head, .cal { gap: 4px; } .day { min-height: 70px; }
}
.composer textarea:focus-visible, .composer textarea:focus { outline: none; box-shadow: none; }

/* ============ top header ============ */
:root { --tb: 60px; }
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--tb); flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  position: sticky; top: 0; z-index: 5;
  background: rgba(255,255,255,.78); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.tb-title { font-weight: 600; font-size: 15px; color: var(--text); }
.tb-title .crumb { color: var(--muted); font-weight: 500; }
.meta-logo { height: 22px; width: auto; display: block; }
main.chat-mode { height: calc(100vh - var(--tb)); }
.chat { height: 100%; }
.chat-top { position: static; padding: 10px 28px; }
@media (max-width: 760px) {
  .topbar { padding: 0 16px; } .meta-logo { height: 18px; }
  main.chat-mode { height: auto; } .chat { height: calc(100vh - 200px); }
}

/* ============ brands ============ */
.brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.brand-card { background: var(--panel); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; display: block; }
.brand-card:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 12px 30px rgba(0,0,0,.07); }
.bc-hero { height: 130px; position: relative; overflow: hidden; display: grid; place-items: center; }
.bc-glow { position: absolute; width: 140%; height: 120px; bottom: -80px; filter: blur(36px); opacity: .45; }
.bc-hero img { max-height: 48px; max-width: 70%; object-fit: contain; position: relative; }
.bc-initial { font-size: 54px; font-weight: 800; position: relative; }
.bc-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.sws { display: flex; gap: 4px; }
.sw { width: 18px; height: 18px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); display: inline-block; }
.sw.sm { width: 10px; height: 10px; border-radius: 3px; }
.brand-edit { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 22px; align-items: start; margin-top: 18px; }
.brand-edit .col { display: flex; flex-direction: column; gap: 16px; }
.brand-edit h3 { margin: 0 0 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brand-preview { position: sticky; top: calc(var(--tb, 60px) + 16px); }
.pv-frame { margin-top: 14px; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), var(--shadow); position: relative; background: #fff; }
.pv-frame iframe { border: 0; transform-origin: top right; position: absolute; top: 0; right: 0; }
.logo-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.logo-prev { width: 200px; height: 90px; border-radius: 14px; background: repeating-conic-gradient(#f2f2f5 0% 25%, #fff 0% 50%) 50% / 16px 16px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.logo-prev img { max-width: 170px; max-height: 64px; object-fit: contain; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.palette > div { width: 100%; }
.pal { width: 74px; height: 54px; border-radius: 12px; border: none; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s; }
.pal:hover { transform: scale(1.05); }
.pal span { font-size: 10.5px; background: rgba(255,255,255,.85); border-radius: 6px; padding: 0 5px; direction: ltr; font-weight: 600; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.slot { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; }
.slot.on { border-color: var(--blue); background: var(--blue-soft); }
.slot input[type=color], .gstop { width: 40px; height: 40px; border: none; padding: 0; background: none; cursor: pointer; border-radius: 10px; flex-shrink: 0; }
.slot input[type=color]::-webkit-color-swatch, .gstop::-webkit-color-swatch { border: none; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.slot input[type=color]::-webkit-color-swatch-wrapper, .gstop::-webkit-color-swatch-wrapper { padding: 0; }
.slot .sl { font-size: 12px; color: var(--muted); }
.slot .hex { padding: 3px 8px; font-size: 13px; border-radius: 8px; width: 100px; font-family: ui-monospace, 'SF Mono', monospace; }
.gbar { flex: 1; min-width: 120px; height: 40px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.font-sample { margin-top: 14px; padding: 18px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.fs-h { font-size: 30px; font-weight: 700; line-height: 1.3; }
.fs-b { font-size: 16px; margin-top: 6px; opacity: .8; }
.brand-saved { display: inline-flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.brand-saved img { height: 26px; max-width: 100px; object-fit: contain; }
@media (max-width: 1100px) { .brand-edit { grid-template-columns: 1fr; } .brand-preview { position: static; order: -1; } }
@media (max-width: 600px) { .two { grid-template-columns: 1fr; } }

/* ============ settings ============ */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; margin-top: 6px; }
.settings .col, .settings .side-col { display: flex; flex-direction: column; gap: 16px; }
.settings .side-col { position: sticky; top: calc(var(--tb, 60px) + 16px); }
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.sec-h h3 { margin: 0; }
.sec-ic { width: 36px; height: 36px; border-radius: 10px; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.src { font-size: 11px; color: var(--soft); background: var(--panel-2); border-radius: 6px; padding: 1px 7px; font-weight: 500; }
.src.warn { color: #9a5b00; background: #fff4de; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
.hint a, .guide a { color: var(--blue); }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row input { flex: 1; font-family: ui-monospace, 'SF Mono', monospace; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); margin-top: 14px; cursor: pointer; }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: #d2d2d8; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: right .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { right: 21px; }
.guide { background: var(--panel-2); border-radius: 14px; padding: 12px 16px; margin: 10px 0 4px; }
.guide summary { cursor: pointer; font-weight: 600; color: var(--blue); }
.guide ol { margin: 10px 0 4px; padding-right: 20px; line-height: 1.9; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.copy-row code { background: var(--panel); padding: 6px 10px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; }
.scopes { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.scopes code { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; }
.test-out { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.test-out.ok { color: var(--ok); } .test-out.bad { color: var(--err); }
a.btn[aria-disabled] { opacity: .45; }
.checks { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: none; }
.ck { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.ck.ok { background: var(--green); } .ck.bad { background: var(--err); } .ck.warn { background: var(--orange); }
.cl { font-size: 13.5px; font-weight: 500; } .cd { font-size: 12px; color: var(--muted); word-break: break-all; }
.notice { background: #fff4de; color: #9a5b00; padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; }
@media (max-width: 1100px) { .settings { grid-template-columns: 1fr; } .settings .side-col { position: static; } }

/* ============ users / tokens / topbar user ============ */
.mini-list { display: flex; flex-direction: column; margin-top: 10px; }
.mi { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.mi:last-child { border-bottom: none; }
.tok-once { background: #fff8e8; border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.tok-once code { word-break: break-all; }
.tb-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--panel-2); margin-inline-end: 14px; }
.tb-av { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.copy-row code, .tok-once code { direction: ltr; text-align: left; unicode-bidi: isolate; }
