:root {
  --bg: #f5f3ef;
  --card: #ffffff;
  --ink: #1d1c1a;
  --ink-soft: #6b6862;
  --line: #e3ded6;
  --accent: #9a6b3f;
  --accent-dark: #7d5530;
  --ok: #2f7d4f;
  --warn: #b07a1e;
  --err: #a83a32;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 30px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  letter-spacing: .5px;
}
.brand-text { font-weight: 600; letter-spacing: .3px; }
.brand-text em { font-style: normal; font-weight: 400; color: var(--ink-soft); font-size: 13px; }

.nav { display: flex; gap: 6px; }
.nav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
}
.nav a:hover { background: #f3f0eb; text-decoration: none; }
.nav a.active { background: #f0ece5; color: var(--ink); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: var(--ink-soft); font-size: 13px; }

.page { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0 0 2px; font-size: 24px; letter-spacing: -.3px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: .2px; text-transform: uppercase; color: var(--ink-soft); }
.card h3 { margin: 0 0 10px; font-size: 14px; }

.empty { text-align: center; padding: 50px 20px; }
.empty p { color: var(--ink-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: #f0ece5;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #e9e3d9; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #33312d; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: #f7f4ef; }
.btn-block { width: 100%; margin-top: 8px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(154, 107, 63, .12);
}
.field textarea { resize: vertical; min-height: 160px; }

.check-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.check-title { flex: 1; }
.ok-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.side { display: grid; gap: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.chip:hover { text-decoration: none; border-color: #cfc7ba; }
.chip-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.posts { display: grid; gap: 10px; }
.post-row { display: flex; gap: 16px; padding: 16px 20px; color: var(--ink); }
.post-row:hover { text-decoration: none; border-color: #cfc7ba; box-shadow: 0 2px 10px rgba(29,28,26,.05); }
.post-row-main { flex: 1; min-width: 0; }
.post-row-title { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.post-row-text { margin: 0 0 8px; color: var(--ink-soft); }
.post-row-meta { display: flex; gap: 16px; font-size: 12.5px; color: #9a958d; }
.post-row-side { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.target-dot { width: 9px; height: 9px; border-radius: 50%; background: #d5d0c7; display: inline-block; }
.target-sent { background: var(--ok); }
.target-failed { background: var(--err); }
.target-skipped { background: #cfc9bf; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: #f0ece5; color: var(--ink-soft); }
.badge-published { background: #e4f1e9; color: var(--ok); }
.badge-partial { background: #fbf0dc; color: var(--warn); }
.badge-failed { background: #f8e4e2; color: var(--err); }
.badge-scheduled { background: #e9edf7; color: #3b5aa6; }
.badge-pending { background: #f3ecdc; color: var(--warn); }
.badge-publishing { background: #e9edf7; color: #3b5aa6; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: #f8e4e2; color: var(--err); border: 1px solid #eccac6; }

.login-wrap { display: grid; place-items: center; min-height: 70vh; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }

.media-block { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.media-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.media-item { position: relative; width: 110px; height: 110px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: #faf8f4; }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-file { display: grid; place-items: center; height: 100%; font-size: 11px; padding: 6px; text-align: center; color: var(--ink-soft); }
.media-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(29,28,26,.72); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer;
}

.results { margin-top: 18px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-soft); font-weight: 600; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.log li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px dashed #eee9e1; }
.log-time { color: #9a958d; white-space: nowrap; }
.log-platform { color: var(--accent-dark); min-width: 86px; }
.log-error { color: var(--err); }
.log-warning { color: var(--warn); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; align-items: start; }
.setting-card { display: flex; flex-direction: column; }
.setting-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.setting-head h2 { margin: 0; font-size: 16px; text-transform: none; color: var(--ink); }
.status-pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #f0ece5; color: var(--ink-soft); }
.status-pill.ok { background: #e4f1e9; color: var(--ok); }
.status-pill.fail { background: #f8e4e2; color: var(--err); }
.setting-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.setting-result { margin-top: 10px; min-height: 18px; }
.setting-result.ok { color: var(--ok); }
.setting-result.fail { color: var(--err); }
.err-text { color: var(--err); }

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .page { padding: 18px 14px 50px; }
  .post-row { flex-direction: column; }
}
