/* dreamdrop publisher admin — minimal clean theme */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f6f7f9;
  color: #1c1f23;
  font-size: 15px;
  line-height: 1.45;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid #e4e7eb;
}
.brand { font-weight: 600; color: #1c1f23; }
.nav-right { display: flex; gap: 16px; align-items: center; }
.username { color: #6b7280; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 24px 0 12px; font-size: 18px; }
.muted { color: #6b7280; }
.small { font-size: 13px; }
.error { color: #b91c1c; background: #fef2f2; border-left: 3px solid #b91c1c; padding: 8px 12px; margin: 8px 0; border-radius: 3px; }

/* login */
.login-card {
  max-width: 360px; margin: 80px auto; padding: 32px;
  background: #fff; border: 1px solid #e4e7eb; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.login-card h1 { margin-bottom: 4px; }
.login-card .subtitle { color: #6b7280; margin-top: 0; margin-bottom: 24px; }
.login-card label { display: block; margin-bottom: 16px; font-size: 13px; color: #374151; }
.login-card input { width: 100%; padding: 9px 11px; border: 1px solid #cbd5e0; border-radius: 5px; font-size: 14px; margin-top: 4px; }
.login-card button { width: 100%; padding: 10px; background: #2563eb; color: #fff; border: 0; border-radius: 5px; font-size: 14px; cursor: pointer; }
.login-card button:hover { background: #1d4ed8; }

/* tables */
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f3f5; vertical-align: top; }
th { background: #f9fafb; font-weight: 600; font-size: 13px; color: #374151; }
tr:last-child td { border-bottom: 0; }

.posts-table .when { white-space: nowrap; min-width: 140px; }
.badge { display: inline-block; background: #eef2ff; color: #4338ca; padding: 2px 6px; border-radius: 3px; font-size: 12px; margin-left: 6px; }

.status-pill {
  display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500;
}
.status-draft { background: #f3f4f6; color: #6b7280; }
.status-queued { background: #fef3c7; color: #92400e; }
.status-publishing { background: #dbeafe; color: #1e40af; }
.status-published { background: #d1fae5; color: #047857; }
.status-failed { background: #fee2e2; color: #b91c1c; }

/* form */
.post-form label { display: block; margin-bottom: 16px; font-weight: 500; }
.post-form .hint { display: block; font-weight: 400; color: #6b7280; font-size: 13px; margin-top: 4px; }
.post-form input[type="text"], .post-form input[type="datetime-local"], .post-form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cbd5e0; border-radius: 5px; font-size: 14px;
  font-family: inherit; margin-top: 4px;
}
.post-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; }
.post-form fieldset { border: 1px solid #e4e7eb; border-radius: 5px; padding: 12px 16px; margin-bottom: 16px; }
.post-form legend { padding: 0 6px; color: #374151; font-weight: 500; }
.post-form .inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-weight: 400; }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.btn { padding: 9px 20px; border: 0; border-radius: 5px; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.secondary { background: #e5e7eb; color: #374151; }
.btn.secondary:hover { background: #d1d5db; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.danger:hover { background: #fecaca; }
.link-button { background: 0; border: 0; color: #6b7280; cursor: pointer; padding: 0; font: inherit; }
.link-button:hover { color: #2563eb; text-decoration: underline; }

/* post view */
.post-card { background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; padding: 20px; }
.post-card .meta { color: #6b7280; font-size: 13px; margin-bottom: 12px; }
.post-card .post-body { white-space: pre-wrap; font-family: -apple-system, sans-serif; font-size: 15px; margin: 12px 0; }
.post-card .vk-tail { padding: 8px 12px; background: #f9fafb; border-radius: 4px; font-size: 13px; }
.photos { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.photos img { max-width: 200px; border-radius: 4px; }

/* nav links */
.nav-links { display: flex; gap: 16px; }
.nav-links a { color: #4b5563; font-size: 14px; }
.nav-links a:hover { color: #2563eb; text-decoration: none; }
.topnav { gap: 24px; }
.topnav .brand { flex-shrink: 0; }

/* dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; padding: 16px; }
.card-label { color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 28px; font-weight: 600; margin: 6px 0; }
.card-sub { font-size: 12px; color: #6b7280; }
.text-error { color: #b91c1c; }

/* post editor (split form + preview) */
.post-editor { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .post-editor { grid-template-columns: 1fr; } }
.preview-pane { background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; padding: 16px; position: sticky; top: 16px; }
.preview-pane h3 { margin-top: 0; font-size: 14px; color: #374151; }
.preview-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid #e4e7eb; }
.tab { padding: 6px 12px; background: 0; border: 0; cursor: pointer; font-size: 13px; color: #6b7280; border-bottom: 2px solid transparent; }
.tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 500; }
.preview-body { display: none; padding: 12px; background: #f9fafb; border-radius: 4px; min-height: 200px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.preview-body.active { display: block; }

/* drop zone */
.dropzone {
  border: 2px dashed #cbd5e0; border-radius: 6px; padding: 24px; text-align: center;
  background: #f9fafb; cursor: pointer; transition: all 0.15s; margin-top: 4px;
}
.dropzone:hover, .dropzone.over { border-color: #2563eb; background: #eff6ff; }
.dropzone-text { margin: 0; color: #6b7280; }
.dropzone .link { color: #2563eb; cursor: pointer; text-decoration: underline; }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.photo-thumb { position: relative; width: 100px; height: 100px; border-radius: 4px; overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0;
  border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.photo-thumb button:hover { background: #b91c1c; }

.btn.small { padding: 5px 12px; font-size: 13px; }

/* settings */
.success { color: #047857; background: #d1fae5; border-left: 3px solid #047857; padding: 8px 12px; margin: 8px 0; border-radius: 3px; }

/* page-head extra buttons */
.page-head-actions { display: flex; gap: 8px; align-items: center; }

/* filter bar */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
  background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; padding: 12px;
}
.filter-bar input[type="text"], .filter-bar input[type="date"], .filter-bar select {
  padding: 6px 10px; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 14px;
}
.filter-bar input[type="text"] { flex: 1; min-width: 180px; }

/* calendar grid */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: #e4e7eb; padding: 4px; border-radius: 6px; }
.cal-head { background: #f9fafb; text-align: center; padding: 8px 0; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; }
.cal-day { background: #fff; min-height: 100px; padding: 6px; border-radius: 3px; }
.cal-day.empty { background: #f9fafb; }
.cal-day.today { box-shadow: inset 0 0 0 2px #2563eb; }
.cal-num { font-size: 13px; color: #6b7280; margin-bottom: 4px; }
.cal-event {
  display: block; padding: 3px 6px; margin-bottom: 3px; border-radius: 3px;
  font-size: 12px; line-height: 1.3; text-decoration: none;
  background: #eef2ff; color: #4338ca; border-left: 3px solid #4338ca;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event.status-published { background: #d1fae5; color: #047857; border-left-color: #047857; }
.cal-event.status-failed { background: #fee2e2; color: #b91c1c; border-left-color: #b91c1c; }
.cal-event.status-queued { background: #fef3c7; color: #92400e; border-left-color: #92400e; }
.cal-event:hover { text-decoration: none; opacity: 0.9; }

/* form: char counter, autosave, product import, buttons */
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.char-count { font-size: 12px; color: #6b7280; font-weight: normal; }
.char-count.warn { color: #d97706; }
.char-count.error { color: #b91c1c; font-weight: 600; }

.autosave-status { font-size: 12px; color: #6b7280; height: 14px; margin-bottom: 8px; }

.product-import {
  display: flex; gap: 8px; align-items: center; margin: -8px 0 16px;
  flex-wrap: wrap;
}
.product-import input[type="text"] {
  flex: 1; min-width: 240px; padding: 7px 10px; border: 1px solid #cbd5e0;
  border-radius: 4px; font-size: 13px;
}
.product-import .hint { color: #6b7280; font-size: 12px; }

.btn-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.btn-edit { display: flex; gap: 4px; align-items: center; }
.btn-edit input[type="text"] { padding: 5px 8px; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 13px; width: 130px; }
.btn-edit button {
  background: #fee2e2; color: #b91c1c; border: 0; width: 24px; height: 24px;
  border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.btn-edit button:hover { background: #fecaca; }

.existing-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.tg-buttons-preview { background: #f0f9ff; border-left: 3px solid #0284c7; padding: 8px 12px; margin-top: 12px; font-size: 13px; }
.tg-buttons-preview pre { margin: 4px 0 0; font-size: 12px; color: #6b7280; }

/* compare */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 800px) { .compare-grid { grid-template-columns: 1fr; } }
.metric-row { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.metric { background: #f9fafb; padding: 8px 14px; border-radius: 6px; text-align: center; font-size: 12px; color: #6b7280; flex: 1; min-width: 80px; }
.metric b { font-size: 18px; color: #1c1f23; display: block; }
