:root {
  --blue: #0879d8;
  --deep-blue: #0756a8;
  --yellow: #ffd43d;
  --pink: #ff5aa5;
  --green: #46b83f;
  --orange: #ff9c22;
  --teal: #16b8aa;
  --ink: #172033;
  --muted: #667085;
  --panel: #ffffff;
  --bg: #dff4ff;
  --line: #d7e0ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(#8ed7ff 0 220px, var(--bg) 220px);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 14px 14px 92px;
}

.topbar,
.section-title,
.filters,
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin: 0 auto 14px;
  max-width: 980px;
}

.eyebrow,
.muted,
.metric-card p,
.form-status {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1;
}

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

h3 {
  margin-bottom: 8px;
}

.status-pill,
.text-action,
.primary-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.status-pill {
  padding: 8px 10px;
  background: var(--yellow);
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.16);
  font-size: 12px;
}

.screen {
  display: none;
  max-width: 980px;
  margin: 0 auto;
}

.screen.is-active {
  display: block;
}

.office-town {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  border: 4px solid var(--deep-blue);
  border-radius: 8px;
  background: linear-gradient(#4cc0ff 0 48%, #67c947 48% 100%);
  box-shadow: inset 0 -14px rgba(0, 0, 0, 0.1);
}

.skyline {
  position: absolute;
  inset: 0;
}

.cloud,
.cloud::before,
.cloud::after {
  position: absolute;
  display: block;
  width: 54px;
  height: 22px;
  border-radius: 8px;
  background: #fff;
}

.cloud {
  left: 24px;
  top: 28px;
}

.cloud::before,
.cloud::after {
  content: "";
  top: -12px;
}

.cloud::before {
  left: 10px;
}

.cloud::after {
  left: 30px;
}

.cloud-small {
  left: auto;
  right: 42px;
  top: 50px;
  transform: scale(0.75);
}

.office-building {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: min(78%, 520px);
  height: 176px;
  transform: translateX(-50%);
  border: 4px solid #1f3c70;
  border-radius: 8px;
  background: repeating-linear-gradient(0deg, #f4dfb8 0 22px, #e7cfa4 22px 24px);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.18);
}

.roof {
  position: absolute;
  left: -10px;
  right: -10px;
  top: -26px;
  height: 28px;
  border-radius: 8px 8px 0 0;
  background: var(--blue);
}

.lego-stud {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.13);
}

.row-a {
  left: 20px;
  top: -22px;
}

.row-b {
  right: 20px;
  top: -22px;
}

.sign {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 6px;
  background: #20252f;
  color: #fff;
  font-size: clamp(14px, 3.8vw, 28px);
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.windows {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 78px 36px 0;
}

.windows span {
  height: 38px;
  border: 4px solid #17345f;
  border-radius: 6px;
  background: #70c9ff;
}

.door {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 48px;
  height: 58px;
  transform: translateX(-50%);
  border-radius: 8px 8px 0 0;
  background: #513826;
}

.dashboard-grid,
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.brick-card {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  padding: 18px;
  border: 3px solid rgba(0, 0, 0, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.08), 0 8px 18px rgba(23, 32, 51, 0.12);
}

.brick-card > .lego-stud {
  right: 12px;
  top: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.metric-card strong {
  font-size: 32px;
  line-height: 1;
}

.section-block,
.section-title {
  margin-top: 18px;
}

.section-title > div {
  min-width: 0;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-action {
  padding: 9px 12px;
  background: var(--yellow);
  color: var(--ink);
}

.refresh-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.22);
}

.refresh-button:disabled {
  opacity: 0.72;
}

.refresh-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.refresh-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(70, 184, 63, 0.14);
}

.refresh-status.is-loading .refresh-dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 156, 34, 0.16);
}

.refresh-status.is-error {
  color: #a13b24;
}

.refresh-status.is-error .refresh-dot {
  background: #e34834;
  box-shadow: 0 0 0 3px rgba(227, 72, 52, 0.16);
}

.agent-card {
  border-color: rgba(0, 0, 0, 0.2);
}

.agent-card.blue {
  background: #d9efff;
}

.agent-card.pink {
  background: #ffe0ef;
}

.agent-minifig {
  width: 68px;
  height: 80px;
  margin-bottom: 12px;
}

.agent-head {
  width: 42px;
  height: 38px;
  margin: 0 auto;
  border-radius: 50% 50% 44% 44%;
  background: var(--yellow);
  border: 3px solid rgba(0, 0, 0, 0.2);
}

.agent-body {
  width: 62px;
  height: 42px;
  margin: -2px auto 0;
  border-radius: 8px 8px 5px 5px;
  background: var(--blue);
  border: 3px solid rgba(0, 0, 0, 0.2);
}

.agent-card.pink .agent-body {
  background: var(--pink);
}

.attention-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.attention-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff5cf;
}

.attention-card h3 {
  margin-bottom: 4px;
}

.attention-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.attention-reason {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--pink);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.14);
}

.filters {
  margin: 14px 0;
}

.filter-button {
  min-height: 46px;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.16);
}

select,
input,
textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
}

.task-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.task-form label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.primary-button {
  min-height: 48px;
  background: var(--blue);
  color: #fff;
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.22);
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  transition: border-color 160ms ease, transform 160ms ease;
}

.task-card.is-open {
  border-color: var(--blue);
}

.task-card.is-hidden-task {
  opacity: 0.72;
}

.task-summary {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.task-summary strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
}

.task-chevron {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.16);
}

.task-card.is-open .task-chevron {
  transform: rotate(180deg);
}

.task-details {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}

.task-details[hidden] {
  display: none;
}

.task-result {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-result p {
  margin: 0;
  white-space: pre-wrap;
}

.task-secondary-button {
  min-height: 38px;
  padding: 8px 12px;
  background: #edf2f7;
  color: var(--ink);
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.12);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #edf2f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.12);
}

.status-badge--in-progress {
  background: #d9efff;
  color: #0756a8;
}

.status-badge--completed {
  background: #dff7d8;
  color: #256f25;
}

.status-badge--failed {
  background: #ffe0dc;
  color: #9c271d;
}

.status-badge--needs-input {
  background: #fff5cf;
  color: #8a5a00;
}

.lifecycle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lifecycle-step {
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.12);
}

.lifecycle-step.is-done {
  background: var(--green);
  color: #fff;
}

.task-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.task-run-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--orange);
  color: #fff;
  padding: 8px 12px;
  font-weight: 900;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.2);
}

.task-run-button:disabled {
  opacity: 0.7;
}

.task-run-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}

.timeline-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 8px;
  background: var(--deep-blue);
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.26);
}

.bottom-nav button {
  position: relative;
  min-width: 0;
  min-height: 48px;
  flex: 1;
  border: 0;
  border-radius: 8px;
  background: #1d8ce8;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.24);
}

.bottom-nav button.is-active {
  background: var(--yellow);
  color: var(--ink);
}

.nav-badge {
  position: absolute;
  right: 4px;
  top: 3px;
  min-width: 18px;
  height: 18px;
  padding: 2px 5px;
  border-radius: 9px;
  background: var(--pink);
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.limits-card {
  margin-top: 14px;
  background: #fff5cf;
}

@media (max-width: 520px) {
  .app-shell {
    padding-inline: 10px;
  }

  .bottom-nav {
    gap: 5px;
  }

  .bottom-nav button {
    min-height: 44px;
    font-size: 10px;
  }

  .filters {
    display: grid;
  }

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