* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #171717; background: #f7f7f8; }
button, input, textarea, select { font: inherit; }
button { border: 0; background: #171717; color: #fff; padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight: 650; }
button.secondary { background: #e7e7e9; color: #171717; }
button:hover { opacity: .9; }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #d8d8dc; border-radius: 10px; background: #fff; margin: 6px 0 14px; }
label { font-weight: 700; display: block; margin-top: 10px; }
#app { display: grid; grid-template-columns: 285px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid #e5e5e7; padding: 22px 18px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: #171717; color: #fff; display: grid; place-items: center; font-weight: 900; }
.brand h1 { font-size: 17px; margin: 0; }
.brand p { margin: 2px 0 0; color: #777; font-size: 13px; }
nav { display: grid; gap: 8px; }
.nav { width: 100%; text-align: left; background: transparent; color: #555; border-radius: 10px; }
.nav.active { background: #171717; color: #fff; }
.status-box { margin-top: auto; padding: 14px; background: #f6f6f7; border-radius: 14px; }
.badge { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; margin-bottom: 10px; }
.badge.good { background: #e8f8ee; color: #137333; }
.badge.warning { background: #fff4d8; color: #8a5a00; }
.badge.bad { background: #ffe8e8; color: #a40000; }
main { padding: 34px; overflow: auto; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 24px; }
.page-head h2 { font-size: 34px; margin: 0 0 5px; }
.page-head p { color: #666; margin: 0; }
.grid.cards { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric { background: #fff; border: 1px solid #e5e5e8; padding: 22px; border-radius: 16px; }
.metric span { display: block; font-size: 36px; font-weight: 900; }
.metric label { color: #666; margin: 0; }
.panel { background: #fff; border: 1px solid #e5e5e8; border-radius: 16px; padding: 20px; margin-bottom: 18px; }
.panel h3 { margin-top: 0; }
.two-col { display: grid; grid-template-columns: minmax(360px, 560px) 1fr; gap: 18px; align-items: start; }
.file-picker { display: inline-block; border: 1px dashed #aaa; padding: 18px; border-radius: 14px; cursor: pointer; margin-right: 10px; }
.file-picker input { display: none; }
.status-line { margin-top: 12px; color: #555; white-space: pre-wrap; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.media-card { background: #fff; border: 1px solid #e5e5e8; border-radius: 16px; padding: 12px; }
.media-card img, .media-card video { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; background: #eee; }
.media-card h4 { margin: 10px 0 4px; font-size: 15px; word-break: break-word; }
.media-card small { color: #666; }
.media-card a { display: inline-block; margin-top: 8px; color: #0b57d0; word-break: break-word; }
.select-list { display: grid; gap: 8px; margin-bottom: 16px; max-height: 260px; overflow: auto; }
.select-item { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid #e4e4e8; border-radius: 12px; cursor: pointer; }
.select-item input { width: auto; margin: 0; }
.select-item.selected { border-color: #171717; background: #f4f4f5; }
.preview-box { min-height: 380px; background: #f1f1f2; border-radius: 16px; display: grid; place-items: center; color: #777; overflow: hidden; }
.preview-box img, .preview-box video { width: 100%; max-height: 460px; object-fit: contain; background: #000; }
.preview-text { white-space: pre-wrap; }
.muted { color: #777; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { padding: 8px 10px; background: #f1f1f2; border: 1px solid #e1e1e5; border-radius: 999px; font-size: 13px; }
.post-list { display: grid; gap: 14px; }
.post-card { background: #fff; border: 1px solid #e5e5e8; border-radius: 16px; padding: 18px; }
.post-card .meta { color: #666; font-size: 13px; margin-bottom: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.result-box { background: #111; color: #e6e6e6; padding: 14px; border-radius: 12px; overflow: auto; min-height: 90px; white-space: pre-wrap; }
#toast { position: fixed; right: 24px; top: 24px; display: grid; gap: 10px; z-index: 1000; }
.toast { background: #171717; color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.2); max-width: 360px; }
.toast.error { background: #bd1e1e; }
.toast.good { background: #137333; }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .two-col, .grid.cards { grid-template-columns: 1fr; }
}
