* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  color: #edf2ff;
  background: #080d1b;
  font: 15px/1.5 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --text: #edf2ff;
  --muted: #a9b6d0;
  --line: #b5caff2e;
  --surface: #131d33;
  --radius: 22px;
}
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 17% 0%, #423378 0, transparent 49%),
    radial-gradient(ellipse at 93% 9%, #174258 0, transparent 45%),
    linear-gradient(165deg,#111b33,#0b1225 57%,#080d1b);
  background-attachment: fixed;
}
body:not(.publisher) > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px max(24px, calc((100vw - 1152px) / 2));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg,#e2eaff16,#d0e6ff08);
  backdrop-filter: blur(22px) saturate(150%);
}
header p { margin: 3px 0 0; color: var(--muted); }
main { width: min(1152px, calc(100% - 52px)); margin: 25px auto 42px; }
h1,h2,h3 { margin: 0; font-weight: 650; line-height: 1.15; letter-spacing: -.035em; }
h1 { font-size: clamp(24px,4vw,36px); }
h2 { font-size: 22px; margin-bottom: 16px; }
h3 { font-size: 17px; }
p { margin: 8px 0; }
.workspace { display: grid; grid-template-columns: minmax(255px,.8fr) minmax(300px,1.2fr); gap: 17px; }
body:not(.publisher) section {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 14px 35px #03081342;
}
form { display: grid; gap: 9px; }
label { font-weight: 600; }
label.inline { display: flex; gap: 9px; align-items: center; font-weight: 500; }
button,input,select,textarea { font: inherit; }
input:not([type=checkbox]),select,textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c2d4ff32;
  border-radius: 11px;
  padding: 8px 11px;
  background: #0c1528;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #9ba9c4; }
textarea { resize: vertical; }
button {
  width: fit-content;
  min-height: 38px;
  border: 1px solid #b5d0ff66;
  border-radius: 100px;
  padding: 7px 15px;
  background: linear-gradient(155deg,#b7d2ff,#7eafff);
  color: #0b1932;
  font-weight: 650;
  cursor: pointer;
  box-shadow: inset 0 1px #ffffff76, 0 5px 14px #091b3a6f;
  transition: filter 130ms ease, background-color 130ms ease, border-color 130ms ease;
}
button:hover:enabled { filter: brightness(1.14); }
button.quiet {
  border-color: #ccd9ff38;
  background: linear-gradient(150deg,#d5e7ff22,#a4caff0d);
  color: #e5edff;
  box-shadow: inset 0 1px #e5f1ff26;
}
button:disabled { opacity: .48; cursor: default; }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible,summary:focus-visible {
  outline: 2px solid #aacaef;
  outline-offset: 3px;
}
a { color: #c4d9ff; text-underline-offset: 3px; }
a:hover { color: #fff; }
.notice {
  margin: 0 0 13px;
  padding: 11px 15px;
  border: 1px solid #abcaff44;
  border-radius: 14px;
  background: #233652b8;
  color: #e1ecff;
}
.notice button { margin-left: 10px; }
.journal { margin-top: 17px; }
.row { padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.row:first-child { margin-top: 10px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 9px; }
.muted { color: var(--muted); font-size: 13px; }
.caption { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#preview { border-radius: 13px; background: #0a1324; text-align: center; }
#preview img { max-width: 100%; max-height: 300px; vertical-align: middle; }
summary { cursor: pointer; }

body.publisher {
  display: flow-root;
  --muted:#c7d4ea;
  background:linear-gradient(180deg,#06102340,#04112224 54%,#07112276),
    url("/wallpaper.png") 50% 47% / cover no-repeat fixed #0b1727;
}
html:has(> body.publisher)::-webkit-scrollbar { width:10px; }
html:has(> body.publisher)::-webkit-scrollbar-track { background:#102033; }
html:has(> body.publisher)::-webkit-scrollbar-thumb {
  border:2px solid #102033;
  border-radius:10px;
  background:linear-gradient(#a6c6de,#5e89a6);
}
html:has(> body.publisher)::-webkit-scrollbar-thumb:hover { background:linear-gradient(#c9e7f4,#7cabc7); }
html:has(> body.publisher)::-webkit-scrollbar-button { display:none; }
.publisher .glass,.publisher .task-card {
  background:linear-gradient(140deg,#c1e6ff1c,#79aee510 40%,#6491aa18),#0816286e;
  border-color:#cee8ff3c;
  backdrop-filter:blur(12px) saturate(145%);
  box-shadow:inset 0 1px #e1f3ff42,inset 0 -1px #92b4dc16,0 8px 24px #03091645;
}
.publisher .app-bar.glass {
  background:linear-gradient(115deg,#c5e4ff25,#7ca8d81c 60%,#a1dbed24),#0b1b307a;
  backdrop-filter:blur(20px) saturate(140%);
}
.publisher .app-bar {
  position:sticky; z-index:5; top:0; display:flex; align-items:center; justify-content:space-between; gap:8px;
  min-height:44px; padding:6px 8px 6px 12px; border-width:0 0 1px;
  user-select:none;
}
.publisher main { width:min(644px,calc(100% - 32px)); margin:14px auto 26px; }
.app-brand { display:flex; align-items:center; gap:10px; }
.app-brand h1 { font-size:16px; letter-spacing:-.025em; white-space:nowrap; }
.app-controls { display:flex; flex:0 0 auto; align-items:center; gap:8px; }
.language-switch { display:flex; gap:1px; padding:2px; border:1px solid #dfe8ff32; border-radius:8px; background:#0b1b3045; }
.language-switch button {
  min-height:24px; min-width:27px; padding:2px 4px; font-size:11px; font-weight:700;
  border:1px solid transparent; border-radius:5px; background:transparent; box-shadow:none; color:#d5e2f4;
}
.language-switch button:hover { background:#d9e3ff28; }
.language-switch button[aria-pressed="true"] { background:#d9e3ff32; border-color:#dfe8ff42; color:white; }
.window-controls { display:flex; flex:0 0 auto; gap:3px; }
.window-controls button {
  display:grid; place-items:center; position:relative;
  border:1px solid transparent; padding:0; width:29px; height:29px; min-height:29px; border-radius:8px;
  background:transparent; box-shadow:none; color:#e2eafa;
}
.window-controls button:hover { background:#d9e3ff28; border-color:#dfe8ff2e; }
.window-controls .window-close:hover { background:#bd506267; border-color:#ffc5d051; }
.window-controls button::before,.window-controls .window-close::after {
  content:""; display:block; box-sizing:border-box; width:10px; height:1px; background:currentColor;
}
.window-controls .window-maximize::before { height:9px; border:1px solid currentColor; background:transparent; border-radius:1px; }
.window-controls .window-maximize[data-maximized="true"]::before { box-shadow:2px -2px currentColor; }
.window-close::before,.window-close::after { position:absolute; inset:auto; transform:rotate(45deg); }
.window-close::after { transform:rotate(-45deg); }
.app-mark {
  display:block; width:34px; height:34px; flex:0 0 34px; object-fit:contain;
}
.glass {
  background:linear-gradient(132deg,#eff0ff19,#b9c7ff0d 65%,#9cbbff13);
  border:1px solid #e0e5ff2b;
  backdrop-filter:blur(22px) saturate(125%);
  box-shadow:inset 0 1px #f1f4ff23,0 8px 24px #05071237;
}
.connection-shell { border-radius:16px; overflow:hidden; }
.connection-summary {
  display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:12px;
  min-height:52px; padding:9px 13px; list-style:none;
}
.connection-summary::-webkit-details-marker,.task-details summary::-webkit-details-marker { display:none; }
.connection-heading { font-weight:650; }
.connection-state { justify-self:end; display:inline-flex; align-items:center; gap:6px; color:var(--muted); font-size:12px; }
.connection-state::before { content:""; width:6px; height:6px; flex:0 0 6px; border-radius:50%; background:#e0bb80; }
.connection-state[data-ready="true"]::before { background:#88dabd; }
.chevron { display:block; width:7px; height:7px; border-right:1.5px solid #c6cfea; border-bottom:1.5px solid #c6cfea; transform:rotate(45deg); margin-bottom:3px; }
.connection-shell[open] > summary .chevron,.task-details[open] > summary .chevron { transform:rotate(225deg); margin-bottom:-3px; }
.connection-content { padding:0 13px 2px; }
.connection-entry { padding:12px 0; border-top:1px solid var(--line); }
.connection-entry-title { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.connection-entry-title h2 { margin:0; font-size:15px; letter-spacing:-.01em; }
.connection-entry .row { border:0; padding:4px 0; }
#crm-login { display:flex; flex-wrap:wrap; align-items:end; gap:10px; margin-top:10px; }
#crm-login label { flex:1 1 160px; }
#crm-login input { display:block; margin-top:3px; }
#crm-login-error { flex:0 0 100%; margin:0; color:#ffd0d6; font-size:14px; }
.mode-control { margin-top:9px; padding:8px 12px; border-radius:14px; }
.mode-control > select { margin-top:8px; }
.mode-row { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:35px; }
.mode-heading { display:flex; align-items:baseline; flex-wrap:wrap; gap:2px 9px; }
.autopilot-switch {
  appearance:none; position:relative; flex:0 0 43px; width:43px; height:24px; margin:0;
  border:1px solid #b2c5f655; border-radius:100px;
  background:linear-gradient(150deg,#5969878f,#34445e8a); cursor:pointer;
}
.autopilot-switch::before {
  position:absolute; left:2px; top:2px; width:18px; height:18px;
  content:""; border-radius:50%; background:#e1e9ff; box-shadow:0 1px 4px #10204585;
  transition:transform 150ms ease;
}
.autopilot-switch:checked { background:linear-gradient(130deg,#6784d8,#77a6e3); }
.autopilot-switch:checked::before { transform:translateX(19px); }
.autopilot-switch:disabled { opacity:.55; cursor:default; }
.queue { margin-top:18px; }
.queue-group + .queue-group { margin-top:18px; padding-top:14px; border-top:1px solid #c1d3ff29; }
.queue-heading { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.queue-heading h2 { margin:0; font-size:21px; }
.publisher .queue-heading { text-shadow:0 2px 8px #030c20d4; }
.queue-count {
  display:inline-grid; place-items:center; min-width:20px; height:20px; padding:0 5px;
  border-radius:7px; background:#839ddf25; color:#cfddfc; font-size:11px; font-weight:650;
}
.queue-count:empty { display:none; }
.archive-group > summary { margin-bottom:8px; font-weight:650; }
.task-list { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; }
.empty-queue { margin:0; padding:18px; border:1px dashed var(--line); border-radius:14px; color:var(--muted); }
.task-card {
  display:grid; grid-template-columns:74px minmax(0,1fr); gap:0 12px;
  min-width:0; position:relative; padding:11px;
  border:1px solid #b8c9fb26; border-radius:15px; background:#1b2235;
}
.task-picture {
  display:grid; place-items:center; position:relative; overflow:hidden; width:74px; height:74px;
  border-radius:10px; background:#26334d;
}
.task-picture img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.task-picture span { padding:4px; font-size:10px; text-align:center; }
.task-body { min-width:0; padding:1px 32px 0 0; }
.task-heading h3 { font-size:16px; letter-spacing:-.025em; overflow-wrap:anywhere; }
.task-status { margin:3px 0 0; color:var(--muted); font-size:12px; }
.task-status[data-state="ready"] { color:#95dbbf; }
.task-action { display:inline-block; margin-top:5px; font-size:13px; font-weight:600; }
.task-controls { display:flex; flex-wrap:wrap; gap:6px; margin-top:7px; }
.task-controls select { flex:1 1 100%; }
.task-controls button,.task-details button { min-height:32px; padding:4px 11px; font-size:13px; }
.task-details { grid-column:1/-1; min-width:0; }
.task-details > summary {
  display:grid; place-items:center; list-style:none; position:absolute; right:6px; top:5px;
  width:40px; height:40px; border-radius:10px;
}
.task-details > summary:hover { background:#eff2ff12; }
.task-details[open] { margin-top:10px; padding:9px 4px 2px; border-top:1px solid var(--line); }
.task-details .caption { margin-top:0; color:#e6edfa; font-size:14px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.autopilot-dialog {
  box-sizing:border-box;
  width:min(360px,calc(100% - 28px));
  max-height:calc(100% - 28px);
  overflow:auto;
  overscroll-behavior:contain;
  border:1px solid;
  border-radius:20px;
  padding:20px;
  color:var(--text);
}
.publisher .autopilot-dialog.glass {
  background:linear-gradient(145deg,#b4e4ff38,#89b6e51c 55%,#80b7d12c),#0c1b30d6;
  border-color:#d4edff54;
  box-shadow:inset 0 1px #eaf7ff54,0 20px 54px #030914a6;
}
.autopilot-dialog::backdrop { background:#06101e65; backdrop-filter:blur(5px); }
.autopilot-dialog h2 { margin:0 0 8px; font-size:18px; line-height:1.25; }
.autopilot-dialog p { margin:0 0 12px; color:var(--muted); }
.autopilot-dialog p.autopilot-account {
  width:fit-content;
  max-width:100%;
  box-sizing:border-box;
  border:1px solid #cfe6ff40;
  border-radius:10px;
  padding:4px 9px;
  background:#a4cbff18;
  color:var(--text);
  overflow-wrap:anywhere;
}
.dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:16px; }
@media (max-width:640px) {
  main { width:calc(100% - 24px); }
  .workspace { grid-template-columns:minmax(0,1fr); }
  .publisher main { width:calc(100% - 24px); margin-top:12px; }
  .queue { margin-top:17px; }
}
@media (prefers-reduced-transparency:reduce) {
  .glass,body:not(.publisher) > header { backdrop-filter:none; background:#1e2639; }
  .publisher .glass,.publisher .task-card,.publisher .app-bar.glass { backdrop-filter:none; background:#152438; }
  .publisher .autopilot-dialog.glass { background:#152438; }
  .autopilot-dialog::backdrop { backdrop-filter:none; background:#06101ebd; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { transition:none !important; }
}
