/* МультиПост — личный центр автопостинга. Автономные стили, без внешних ресурсов. */

:root {
  --bg: #f4f4fb;
  --bg-soft: #ececf6;
  --surface: #ffffff;
  --surface-2: #f8f8fd;
  --border: #e3e3ef;
  --text: #1c1c2e;
  --muted: #6b6b85;
  --accent: #6d5dfc;
  --accent-2: #8f7bff;
  --accent-soft: #efeaff;
  --accent-text: #4a3fd6;
  --ok: #17a673;
  --ok-soft: #e2f7ef;
  --warn: #d99000;
  --warn-soft: #fdf3dd;
  --err: #d64550;
  --err-soft: #fdeaec;
  --info: #2b7fd4;
  --info-soft: #e6f1fb;
  --shadow: 0 1px 2px rgba(28,28,46,.06), 0 8px 24px rgba(28,28,46,.07);
  --radius: 14px;
  --sidebar-w: 236px;
}
body[data-theme="dark"] {
  --bg: #13131d;
  --bg-soft: #1a1a28;
  --surface: #1e1e2c;
  --surface-2: #232334;
  --border: #2e2e42;
  --text: #ececf4;
  --muted: #9d9dba;
  --accent: #8f7bff;
  --accent-2: #a99bff;
  --accent-soft: #2a2547;
  --accent-text: #c3b8ff;
  --ok: #34c48c;
  --ok-soft: #1d3a30;
  --warn: #e8b052;
  --warn-soft: #3a3018;
  --err: #e56a74;
  --err-soft: #3d2026;
  --info: #6aa9e8;
  --info-soft: #1d2e42;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  color: var(--text); border: none; background: none; width: 100%;
  font: inherit; text-align: left;
}
.nav-item:hover { background: var(--bg-soft); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item .ic { flex-shrink: 0; }
.nav-sep { margin: 10px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sidebar-foot { margin-top: auto; padding: 10px 8px; font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 26px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 700; font-size: 17px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.burger { display: none; }
.content { padding: 24px 26px 60px; max-width: 1160px; width: 100%; }

@media (max-width: 920px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .burger { display: inline-flex; }
  .content { padding: 18px 14px 60px; }
  .topbar { padding: 12px 14px; }
}
.backdrop {
  position: fixed; inset: 0; background: rgba(10,10,25,.45); z-index: 55;
}

/* ---------- элементы ---------- */
.ic { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; }
.ic-lg { width: 22px; height: 22px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 12px; }
.card-muted { color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 920px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.metric-value { font-size: 26px; font-weight: 800; }
.metric-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 10px;
  padding: 8px 14px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn.danger:hover { background: var(--err-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon-only { padding: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.acc { background: var(--accent-soft); color: var(--accent-text); }
.badge.gray { background: var(--bg-soft); color: var(--muted); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; font-size: 13px;
}
.chip.selectable { cursor: pointer; user-select: none; }
.chip.selectable.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

label.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, .textarea, .select {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit;
}
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--accent-2); outline-offset: 0; border-color: var(--accent); }
.textarea { min-height: 140px; resize: vertical; }
.select { appearance: auto; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty {
  text-align: center; color: var(--muted); padding: 34px 16px;
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
}

/* календарь */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head div { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 92px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; font-size: 12px;
}
.cal-cell.out { opacity: .45; }
.cal-cell.today { border-color: var(--accent); }
.cal-day-num { font-weight: 700; margin-bottom: 4px; }
.cal-post {
  border-radius: 7px; padding: 3px 6px; margin-bottom: 4px;
  font-size: 11px; cursor: pointer; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; border: 1px solid transparent;
}
.cal-post.queued { background: var(--info-soft); color: var(--info); }
.cal-post.published { background: var(--ok-soft); color: var(--ok); }
.cal-post.draft { background: var(--bg-soft); color: var(--muted); }
@media (max-width: 700px) {
  .cal-cell { min-height: 60px; }
  .cal-post { display: none; }
  .cal-cell .cal-count { display: inline-block; }
}
.cal-count { display: none; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 1px 8px; font-weight: 700; }

/* графики */
.chart-bar { fill: var(--accent); }
.chart-axis { font-size: 11px; fill: var(--muted); }

/* лендинг */
.hero {
  background:
    radial-gradient(1000px 420px at 85% -10%, rgba(143,123,255,.25), transparent 60%),
    radial-gradient(800px 380px at -10% 110%, rgba(43,127,212,.18), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 46px 34px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 34px; max-width: 720px; }
.hero .lead { font-size: 17px; color: var(--muted); max-width: 640px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature-ic {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
}
.net-strip { display: flex; flex-wrap: wrap; gap: 8px; }

/* тосты и модалки */
#toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow);
  max-width: 340px; font-size: 14px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,10,25,.5); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.net-card { display: flex; flex-direction: column; gap: 10px; }
.net-card-top { display: flex; align-items: center; gap: 10px; }
.net-logo {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
}
.post-text { white-space: pre-wrap; }
.preview-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
@media (max-width: 600px) { .preview-truncate { max-width: 150px; } }

.note {
  border-left: 4px solid var(--info); background: var(--info-soft);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px;
}
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.section-h { margin: 26px 0 12px; }
code.inline {
  background: var(--bg-soft); border-radius: 6px; padding: 1px 6px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
pre.code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; overflow-x: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.5;
}
.variants > .card { margin-top: 12px; }
.editor-grid { grid-template-columns: 1.6fr 1fr; align-items: start; }
@media (max-width: 920px) { .editor-grid { grid-template-columns: 1fr; } }
.att-card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.sch-card { margin-bottom: 12px; }
.import-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 34px 16px; text-align: center;
  cursor: pointer; color: var(--muted);
}
.import-drop:hover { border-color: var(--accent); color: var(--accent-text); }
.spoil { background: var(--muted); color: transparent; border-radius: 4px; padding: 0 4px; cursor: pointer; }
.spoil:hover { color: var(--surface); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.media-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* v14: dropdown menu (accounts/pages tabs) */
.menu{background:var(--surface-2);border:1px solid rgba(128,128,128,.35);border-radius:10px;margin-top:8px;overflow:hidden;box-shadow:0 4px 16px rgba(0,0,0,.12)}
.menu-item{padding:10px 14px;font-size:14px;cursor:pointer}
.menu-item:hover{background:rgba(128,128,128,.12)}
.menu-item.danger{color:#e5484d}

.grid-7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
@media (max-width: 900px) { .grid-7 { grid-template-columns: repeat(2, 1fr); } }
