:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #111827;
    --muted: #667085;
    --line: #e6eaf2;
    --brand: #0f766e;
    --brand-strong: #115e59;
    --accent: #b7791f;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef8f6, #f7f9fc 48%, #fff7ed); }
.auth-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 28px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: white; background: var(--brand); font-weight: 900; }
.muted { color: var(--muted); }
.form-grid { display: grid; gap: 14px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; background: #fff; color: var(--ink); }
.field textarea { min-height: 110px; resize: vertical; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.btn { border: 0; border-radius: 8px; padding: 10px 14px; display: inline-flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; }
.btn-primary { color: #fff; background: var(--brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-soft { background: #edf7f5; color: var(--brand-strong); }
.btn-danger { background: #fff1f0; color: var(--danger); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { background: #0b1220; color: #dbe7ff; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.sidebar .brand { color: #fff; margin-bottom: 24px; }
.nav-section { margin: 22px 0 8px; color: #8fa4c5; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #dbe7ff; margin: 3px 0; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.09); color: #fff; }
.main { min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.content { padding: 28px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-title { margin: 0; font-size: 28px; letter-spacing: 0; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(17, 24, 39, .05); padding: 18px; }
.stat-value { font-size: 30px; font-weight: 900; margin-top: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #eef2f7; color: #344054; }
.badge-active { background: #ecfdf3; color: #067647; }
.badge-draft { background: #fff7ed; color: #b54708; }
.badge-approved, .badge-ready { background: #edf7f5; color: #0f766e; }
.badge-scheduled, .badge-placeholder { background: #eef4ff; color: #3538cd; }
.badge-published, .badge-completed { background: #ecfdf3; color: #067647; }
.badge-paused { background: #fff1f0; color: #b42318; }
.badge-connected, .badge-queued { background: #ecfdf3; color: #067647; }
.badge-failed, .badge-needs_configuration { background: #fff1f0; color: #b42318; }
.badge-suspended { background: #fff1f0; color: #b42318; }
.badge-active { background: #ecfdf3; color: #067647; }
.alert { border-radius: 8px; border: 1px solid #b7e4d7; background: #ecfdf3; color: #067647; padding: 10px 12px; margin-bottom: 16px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.company-switch { display: flex; align-items: center; gap: 8px; }
.company-switch select { max-width: 230px; }
.pagination { margin-top: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.calendar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.provider-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .calendar-grid, .channel-grid, .provider-grid, .two-col { grid-template-columns: 1fr; }
    .topbar { position: relative; padding: 16px; height: auto; align-items: flex-start; gap: 12px; flex-direction: column; }
    .content { padding: 18px; }
}
@media (max-width: 620px) {
    .stats { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
}
