:root {
  --ink: #20242a;
  --muted: #667085;
  --line: #d9dee7;
  --panel: #ffffff;
  --surface: #f5f7fb;
  --surface-strong: #eef2f7;
  --accent: #0f766e;
  --accent-dark: #134e4a;
  --blue: #2563eb;
  --rose: #be3455;
  --gold: #a35c00;
  --shadow: 0 18px 50px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #18202a;
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #ffffff;
  color: #18202a;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: #b6c2d3;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: #dbe5f1;
  text-decoration: none;
  font-weight: 700;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.sidebar-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c6d3e2;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
}

.main {
  min-width: 0;
  padding: 30px;
}

.topbar,
.section-toolbar,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 28px;
}

.eyebrow,
.label {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.topbar-actions,
.section-toolbar {
  flex-wrap: wrap;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.ghost-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.signal-grid,
.source-grid,
.content-grid,
.connection-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card,
.panel,
.source-card,
.content-card,
.connection-card,
.settings-form,
.calendar-cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card,
.source-card,
.content-card,
.connection-card {
  min-height: 164px;
  padding: 18px;
}

.metric-card strong,
.source-card strong,
.connection-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.15;
}

.metric-card p,
.source-card p,
.content-card p,
.connection-card p {
  color: var(--muted);
  line-height: 1.5;
}

.priority-card {
  grid-column: span 2;
  background: #e7f7f4;
  border-color: #b8ded8;
}

.split-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #def7ec;
  color: #075642;
  font-size: 12px;
  font-weight: 800;
}

.pill.warning {
  background: #fff5d7;
  color: #7c4b00;
}

.action-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.action-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #374151;
}

.action-list span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-strong);
  font-weight: 800;
}

.status-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-toolbar {
  margin-bottom: 18px;
}

.source-card.connected {
  border-color: #8bd3c7;
}

.source-card.waiting {
  border-color: #edcf88;
}

.source-card.parked {
  background: #f8fafc;
}

.brand-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
}

.brand-chip.active {
  background: var(--ink);
  color: #ffffff;
}

.content-card {
  min-height: 190px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

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

.calendar-cell {
  min-height: 112px;
  padding: 12px;
}

.calendar-cell strong {
  display: block;
  margin-bottom: 10px;
}

.scheduled-dot {
  display: block;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.settings-form {
  max-width: 720px;
  display: grid;
  gap: 16px;
  padding: 22px;
}

.settings-form label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-weight: 800;
}

.settings-form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
}

.dialog-card {
  max-width: 420px;
  padding: 24px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .signal-grid,
  .source-grid,
  .content-grid,
  .connection-list,
  .split-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-toolbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav,
  .signal-grid,
  .source-grid,
  .content-grid,
  .connection-list,
  .split-layout,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .priority-card {
    grid-column: span 1;
  }
}
