:root {
  --bg: #090a0f;
  --bg2: #0e1017;
  --card: #13161f;
  --card2: #191d29;
  --field: #0f121a;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .13);
  --text: #eef0f6;
  --muted: #9aa1b5;
  --faint: #656c82;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, .16);
  --grad: linear-gradient(135deg, #8b5cf6 0%, #d946ef 50%, #f97316 100%);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, .12);
  --info: #7dd3fc;
  --info-soft: rgba(125, 211, 252, .1);
  --yt: #ff2b45;
  --fb: #1877f2;
  --ig: linear-gradient(45deg, #f9ce34 0%, #ee2a7b 50%, #6228d7 100%);
  --r: 18px;
  --r-sm: 11px;
  --nav-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, .13), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(236, 72, 153, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; width: 248px; flex: none;
  padding: 26px 18px; border-right: 1px solid var(--line);
  background: rgba(13, 15, 22, .7); backdrop-filter: blur(14px);
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 20px -6px rgba(217, 70, 239, .6); }
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: .02em; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 560; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: #fff; }
.nav a.on svg { color: #c4b5fd; }
.nav .count { margin-left: auto; font-size: 12px; background: rgba(255, 255, 255, .08); padding: 1px 8px; border-radius: 99px; color: var(--muted); }
.side .foot { margin-top: auto; padding: 10px 8px 0; }

.main { flex: 1; min-width: 0; padding: 34px 40px 120px; }
.wrap { max-width: 860px; margin: 0 auto; }
.topbar { display: none; }
.tabbar { display: none; }

.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 22px; }
.page-h h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; line-height: 1.15; }
.page-h p { margin: 6px 0 0; color: var(--muted); }

.testpill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650;
  padding: 5px 11px; border-radius: 99px; background: var(--warn-soft); color: var(--warn);
  border: 1px solid rgba(251, 191, 36, .25); text-decoration: none; white-space: nowrap;
}
.testpill i { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, .2); }

/* ---------- cards & bits ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 22px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 18px 40px -24px rgba(0, 0, 0, .7);
}
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.card-h h2 { margin: 0; font-size: 16.5px; letter-spacing: -.01em; }
.card-h .step {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-size: 13px; font-weight: 750; background: var(--accent-soft); color: #c4b5fd;
}
.card-h .grow { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line2);
  background: var(--card2); font-weight: 620; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #20253a; border-color: rgba(255, 255, 255, .2); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; transform: none; pointer-events: none; }
.btn-primary { border: 0; background: var(--grad); color: #fff; box-shadow: 0 10px 28px -10px rgba(217, 70, 239, .65); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }

.field { display: block; }
.field > span { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.field > span em { font-style: normal; font-weight: 500; color: var(--faint); }
.field > span em.over { color: var(--err); }
.input, .textarea, .select {
  width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--field);
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input, .select { height: 44px; padding-top: 0; padding-bottom: 0; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(167, 139, 250, .7); box-shadow: 0 0 0 4px rgba(139, 92, 246, .16); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239aa1b5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input[type="datetime-local"] { color-scheme: dark; }
::placeholder { color: var(--faint); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; background: rgba(255, 255, 255, .06); color: var(--muted); border: 1px solid var(--line);
}
button.chip { cursor: pointer; }
button.chip:hover { color: var(--text); border-color: var(--line2); }
.chip.tag { color: #d8b4fe; background: rgba(168, 85, 247, .1); border-color: rgba(168, 85, 247, .2); }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 13px; background: var(--field); border: 1px solid var(--line); }
.seg button { height: 36px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 620; cursor: pointer; }
.seg button.on { background: var(--card2); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.seg.small button { height: 30px; padding: 0 12px; font-size: 13px; }

.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #2a2f40; transition: background .2s; cursor: pointer; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(19px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px rgba(139, 92, 246, .3); }

.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 13px;
  font-size: 14px; border: 1px solid transparent; margin-bottom: 16px;
}
.banner svg { flex: none; margin-top: 2px; }
.banner.ok { background: var(--ok-soft); border-color: rgba(52, 211, 153, .25); color: #a7f3d0; }
.banner.err { background: var(--err-soft); border-color: rgba(248, 113, 113, .25); color: #fecaca; }
.banner.warn { background: var(--warn-soft); border-color: rgba(251, 191, 36, .22); color: #fde68a; }
.banner.info { background: var(--info-soft); border-color: rgba(125, 211, 252, .2); color: #bae6fd; }
.banner a { font-weight: 650; }
.banner .x { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0 2px; font-size: 18px; line-height: 1; }

.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width .3s ease; }
.progress.busy i { width: 35% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(310%); } }

.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: rot .8s linear infinite; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- new post ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  min-height: 230px; padding: 28px; border-radius: 16px; cursor: pointer;
  border: 1.5px dashed rgba(167, 139, 250, .35); background: rgba(139, 92, 246, .05);
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: rgba(196, 181, 253, .8); background: rgba(139, 92, 246, .1); }
.drop .big { width: 58px; height: 58px; border-radius: 17px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 14px 34px -12px rgba(217, 70, 239, .7); }
.drop b { font-size: 17px; }

.vid { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.vid video { width: 200px; max-height: 300px; aspect-ratio: 9 / 14; object-fit: contain; background: #000; border-radius: 14px; border: 1px solid var(--line); }
.vid .info h3 { margin: 2px 0 4px; font-size: 16px; word-break: break-word; }
.vid .status { display: flex; align-items: center; gap: 9px; margin: 12px 0 10px; font-weight: 600; font-size: 14px; }
.vid .status.ok { color: var(--ok); }
.vid .status.err { color: var(--err); }
.vid .chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.hint { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.hint svg { margin-top: 2px; flex: none; color: var(--faint); }

.plats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plat {
  border-radius: 15px; border: 1px solid var(--line2); background: var(--card2); padding: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s; display: flex; flex-direction: column; gap: 12px;
}
.plat.on { border-color: rgba(167, 139, 250, .55); box-shadow: 0 0 0 3px rgba(139, 92, 246, .14); background: #1b1f2f; }
.plat-h { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.plat-h b { font-size: 15px; }
.plat-h .switch { margin-left: auto; }
.picon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff; }
.picon.youtube { background: var(--yt); }
.picon.instagram { background: var(--ig); }
.picon.facebook { background: var(--fb); }
.picon.sm { width: 22px; height: 22px; border-radius: 7px; }
.plat .opts { display: grid; gap: 10px; }
.plat .note { font-size: 12.5px; color: var(--muted); }
.plat .note a { color: #c4b5fd; font-weight: 600; }
.plat .select { height: 38px; font-size: 13.5px; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.when-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.when-row .input { max-width: 260px; }
.rel { font-size: 13.5px; color: var(--muted); }
.rel.bad { color: var(--err); }

.submit {
  position: sticky; bottom: 16px; z-index: 5; margin-top: 18px; display: flex; align-items: center; gap: 16px;
  padding: 14px 16px 14px 20px; border-radius: 18px; border: 1px solid var(--line2);
  background: rgba(20, 23, 33, .88); backdrop-filter: blur(16px); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
}
.submit .why { flex: 1; font-size: 13.5px; color: var(--muted); }
.submit .why b { color: var(--text); }

/* ---------- queue ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  height: 38px; padding: 0 15px; border-radius: 11px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); font-weight: 620; cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--card2); color: #fff; border-color: var(--line2); }
.tabs button span { margin-left: 6px; font-size: 12px; color: var(--faint); }

.day { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 22px 4px 10px; }
.day:first-child { margin-top: 4px; }
.post {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.post + .post { margin-top: 10px; }
.post .th { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: #000 center / cover; border: 1px solid var(--line); }
.post .th img { width: 100%; height: 100%; object-fit: cover; }
.post .th .picon { position: absolute; right: 3px; bottom: 3px; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.post .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post .m { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.post .e { font-size: 13px; color: var(--err); margin-top: 6px; }
.post .acts { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.post .edit { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.post .edit .input { max-width: 250px; height: 38px; }
.st { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st.scheduled { background: rgba(125, 211, 252, .1); color: var(--info); }
.st.posting, .st.converting { background: var(--accent-soft); color: #d8b4fe; }
.st.posted { background: var(--ok-soft); color: var(--ok); }
.st.failed { background: var(--err-soft); color: var(--err); }
.st.cancelled { background: rgba(255, 255, 255, .06); color: var(--faint); }
.st.test { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty .big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: #c4b5fd; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- accounts ---------- */
.acc { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 13px; background: var(--card2); border: 1px solid var(--line); }
.acc + .acc { margin-top: 8px; }
.acc img, .acc .av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #2a2f40; flex: none; }
.acc b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.setup { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
details.setup summary { cursor: pointer; font-weight: 650; color: #c4b5fd; list-style: none; display: flex; align-items: center; gap: 8px; }
details.setup summary::-webkit-details-marker { display: none; }
details.setup summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 18px; line-height: 1; }
details.setup[open] summary::before { transform: rotate(90deg); }
.steps { margin: 14px 0 18px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 13px 38px; color: var(--muted); font-size: 14px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 750; background: rgba(255, 255, 255, .06); color: var(--text);
}
.steps b { color: var(--text); font-weight: 620; }
.steps a { color: #c4b5fd; }
.copy { display: flex; gap: 8px; margin-top: 7px; }
.copy code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px 11px; border-radius: 9px;
  background: var(--field); border: 1px solid var(--line); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: #e9d5ff;
}

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: 100%; max-width: 400px; padding: 30px; }
.auth .brand { padding: 0 0 20px; }
.auth h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.auth p { margin: 0 0 20px; color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .side { display: none; }
  .main { padding: 14px 16px calc(var(--nav-h) + 110px + env(safe-area-inset-bottom)); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 10; margin: -14px -16px 16px; padding: 12px 16px;
    background: rgba(9, 10, 15, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; font-size: 17px; }
  .topbar .brand .logo { width: 30px; height: 30px; border-radius: 9px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(13, 15, 22, .92); backdrop-filter: blur(18px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--faint); font-size: 11.5px; font-weight: 650; position: relative; }
  .tabbar a.on { color: #fff; }
  .tabbar a.on svg { color: #c4b5fd; }
  .tabbar a .dot { position: absolute; top: 9px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10.5px; display: grid; place-items: center; }
  .page-h { margin-top: 0; }
  .page-h h1 { font-size: 24px; }
  .card { padding: 18px; }
  .plats { grid-template-columns: 1fr; }
  .submit { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 620px) {
  .vid { grid-template-columns: 1fr; }
  .vid video { width: 100%; max-height: 360px; aspect-ratio: auto; }
  .grid2 { grid-template-columns: 1fr; }
  .post { grid-template-columns: 56px 1fr; }
  .post .th { width: 56px; height: 56px; }
  .post .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .submit { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
  .submit .btn { width: 100%; }
  .when-row .input { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
