:root {
  color-scheme: light;
  --ink: #171915;
  --paper: #f4f1e9;
  --panel: #fffdf8;
  --line: #dcd7ca;
  --muted: #6f716a;
  --accent: #d8ff4f;
  --accent-dark: #9cbd21;
  --danger: #c53c32;
  --success: #3e7d52;
  --shadow: 0 18px 50px rgba(39, 38, 31, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.app-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--ink); color: white; padding: 26px 18px 20px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { color: #a7aaa2; font-size: 12px; margin-top: 3px; }
.brand-mark { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--accent); color: var(--ink); font: 800 25px/1 Georgia, serif; }
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px; font-size: 19px; }
nav { display: grid; gap: 5px; }
.nav-item { appearance: none; border: 0; background: transparent; color: #c8cbc4; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 12px 13px; border-radius: 12px; cursor: pointer; transition: .16s ease; }
.nav-item:hover { background: #242721; color: white; }
.nav-item.active { background: #30342b; color: white; }
.nav-item span { font-size: 18px; }
.nav-item b { font-size: 11px; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center; background: var(--accent); color: var(--ink); border-radius: 20px; }
.nav-item b:empty { display: none; }
.sidebar-bottom { margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid #33362f; }
.connection { display: flex; align-items: center; gap: 8px; color: #b5b8b0; font-size: 12px; line-height: 1.35; }
.connection i { width: 8px; height: 8px; background: #a7aaa2; border-radius: 50%; flex: 0 0 auto; }
.connection.connected i { background: var(--accent); box-shadow: 0 0 0 4px rgba(216,255,79,.11); }
.text-button { background: transparent; color: #979a93; border: 0; padding: 14px 0 0; cursor: pointer; font-size: 12px; }
.workspace { min-width: 0; }
.topbar { min-height: 112px; padding: 28px clamp(22px, 4vw, 58px) 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(244,241,233,.88); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 8; }
.topbar h1 { margin: 2px 0 0; font: 600 clamp(27px, 3vw, 38px)/1.05 Georgia, serif; }
.eyebrow { font-size: 10px; letter-spacing: .18em; font-weight: 800; color: var(--muted); margin: 0; }
.content { padding: 34px clamp(22px, 4vw, 58px) 80px; max-width: 1500px; width: 100%; margin: 0 auto; }
.button { border: 1px solid var(--line); border-radius: 12px; padding: 11px 16px; background: var(--panel); cursor: pointer; font-weight: 700; transition: .15s ease; }
.button:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(20,20,15,.08); }
.button:disabled { opacity: .5; cursor: wait; transform: none; box-shadow: none; }
.button.primary { background: var(--accent); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.button.primary:hover { box-shadow: 1px 1px 0 var(--ink); transform: translate(2px,2px); }
.button.dark { background: var(--ink); color: white; border-color: var(--ink); }
.button.ghost { background: transparent; }
.button.danger { color: var(--danger); border-color: #e3b5b1; }
.button.full { width: 100%; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.metric, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.metric { padding: 21px; min-height: 136px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font: 600 38px/1 Georgia, serif; }
.metric em { color: var(--muted); font-size: 11px; font-style: normal; }
.panel { margin-top: 17px; padding: 24px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel h2 { font: 600 23px/1.2 Georgia, serif; margin: 0; }
.panel h3 { margin: 0; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px,.75fr); gap: 17px; }
.job-progress { height: 10px; background: #e5e0d4; border-radius: 99px; overflow: hidden; margin: 18px 0 10px; }
.job-progress > i { display: block; height: 100%; background: var(--ink); border-radius: inherit; transition: width .4s ease; }
.job-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.status-pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 6px 9px; background: #e8e4d9; font-size: 11px; font-weight: 800; }
.status-pill.running, .status-pill.queued { background: #ecf7c7; }
.status-pill.failed { background: #fae0dd; color: var(--danger); }
.status-pill.published, .status-pill.completed { background: #dcecdf; color: var(--success); }
.empty { text-align: center; padding: 64px 24px; }
.empty .empty-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: #ebe7dc; margin: 0 auto 17px; font-size: 25px; }
.empty h2 { margin: 0 0 8px; }
.draft-list { display: grid; gap: 24px; max-width: 920px; margin: 0 auto; }
.draft-card { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.draft-media { background: #1a1b19; min-height: 360px; max-height: 680px; display: grid; place-items: center; overflow: hidden; }
.draft-media img { display: block; width: 100%; height: 100%; min-height: 360px; max-height: 680px; object-fit: contain; }
.draft-copy { padding: clamp(20px, 4vw, 34px); }
.draft-copy h2 { font: 600 24px/1.25 Georgia, serif; margin: 0 0 20px; }
.caption-wrap { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; }
.caption-wrap textarea { width: 100%; resize: vertical; min-height: 152px; border: 0; outline: 0; background: transparent; padding: 18px; line-height: 1.55; font-size: 16px; color: var(--ink); }
.caption-tools { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 9px 12px; gap: 10px; }
.caption-tools span { font-size: 11px; color: var(--muted); }
.caption-tools span.over { color: var(--danger); font-weight: 800; }
.draft-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.draft-facts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 15px; font-size: 11px; color: var(--muted); }
.draft-facts a { color: inherit; }
.queue-list, .source-list, .activity-list { display: grid; gap: 10px; }
.queue-item, .source-item, .activity-item { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; align-items: center; gap: 14px; }
.queue-item { grid-template-columns: 76px minmax(0,1fr) auto; }
.queue-thumb { width: 76px; height: 76px; object-fit: cover; border-radius: 11px; background: #ddd; }
.queue-item p { margin: 5px 0 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.queue-actions { display: flex; align-items: center; gap: 8px; }
.source-item { grid-template-columns: minmax(0,1fr) auto; }
.source-item p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #cbc7bc; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 2px 5px #7775; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--accent); }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.settings-section { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.settings-section.wide { grid-column: 1 / -1; }
.settings-section h2 { font: 600 21px/1.2 Georgia, serif; margin: 0 0 8px; }
.settings-section > p { margin: 0 0 19px; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field > span { font-weight: 700; font-size: 12px; }
.field small { color: var(--muted); line-height: 1.35; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: white; padding: 11px 12px; outline: 0; color: var(--ink); }
.field textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,25,21,.08); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.activity-item { grid-template-columns: 42px minmax(0,1fr) auto; }
.activity-icon { width: 42px; height: 42px; border-radius: 12px; background: #ece8dc; display: grid; place-items: center; }
.timeline { padding: 2px 0 2px 17px; border-left: 1px solid var(--line); margin: 16px 0 0 7px; display: grid; gap: 13px; }
.timeline-item { position: relative; font-size: 13px; }
.timeline-item::before { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); left: -21px; top: 5px; }
.timeline-item span { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.login-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-card { width: min(420px,100%); background: var(--panel); border-radius: 24px; padding: 34px; box-shadow: 0 30px 90px #0008; }
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { font: 600 33px/1.1 Georgia,serif; margin: 7px 0 10px; }
.login-card .muted { line-height: 1.5; margin: 0 0 24px; }
.form-error { min-height: 19px; color: var(--danger); font-size: 12px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; width: min(390px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: white; border: 1px solid #42463d; padding: 14px 16px; border-radius: 13px; box-shadow: 0 16px 40px #0003; animation: toast-in .2s ease; font-size: 13px; }
.toast.error { border-color: #a94239; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.skeleton { background: linear-gradient(90deg,#e9e5da,#f4f1e9,#e9e5da); background-size: 200% 100%; animation: shine 1.2s infinite; border-radius: 12px; min-height: 110px; }
@keyframes shine { to { background-position: -200% 0; } }
@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; padding-bottom: 72px; }
  .sidebar { position: fixed; z-index: 20; inset: auto 0 0; width: auto; height: 67px; padding: 7px 8px max(7px,env(safe-area-inset-bottom)); display: block; border-top: 1px solid #33362f; }
  .brand, .sidebar-bottom { display: none; }
  nav { display: grid; grid-template-columns: repeat(6,1fr); gap: 2px; }
  .nav-item { display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; padding: 7px 2px; font-size: 9px; border-radius: 9px; position: relative; }
  .nav-item span { font-size: 16px; }
  .nav-item b { position: absolute; top: 1px; right: 13%; }
  .topbar { min-height: 88px; padding: 18px 17px; }
  .topbar h1 { font-size: 28px; }
  .topbar .button { padding: 10px 12px; font-size: 12px; }
  .content { padding: 20px 13px 50px; }
  .cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .metric { padding: 15px; min-height: 108px; }
  .metric strong { font-size: 30px; }
  .panel { padding: 17px; }
  .draft-media, .draft-media img { min-height: 300px; max-height: 520px; }
  .draft-copy { padding: 19px 15px 20px; }
  .draft-copy h2 { font-size: 20px; }
  .draft-actions .button { flex: 1 1 calc(50% - 9px); font-size: 12px; }
  .queue-item { grid-template-columns: 58px minmax(0,1fr); }
  .queue-thumb { width: 58px; height: 58px; }
  .queue-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .settings-grid { grid-template-columns: 1fr; }
}
