:root {
  --ink: #15231d;
  --ink-soft: #37423c;
  --muted: #6e756f;
  --line: #dedbd4;
  --line-strong: #c7d3c9;
  --paper: #f8f6f1;
  --surface: #fffdf8;
  --surface-soft: #f1eee7;
  --green: #194d3a;
  --green-soft: #dbeade;
  --blue: #2b78bc;
  --blue-soft: #dfeaf3;
  --amber: #c98b17;
  --amber-soft: #fbefcf;
  --coral: #a65335;
  --coral-soft: #f2ddd5;
  --navy: var(--ink);
  --shadow: 0 20px 50px rgba(34, 39, 34, 0.08);
  --topbar: 58px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(25, 77, 58, 0.045) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(180deg, rgba(25, 77, 58, 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 1em;
  height: 1em;
}

.svg-sprite {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(210px, 260px) 1fr auto;
  align-items: center;
  min-height: var(--topbar);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar);
  padding: 0 22px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  color: var(--green);
}

.primary-nav {
  display: flex;
  align-items: stretch;
  gap: 12px;
  height: var(--topbar);
  overflow-x: auto;
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--topbar);
  padding: 0 13px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active {
  color: var(--green);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  background: var(--green);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-height: var(--topbar);
  border-left: 1px solid var(--line);
}

.auth-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--topbar);
  padding: 0 14px;
  border-right: 1px solid var(--line);
}

.auth-control[hidden] {
  display: none;
}

.auth-control span {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-control button {
  min-height: 34px;
  border: 1px solid var(--green);
  border-radius: 6px;
  color: white;
  background: linear-gradient(180deg, var(--green), #0f3a2b);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.range-control {
  display: inline-flex;
  gap: 8px;
  padding: 0 18px;
}

.range-button,
.panel-heading button,
.table-tools button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 700;
}

.range-button {
  min-width: 58px;
}

.range-button.active,
.panel-heading button:hover,
.table-tools button:hover {
  border-color: var(--green);
  color: white;
  background: linear-gradient(180deg, var(--green), #0f3a2b);
}

.analytics-shell {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  min-height: calc(100svh - var(--topbar));
}

.side-rail {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  display: grid;
  gap: 5px;
  height: calc(100svh - var(--topbar));
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.78), rgba(241, 238, 231, 0.9)),
    #d7cec0;
}

.rail-link {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.rail-link svg {
  width: 18px;
  height: 18px;
}

.rail-link:hover,
.rail-link.active {
  border-color: rgba(25, 77, 58, 0.22);
  color: var(--green);
  background: rgba(255, 253, 248, 0.72);
}

.dashboard {
  display: grid;
  gap: 22px;
  min-width: 0;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
}

.page-heading,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-heading h1,
.panel-heading h2,
.architecture-strip h2 {
  margin: 3px 0 0;
  color: var(--navy);
  line-height: 1.05;
}

.page-heading h1 {
  max-width: 850px;
  font-size: clamp(30px, 3.6vw, 52px);
  font-weight: 350;
  letter-spacing: 0;
}

.panel-heading h2,
.architecture-strip h2 {
  font-size: 20px;
}

.section-label {
  margin: 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--green);
  background: rgba(255, 253, 248, 0.74);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

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

.metric-card,
.panel,
.work-item-section,
.architecture-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
}

.metric-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon label"
    "icon value"
    "icon hint";
  column-gap: 14px;
  min-height: 132px;
  padding: 18px;
}

.metric-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
}

.metric-icon svg {
  width: 22px;
  height: 22px;
}

.metric-icon.green {
  color: var(--green);
  background: var(--green-soft);
}

.metric-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.metric-icon.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.metric-icon.coral {
  color: var(--coral);
  background: var(--coral-soft);
}

.metric-card span {
  grid-area: label;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  grid-area: value;
  margin-top: 4px;
  color: var(--navy);
  font-size: 30px;
  font-weight: 520;
  line-height: 1;
}

.metric-card small {
  grid-area: hint;
  align-self: end;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.82fr);
  gap: 14px;
}

.panel,
.work-item-section,
.architecture-strip {
  padding: 18px;
}

.activity-panel {
  min-height: 382px;
}

.recommendation-panel {
  grid-column: 1 / -1;
}

.panel-heading select,
.table-tools select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 700;
}

.line-chart {
  margin-top: 18px;
  min-height: 250px;
  overflow: hidden;
}

.line-chart svg {
  display: block;
  width: 100%;
  min-height: 250px;
}

.grid-lines path {
  stroke: var(--line);
  stroke-width: 1;
}

#created-line,
#updated-line,
#completed-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#created-line {
  stroke: var(--green);
}

#updated-line {
  stroke: var(--blue);
}

#completed-line {
  stroke: var(--coral);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 999px;
}

.legend-dot.green {
  background: var(--green);
}

.legend-dot.blue {
  background: var(--blue);
}

.legend-dot.coral {
  background: var(--coral);
}

.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  margin-top: 12px;
}

.donut {
  position: relative;
  width: 164px;
  height: 164px;
  border-radius: 50%;
  background: conic-gradient(var(--amber) 0 38%, var(--green) 38% 100%);
}

.donut::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--surface);
  transform: translate(-50%, -50%);
}

.donut-copy {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 118px;
  min-height: 96px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.donut-copy strong {
  color: var(--navy);
  font-size: 34px;
  font-weight: 520;
  line-height: 1;
}

.donut-copy span {
  max-width: 94px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.split-bars {
  display: grid;
  gap: 10px;
}

.split-bars label {
  display: grid;
  grid-template-columns: 58px 1fr 68px;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.split-bars i {
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--green) var(--bar), #e9eee9 var(--bar));
}

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

.recommendation {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.48);
}

.recommendation strong {
  color: var(--navy);
  font-size: 14px;
}

.recommendation p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.recommendation small {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.work-item-section {
  display: grid;
  gap: 16px;
}

.table-tools {
  display: inline-flex;
  gap: 8px;
}

.work-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.table-head,
.work-row {
  display: grid;
  grid-template-columns: 88px 82px minmax(260px, 1fr) 96px 112px 104px 106px 128px;
  min-width: 1040px;
}

.table-head {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-head span,
.work-row span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-right: 1px solid var(--line);
}

.table-head span:last-child,
.work-row span:last-child {
  border-right: 0;
}

.work-row {
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.58);
  font-size: 13px;
}

.empty-row {
  min-width: 1040px;
  min-height: 54px;
  padding: 17px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.58);
  font-size: 13px;
  font-weight: 750;
}

.work-row strong {
  color: var(--navy);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.pill.agent {
  color: var(--green);
  background: var(--green-soft);
}

.pill.human {
  color: #80510d;
  background: var(--amber-soft);
}

.pill.mixed {
  color: #215f91;
  background: var(--blue-soft);
}

.architecture-strip {
  display: grid;
  gap: 16px;
}

.architecture-strip ol {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.architecture-strip li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.architecture-strip li:first-child {
  grid-template-columns: 1fr;
  color: white;
  background: linear-gradient(180deg, var(--green), #0f3a2b);
}

.architecture-strip svg {
  color: var(--green);
}

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

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

  .recommendation-panel {
    grid-column: auto;
  }

  .recommendation-list {
    grid-template-columns: 1fr;
  }

  .architecture-strip ol {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr;
    padding-bottom: 10px;
  }

  .topbar-actions {
    border-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .range-control {
    padding: 0 20px;
  }

  .auth-control {
    min-height: 42px;
    padding: 0 20px;
    border-right: 0;
  }

  .analytics-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    height: auto;
    overflow-x: auto;
    border-right: 0;
  }

  .dashboard {
    padding: 20px;
  }

  .page-heading {
    display: grid;
  }
}

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

  .architecture-strip ol {
    grid-template-columns: 1fr;
  }

  .table-tools,
  .panel-heading {
    display: grid;
  }
}
