:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7f5;
  color: #191917;
  --surface: #ffffff;
  --muted: #706f68;
  --border: #dfded7;
  --accent: #0f766e;
  --danger: #b42318;
  --warning: #a15c07;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f7f7f5;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 86px 14px 32px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px max(14px, calc((100vw - 920px) / 2 + 14px));
  background: rgb(247 247 245 / 94%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 10;
}

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

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

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

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.icon-button,
.ghost-button,
.auth-panel button,
.admin-block button,
.agent-actions button,
.nav-button {
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #191917;
  border-radius: 8px;
  padding: 0 14px;
}

.icon-button {
  width: 44px;
  font-size: 22px;
}

.nav-button.active {
  border-color: #0f766e;
  color: #0f766e;
}

.auth-panel,
.admin-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.setup-panel {
  margin-top: 24px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  color: #191917;
  background: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.list-header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  margin: 10px 2px;
}

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

.task-row {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
}

.task-title-line,
.metric-grid,
.event-line,
.notification-line,
.agent-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.task-title {
  font-size: 16px;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e6f4f1;
  color: #115e59;
  font-size: 12px;
  flex-shrink: 0;
}

.status.failed,
.status.blocked {
  background: #fee4e2;
  color: var(--danger);
}

.status.completed {
  background: #e8f5e9;
  color: #166534;
}

.progress-track {
  height: 8px;
  background: #ecebe5;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 10px;
}

.progress-fill {
  height: 100%;
  width: var(--value);
  background: var(--accent);
}

.task-meta,
.event-meta,
.notification-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.detail {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  background: #f7f7f5;
  border-radius: 8px;
  padding: 10px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.timeline,
.notifications,
.agent-list {
  display: grid;
  gap: 10px;
}

.event,
.notification,
.agent {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.event:first-child,
.notification:first-child,
.agent:first-child {
  border-top: 0;
  padding-top: 0;
}

.snippet {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #191917;
  color: #f7f7f5;
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.history-panel {
  margin-top: 14px;
}

.empty,
.error {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--danger);
}

@media (max-width: 430px) {
  h1 {
    font-size: 26px;
  }

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