* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; color: #1d2939; background: #f9fafb; }
header { display: flex; justify-content: space-between; align-items: center; padding: 16px 32px; background: #1d2939; color: #fff; }
header h1 { margin: 0; font-size: 1.2rem; font-weight: 600; }
#user-info { font-size: 0.9rem; opacity: 0.85; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 32px; }
button { background: #2e90fa; color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
button:hover { background: #1570cd; }
button.secondary { background: #e5e7eb; color: #1d2939; }
button.secondary:hover { background: #d2d6db; }
button.danger { background: #d92d20; }
button.danger:hover { background: #b42318; }
.actions { display: flex; gap: 8px; margin-bottom: 24px; }
form { background: #fff; padding: 16px; border-radius: 8px; border: 1px solid #e5e7eb; margin-bottom: 24px; }
form label { display: block; margin-bottom: 12px; font-size: 0.9rem; font-weight: 500; }
form input, form textarea, form select { width: 100%; margin-top: 4px; padding: 8px; border: 1px solid #d2d6db; border-radius: 6px; font-family: inherit; font-size: 0.9rem; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid #e5e7eb; table-layout: fixed; }
#news-table th:nth-child(1), #news-table td:nth-child(1) { width: 24%; }
#news-table th:nth-child(2), #news-table td:nth-child(2) { width: 36%; }
#news-table th:nth-child(3), #news-table td:nth-child(3) { width: 12%; text-align: center; }
#news-table th:nth-child(4), #news-table td:nth-child(4) { width: 11%; }
#news-table th:nth-child(5), #news-table td:nth-child(5) { width: 11%; }
#news-table th:nth-child(6), #news-table td:nth-child(6) { width: 6%; text-align: center; }
#news-table .news-image { display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 0.8rem; }
#news-table .news-image img { max-width: 80px; max-height: 60px; border-radius: 4px; border: 1px solid #e5e7eb; }
#news-table .news-image button { padding: 4px 8px; font-size: 0.75rem; }
#news-table .news-image input[type="file"] { display: none; }
#news-table td pre { white-space: pre-wrap; word-wrap: break-word; margin: 0; font-family: inherit; font-size: 0.85rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; font-size: 0.9rem; word-wrap: break-word; }
th { background: #f2f4f7; font-weight: 600; }
td .row-actions { display: flex; gap: 6px; justify-content: center; }
td .row-actions button { padding: 4px 10px; font-size: 0.8rem; }
button.btn-icon { padding: 4px 6px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
button.btn-icon svg { width: 14px; height: 14px; display: block; }
td select { padding: 4px 6px; border: 1px solid #d2d6db; border-radius: 4px; font-size: 0.85rem; }
#toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 16px; background: #1d2939; color: #fff; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
#toast.error { background: #d92d20; }
#news-status, #platforms-status { margin: 8px 0; font-size: 0.85rem; color: #475467; }
#platforms-table { margin-bottom: 24px; }
#platforms-table th:nth-child(5), #platforms-table td:nth-child(5) { width: 90px; text-align: center; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 22px; transition: background 0.15s; }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: #2e90fa; }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: 0.6; cursor: wait; }

/* Drafts list */
.drafts-toolbar { display: flex; gap: 16px; align-items: end; margin: 8px 0 12px; flex-wrap: wrap; }
.drafts-toolbar label { font-size: 0.85rem; color: #475467; display: flex; flex-direction: column; gap: 4px; }
.drafts-toolbar select { padding: 6px 8px; border: 1px solid #d2d6db; border-radius: 6px; font-size: 0.9rem; min-width: 140px; }
#drafts-status { font-size: 0.85rem; color: #475467; align-self: center; }
#drafts-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.draft-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; display: grid; grid-template-columns: 1fr 100px; gap: 12px; }
.draft-card-main { min-width: 0; }
.draft-card-headline { font-size: 0.85rem; color: #475467; margin-bottom: 4px; }
.draft-card-title { font-weight: 600; margin-bottom: 6px; }
.draft-card-body { white-space: pre-wrap; font-size: 0.9rem; margin-bottom: 8px; }
.draft-card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.8rem; }
.draft-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.draft-card-tag { background: #eff8ff; color: #175cd3; padding: 2px 8px; border-radius: 12px; font-size: 0.78rem; }
.draft-card-image { width: 100px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; }
.draft-card-image-placeholder { width: 100px; height: 100px; border-radius: 6px; border: 1px dashed #d2d6db; display: flex; align-items: center; justify-content: center; color: #98a2b3; font-size: 0.75rem; text-align: center; }
.draft-card-media { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.draft-card-media-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.draft-media-btn { padding: 4px 8px !important; font-size: 0.75rem !important; }
.draft-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.draft-card-actions button { padding: 6px 12px; font-size: 0.85rem; }
.draft-platform-badge { background: #1d2939; color: #fff; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.draft-status-badge { padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.draft-status-draft { background: #f2f4f7; color: #475467; }
.draft-status-posting { background: #e0f2fe; color: #026aa2; }
.draft-status-posted { background: #d1fadf; color: #027a48; }
.draft-status-failed { background: #fee4e2; color: #b42318; }
.draft-edit-form { display: flex; flex-direction: column; gap: 8px; }
.draft-edit-form input, .draft-edit-form textarea { width: 100%; padding: 6px 8px; border: 1px solid #d2d6db; border-radius: 4px; font-family: inherit; font-size: 0.9rem; }
.draft-edit-form textarea { resize: vertical; min-height: 80px; }

/* Status card (Meta token) */
.status-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; margin-bottom: 24px; max-width: 600px; }
.status-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.status-card-title { font-weight: 600; }
.status-card-body { font-size: 0.9rem; color: #475467; margin-bottom: 12px; }
.status-card-actions { display: flex; gap: 8px; }
.status-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.status-dot-ok { background: #12b76a; }
.status-dot-expiring { background: #f79009; }
.status-dot-expired { background: #d92d20; }
.status-dot-unknown { background: #98a2b3; }
