:root {
  color-scheme: light;
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #171f26;
  --muted: #65727b;
  --line: #dbe2e6;
  --teal: #168a83;
  --teal-dark: #0f6f69;
  --blue-soft: #edf4fb;
  --blue-ink: #345d86;
  --warning-bg: #fff4df;
  --warning-ink: #805117;
  --shadow: 0 20px 54px rgba(23, 31, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(22, 138, 131, 0.08), transparent 32rem),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px) 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand {
  margin-right: auto;
}

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

.brand strong {
  font-size: 1.34rem;
  line-height: 1;
  letter-spacing: 0;
}

.brand span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--warning-ink);
  background: var(--warning-bg);
  border: 1px solid #f2d9aa;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 850;
  white-space: nowrap;
}

.settings-button,
.back-button,
.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 850;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.settings-button:hover,
.back-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.settings-button,
.back-button,
.secondary-button {
  color: var(--blue-ink);
  background: var(--blue-soft);
  border: 1px solid #d2e2f0;
}

.primary-button {
  color: #ffffff;
  background: var(--teal);
  border: 1px solid var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.hero-copy {
  max-width: 780px;
  margin-bottom: 28px;
}

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

h1,
h2,
h3 {
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.35rem);
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
}

h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.hero-copy p,
.section-heading p,
.command-card p,
.project-note,
.footnote,
.settings-dialog p {
  color: var(--muted);
}

.project-section {
  margin-top: 28px;
}

.section-heading {
  margin-bottom: 14px;
}

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

.quick-command-card,
.project-card,
.active-project-card,
.command-card,
.recent-panel,
.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.quick-command-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(18px, 4vw, 32px);
  align-items: start;
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 18px;
}

.quick-command-card h1 {
  margin-top: 6px;
  font-size: clamp(1.8rem, 4vw, 2.85rem);
}

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

.quick-command-form {
  display: grid;
  gap: 12px;
}

.quick-command-form textarea {
  min-height: 150px;
}

.dashboard-result {
  margin-bottom: 24px;
}

.project-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.project-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.project-card h3 {
  margin-bottom: 5px;
}

.project-url,
.project-sector {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  color: var(--blue-ink);
  background: var(--blue-soft);
  border: 1px solid #d2e2f0;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.project-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-meta strong {
  color: var(--ink);
}

.project-note {
  margin-bottom: 0;
}

.project-card .primary-button {
  width: 100%;
}

.workspace-view {
  display: grid;
  gap: 16px;
}

.active-project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.kicker,
.active-meta span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.active-project-card h1 {
  margin: 6px 0 0;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
}

.active-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.active-meta div {
  min-width: 150px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.active-meta strong {
  display: block;
  margin-top: 3px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
  align-items: start;
}

.command-card,
.recent-panel,
.result-card {
  padding: clamp(18px, 3vw, 28px);
}

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

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

textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(22, 138, 131, 0.12);
}

textarea::placeholder {
  color: #8a969d;
}

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

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

.recent-item strong,
.recent-item span {
  display: block;
}

.recent-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-content {
  display: grid;
  gap: 14px;
}

.plan-section {
  padding: 15px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.plan-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.plan-section p,
.plan-section ul {
  margin: 0;
  color: var(--muted);
}

.plan-section ul {
  display: grid;
  gap: 7px;
  padding-left: 20px;
}

.footnote {
  max-width: 780px;
  margin: 22px auto 0;
  font-size: 0.9rem;
  text-align: center;
}

.settings-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.settings-dialog::backdrop {
  background: rgba(23, 31, 38, 0.32);
}

.settings-dialog form {
  padding: 24px;
}

@media (max-width: 900px) {
  .quick-command-card,
  .project-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .recent-panel {
    order: 2;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .topbar,
  .active-project-card {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    margin-right: 0;
  }

  .top-actions,
  .top-actions > *,
  .active-meta,
  .active-meta div,
  .primary-button,
  .secondary-button,
  .back-button {
    width: 100%;
  }

  .status-label,
  .settings-button,
  .back-button {
    justify-content: center;
  }

  .project-card-header {
    display: grid;
  }

  textarea {
    min-height: 260px;
  }
}
