:root {
  --app-bg: #f4f7fb;
  --app-panel: #ffffff;
  --app-text: #172033;
  --app-muted: #65738a;
  --app-line: #dce4ef;
  --app-primary: #0a66c2;
  --app-primary-dark: #084f96;
  --app-success: #137a44;
  --app-warning: #9a6700;
  --app-danger: #b42318;
  --app-radius: 8px;
  --app-shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  color: var(--app-text);
  background:
    linear-gradient(180deg, rgba(10, 102, 194, 0.08), rgba(10, 102, 194, 0) 260px),
    var(--app-bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--app-primary);
}

.app-shell {
  min-height: 100vh;
}

.app-topbar {
  border-bottom: 1px solid rgba(220, 228, 239, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--app-primary);
  font-weight: 800;
}

.navbar-brand {
  color: var(--app-text);
  font-weight: 750;
}

.navbar-brand:hover {
  color: var(--app-primary);
}

.nav-link {
  color: #3c495c;
  font-weight: 600;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--app-primary);
}

.app-main {
  padding-top: 32px;
  padding-bottom: 48px;
}

.page-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  font-weight: 760;
}

.page-subtitle {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--app-muted);
}

.surface {
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  background: var(--app-panel);
  box-shadow: var(--app-shadow);
}

.surface-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--app-line);
}

.surface-body {
  padding: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  background: #fff;
}

.metric-label {
  color: var(--app-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-size: 1.65rem;
  font-weight: 780;
}

.metric-note {
  margin-top: 4px;
  color: var(--app-muted);
  font-size: 0.9rem;
}

.connection-strip {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}

.avatar-placeholder {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #233043;
  font-weight: 750;
}

.btn {
  border-radius: 7px;
  font-weight: 700;
}

.btn-primary {
  border-color: var(--app-primary);
  background: var(--app-primary);
}

.btn-primary:hover {
  border-color: var(--app-primary-dark);
  background: var(--app-primary-dark);
}

.btn-outline-primary {
  border-color: rgba(10, 102, 194, 0.42);
  color: var(--app-primary);
}

.badge {
  border-radius: 999px;
  padding: 0.42em 0.68em;
  font-weight: 750;
}

.status-badge {
  color: #314057;
  background: #e9eef6;
}

.status-published,
.status-connected,
.status-succeeded {
  color: #075b32;
  background: #dff6e9;
}

.status-scheduled,
.status-publishing,
.status-started {
  color: #084f96;
  background: #e0efff;
}

.status-failed,
.status-error,
.status-revoked {
  color: var(--app-danger);
  background: #fde7e5;
}

.status-cancelled,
.status-disconnected,
.status-expired,
.status-abandoned {
  color: #596579;
  background: #edf1f6;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  color: var(--app-muted);
  border-bottom-color: var(--app-line);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.table td {
  color: #263248;
  vertical-align: middle;
}

.empty-state {
  padding: 34px 20px;
  color: var(--app-muted);
  text-align: center;
}

.form-panel {
  max-width: 820px;
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  border: 1px solid #cbd6e5;
  border-radius: 7px;
  padding: 0.64rem 0.76rem;
  color: var(--app-text);
  background: #fff;
}

textarea {
  min-height: 180px;
}

.form-label {
  color: #263248;
  font-weight: 700;
}

.form-text {
  color: var(--app-muted);
}

.post-preview {
  white-space: pre-wrap;
  font-size: 1.02rem;
  line-height: 1.65;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.campaign-calendar {
  display: grid;
  gap: 10px;
}

.calendar-month {
  color: #263248;
  font-weight: 800;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  color: var(--app-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-grid {
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  background: var(--app-line);
  gap: 1px;
}

.calendar-cell {
  display: grid;
  min-height: 104px;
  align-content: start;
  gap: 8px;
  padding: 8px;
  background: #fff;
}

.calendar-cell-muted {
  background: #f2f5f9;
}

.calendar-cell-muted .calendar-date {
  color: #9aa6b7;
}

.calendar-date {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #263248;
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-items {
  display: grid;
  gap: 5px;
}

.calendar-item {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-left: 3px solid var(--app-primary);
  border-radius: 5px;
  color: var(--app-text);
  background: #eef6ff;
  text-decoration: none;
}

.calendar-item:hover {
  color: var(--app-text);
  background: #ddecff;
}

.calendar-time {
  color: var(--app-primary);
  font-size: 0.72rem;
  font-weight: 800;
}

.calendar-title {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #314057;
  font-size: 0.75rem;
  line-height: 1.25;
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
}

.alert {
  border: 0;
  border-radius: var(--app-radius);
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.06);
}

@media (max-width: 992px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-main {
    padding-top: 20px;
  }

  .page-header,
  .connection-strip,
  .surface-header {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .calendar-cell {
    min-height: 84px;
    padding: 6px;
  }

  .calendar-title {
    display: none;
  }
}
