:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-soft: #f7faf8;
  --ink: #202427;
  --muted: #687177;
  --line: #d9dedb;
  --accent: #1f7a68;
  --accent-dark: #145d50;
  --warning: #b66b1e;
  --danger: #b33b3b;
  --shadow: 0 12px 35px rgba(36, 42, 46, 0.1);
}

* {
  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;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: #eef3f0;
  padding: 28px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.page-header h2,
.page-header p,
.section-heading h3,
.process-card h4,
.board-card h4 {
  margin: 0;
}

.brand h1 {
  font-size: 1.2rem;
}

.brand p,
.page-header p {
  color: var(--muted);
}

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

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
}

.nav-tab.is-active {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(31, 122, 104, 0.08);
}

.quick-stats {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.quick-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 12px;
}

.quick-stats span {
  font-size: 1.35rem;
  font-weight: 800;
}

.quick-stats small {
  color: var(--muted);
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.view {
  display: none;
}

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

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

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.page-header h2 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.05;
}

.primary-action,
.secondary-action,
.card-actions button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 14px;
  font-weight: 700;
}

.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action,
.card-actions button {
  background: var(--panel);
  color: var(--ink);
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.form-panel,
.process-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 20px;
}

form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #3f484d;
  font-size: 0.92rem;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(31, 122, 104, 0.16);
  border-color: var(--accent);
}

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.analysis-fields {
  display: grid;
  gap: 14px;
}

.steps-editor {
  display: grid;
  gap: 8px;
}

.step-editor-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  align-items: start;
}

.step-editor-row textarea {
  min-width: 0;
  min-height: 46px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  resize: vertical;
}

.step-editor-row button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--danger);
  font-weight: 800;
}

.inline-action {
  justify-self: start;
}

.process-list {
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.section-heading span {
  display: grid;
  min-width: 32px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.stack-list {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 14px;
}

.process-card,
.board-card {
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.process-card {
  display: grid;
  gap: 11px;
}

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

.card-header h4 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.priority-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e7f1ee;
  color: var(--accent-dark);
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.priority-pill.high {
  background: #f9eadb;
  color: var(--warning);
}

.priority-pill.low {
  background: #e9edf2;
  color: #586473;
}

.card-objective,
.card-meta {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card-meta {
  font-size: 0.86rem;
}

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

.card-actions button[data-action="delete"] {
  color: var(--danger);
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}

.board-column {
  display: grid;
  gap: 12px;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.column-header h3 {
  margin: 0;
  font-size: 1rem;
}

.column-header span {
  color: var(--muted);
  font-weight: 800;
}

.column-dropzone {
  display: grid;
  gap: 10px;
  min-height: 260px;
  align-content: start;
}

.column-dropzone.is-over {
  outline: 3px solid rgba(31, 122, 104, 0.16);
  border-radius: 8px;
}

.board-card {
  display: grid;
  gap: 12px;
  box-shadow: 0 5px 18px rgba(36, 42, 46, 0.08);
}

.board-card.dragging {
  opacity: 0.55;
}

.step-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 8px;
  color: #3f484d;
  font-size: 0.9rem;
  line-height: 1.35;
}

.step-list input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
}

.step-list span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.step-list input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.board-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.board-card-footer select {
  max-width: 138px;
  padding: 8px;
}

.card-owner {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

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

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

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

  .nav-tabs,
  .quick-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analysis-layout {
    grid-template-columns: 1fr;
  }

  .stack-list {
    max-height: none;
  }

  .board {
    grid-template-columns: repeat(4, minmax(260px, 1fr));
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .page-header {
    display: grid;
  }

  .field-grid,
  .nav-tabs,
  .quick-stats {
    grid-template-columns: 1fr;
  }

  .board {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .board-column {
    min-height: auto;
  }

  .column-dropzone {
    min-height: 120px;
  }

  .form-actions {
    display: grid;
  }

  .header-actions {
    display: grid;
  }

  .primary-action,
  .secondary-action,
  .card-actions button {
    width: 100%;
  }
}
