/* ==========================================================================
   postitfor.me — design system
   Warm paper neutrals + one confident violet accent. Light & dark themes.
   ========================================================================== */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/manrope-latin-wght.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/manrope-latin-ext-wght.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --bg: #f6f4ef;
  --bg-grad-1: rgba(123, 97, 255, .10);
  --bg-grad-2: rgba(255, 170, 120, .10);
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f1eee8;
  --glass: rgba(255, 255, 255, .72);
  --border: #e7e2d8;
  --border-strong: #d6cfc2;
  --text: #1c1a24;
  --text-2: #4a4656;
  --muted: #777284;
  --accent: #5b3ff0;
  --accent-hover: #4a2fe0;
  --accent-soft: #eeeaff;
  --accent-soft-2: #ded6ff;
  --accent-text: #4a2fd6;
  --on-accent: #ffffff;
  --success: #138a52;
  --success-soft: #e3f5ec;
  --warning: #c26a00;
  --warning-soft: #fff1dc;
  --danger: #d0303f;
  --danger-soft: #fde8ea;
  --focus: #5b3ff0;
  --logo-a: #7b61ff;
  --logo-b: #4f2fe0;
  --logo-fold: #c9beff;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --shadow-xs: 0 1px 2px rgba(28, 26, 36, .06);
  --shadow-sm: 0 1px 2px rgba(28, 26, 36, .05), 0 2px 8px rgba(28, 26, 36, .05);
  --shadow: 0 1px 2px rgba(28, 26, 36, .04), 0 6px 20px -4px rgba(28, 26, 36, .10), 0 18px 40px -18px rgba(60, 40, 140, .18);
  --shadow-lg: 0 2px 4px rgba(28, 26, 36, .05), 0 20px 50px -12px rgba(40, 30, 90, .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --topbar-h: 68px;
  --tabbar-h: 0px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0e14;
  --bg-grad-1: rgba(123, 97, 255, .16);
  --bg-grad-2: rgba(255, 140, 90, .06);
  --surface: #17161f;
  --surface-2: #1c1b25;
  --surface-3: #24222f;
  --glass: rgba(23, 22, 31, .72);
  --border: #2a2836;
  --border-strong: #3a3748;
  --text: #f1eff7;
  --text-2: #c9c5d6;
  --muted: #938ea3;
  --accent: #8b77ff;
  --accent-hover: #9c8bff;
  --accent-soft: #231e3d;
  --accent-soft-2: #2e2752;
  --accent-text: #b3a6ff;
  --on-accent: #0f0b24;
  --success: #3ccf8e;
  --success-soft: #11291e;
  --warning: #ffab40;
  --warning-soft: #2e2211;
  --danger: #ff6b78;
  --danger-soft: #331519;
  --focus: #a797ff;
  --logo-fold: #3e3478;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 60px -12px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0e14;
    --bg-grad-1: rgba(123, 97, 255, .16);
    --bg-grad-2: rgba(255, 140, 90, .06);
    --surface: #17161f;
    --surface-2: #1c1b25;
    --surface-3: #24222f;
    --glass: rgba(23, 22, 31, .72);
    --border: #2a2836;
    --border-strong: #3a3748;
    --text: #f1eff7;
    --text-2: #c9c5d6;
    --muted: #938ea3;
    --accent: #8b77ff;
    --accent-hover: #9c8bff;
    --accent-soft: #231e3d;
    --accent-soft-2: #2e2752;
    --accent-text: #b3a6ff;
    --on-accent: #0f0b24;
    --success: #3ccf8e;
    --success-soft: #11291e;
    --warning: #ffab40;
    --warning-soft: #2e2211;
    --danger: #ff6b78;
    --danger-soft: #331519;
    --focus: #a797ff;
    --logo-fold: #3e3478;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 60px -12px rgba(0, 0, 0, .7);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 8% -8%, var(--bg-grad-1), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, var(--bg-grad-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
img, video, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); }
h2 { font-size: 1.15rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft-2); }

:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

/* Sprite root attributes don't reach <use> instances, so line-icon styling lives here. */
.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 12px; font-weight: 700;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.spacer-16 { height: 16px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* ---------- Logo ---------- */
.logo { height: 34px; width: auto; overflow: visible; }
.logo-mark { width: 40px; height: 40px; }
.logo-word { font-family: var(--font); font-weight: 800; font-size: 25px; letter-spacing: -.035em; fill: var(--text); }
.logo-tld { fill: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-inner {
  max-width: 1240px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; border-radius: 12px; }
.nav { display: flex; gap: 4px; margin-left: 12px; padding: 4px; background: var(--surface-3); border-radius: 14px; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px;
  color: var(--text-2); font-weight: 650; text-decoration: none; font-size: .93rem;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 20px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-head p { margin-top: 6px; color: var(--muted); }
.page-head p.small a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.card-head h2 { display: flex; align-items: center; gap: 10px; }
.card-head .hint { margin-left: auto; font-size: .82rem; color: var(--muted); }
.card-body { padding: 16px 22px 22px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title .icon { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 13px; border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; font-size: .94rem; letter-spacing: -.005em;
  text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease), opacity .2s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-border: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-primary:hover { --btn-bg: var(--accent-hover); border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--text-2); }
.btn-ghost:hover { --btn-bg: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-text); --btn-border: transparent; }
.btn-soft:hover { --btn-bg: var(--accent-soft-2); border-color: transparent; }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: transparent; }
.btn-danger:hover { filter: brightness(1.06); border-color: transparent; }
.btn-danger-soft { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: .86rem; }
.btn-lg { min-height: 54px; padding: 0 26px; border-radius: 16px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-icon-idle { display: none; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 16px; }
.label { font-weight: 700; font-size: .9rem; color: var(--text); }
.help { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.input, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 13px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.input:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .83rem; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 48px; }
.input-group .btn { position: absolute; right: 4px; }

.checkbox { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .92rem; }
.checkbox input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

/* Switch */
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-track {
  position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong);
  transition: background .25s var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .25s var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: .5; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: .74rem; font-weight: 750; letter-spacing: .01em; line-height: 1.4;
  background: var(--surface-3); color: var(--text-2);
}
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge .icon { width: 13px; height: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 7px; border-radius: 99px;
  font-size: .8rem; font-weight: 700;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
}
.chip .icon { width: 15px; height: 15px; }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-failed { background: var(--danger-soft); color: var(--danger); }
.chip-pending { background: var(--warning-soft); color: var(--warning); }

/* Segmented filter */
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 14px; background: var(--surface-3); }
.segmented a {
  padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: .88rem;
  color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.segmented a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed; z-index: 90; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none; max-width: min(420px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 14px 14px 16px; border-radius: 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: .92rem;
  animation: toast-in .35s var(--ease) both;
}
.toast.is-leaving { animation: toast-out .25s var(--ease) both; }
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: var(--success); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--accent); }
.toast-close { margin: -6px -6px -6px 4px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- Dialog ---------- */
dialog.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.dialog[open] { animation: dialog-in .28s var(--ease) both; }
dialog.dialog::backdrop { background: rgba(15, 12, 30, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog-body { padding: 26px 26px 8px; }
.dialog-icon {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  background: var(--danger-soft); color: var(--danger); margin-bottom: 16px;
}
.dialog-body h2 { font-size: 1.2rem; margin-bottom: 8px; }
.dialog-body p { color: var(--text-2); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 20px 26px 24px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- Empty states & skeletons ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 56px 24px;
}
.empty-art {
  width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-soft), var(--surface-3));
  color: var(--accent); margin-bottom: 8px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.empty-art .icon { width: 36px; height: 36px; }
.empty h2 { font-size: 1.15rem; }
.empty p { color: var(--muted); max-width: 380px; }

.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton-line { height: 20px; width: 80%; }
.skeleton-line + .skeleton-line { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Alerts ---------- */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; border-radius: 14px; font-size: .9rem; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.alert .icon { margin-top: 1px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--accent-soft); color: var(--accent-text); }

/* ==========================================================================
   Compose page
   ========================================================================== */
.compose {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start;
}
.compose-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.compose-side { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 16px; }

/* Drop zone */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  padding: 40px 24px; min-height: 240px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-strong);
  background:
    radial-gradient(400px 200px at 50% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.is-dragover { border-color: var(--accent); border-style: solid; transform: scale(1.005); background: var(--accent-soft); }
.dropzone-icon {
  width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  margin-bottom: 6px;
  transition: transform .3s var(--ease);
}
.dropzone:hover .dropzone-icon, .dropzone.is-dragover .dropzone-icon { transform: translateY(-3px) rotate(-4deg); }
.dropzone-icon .icon { width: 32px; height: 32px; }
.dropzone-title { font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; }
.dropzone-sub { color: var(--muted); font-size: .9rem; max-width: 420px; }
.dropzone-formats { font-size: .76rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); margin-top: 4px; }
.dropzone.is-compact { min-height: 0; padding: 18px; flex-direction: row; gap: 14px; text-align: left; justify-content: flex-start; }
.dropzone.is-compact .dropzone-icon { width: 44px; height: 44px; border-radius: 14px; margin: 0; }
.dropzone.is-compact .dropzone-icon .icon { width: 22px; height: 22px; }
.dropzone.is-compact .dropzone-sub, .dropzone.is-compact .dropzone-formats { display: none; }
.dropzone.is-compact .dropzone-title { font-size: .98rem; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Media grid */
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px;
  list-style: none; padding: 0; margin: 0;
}
.media-item {
  position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden;
  background: var(--surface-3); box-shadow: var(--shadow-xs);
  outline: 1px solid var(--border);
  animation: pop-in .3s var(--ease) both;
  touch-action: manipulation;
}
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-item.is-invalid { outline: 2px solid var(--danger); }
.media-item.is-invalid img, .media-item.is-invalid video { opacity: .35; filter: grayscale(1); }
.media-item.sortable-ghost { opacity: .35; }
.media-item.sortable-chosen { box-shadow: var(--shadow-lg); transform: scale(1.03); }
.media-index {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px;
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 800;
  background: rgba(15, 12, 30, .6); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.media-remove {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 32px; height: 32px; border-radius: 11px; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: rgba(15, 12, 30, .6); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background .2s, transform .15s;
}
.media-remove:hover { background: var(--danger); }
.media-remove:active { transform: scale(.94); }
.media-remove .icon { width: 16px; height: 16px; }
.media-meta {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 5px; padding: 22px 8px 8px;
  background: linear-gradient(transparent, rgba(10, 8, 20, .72));
  color: #fff; font-size: .72rem; font-weight: 700;
}
.media-meta .badge { background: rgba(255, 255, 255, .2); color: #fff; padding: 2px 7px; font-size: .68rem; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.media-meta .spacer { flex: 1; }
.media-error {
  position: absolute; inset: auto 6px 6px 6px; z-index: 3;
  padding: 6px 8px; border-radius: 10px; background: var(--danger); color: #fff;
  font-size: .7rem; font-weight: 700; line-height: 1.3;
}
.media-warn {
  position: absolute; left: 8px; top: 38px; z-index: 2;
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: var(--warning); color: #fff;
}
.media-warn .icon { width: 14px; height: 14px; }
.media-play {
  position: absolute; inset: 0; margin: auto; z-index: 1;
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(15, 12, 30, .55); color: #fff; pointer-events: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.media-play .icon { width: 18px; height: 18px; margin-left: 2px; }
.media-item.is-playing .media-play { opacity: 0; }
.media-handle { position: absolute; inset: 0; z-index: 1; cursor: grab; }
.media-handle:active { cursor: grabbing; }
.media-move { display: none; }
@keyframes pop-in { from { opacity: 0; transform: scale(.92); } }

.compress-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.compress-row .small { display: inline-flex; align-items: center; gap: 6px; }

/* Caption editor */
.editor {
  border: 1.5px solid var(--border); border-radius: 18px; background: var(--surface-2);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s;
}
.editor:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .btn { min-height: 36px; width: 38px; padding: 0; border-radius: 10px; }
.toolbar .divider { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.editor textarea {
  display: block; width: 100%; min-height: 180px; max-height: 60vh; resize: vertical;
  padding: 14px 16px; border: 0; background: transparent; outline: none;
  font-size: 1rem; line-height: 1.6;
}
.editor-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px 10px 14px; border-top: 1px solid var(--border); }
.counters { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.counter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 6px; border-radius: 99px;
  font-size: .78rem; font-weight: 750; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-2);
  transition: background .2s, color .2s;
}
.counter .icon { width: 15px; height: 15px; }
.counter.is-warn { background: var(--warning-soft); color: var(--warning); }
.counter.is-over { background: var(--danger-soft); color: var(--danger); }
.draft-state { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

.emoji-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px;
  padding: 8px; border-bottom: 1px solid var(--border); max-height: 180px; overflow-y: auto;
}
.emoji-panel button {
  border: 0; background: transparent; font-size: 1.35rem; height: 40px; border-radius: 10px; cursor: pointer;
}
.emoji-panel button:hover, .emoji-panel button:focus-visible { background: var(--surface-3); }

.warnings { display: flex; flex-direction: column; gap: 8px; }

/* Platforms */
.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.platform {
  --brand: var(--accent);
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 18px;
  border: 1.5px solid var(--border); background: var(--surface-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.platform.is-on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); box-shadow: 0 6px 20px -12px var(--brand); }
.platform.is-disabled { opacity: .62; }
.platform-icon {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--brand); color: #fff;
}
.platform-icon .icon { width: 22px; height: 22px; }
.platform-name { font-weight: 800; }
.platform-sub { font-size: .78rem; color: var(--muted); font-weight: 600; }
.platform-sub a { font-weight: 700; }
.platform .switch { margin-left: auto; }

/* Preview (Telegram-like) */
.preview-card { overflow: hidden; }
.preview-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.preview-head h2 { font-size: .98rem; }
.preview-toggle { display: none; }
.tg-screen {
  padding: 18px 14px 20px;
  min-height: 260px; max-height: calc(100vh - var(--topbar-h) - 260px); overflow-y: auto;
  background-color: #cfd9c6;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .35) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .25) 0 2px, transparent 3px),
    linear-gradient(160deg, #d6e2b8 0%, #9fc3a8 50%, #8fb8b0 100%);
  background-size: 38px 38px, 52px 52px, 100% 100%;
}
:root[data-theme="dark"] .tg-screen { background-color: #0e1621; background-image: linear-gradient(160deg, #1b2837 0%, #0e1621 100%); background-size: 100% 100%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-screen { background-color: #0e1621; background-image: linear-gradient(160deg, #1b2837 0%, #0e1621 100%); background-size: 100% 100%; } }
.tg-msg {
  max-width: 340px; margin: 0 0 8px; border-radius: 16px 16px 16px 6px; overflow: hidden;
  background: #fff; color: #000; box-shadow: 0 1px 1.5px rgba(0, 0, 0, .14);
  font-family: -apple-system, "Segoe UI", Roboto, var(--font), sans-serif; font-size: 14.5px; line-height: 1.38;
  animation: pop-in .25s var(--ease) both;
}
:root[data-theme="dark"] .tg-msg { background: #182533; color: #f5f5f5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-msg { background: #182533; color: #f5f5f5; } }
.tg-channel { padding: 8px 12px 0; font-weight: 700; font-size: 14px; color: #2481cc; }
:root[data-theme="dark"] .tg-channel { color: #71baf2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg-channel { color: #71baf2; } }
.tg-album { display: grid; gap: 2px; grid-template-columns: repeat(6, 1fr); }
.tg-album > * { position: relative; background: #0002; min-height: 70px; overflow: hidden; }
.tg-album img, .tg-album video { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto; }
.tg-album.n1 > * { grid-column: span 6; max-height: 360px; }
.tg-album.n1 img, .tg-album.n1 video { max-height: 360px; }
.tg-album.n2 > * { grid-column: span 3; aspect-ratio: 1; }
.tg-album.n3 > *:first-child { grid-column: span 6; aspect-ratio: 16/10; }
.tg-album.n3 > *:not(:first-child) { grid-column: span 3; aspect-ratio: 1; }
.tg-album.n4 > * { grid-column: span 3; aspect-ratio: 1; }
.tg-album.nmany > *:first-child { grid-column: span 6; aspect-ratio: 16/10; }
.tg-album.nmany > *:not(:first-child) { grid-column: span 2; aspect-ratio: 1; }
.tg-album .tg-dur {
  position: absolute; left: 6px; top: 6px; padding: 1px 6px; border-radius: 8px;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 11.5px; font-weight: 600;
}
.tg-text { padding: 7px 12px 0; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.tg-text a { color: #2481cc; text-decoration: none; }
:root[data-theme="dark"] .tg-text a { color: #71baf2; }
.tg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding: 2px 10px 6px; font-size: 12px; color: #8a9aa9; }
.tg-meta .icon { width: 13px; height: 13px; }
.tg-empty { color: rgba(0, 0, 0, .55); text-align: center; font-weight: 600; font-size: .9rem; padding: 60px 16px; }
:root[data-theme="dark"] .tg-empty { color: rgba(255, 255, 255, .5); }
.tg-more { font-size: 12px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .35); border-radius: 12px; padding: 3px 10px; display: inline-block; margin: 0 0 8px; }

/* Publish panel */
.publish-card { padding: 18px; }
.publish-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.progress {
  height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 12px 0 8px;
}
.progress-bar {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #ff8a5c));
  transition: width .3s var(--ease);
}
.progress.is-indeterminate .progress-bar { width: 35% !important; animation: indeterminate 1.2s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.progress-label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.progress-label .spinner { width: 16px; height: 16px; color: var(--accent); }

.results { display: flex; flex-direction: column; gap: 10px; }
.result {
  --brand: var(--accent);
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface-2);
  animation: pop-in .3s var(--ease) both;
}
.result.is-success { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); background: color-mix(in srgb, var(--success) 6%, var(--surface)); }
.result.is-failed { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.result-status { flex: none; margin-top: 2px; }
.result.is-success .result-status { color: var(--success); }
.result.is-failed .result-status { color: var(--danger); }
.result-body { flex: 1; min-width: 0; }
.result-title { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.result-error { margin-top: 4px; color: var(--text-2); font-size: .88rem; white-space: pre-line; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.mobile-publish { display: none; }

/* ==========================================================================
   History
   ========================================================================== */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat-success .stat-value { color: var(--success); }
.stat-failed .stat-value { color: var(--danger); }

.history-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search .input { padding-left: 40px; }

.post-list { display: flex; flex-direction: column; gap: 12px; list-style: none; margin: 0; padding: 0; }
.post-row {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 18px; align-items: center;
  padding: 14px; transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.post-row:hover { box-shadow: var(--shadow); }
.thumbs { position: relative; width: 112px; height: 84px; border-radius: 14px; overflow: hidden; background: var(--surface-3); display: grid; gap: 2px; }
.thumbs.n2 { grid-template-columns: 1fr 1fr; }
.thumbs.n3, .thumbs.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.thumbs.n3 > :first-child { grid-row: span 2; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .thumb-empty { display: grid; place-items: center; color: var(--muted); width: 100%; height: 100%; }
.thumbs .thumb-count {
  position: absolute; right: 5px; bottom: 5px; padding: 1px 7px; border-radius: 8px;
  background: rgba(15, 12, 30, .65); color: #fff; font-size: .7rem; font-weight: 800;
}
.post-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.post-caption { font-weight: 600; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.post-caption.is-empty { color: var(--muted); font-style: italic; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; color: var(--muted); font-weight: 600; }
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.post-targets { display: flex; flex-wrap: wrap; gap: 6px; }
.post-targets a.chip { text-decoration: none; }
.post-targets a.chip:hover { filter: brightness(.97); text-decoration: underline; }
.post-actions { display: flex; gap: 6px; align-items: center; }
.post-error { font-size: .82rem; color: var(--danger); font-weight: 600; white-space: pre-line; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 24px; }
.pagination .page-info { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Settings
   ========================================================================== */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.settings-main, .settings-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.platform-settings { overflow: hidden; }
.platform-settings-head {
  --brand: var(--accent);
  display: flex; align-items: center; gap: 14px; padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(120deg, color-mix(in srgb, var(--brand) 9%, transparent), transparent 60%);
}
.platform-settings-head .platform-icon { width: 46px; height: 46px; border-radius: 15px; background: var(--brand); }
.platform-settings-head h2 { font-size: 1.1rem; }
.platform-settings-head .badge { margin-left: auto; }
.platform-settings form { padding: 20px 22px 22px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.secret-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; color: var(--text-2); }
.secret-mask { font-family: var(--mono); font-size: .85rem; padding: 3px 9px; border-radius: 8px; background: var(--surface-3); color: var(--text); letter-spacing: .04em; }
.test-result { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; font-size: .9rem; }
.check .icon { margin-top: 1px; }
.check.is-ok .icon { color: var(--success); }
.check.is-fail { color: var(--danger); }
.coming-soon { padding: 18px 22px 22px; color: var(--muted); }
.remove-instance { padding: 0 22px 18px; margin-top: -8px; }

/* Collapsed "add another channel" section */
details.platform-settings.is-addable { border-style: dashed; box-shadow: none; background: transparent; }
details.platform-settings.is-addable[open] { border-style: solid; background: var(--surface); box-shadow: var(--shadow-sm); }
details.platform-settings > summary { cursor: pointer; list-style: none; }
details.platform-settings > summary::-webkit-details-marker { display: none; }
details.platform-settings:not([open]) > summary { border-bottom: 0; background: none; }
details.platform-settings.is-addable > summary .platform-icon { background: var(--surface-3); color: var(--brand); }
details.platform-settings.is-addable > summary:hover .platform-icon { background: var(--brand); color: #fff; }
details.platform-settings.is-addable > summary h2 { font-size: 1rem; }
.platform-settings-head .badge { white-space: nowrap; flex: none; }

.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.info-list li:last-child { border-bottom: 0; }
.info-list .k { color: var(--muted); font-weight: 600; }
.info-list .v { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ext-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.usage-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 10px; display: flex; }
.usage-bar span { height: 100%; }
.usage-bar .u-uploads { background: var(--accent); }
.usage-bar .u-thumbs { background: color-mix(in srgb, var(--accent) 45%, var(--surface-3)); }

/* Security (2FA) */
.security-grid { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }
.setup-steps { margin: 16px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.setup-steps li { padding-left: 4px; }
.qr { width: 220px; max-width: 100%; margin: 12px 0; padding: 10px; background: #fff; border-radius: 16px; border: 1px solid var(--border); }
.qr svg { width: 100%; height: auto; }
.secret-key { display: inline-block; font-family: var(--mono); font-size: .95rem; letter-spacing: .08em; padding: 8px 12px; border-radius: 10px; background: var(--surface-3); word-break: break-all; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; margin: 16px 0; padding-left: 26px; }
.backup-codes code { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .06em; }
.backup-codes-card { border-color: color-mix(in srgb, var(--warning) 50%, var(--border)); }
.input-code { font-family: var(--mono); font-size: 1.2rem; letter-spacing: .25em; max-width: 220px; }
.divider-line { border: 0; border-top: 1px dashed var(--border); margin: 22px 0; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
  background: linear-gradient(150deg, #6a4dff 0%, #4a2fe0 45%, #2c1a8f 100%);
  color: #fff;
}
.auth-art::before, .auth-art::after {
  content: ""; position: absolute; border-radius: 40px; transform: rotate(-12deg);
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
}
.auth-art::before { width: 320px; height: 320px; right: -60px; top: 18%; }
.auth-art::after { width: 220px; height: 220px; right: 180px; bottom: -40px; transform: rotate(10deg); }
.auth-art .logo { height: 40px; --logo-a: #ffffff; --logo-b: #e6e0ff; --logo-fold: #b7a8ff; }
.auth-art .logo-word { fill: #fff; }
.auth-art .logo-tld { fill: #cfc4ff; }
.auth-art .logo path[stroke="#fff"], .auth-art .logo circle[fill="#fff"] { stroke: #4a2fe0; }
.auth-hero { position: relative; z-index: 1; max-width: 460px; }
.auth-hero h1 { font-size: clamp(2rem, 1.4rem + 2vw, 2.9rem); letter-spacing: -.035em; }
.auth-hero p { margin-top: 14px; font-size: 1.05rem; opacity: .85; }
.auth-flow { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.auth-flow .pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-weight: 700; font-size: .9rem;
}
.auth-flow .pill.is-soon { opacity: .65; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo-mobile { display: none; margin-bottom: 28px; }
.auth-card h1 { font-size: 1.9rem; }
.auth-card .lead { color: var(--muted); margin: 8px 0 26px; }
.auth-card form .btn-primary { margin-top: 22px; }
.auth-foot { margin-top: 28px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .82rem; }

/* Error page */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-card { max-width: 460px; width: 100%; text-align: center; padding: 40px 28px; }
.error-mark { margin: 0 auto 18px; width: 52px; height: 52px; }
.error-code { font-size: 4rem; font-weight: 800; letter-spacing: -.05em; color: var(--accent); line-height: 1; }
.error-card p { color: var(--text-2); margin: 14px 0 24px; }
.debug { text-align: left; margin-top: 20px; font-family: var(--mono); font-size: .75rem; white-space: pre-wrap; overflow-x: auto; background: var(--surface-3); padding: 14px; border-radius: 12px; max-height: 360px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .compose { grid-template-columns: minmax(0, 1fr) 340px; }
  .settings { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --topbar-h: 60px; --tabbar-h: 66px; }
  .nav { display: none; }
  .topbar-inner { padding: 0 16px; }
  .logo { height: 30px; }
  .container { padding: 22px 16px calc(var(--tabbar-h) + 40px); }
  body.page-compose .container { padding-bottom: calc(var(--tabbar-h) + 110px); }

  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--glass);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 750;
  }
  .tabbar a .icon { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }

  .toast-region { left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); align-items: stretch; max-width: none; }
  body.page-compose .toast-region { bottom: calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom)); }

  .compose { grid-template-columns: 1fr; }
  .compose-side { position: static; }
  .preview-toggle { display: inline-flex; margin-left: auto; }
  .preview-card.is-collapsed .tg-screen { display: none; }
  .tg-screen { max-height: 70vh; }
  .publish-card .publish-button-desktop { display: none; }

  .mobile-publish {
    display: flex; gap: 10px; align-items: center;
    position: fixed; left: 12px; right: 12px; z-index: 44;
    bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom));
    padding: 8px; border-radius: 20px;
    background: var(--glass); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
  }
  .mobile-publish .btn { flex: 1; }
  .mobile-publish .mp-info { padding: 0 6px 0 10px; font-size: .78rem; font-weight: 700; color: var(--text-2); line-height: 1.25; }

  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .media-item { border-radius: 13px; }
  .dropzone { min-height: 190px; padding: 28px 18px; }

  .post-row { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; }
  .thumbs { width: 84px; height: 84px; }
  .post-actions { grid-column: 1 / -1; justify-content: flex-end; }

  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-card .logo-mobile { display: block; }
}

@media (max-width: 520px) {
  body { font-size: 15px; }
  .hide-sm { display: none; }
  .media-meta > span:last-child, .media-meta .spacer { display: none; }
  .media-meta { padding: 16px 6px 6px; }
  .card-pad, .card-body { padding-left: 16px; padding-right: 16px; }
  .card-head { padding-left: 16px; padding-right: 16px; }
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 1.3rem; }
  .platforms { grid-template-columns: 1fr; }
  .segmented { width: 100%; }
  .segmented a { flex: 1; text-align: center; padding: 8px 6px; }
  .search { max-width: none; }
  .toolbar .btn { width: 42px; min-height: 40px; }
}

@media (hover: none) {
  .media-move {
    display: flex; position: absolute; left: 6px; bottom: 30px; z-index: 3; gap: 4px;
  }
  .media-move button {
    width: 30px; height: 30px; border: 0; border-radius: 10px; display: grid; place-items: center;
    background: rgba(15, 12, 30, .6); color: #fff;
  }
  .media-move .icon { width: 15px; height: 15px; }
}

/* ---------- Premium akkaunt (Settings) ---------- */
.risk-list { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: .92rem; }
.premium-risk { border-color: var(--warning-soft); }
.premium-locked { border-color: var(--danger); }
.worker-status { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); flex: none; }
.worker-status[data-online="1"] .status-dot { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.channel-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.channel-name { display: flex; flex-direction: column; min-width: 0; }
.channel-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-like { cursor: pointer; color: var(--accent-text); font-weight: 700; font-size: .9rem; }
.row > .input { flex: 1; min-width: 0; }

/* ---------- Telegram mode switch (composer) ---------- */
.tg-mode { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.tg-mode legend { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 0; }
.tg-mode .segmented { display: flex; width: 100%; }
.tg-mode .segmented label { flex: 1; position: relative; cursor: pointer; }
.tg-mode .segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tg-mode .segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 10px;
  border-radius: 11px; font-weight: 700; font-size: .88rem; color: var(--text-2); text-align: center;
}
.tg-mode .segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.tg-mode .segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.tg-mode .help { margin-top: 8px; }
.badge-premium { background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff; }
.chip-mode { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .7rem; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.chip-mode.is-premium { background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff; }

/* ---------- Rich caption editor (Premium mode) ---------- */
.rich-editor {
  position: relative; display: block; width: 100%; min-height: 180px; max-height: 60vh; overflow-y: auto;
  padding: 14px 16px; outline: none; font-size: 1rem; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.rich-editor.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; }
.rich-editor a { color: var(--accent-text); }
.ce { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -.28em; margin: 0 .03em; user-select: all; }
.sticker-media { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; line-height: 1; overflow: hidden; }
.sticker-media img, .sticker-media video, .sticker-media .lottie-box, .sticker-media svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.sticker-media.is-loading { opacity: .6; }
.ce .sticker-media { font-size: 1.05em; }
.tg-text .ce-media { display: inline-flex; width: 1.25em; height: 1.25em; vertical-align: -.25em; }

/* Premium-only controls are shown in Premium mode only */
body:not([data-tg-mode="premium"]) .premium-only { display: none !important; }

/* Sticker choice under the editor */
.sticker-choice { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); }
.sticker-choice-media { width: 64px; height: 64px; flex: none; border-radius: 12px; background: var(--surface-3); display: flex; }
.sticker-choice-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.sticker-choice-body strong { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.segmented-sm { display: inline-flex; }
.segmented-sm label { position: relative; cursor: pointer; }
.segmented-sm input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented-sm span { display: block; padding: 5px 10px; border-radius: 9px; font-weight: 700; font-size: .8rem; color: var(--text-2); white-space: nowrap; }
.segmented-sm input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.segmented-sm input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Pickers */
.picker { border-bottom: 1px solid var(--border); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.picker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.picker-title { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: .9rem; }
.picker-search { width: 100%; }
.picker-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.picker-tabs button {
  flex: none; display: inline-flex; align-items: center; gap: 5px; max-width: 160px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-2);
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.picker-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.picker-body { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.picker-grid { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.picker-stickers .picker-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.picker-item {
  position: relative; aspect-ratio: 1; border: 0; border-radius: 10px; padding: 4px; background: transparent;
  font-size: 1.4rem; cursor: pointer; display: flex;
}
.picker-item:hover, .picker-item:focus-visible { background: var(--surface-3); }
.picker-premium { position: absolute; right: 2px; bottom: 2px; color: #a855f7; display: flex; }
.picker-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px 8px; color: var(--muted); font-size: .9rem; text-align: center; }

@media (max-width: 640px) {
  .picker {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-height: 70vh;
    border: 1px solid var(--border); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg, 0 -8px 30px rgba(0, 0, 0, .25));
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }
  .picker-body { max-height: 46vh; }
}

/* Live preview: premium sticker bubble */
.tg-msg.tg-sticker { background: transparent !important; box-shadow: none; padding: 0; }
.tg-sticker-media { display: flex; width: 160px; height: 160px; }
.tg-msg.tg-sticker .tg-meta { justify-content: flex-start; }

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

@media print {
  .topbar, .tabbar, .mobile-publish, .toast-region { display: none !important; }
}
