:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #111827;
  --muted: #667085;
  --line: #d8e0ea;
  --blue: #1d5fd6;
  --green: #17835b;
  --amber: #b7791f;
  --red: #c2413d;
  --nav: #172033;
  --nav-soft: #24304a;
  --shadow: 0 10px 28px rgba(21, 35, 62, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
}

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

.sidebar {
  background: var(--nav);
  color: #e7edf7;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #fff;
  text-decoration: none;
  padding: 10px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f4c95d;
  color: #172033;
  font-weight: 800;
}

.brand small,
.side-label {
  display: block;
  color: #aeb9cb;
  font-size: 12px;
}

.side-section {
  margin-top: 22px;
}

.side-label {
  padding: 0 10px 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 5px;
}

.side-group {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
}

.side-nav a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 7px;
  color: #e7edf7;
}

.side-nav a:hover,
.side-nav a.active {
  background: var(--nav-soft);
}

.content {
  padding: 24px;
  min-width: 0;
}

.workspacebar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -24px -24px 22px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.home-button,
.add-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-weight: 800;
}

.add-button {
  background: #79ad22;
  color: #fff;
  border-color: #79ad22;
  font-size: 24px;
  line-height: 1;
}

.client-switcher {
  min-width: 330px;
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.client-switcher select {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.lead,
.muted {
  color: var(--muted);
}

.top-actions,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.build-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button,
.ghost-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.ghost-button,
.mini-button {
  background: var(--surface);
}

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

.client-header {
  padding: 14px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.fact {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.fact:first-child {
  border-left: 0;
  padding-left: 0;
}

.fact-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}

.fact-value {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.tabs a {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  color: #1f2937;
}

.tabs a.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.monitor-card p {
  min-height: 88px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

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

.metric-card {
  min-height: 118px;
  display: grid;
  gap: 7px;
  align-content: start;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric-card.ok {
  border-left: 4px solid var(--green);
}

.metric-card.warn {
  border-left: 4px solid var(--amber);
}

.metric-card.bad {
  border-left: 4px solid var(--red);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.metric-card b {
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric-card small {
  color: var(--muted);
}

.live-note {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.section-link-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.section-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  text-decoration: none;
  font-weight: 700;
}

.section-link:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.blocker-list {
  display: grid;
  gap: 10px;
}

.work-list {
  display: grid;
  gap: 10px;
}

.work-summary {
  margin-bottom: 2px;
}

.work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.work-row h3 {
  margin-top: 7px;
}

.work-row p {
  color: var(--muted);
  margin-bottom: 5px;
}

.work-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.task-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.task-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.task-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-head {
  margin-bottom: 0;
}

.compact-head h2 {
  font-size: 17px;
  margin-bottom: 3px;
}

.task-row {
  background: #fff;
}

.lane-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lane-row.red {
  border-left: 4px solid var(--red);
}

.lane-row.amber {
  border-left: 4px solid var(--amber);
}

.lane-row h3 {
  margin-bottom: 4px;
}

.lane-row p {
  margin-bottom: 0;
  color: var(--muted);
}

.blocker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.blocker-row.red {
  border-left: 4px solid var(--red);
}

.blocker-row.amber {
  border-left: 4px solid var(--amber);
}

.blocker-row p {
  color: var(--muted);
  margin-bottom: 8px;
}

.blocker-row ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.blocker-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
}

.blocker-actions small {
  max-width: 220px;
  color: var(--muted);
}

.badges,
.token-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.compact-auth-panel {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.compact-auth-panel h2 {
  font-size: 17px;
  margin-bottom: 4px;
}

.compact-auth-panel p {
  margin: 0;
}

.primary-work-panel {
  border-color: #b7caec;
  box-shadow: 0 8px 24px rgba(29, 78, 216, .08);
}

.token-row input {
  min-width: 320px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
}

.ghost-mini {
  background: #fff;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.empty-state.warn {
  border-left: 4px solid var(--amber);
}

.empty-state.bad {
  border-left: 4px solid var(--red);
}

.empty-state.ok {
  border-left: 4px solid var(--green);
}

.loading {
  color: var(--muted);
}

.section-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.section-card p {
  color: var(--muted);
  min-height: 68px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf3ff;
  color: #194aa8;
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  background: #e7f6ef;
  color: var(--green);
}

.badge.amber {
  background: #fff7e6;
  color: var(--amber);
}

.badge.red {
  background: #fff0f0;
  color: var(--red);
}

.checklist {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}

.checklist li {
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .side-section {
    margin-top: 12px;
  }

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

  .side-group {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-nav a {
    min-height: 38px;
    align-items: center;
  }

  .topbar,
  .workspacebar,
  .client-header,
  .section-head,
  .blocker-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .client-switcher {
    min-width: 0;
  }

  .fact {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }

  .cards,
  .monitor-grid,
  .live-grid,
  .task-kpis,
  .task-columns,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .blocker-actions {
    justify-content: flex-start;
  }

  .work-row {
    grid-template-columns: 1fr;
  }

  .token-row input {
    min-width: 0;
    width: 100%;
  }
}
