:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #647086;
  --line: #dce3ee;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --accent: #f59e0b;
  --danger: #dc2626;
  --ok: #15803d;
  --shadow: 0 14px 35px rgba(28, 42, 68, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-session {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.82rem;
  text-decoration: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  display: grid;
  grid-template-columns: 252px 1fr;
}

.sidebar {
  min-height: 100vh;
  background: #111827;
  color: white;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 800;
}

.brand small,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0 0 5px;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.sidebar a.active,
.sidebar a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.app-shell {
  padding: 30px;
  max-width: 1440px;
  width: 100%;
}

.topbar,
.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 0;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  min-height: 40px;
}

button:hover {
  background: var(--primary-strong);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 14px;
  margin: 28px 0 20px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.wide {
  grid-column: span 1;
}

.table-list,
.channel-list,
.deal-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.9fr 0.6fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  align-items: center;
}

.row strong,
.deal strong {
  display: block;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: #0f172a;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
  width: max-content;
}

.pill.confirmed,
.pill.completed {
  color: white;
  background: var(--ok);
}

.pill.pending {
  color: #422006;
  background: #fde68a;
}

.channel,
.deal,
.automation-job {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-top: 8px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.automation-empty {
  margin-top: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .metrics-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
