:root {
  color-scheme: light;
  --bg: #eef2f3;
  --surface: #ffffff;
  --surface-strong: #f7faf8;
  --ink: #17201b;
  --muted: #5c6b61;
  --line: #d6ded9;
  --accent: #167a5b;
  --accent-2: #c26d2f;
  --accent-3: #276aa3;
  --danger: #a34040;
  --shadow: 0 18px 50px rgba(31, 47, 39, 0.14);
}

:root.dark {
  color-scheme: dark;
  --bg: #111816;
  --surface: #18211d;
  --surface-strong: #202b25;
  --ink: #edf5ef;
  --muted: #a9b9ae;
  --line: #334039;
  --accent: #42c395;
  --accent-2: #e0a05f;
  --accent-3: #6bb1e7;
  --danger: #ef8d8d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar,
.inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-color: var(--line);
  background: var(--surface-strong);
}

.sidebar {
  border-right: 1px solid var(--line);
}

.inspector {
  border-left: 1px solid var(--line);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.15rem;
  line-height: 1.15;
}

h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.38) inset;
}

.compact {
  padding-bottom: 10px;
}

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

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 12px;
  line-height: 1.45;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

input[type="text"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.field-label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.mode-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.mode-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-3);
  font-weight: 800;
}

.mode-title {
  display: block;
  font-size: 0.93rem;
  font-weight: 750;
}

.mode-copy {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  color: var(--ink);
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-rows: auto 176px minmax(0, 1fr);
  min-width: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 72%, transparent), transparent 36%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

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

.context-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.2rem;
}

.hero-media {
  margin: 18px 18px 0;
  min-height: 158px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.2)),
    url("assets/global-network.png");
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.chat-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: 18px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  max-width: 850px;
}

.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.message.user .avatar {
  order: 2;
  background: var(--accent-2);
}

.message.user .bubble {
  order: 1;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

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

.bubble header {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bubble p {
  white-space: pre-wrap;
  line-height: 1.55;
}

.composer {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  box-shadow: var(--shadow);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.quick-actions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0 10px;
  font-size: 0.84rem;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: end;
}

.send-button {
  min-height: 70px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.plan-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.plan-list li {
  color: var(--ink);
  line-height: 1.35;
}

.meter {
  display: grid;
  gap: 6px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.85rem;
}

progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.briefs {
  display: grid;
  gap: 8px;
}

.brief-card,
.article-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.article-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

.article-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 0.88rem;
}

.article-card p {
  color: var(--muted);
}

.mini-button,
.text-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.text-button {
  margin-top: 8px;
  min-height: 28px;
  padding: 0 9px;
  color: var(--danger);
  font-size: 0.78rem;
}

.artifact-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.artifact-tabs button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.artifact-tabs button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--ink);
}

.artifact-output {
  min-height: 190px;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 10px;
  white-space: pre-wrap;
  font: 0.78rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    grid-template-rows: auto 130px minmax(520px, 1fr);
  }

  .topbar,
  .input-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .hero-media {
    min-height: 116px;
  }

  .send-button {
    min-height: 46px;
  }
}
