:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #f0f4f8;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9e0ea;
  --line-strong: #c4cedb;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #d9f4ef;
  --blue: #335cbb;
  --blue-soft: #e3eaff;
  --rose: #b93a54;
  --rose-soft: #ffe2e8;
  --amber: #9a6700;
  --amber-soft: #fff2c7;
  --violet: #6351b8;
  --violet-soft: #ebe7ff;
  --shadow: 0 16px 40px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), transparent 280px),
    var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

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

.brand-name {
  font-size: 17px;
  font-weight: 800;
}

.brand-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}

.nav-button:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.nav-button.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(24, 33, 47, 0.06);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--accent);
  font-size: 12px;
}

.nav-count {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.mini-stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mini-stat span {
  display: block;
  font-size: 20px;
  font-weight: 850;
}

.mini-stat small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 88px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, 0.88);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.view {
  padding: 24px 28px 48px;
}

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

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

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

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

.split {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}

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

.panel.flat {
  box-shadow: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 0;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 16px;
}

.stat {
  display: grid;
  align-content: space-between;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 900;
}

.stat-note {
  color: var(--muted);
  font-size: 13px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  max-width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: var(--accent-strong);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--ink);
}

.button.secondary:hover {
  background: var(--panel-strong);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.button.ghost:hover {
  background: var(--panel-strong);
}

.button.danger {
  border-color: var(--rose);
  background: var(--rose);
}

.button.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.button.icon {
  width: 38px;
  padding: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 118px;
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.item {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-align: left;
}

.item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.item-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.chip.green {
  border-color: #a5d8ce;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip.blue {
  border-color: #c8d4ff;
  background: var(--blue-soft);
  color: var(--blue);
}

.chip.rose {
  border-color: #ffc0cc;
  background: var(--rose-soft);
  color: var(--rose);
}

.chip.amber {
  border-color: #efd488;
  background: var(--amber-soft);
  color: var(--amber);
}

.chip.violet {
  border-color: #d6cef8;
  background: var(--violet-soft);
  color: var(--violet);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  display: grid;
  gap: 10px;
  min-height: 180px;
  align-content: center;
  justify-items: center;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.empty h3 {
  margin: 0;
  font-size: 16px;
}

.empty p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.timeline {
  display: grid;
  gap: 10px;
}

.step {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.step.done .step-dot {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.step strong {
  display: block;
  font-size: 14px;
}

.step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.meter {
  display: grid;
  gap: 6px;
}

.meter-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: center;
}

.meter-label {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.meter-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-strong);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.meter-value {
  min-width: 72px;
  text-align: right;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.prompt-box {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #263449;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

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

.art-tile {
  position: relative;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(51, 92, 187, 0.82)),
    linear-gradient(45deg, #18212f 25%, transparent 25%),
    linear-gradient(-45deg, #b93a54 25%, transparent 25%);
}

.art-tile:nth-child(2) {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.44), transparent 18%),
    linear-gradient(135deg, #18212f, #0f766e 52%, #d4a017);
}

.art-tile:nth-child(3) {
  background:
    linear-gradient(90deg, rgba(24, 33, 47, 0.18) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 33, 47, 0.18) 1px, transparent 1px),
    linear-gradient(135deg, #6351b8, #0f766e);
  background-size: 16px 16px, 16px 16px, auto;
}

.art-tile:nth-child(4) {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 8px, transparent 8px 16px),
    linear-gradient(135deg, #335cbb, #b93a54);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

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

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand > div:not(.brand-mark),
  .nav-button span:not(.nav-icon),
  .nav-count,
  .sidebar-footer {
    display: none;
  }

  .nav-button {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .split,
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    justify-content: flex-start;
  }

  .brand > div:not(.brand-mark),
  .nav-button span:not(.nav-icon),
  .nav-count {
    display: block;
  }

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

  .nav-button {
    grid-template-columns: 22px 1fr;
    min-height: 40px;
    padding: 8px;
    font-size: 12px;
  }

  .topbar {
    position: static;
    display: grid;
    min-height: auto;
    padding: 18px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .view {
    padding: 18px;
  }

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

  .meter-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .meter-value {
    text-align: left;
  }
}
