:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: #ffffff;
  --ink: #19212a;
  --muted: #66717f;
  --line: #d9d4ca;
  --blue: #1f5eff;
  --green: #0f8b63;
  --amber: #b76a00;
  --red: #c0392b;
  --shadow: 0 18px 40px rgba(34, 45, 59, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #17202b;
  color: #fff;
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffffff;
  color: #17202b;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 16px;
  font-size: 17px;
}

.account-strip {
  display: grid;
  gap: 4px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.62);
}

.account-strip span {
  color: var(--muted);
  font-size: 13px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid,
.split-grid,
.workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.split-grid,
.workbench {
  margin-top: 18px;
}

.workbench.wide {
  grid-template-columns: 360px minmax(0, 1fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin-bottom: 0;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(15, 139, 99, 0.12);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.warm {
  background: rgba(183, 106, 0, 0.13);
  color: var(--amber);
}

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

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

.metric {
  min-height: 86px;
  border: 1px solid #ece7de;
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.metric span,
.task span,
.content-list span,
.agent-card span,
.calendar-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}

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

.task,
.content-list div {
  border: 1px solid #ece7de;
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.task {
  border-left: 4px solid var(--line);
}

.task.done {
  border-left-color: var(--green);
}

.task.active {
  border-left-color: var(--blue);
}

.text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.agent-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.agent-card h2 {
  margin-bottom: 8px;
}

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

.agent-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #ece7de;
  padding-top: 12px;
}

.flow-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.flow-node {
  position: relative;
  min-height: 92px;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  padding: 14px;
  background: #f8fbff;
}

.flow-node.current {
  border-color: var(--blue);
  background: #eef4ff;
}

.flow-node strong {
  display: block;
  margin-bottom: 8px;
}

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

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

textarea {
  min-height: 104px;
  resize: vertical;
}

.output-card p,
.script-card p {
  border-bottom: 1px solid #ece7de;
  padding-bottom: 12px;
  color: #3b4652;
}

.output-card p:last-child,
.script-card p:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.calendar-grid div {
  min-height: 120px;
  border: 1px solid #ece7de;
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf7;
}

.calendar-grid strong {
  display: block;
  margin-bottom: 10px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .dashboard-grid,
  .split-grid,
  .workbench,
  .workbench.wide,
  .agent-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 640px) {
  .main-panel {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .nav-list,
  .metric-grid,
  .metric-grid.compact,
  .flow-map,
  .calendar-grid {
    grid-template-columns: 1fr;
  }
}
