:root {
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --panel-2: #f8f5ee;
  --ink: #1f2a2c;
  --ink-2: #4b5759;
  --ink-3: #7c8789;
  --line: #e3ddd0;
  --line-2: #d4ccbb;
  --brand: #234e52;
  --brand-ink: #f6e7c1;
  --accent: #c2662d;
  --ok: #2f7d4f;
  --warn: #b7791f;
  --bad: #b23b3b;
  --li: #2867b2;
  --ig: #c13584;
  --fb: #3b5bdb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 44, .06), 0 4px 16px rgba(31, 42, 44, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1b; --panel: #1b2324; --panel-2: #212b2c; --ink: #e9e4d8; --ink-2: #b9b4a8; --ink-3: #868b88;
    --line: #2c3637; --line-2: #3a4647; --brand: #7fb5b0; --brand-ink: #10191a; --accent: #e08a52;
    --ok: #5cb57f; --warn: #e0a84a; --bad: #e07070; --li: #6ea8e8; --ig: #e46fb5; --fb: #7d93f0;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--ink-3); }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--panel) 219px, var(--line) 219px, var(--line) 220px, transparent 220px); }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; padding: 4px 10px 18px; }
.logo i { width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-style: normal; font-size: 15px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { background: var(--brand); color: var(--brand-ink); }
.nav a .count { font-size: 12px; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-weight: 600; }
.side .grow { flex: 1; }
.me { font-size: 13px; color: var(--ink-3); padding: 10px; border-top: 1px solid var(--line); }
.me b { color: var(--ink); display: block; }
.me button { margin-top: 6px; }
.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.top .sub { color: var(--ink-3); font-size: 13px; }
.autopill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.autopill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.autopill.on .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; border: 1px solid currentColor; white-space: nowrap; }
.chip.linkedin { color: var(--li); } .chip.instagram { color: var(--ig); } .chip.facebook { color: var(--fb); }
.st { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; white-space: nowrap; background: var(--panel-2); color: var(--ink-2); }
.st.pending_review { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.st.approved { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.st.published { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st.rejected, .st.failed { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.st.publishing { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.flag { font-size: 12px; color: var(--bad); font-weight: 600; }

/* cards & tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel.pad { padding: 18px 20px; }
.panel h2 { font-size: 15px; margin: 0 0 4px; }
.panel h2 + .hint { margin: 0 0 14px; }
.stack > * + * { margin-top: 16px; }
.day-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 22px 0 8px; }
.card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.card:last-child { border-bottom: 0; }
.card:hover { background: var(--panel-2); }
.card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.card .ttl { font-weight: 600; }
.card .ex { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .acts { display: flex; gap: 6px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel-2); }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dh { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-transform: uppercase; }
.cal .d { min-width: 0; min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); }
.cal .d.out { background: var(--panel-2); opacity: .6; }
.cal .d.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .n { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; border-left: 3px solid; background: var(--panel-2); color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.linkedin { border-color: var(--li); } .ev.instagram { border-color: var(--ig); } .ev.facebook { border-color: var(--fb); }
.ev.published { opacity: .55; text-decoration: line-through; }
.ev.rejected, .ev.failed { color: var(--bad); }

/* post editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.counter { font-size: 12px; color: var(--ink-3); text-align: right; margin-top: 4px; }
.counter.over { color: var(--bad); font-weight: 600; }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.media .m { position: relative; aspect-ratio: 4/5; border-radius: 8px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
.media .m img, .media .m video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .m button { position: absolute; top: 4px; right: 4px; border: 0; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; width: 24px; height: 24px; cursor: pointer; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 8px; padding: 14px; text-align: center; color: var(--ink-3); font-size: 13px; cursor: pointer; }
.drop.over { border-color: var(--brand); color: var(--brand); }
.preview { padding: 16px; }
.preview .who { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.preview .av { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.preview .txt { white-space: pre-wrap; word-wrap: break-word; }
.preview .txt .more { color: var(--ink-3); }
.preview .img { margin-top: 10px; border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.preview .img img { width: 100%; display: block; }
.brief { white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.notes { border-left: 3px solid var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; }
.error { border-left: 3px solid var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; white-space: pre-wrap; font-size: 13px; }
.acts-panel { display: flex; flex-direction: column; gap: 8px; }
.acts-panel .btn { justify-content: center; }
.log { font-size: 13px; color: var(--ink-2); }
.log div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.log time { color: var(--ink-3); font-size: 12px; display: block; }

/* switches */
.sw { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sw:last-child { border-bottom: 0; }
.sw .lbl b { display: block; }
.sw .lbl span { font-size: 13px; color: var(--ink-3); }
.toggle { position: relative; width: 46px; height: 26px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle i { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: .15s; cursor: pointer; }
.toggle i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.toggle input:checked + i { background: var(--ok); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:disabled + i { opacity: .5; cursor: not-allowed; }
.toggle input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.code { font-family: var(--mono); font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; word-break: break-all; }
ol.steps { padding-left: 20px; margin: 8px 0 0; color: var(--ink-2); }
ol.steps li { margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--brand); font-weight: 600; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 380px; padding: 28px; }
.auth h1 { margin: 0 0 4px; font-size: 22px; }
.auth p { color: var(--ink-3); margin: 0 0 20px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 21, .45); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal { background: var(--panel); border-radius: 12px; padding: 22px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 12px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .side .grow, .me { display: none; }
  .logo { padding: 0 8px 0 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .main { padding: 16px; }
  .editor, .grid2 { grid-template-columns: 1fr; }
  .card { grid-template-columns: auto 1fr; gap: 10px; }
  .card .acts { grid-column: 2; }
  .cal .d { min-height: 70px; }
  .ev { font-size: 11px; }
}

.sw .row { flex-wrap: nowrap; }
