*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --accent: #CD412B;
    --accent-hover: #b8351f;
    --bg: #f5f4f0;
    --bg-card: #fff;
    --bg-sidebar: #fff;
    --border: rgba(0,0,0,0.1);
    --border-med: rgba(0,0,0,0.15);
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-hint: #999;
    --radius: 8px;
    --radius-lg: 12px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: var(--bg); color: var(--text); line-height: 1.5; }

a { text-decoration: none; color: inherit; }

#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.nav-sidebar { background: var(--bg-sidebar); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; padding: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav-logo { display: flex; align-items: center; gap: 8px; padding: 18px 16px 14px; font-weight: 600; font-size: 15px; border-bottom: 0.5px solid var(--border); }
.nav-logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
nav { padding: 8px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--radius); color: var(--text-muted); font-size: 13px; transition: all .15s; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: #fdf0ee; color: var(--accent); font-weight: 500; }
.nav-bottom { padding: 12px; border-top: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.btn-logout { width: 100%; padding: 7px; border: 0.5px solid var(--border-med); border-radius: var(--radius); background: transparent; cursor: pointer; font-size: 12px; color: var(--text-muted); }
.btn-logout:hover { background: #fdf0ee; color: var(--accent); border-color: var(--accent); }

.main-content { padding: 24px 28px; max-width: 1100px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.btn-primary { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 500; transition: background .15s; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { padding: 8px 16px; background: transparent; border: 0.5px solid var(--border-med); border-radius: var(--radius); cursor: pointer; font-size: 13px; color: var(--text); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { padding: 8px 16px; background: #dc2626; color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.btn-outline { padding: 7px 14px; background: transparent; border: 0.5px solid var(--border-med); border-radius: var(--radius); cursor: pointer; font-size: 13px; color: var(--text); transition: all .15s; }
.btn-outline:hover { background: var(--bg); border-color: var(--border-med); }

.filters-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.status-tabs { display: flex; gap: 4px; background: var(--bg-card); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 3px; }
.tab { padding: 5px 12px; border-radius: 6px; border: none; background: transparent; cursor: pointer; font-size: 12px; color: var(--text-muted); transition: all .15s; }
.tab.active { background: var(--accent); color: #fff; }
.search-input { padding: 7px 12px; border: 0.5px solid var(--border); border-radius: var(--radius); background: var(--bg-card); font-size: 13px; width: 220px; }

.messages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.msg-card { background: var(--bg-card); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; transition: border-color .15s; }
.msg-card:hover { border-color: var(--border-med); }
.msg-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.msg-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; }
.msg-badge[data-status="draft"] { background: #f1f0eb; color: #666; }
.msg-badge[data-status="scheduled"] { background: #fef3c7; color: #92400e; }
.msg-badge[data-status="published"] { background: #d1fae5; color: #065f46; }
.msg-badge[data-status="error"] { background: #fee2e2; color: #991b1b; }
.msg-badge[data-status="paused"] { background: #e0e7ff; color: #3730a3; }
.msg-type { font-size: 11px; color: var(--text-hint); margin-left: auto; }
.msg-card-actions { display: flex; gap: 4px; }
.icon-btn { background: transparent; border: none; cursor: pointer; padding: 4px 6px; border-radius: 5px; font-size: 13px; color: var(--text-muted); }
.icon-btn:hover { background: var(--bg); }
.msg-card-title { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.msg-card-meta { font-size: 12px; color: var(--text-hint); }
.msg-card-schedule { font-size: 11px; color: var(--text-hint); margin-top: 6px; min-height: 16px; }

.loading-row, .empty-row, .error-row { grid-column: 1/-1; text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

.pagination { display: flex; gap: 6px; margin-top: 20px; justify-content: center; }
.page-btn { padding: 6px 12px; border: 0.5px solid var(--border); border-radius: var(--radius); background: var(--bg-card); cursor: pointer; font-size: 13px; }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay[style*="flex"] { display: flex !important; }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; min-width: 360px; max-width: 500px; width: 90%; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: transparent; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--bg); }
.modal-text { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.modal-body { margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-wide { max-width: 480px; }
.modal-preview { max-width: 720px; width: 95%; }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.form-input { padding: 7px 10px; border: 0.5px solid var(--border-med); border-radius: var(--radius); font-size: 13px; background: var(--bg); color: var(--text); }
.form-input:focus { outline: none; border-color: var(--accent); }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.form-row { display: flex; gap: 10px; }
.radio-group { display: flex; gap: 12px; }
.radio-item { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--bg-card); border: 0.5px solid var(--border); border-radius: 16px; padding: 40px; max-width: 380px; width: 90%; text-align: center; }
.login-logo { margin-bottom: 28px; }
.login-logo-icon { width: 48px; height: 48px; background: var(--accent); border-radius: 12px; margin: 0 auto 12px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--text-muted); }
.login-error { background: #fee2e2; color: #991b1b; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.btn-discord { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 24px; background: #5865F2; color: #fff; border-radius: var(--radius); font-size: 14px; font-weight: 500; transition: background .15s; }
.btn-discord:hover { background: #4752c4; }

.discord-preview-wrap { background: #36393f; border-radius: 8px; padding: 16px; min-height: 100px; }
.dc-container { border-left: 4px solid #CD412B; background: #2f3136; border-radius: 4px; margin-bottom: 8px; overflow: hidden; }
.dc-container-inner { padding: 8px 12px; }
.dc-text { color: #dcddde; font-size: 14px; line-height: 1.5; margin: 4px 0; word-break: break-word; }
.dc-text h1 { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.dc-text h2 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.dc-text h3 { font-size: 14px; font-weight: 700; color: #fff; }
.dc-text code { background: #202225; padding: 1px 5px; border-radius: 3px; font-size: 12px; color: #f8f8f2; }
.dc-text pre { background: #202225; padding: 8px; border-radius: 4px; overflow-x: auto; margin: 4px 0; }
.dc-text .dc-subtext { font-size: 12px; color: #72767d; }
.dc-separator { padding: 4px 0; }
.dc-sep-large { padding: 8px 0; }
.dc-sep-line { height: 1px; background: #40444b; }
.dc-section { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.dc-section-text { flex: 1; }
.dc-thumbnail { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; }
.dc-media-gallery { display: grid; gap: 4px; border-radius: 4px; overflow: hidden; margin: 4px 0; }
.dc-media-1 { grid-template-columns: 1fr; }
.dc-media-2 { grid-template-columns: 1fr 1fr; }
.dc-media-3, .dc-media-4, .dc-media-5 { grid-template-columns: 1fr 1fr; }
.dc-media-img { width: 100%; height: 160px; object-fit: cover; display: block; }
.dc-media-error { background: #40444b; display: flex; align-items: center; justify-content: center; color: #72767d; font-size: 12px; height: 80px; }
.dc-media-placeholder { background: #40444b; border-radius: 4px; padding: 12px; text-align: center; color: #72767d; font-size: 12px; margin: 4px 0; }
.dc-action-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.dc-btn { padding: 6px 14px; border-radius: 3px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 5px; }
.dc-btn-primary { background: #5865F2; color: #fff; }
.dc-btn-secondary { background: #4f545c; color: #fff; }
.dc-btn-success { background: #3ba55c; color: #fff; }
.dc-btn-danger { background: #ed4245; color: #fff; }
.dc-btn-link { background: transparent; color: #00aff4; text-decoration: underline; }
.dc-btn-sm { padding: 4px 10px; font-size: 12px; }
.dc-select-wrap { padding: 4px 0; }
.dc-select { background: #202225; color: #dcddde; border: 1px solid #40444b; border-radius: 3px; padding: 8px 12px; width: 100%; font-size: 13px; }

#toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 18px; border-radius: var(--radius); background: #1a1a1a; color: #fff; font-size: 13px; z-index: 9999; opacity: 0; transform: translateY(8px); transition: all .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-success { background: #065f46; }
#toast.toast-error { background: #991b1b; }
