:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-bg: #f5f6fb;
    --color-surface: #ffffff;
    --color-text: #1f2330;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* Navbar */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.navbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--color-primary);
    text-decoration: none;
    margin-right: auto;
}

.navbar-links { display: flex; gap: 18px; }
.navbar-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.navbar-links a:hover { color: var(--color-text); }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--color-text-muted);
}

/* Buttons */
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    padding: 0;
}
.btn-link:hover { text-decoration: underline; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
label:first-child { margin-top: 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--color-surface);
}

textarea { resize: vertical; }

.field-hint { color: var(--color-text-muted); font-size: 12px; }

.form-errors {
    color: var(--color-error);
    font-size: 13px;
    margin-top: 10px;
}

.form-row { display: flex; gap: 16px; }
.form-row > div { flex: 1; }

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}
.page-subtitle { color: var(--color-text-muted); margin: 4px 0 0; font-size: 14px; }

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0 0 14px; color: var(--color-text-muted); font-size: 14px; }

.card-link { text-decoration: none; color: inherit; display: block; transition: transform .1s ease; }
.card-link:hover { transform: translateY(-2px); }

/* Sections */
.section { margin-top: 36px; }
.section-header { margin-bottom: 14px; }
.section-header h2 { font-size: 18px; margin: 0; }

/* Table */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
}
.data-table th { color: var(--color-text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-connected, .badge-scheduled, .badge-published, .badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-revoked, .badge-expired, .badge-failed, .badge-error { background: var(--color-error-bg); color: var(--color-error); }
.badge-draft, .badge-pending, .badge-processing { background: #f3f4f6; color: var(--color-text-muted); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
}
.alert-success { background: var(--color-success-bg); color: var(--color-success); }
.alert-error { background: var(--color-error-bg); color: var(--color-error); }

/* Empty state */
.empty-state { color: var(--color-text-muted); font-size: 14px; padding: 20px 0; text-align: center; }

/* Post list */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.post-item-info { display: flex; flex-direction: column; gap: 4px; }
.post-item-caption { color: var(--color-text-muted); font-size: 13px; max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-item-date { font-size: 13px; color: var(--color-text-muted); }

/* Checklist */
.accounts-checklist, .scopes-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.checkbox-item { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; margin: 0; }
.checkbox-item input { width: auto; }

/* Media preview */
.media-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.media-preview img, .media-preview video {
    width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border);
}

/* Inline forms */
.inline-form { display: flex; flex-direction: column; gap: 4px; max-width: 480px; }
.inline-form button { margin-top: 14px; align-self: flex-start; }

/* Code block */
.code-block {
    background: #111827;
    color: #e5e7eb;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 13px;
    overflow-x: auto;
}

code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
