/* Publish — light, minimal dashboard */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e6e8ed;
  --line-strong: #d5d9e1;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --accent: #2f55d4;
  --accent-hover: #2645b3;
  --accent-soft: #eef2fd;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --error: #b42318;
  --error-soft: #fef3f2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --sidebar: 236px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 620; }
p { margin: 0; }
code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  word-break: break-all;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.req { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 4px; }
.i { width: 18px; height: 18px; flex: none; }
.i-lg { width: 32px; height: 32px; }
.brand { width: 18px; height: 18px; flex: none; }

/* ---------- Shell ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  z-index: 20;
}
.brand-link, .bare-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  height: auto;
  color: var(--text);
  text-decoration: none;
  padding: 2px 8px 18px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark .i { width: 16px; height: 16px; }
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
  font-size: 14.5px;
}
.side-nav a:hover, .side-link:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; }
.side-link { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; color: var(--muted); }

.topbar { display: none; }
.tabbar { display: none; }

.main {
  margin-left: var(--sidebar);
  padding: 32px 40px 56px;
  max-width: calc(var(--sidebar) + 1160px);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head p { margin-top: 4px; }
.page-foot { margin-top: 18px; }
.back-link { display: inline-block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }

/* ---------- Cards & common ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stack > * + * { margin-top: 14px; }

.flash {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
  border: 1px solid transparent;
}
.flash .i { margin-top: 1px; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: #abefc6; }
.flash-error { background: var(--error-soft); color: var(--error); border-color: #fecdca; }
.stack .flash, .auth-card .flash { margin-bottom: 0; }

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.callout > .i { color: var(--accent); margin-top: 2px; }
.callout p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.callout .btn { margin-top: 10px; }
.callout-info { background: var(--accent-soft); border-color: #d5defa; }
.callout-plain { margin-bottom: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 560;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-error { background: var(--error-soft); color: var(--error); }
.pill-info { background: var(--accent-soft); color: var(--accent); }
.pill-muted { background: #f2f4f7; color: #475467; }

.empty-state { text-align: center; padding: 48px 24px; }
.empty-state > .i { color: var(--muted); margin: 0 auto 12px; }
.empty-state p { margin: 6px 0 18px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-label { font-size: 13.5px; font-weight: 580; color: var(--text-2); }
.field-help { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--error); }

input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 85, 212, .14); }
input::placeholder, textarea::placeholder { color: #9ca3af; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 560;
  line-height: 1.2;
  padding: 9px 15px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn .i { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 13.5px; }
.btn-lg { min-height: 50px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--accent);
  cursor: pointer;
}
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--error-soft); color: var(--error); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }

.segmented {
  display: inline-flex;
  background: #f0f2f5;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  align-self: flex-start;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 540;
  color: var(--muted);
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.switch {
  -webkit-appearance: none;
  appearance: none;
  width: 42px;
  height: 25px;
  border-radius: 999px;
  background: #d9dde5;
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background .2s;
  margin: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(17px); }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  cursor: pointer;
}
.switch-row > span { display: flex; flex-direction: column; gap: 1px; }
.switch-row strong { font-weight: 560; font-size: 14.5px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.checks input:disabled + * , .checks label.disabled { color: #9ca3af; }
.checks.indent { flex-direction: column; gap: 8px; padding: 0 0 10px 2px; }

.copyable { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; vertical-align: middle; }
.copyable code { word-break: break-all; }
.copy-btn {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  flex: none;
}
.copy-btn .i { width: 15px; height: 15px; }
.copy-btn:hover { color: var(--accent); background: var(--accent-soft); }
.copy-btn.copied { color: var(--ok); }
code.break { word-break: break-all; }

/* ---------- Composer ---------- */
.compose-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.compose-media { position: sticky; top: 24px; }
.media-card { padding: 14px; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  min-height: 420px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  padding: 24px;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--accent);
  margin-bottom: 8px;
}
.dz-title { font-weight: 620; font-size: 16px; }
.dz-sub { font-size: 13px; color: var(--muted); }
@media (hover: none) { .hide-touch { display: none; } }

.video-frame {
  position: relative;
  background: #0c0e13;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 9 / 13;
  max-height: 520px;
}
.video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0c0e13; }
.media-info { padding: 12px 2px 4px; }
.media-name { font-weight: 580; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 13px; color: var(--muted); }
.upload-status { padding: 8px 2px 2px; }
.upload-row { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font-size: 13px; color: var(--muted); gap: 12px; }
.upload-status.is-done #upload-text { color: var(--ok); font-weight: 560; }
.upload-status.is-error #upload-text { color: var(--error); }

.bar { height: 6px; border-radius: 99px; background: #eceff3; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.is-done .bar span { background: #17b26a; }
.is-error .bar span { background: var(--error); }

.counters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 22px; }
.count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px 2px 5px;
  font-variant-numeric: tabular-nums;
}
.count .brand { width: 13px; height: 13px; }
.count.over { color: var(--error); background: var(--error-soft); border-color: #fecdca; }
.counter { align-self: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--error); }

.dest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.dest {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.dest:hover { border-color: var(--line-strong); }
.dest input { position: absolute; opacity: 0; pointer-events: none; }
.dest.is-on { border-color: var(--accent); background: #f7f9fe; }
.dest:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.dest-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dest-text strong { font-weight: 580; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest-warn { font-size: 12px; color: var(--warn); line-height: 1.35; }
.dest-warn.err { color: var(--error); }
.dest-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.dest-check .i { width: 13px; height: 13px; opacity: 0; }
.dest.is-on .dest-check { background: var(--accent); border-color: var(--accent); }
.dest.is-on .dest-check .i { opacity: 1; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e9ecf2;
  color: var(--text-2);
  display: grid;
  place-items: center;
  font-weight: 620;
  font-size: 15px;
  position: relative;
  flex: none;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1.5px #fff;
}
.avatar-badge .brand { width: 12px; height: 12px; }

.panel { padding: 0; }
.panel summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.panel[open] summary .chev { transform: rotate(90deg); }
.panel-body { padding: 0 20px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.override { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; }
.panel-body > .override:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.override-field { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.override-field textarea { min-height: 100px; }
.tt-creators { margin-bottom: 14px; }
.tt-creators strong { color: var(--text); }
.tt-label-note { color: var(--accent); }

.publish-card { position: relative; }
.issues { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.issues:empty { display: none; }
.issues li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
.issues li .i { width: 16px; height: 16px; margin-top: 1px; }
.issues .error { color: var(--error); }
.issues .warn { color: var(--warn); }
.publish-card .small { margin-top: 10px; }

/* ---------- Progress ---------- */
.progress-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.progress-head p { margin-top: 3px; }
.target-list { list-style: none; margin: 0; padding: 0; }
.target {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.target:first-child { border-top: 0; }
.target-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.target-icon .brand { width: 20px; height: 20px; }
.target-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.target-top strong { font-weight: 600; }
.target-top span { font-size: 13.5px; }
.target-msg { font-size: 13.5px; color: var(--text-2); margin: 2px 0 7px; line-height: 1.4; word-break: break-word; }
.target.state-failed .target-msg { color: var(--error); }
.target.state-done .target-msg { color: var(--ok); margin-bottom: 0; }
.target .bar { max-width: 420px; }
.target-side { display: flex; align-items: center; gap: 8px; }
.state-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.state-icon .i { width: 15px; height: 15px; }
.state-done .state-icon { background: var(--ok-soft); color: var(--ok); }
.state-failed .state-icon { background: var(--error-soft); color: var(--error); }
.state-working .state-icon, .state-queued .state-icon { color: var(--accent); }
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d9e1fa;
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 16px;
}
.media-note { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); }
.media-note.deleted { color: var(--ok); }
.media-note .i { width: 16px; height: 16px; }
.progress-foot .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.caption-card h2 { margin-bottom: 8px; }
.caption-text { white-space: normal; word-break: break-word; font-size: 14.5px; }
.caption-extra { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; font-size: 14px; word-break: break-word; }
.caption-extra p { margin-top: 4px; }
.caption-extra-label { display: inline-flex; align-items: center; gap: 6px; }
.caption-extra-label .brand { width: 14px; height: 14px; }

/* ---------- Accounts ---------- */
.platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.platform-grid .card + .card { margin-top: 0; }
.platform-card { display: flex; flex-direction: column; }
.platform-head { display: flex; align-items: flex-start; gap: 12px; }
.platform-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: none;
}
.platform-logo .brand { width: 22px; height: 22px; }
.platform-title { flex: 1; min-width: 0; }
.platform-title p { margin-top: 2px; }
.account-list { list-style: none; margin: 16px 0 0; padding: 0; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account-text strong { font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-note { display: flex; gap: 6px; color: var(--error); padding: 0 0 10px 50px; }
.account-note .i { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.platform-actions { margin-top: auto; padding-top: 16px; }

/* ---------- History ---------- */
.list-card { padding: 6px 8px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li + li { border-top: 1px solid var(--line); }
.history-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  color: var(--text);
  border-radius: 10px;
}
.history-row:hover { background: var(--surface-2); text-decoration: none; }
.thumb {
  width: 46px;
  height: 64px;
  border-radius: 8px;
  background: #eceff3;
  color: var(--muted);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.history-caption {
  font-size: 14.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.history-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.target-dots { display: inline-flex; gap: 4px; }
.dot-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); position: relative; }
.dot-icon .brand { width: 12px; height: 12px; }
.dot-icon::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #fff; }
.dot-done::after { background: #17b26a; }
.dot-failed::after { background: #f04438; }
.dot-queued::after, .dot-working::after { background: var(--accent); }

/* ---------- Settings ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.chips a {
  font-size: 13.5px;
  font-weight: 540;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
}
.chips a:hover { border-color: var(--line-strong); text-decoration: none; }
.settings-section { margin-bottom: 34px; scroll-margin-top: 20px; }
.settings-card { scroll-margin-top: 20px; }
.section-title { font-size: 18px; margin-bottom: 4px; }
.section-lead { margin-bottom: 14px; font-size: 14px; }
.settings-section > .card:first-of-type, .settings-section > form.card, .settings-section > .two-col { margin-top: 12px; }
.guide { margin: 16px 0 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.guide summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  font-weight: 580;
  font-size: 14px;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary .chev { transition: transform .2s; color: var(--muted); width: 16px; height: 16px; }
.guide[open] summary .chev { transform: rotate(90deg); }
.guide-steps { margin: 0; padding: 0 16px 6px 36px; font-size: 14px; color: var(--text-2); }
.guide-steps li { padding: 5px 0 5px 4px; line-height: 1.55; }
.guide-note { display: flex; gap: 8px; margin: 8px 14px; font-size: 13.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.guide-note .i { color: var(--warn); width: 16px; height: 16px; margin-top: 2px; flex: none; }
.guide > .btn { margin: 6px 14px 14px; }
.key-form { margin-top: 16px; }
.key-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.key-fields .field + .field { margin-top: 0; }
.option-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.option-card:has(input:checked) { border-color: var(--accent); background: #f7f9fe; }
.option-card input { accent-color: var(--accent); margin: 3px 0 0; width: 17px; height: 17px; flex: none; }
.option-card > span { display: flex; flex-direction: column; gap: 2px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.two-col .card + .card { margin-top: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0; }
.facts div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 580; font-size: 14px; }

/* ---------- Bare pages (sign in, setup, legal) ---------- */
body.bare { min-height: 100vh; }
.bare-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}
.bare-brand { padding: 0 0 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card h1 { font-size: 22px; }
.auth-card > p { margin: 6px 0 20px; }
.setup-card { max-width: 520px; }
.bare-foot { margin-top: 18px; font-size: 13px; color: var(--muted); }
.bare-foot a { color: var(--muted); }
.checklist { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.checklist li > .i { width: 18px; height: 18px; margin-top: 1px; }
.checklist li div { display: flex; flex-direction: column; }
.checklist .ok > .i { color: var(--ok); }
.checklist .bad > .i { color: var(--error); }
.legal { max-width: 760px; width: 100%; padding: 32px; }
.legal h2 { margin: 24px 0 8px; font-size: 17px; }
.legal p, .legal li { color: var(--text-2); font-size: 15px; line-height: 1.65; }
.legal p + p { margin-top: 10px; }
.legal ul { padding-left: 20px; margin: 0; }
.legal li + li { margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .compose-grid { grid-template-columns: minmax(0, 1fr); }
  .compose-media { position: static; }
  .dropzone { min-height: 220px; }
  .video-frame { aspect-ratio: 4 / 5; max-height: 56vh; margin: 0 auto; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  }
  .topbar .brand-link { padding: 0; }
  .main { margin-left: 0; padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 0;
    font-size: 11px;
    font-weight: 560;
    color: var(--muted);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar a .i { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--accent); }
  h1 { font-size: 22px; }
  .page-head { margin-bottom: 16px; }
  .card { padding: 16px; border-radius: 13px; }
  .panel { padding: 0; }
  .panel summary { padding: 14px 16px; }
  .panel-body { padding: 14px 16px 16px; }
  .platform-grid, .two-col, .form-grid, .key-fields, .option-cards { grid-template-columns: minmax(0, 1fr); }
  .dest-list { grid-template-columns: minmax(0, 1fr); }
  .target { grid-template-columns: 36px minmax(0, 1fr); }
  .target-icon { width: 36px; height: 36px; }
  .target-side { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
  .target-side .state-icon { display: none; }
  .history-row { padding: 10px 6px; gap: 12px; align-items: flex-start; }
  .history-row .pill { display: none; }
  .legal { padding: 22px 18px; }
  .flash { margin-bottom: 14px; }
}
