:root {
  --ink: #142033;
  --muted: #66758a;
  --line: #d9e0ea;
  --panel: #ffffff;
  --wash: #f4f7fb;
  --navy: #101d31;
  --navy-2: #1b3453;
  --cyan: #23b8ef;
  --green: #22a06b;
  --amber: #b7791f;
  --red: #ca3a31;
  --shadow: 0 18px 44px rgba(16, 29, 49, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #e8edf5;
}

button,
select {
  font: inherit;
}

button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ink);
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

button:hover:not(:disabled) {
  border-color: var(--cyan);
  color: #075985;
}

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

button.primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #061321;
}

button.success {
  background: #eaf8f1;
  border-color: #8ad8b5;
  color: #176b49;
}

button.danger {
  background: #fff0f0;
  border-color: #ef9a9a;
  color: #9c1c16;
}

select {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  min-width: 270px;
}

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

.sidebar {
  background: linear-gradient(180deg, var(--navy), #0b1424);
  color: #dce8f7;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: #061321;
  font-weight: 900;
  border-radius: 8px;
}

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

.brand span {
  color: #91a5bd;
  font-size: 12px;
  margin-top: 2px;
}

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

.nav a {
  color: #cfe0f3;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

.nav a.active,
.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
}

.sidebar-note p {
  margin: 8px 0 0;
  color: #aabbd0;
  font-size: 12px;
  line-height: 1.45;
}

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

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

.topbar h1 {
  font-size: 24px;
  margin: 3px 0 0;
  letter-spacing: 0;
}

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

.eyebrow {
  margin: 0;
  color: #1787b8;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  margin-bottom: 14px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  background: linear-gradient(135deg, #10243c, #1b3a5a);
  color: #fff;
  border-radius: 8px;
  padding: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-card h2 {
  margin: 6px 0 10px;
  font-size: 26px;
  max-width: 760px;
}

.hero-card p {
  margin: 0;
  color: #dce9f7;
  line-height: 1.55;
  max-width: 850px;
}

.hero-card img {
  width: 100%;
  align-self: center;
}

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

.status-card {
  padding: 18px;
}

.status-card h3 {
  margin: 12px 0 8px;
  font-size: 18px;
}

.status-card p {
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eaf7ff;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}

.tag.muted {
  background: #f1f5f9;
  color: #64748b;
}

.progress-track {
  margin-top: 16px;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

#progressBar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), #6ee7b7);
  transition: width 0.35s ease;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(9, minmax(95px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.queue-lab {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(460px, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.inject {
  height: 38px;
  justify-content: flex-start;
}

.inject.normal {
  border-color: #8ad8b5;
  background: #f0fdf4;
}

.inject.budget {
  border-color: #ef9a9a;
  background: #fff7f7;
}

.inject.vendor {
  border-color: #f6c36a;
  background: #fffbeb;
}

.inject.inventory {
  border-color: #b8a2f4;
  background: #f6f2ff;
}

.inject.ambiguous {
  border-color: #aab7c7;
  background: #f8fafc;
}

.helper-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
}

.queue-table th,
.queue-table td {
  border-bottom: 1px solid #e8edf4;
  padding: 8px;
  text-align: left;
  font-size: 13px;
}

.queue-table th {
  color: #526175;
  background: #f8fafc;
}

.queue-row-pending {
  background: #fffbeb;
}

.queue-row-in_progress {
  background: #eaf7ff;
}

.queue-row-completed {
  background: #f0fdf4;
}

.queue-row-waiting_approval {
  background: #fff7f7;
}

.timeline-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 84px;
  padding: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

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

.timeline-step span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-step.active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(35, 184, 239, 0.18);
}

.timeline-step.done {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(320px, 0.95fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.panel-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.record-table th,
.record-table td {
  border-bottom: 1px solid #e8edf4;
  padding: 9px 8px;
  vertical-align: top;
}

.record-table th {
  width: 136px;
  color: #526175;
  text-align: left;
  background: #f8fafc;
}

.erp-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.context-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.context-grid div,
.decision-box,
.approval-card,
.proposal-card {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #fbfdff;
  padding: 11px;
}

.context-grid strong,
.context-grid span,
.decision-box label,
.decision-box strong {
  display: block;
}

.context-grid span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.decision-box {
  margin-top: 8px;
}

.decision-box label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.approval-card p,
.proposal-card p {
  margin: 7px 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.approval-actions {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 8px;
}

.proposal-card {
  margin-top: 10px;
}

.codex-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.memory-area {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
  margin-bottom: 14px;
}

.event-log {
  margin: 0;
  padding-left: 20px;
  max-height: 300px;
  overflow: auto;
}

.event-log li {
  margin-bottom: 8px;
  color: #334155;
}

.event-log time {
  color: var(--muted);
  font-size: 12px;
  margin-right: 6px;
}

.pattern-table {
  width: 100%;
  border-collapse: collapse;
}

.pattern-table th,
.pattern-table td {
  border-bottom: 1px solid #e8edf4;
  padding: 9px 8px;
  text-align: left;
  font-size: 13px;
}

.pattern-table th {
  color: #526175;
  background: #f8fafc;
}

.evidence {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.evidence article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: var(--shadow);
}

.evidence p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .workspace,
  .memory-area,
  .hero-grid,
  .hero-card,
  .queue-lab,
  .evidence {
    grid-template-columns: 1fr;
  }

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

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

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

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

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

  .erp-buttons,
  .approval-actions {
    grid-template-columns: 1fr;
  }
}
