:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --subtle: #8a96aa;
  --line: #d9e7ec;
  --line-strong: #c5dbe3;
  --paper: #ffffff;
  --paper-soft: #f8fbfc;
  --blue: #2f8ccf;
  --blue-soft: #e6f4ff;
  --mint: #42ad8a;
  --mint-soft: #e7f7ef;
  --rose: #d95c72;
  --rose-soft: #fdecef;
  --amber: #d7992f;
  --amber-soft: #fff6df;
  --violet: #7178c8;
  --violet-soft: #eff0ff;
  --shadow: 0 14px 34px rgba(42, 79, 102, 0.08);
  --font: "Inter", "M PLUS Rounded 1c", "Noto Sans SC", sans-serif;
  --note-font: "Inter", "M PLUS Rounded 1c", "Noto Sans SC", sans-serif;
  font-family: var(--font);
  background: #f5f8fa;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(94, 145, 166, 0.08) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(0deg, rgba(94, 145, 166, 0.06) 1px, transparent 1px) 0 0 / 32px 32px,
    #f6f9fa;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.workspace-shell {
  width: min(1280px, calc(100vw - 48px));
  margin: 28px auto 48px;
}

.detail-workspace {
  width: min(1360px, calc(100vw - 48px));
}

.erp-topbar {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 66px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-lockup,
.filter-buttons,
.date-cell span,
.sku-cell,
.top-nav,
.user-cluster,
.progress-copy,
.detail-nav,
.section-heading,
.pipeline-item,
.supplier-item,
.task-item {
  display: flex;
  align-items: center;
}

.brand-lockup {
  min-width: 0;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 104px;
  height: 35px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  color: #20283a;
  font-size: 15px;
  font-weight: 850;
}

.brand-copy small {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.top-nav {
  justify-content: center;
  gap: 3px;
}

.top-nav a,
.language-button,
.back-link,
.page-chip {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: #5f6b7f;
  font-size: 13px;
  font-weight: 750;
}

.top-nav a.active,
.top-nav a:hover {
  border-color: #d6e8ef;
  background: #eef8fb;
  color: #1f5d7d;
}

.user-cluster {
  justify-content: flex-end;
  gap: 9px;
  color: #526070;
  font-size: 13px;
  font-weight: 750;
}

.language-button {
  padding: 0 12px;
  border-color: #d9e7ec;
  background: #ffffff;
  color: #4a5568;
}

.icon-badge {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #dce7ff;
  border-radius: 999px;
  background: #eef2ff;
  color: #5260bd;
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(42, 79, 102, 0.06);
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 900;
}

.metric-card strong {
  display: block;
  color: #213047;
  font-size: 31px;
  line-height: 1;
}

.metric-card span:last-child {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.metric-card.rose .metric-icon {
  background: var(--rose-soft);
  color: var(--rose);
}

.metric-card.amber .metric-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.metric-card.mint .metric-icon {
  background: var(--mint-soft);
  color: var(--mint);
}

.metric-card.blue .metric-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.side-rail {
  display: grid;
  gap: 14px;
}

.operations-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.material-card {
  overflow: hidden;
}

.compact-card {
  padding: 16px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.section-heading.small {
  padding: 0 0 13px;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  color: #1c2738;
  line-height: 1.15;
}

.section-heading h1 {
  font-size: 22px;
}

.section-heading h2 {
  font-size: 15px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #7590a3;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-buttons {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-buttons button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #d8e6ed;
  border-radius: 7px;
  background: #ffffff;
  color: #526070;
  font-size: 13px;
  font-weight: 760;
}

.filter-buttons button.active {
  border-color: #74b8d9;
  background: #eaf7fd;
  color: #1f6f99;
  box-shadow: 0 0 0 3px rgba(47, 140, 207, 0.1);
}

.timeline-table {
  overflow: hidden;
  border-top: 1px solid #e5eef2;
}

.table-header,
.sku-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) 138px minmax(380px, 2fr) minmax(188px, 1fr) 28px;
  column-gap: 18px;
  align-items: center;
}

.table-header {
  min-height: 42px;
  padding: 0 18px;
  background: #f5fafb;
  color: #7a8ca1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sku-row {
  position: relative;
  min-height: 84px;
  padding: 16px 18px;
  border-top: 1px solid #e6eff2;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
  transition:
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.sku-row * {
  text-decoration: none;
}

.sku-row.completed-row {
  background: #fbfffd;
}

.sku-row.clickable-row:hover {
  z-index: 1;
  background: #f3fbfd;
  box-shadow: inset 3px 0 0 #2f8ccf;
  transform: translateX(2px);
}

.sku-cell {
  min-width: 0;
  gap: 10px;
}

.category-dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 5px var(--blue-soft);
}

.category-dot.plush {
  background: var(--rose);
  box-shadow: 0 0 0 5px var(--rose-soft);
}

.category-dot.pvc {
  background: var(--mint);
  box-shadow: 0 0 0 5px var(--mint-soft);
}

.sku-cell strong {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  color: #192437;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sku-cell small {
  display: block;
  overflow: hidden;
  color: #7c8b9e;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-cell {
  display: grid;
  gap: 7px;
  justify-items: start;
}

.type-pill,
.priority-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  white-space: nowrap;
}

.type-pill {
  min-width: 78px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #d9e7ec;
  background: #f8fbfc;
  color: #4d6172;
  font-size: 12px;
  font-weight: 850;
}

.priority-chip {
  min-height: 22px;
  padding: 0 8px;
  background: #f3f6f8;
  color: #7c8b9e;
  font-size: 11px;
  font-weight: 850;
}

.priority-chip.high {
  background: var(--amber-soft);
  color: var(--amber);
}

.priority-chip.urgent {
  background: var(--rose-soft);
  color: var(--rose);
}

.progress-cell {
  --progress: 0%;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.progress-copy {
  min-width: 0;
  gap: 8px;
}

.progress-copy strong {
  color: #22314a;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.progress-copy span {
  min-width: 0;
  overflow: hidden;
  color: #5e6d80;
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 8px;
  background: #edf4f7;
  color: #587083;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.status-pill.done {
  background: var(--mint-soft);
  color: #238466;
}

.status-pill.need-review,
.status-pill.at-risk {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.blocked {
  background: var(--rose-soft);
  color: var(--rose);
}

.progress-track {
  position: relative;
  height: 9px;
  overflow: visible;
  border-radius: 999px;
  background: #edf3f5;
}

.progress-fill {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: var(--progress);
  border-radius: inherit;
  background: linear-gradient(90deg, #70c9df, #43ae8b);
}

.progress-marker {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: clamp(8px, var(--progress), calc(100% - 8px));
  width: 16px;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: #2f8ccf;
  box-shadow: 0 0 0 2px rgba(47, 140, 207, 0.28);
  transform: translate(-50%, -50%);
}

.completed-row .progress-fill,
.completed .timeline-node,
.passed .timeline-node {
  background: #42ad8a;
}

.date-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  color: #7d8998;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.date-cell span {
  gap: 7px;
}

.date-cell b {
  color: #263248;
  font-weight: 850;
}

.date-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.date-dot.actual {
  background: var(--mint);
}

.date-dot.planned {
  background: #b7c7d0;
}

.actual-delta {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.actual-delta.early {
  background: var(--mint-soft);
  color: #238466;
}

.actual-delta.late {
  background: var(--rose-soft);
  color: var(--rose);
}

.actual-delta.on-time {
  background: #eef3f5;
  color: #657486;
}

.row-action {
  width: 28px;
  height: 28px;
  color: #8fa2b1;
  font-size: 25px;
  line-height: 1;
  text-align: center;
}

.sku-row:not(.clickable-row) .row-action {
  opacity: 0.35;
}

.empty-state,
.empty-mini {
  color: #8795a5;
  font-weight: 760;
}

.empty-state {
  padding: 34px 18px;
  font-size: 15px;
}

.empty-mini {
  padding: 16px 0 4px;
  font-size: 13px;
}

.pipeline-list,
.supplier-list,
.alert-list,
.process-list,
.task-list {
  display: grid;
  gap: 9px;
}

.pipeline-item {
  justify-content: space-between;
  min-height: 35px;
  padding: 0 10px;
  border-radius: 7px;
  background: #f7fbfc;
  color: #526070;
  font-size: 13px;
  font-weight: 780;
}

.pipeline-item strong {
  color: #263248;
  font-size: 15px;
}

.pipeline-item.blue {
  box-shadow: inset 3px 0 0 var(--blue);
}

.pipeline-item.amber {
  box-shadow: inset 3px 0 0 var(--amber);
}

.pipeline-item.mint {
  box-shadow: inset 3px 0 0 var(--mint);
}

.pipeline-item.rose {
  box-shadow: inset 3px 0 0 var(--rose);
}

.supplier-item {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #edf3f5;
}

.supplier-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.supplier-item strong,
.alert-item span {
  display: block;
  color: #243047;
  font-size: 13px;
  font-weight: 850;
}

.supplier-item span {
  display: block;
  margin-top: 4px;
  color: #8090a0;
  font-size: 11px;
  font-weight: 730;
}

.supplier-item em {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.supplier-item em.good {
  background: var(--mint-soft);
  color: #238466;
}

.supplier-item em.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.supplier-item em.danger {
  background: var(--rose-soft);
  color: var(--rose);
}

.alert-card {
  background: linear-gradient(180deg, #ffffff 0%, #fffdf5 100%);
}

.alert-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #f1e3ba;
  border-radius: 7px;
  background: #fff9e8;
  text-decoration: none;
}

.alert-item strong {
  color: #8a6418;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.4;
}

.detail-nav {
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 12px;
}

.back-link,
.page-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-color: #d9e7ec;
  background: rgba(255, 255, 255, 0.9);
  color: #526070;
  font-size: 13px;
  font-weight: 820;
}

.page-chip {
  color: #587083;
}

.timeline-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.utility-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #d9e7ec;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: #526070;
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  cursor: pointer;
}

.utility-button:hover {
  border-color: #9ed1e5;
  background: #f0f9fd;
  color: #1f6f99;
}

.import-button input {
  display: none;
}

.backup-status {
  max-width: 220px;
  color: #708295;
  font-size: 11px;
  line-height: 1.35;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.detail-hero h1 {
  margin: 13px 0 8px;
  color: #1b2638;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.detail-hero p {
  margin: 0;
  color: #667085;
  font-size: 14px;
  font-weight: 760;
}

.detail-stat-pack {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 10px;
}

.mini-stat {
  display: grid;
  gap: 8px;
  min-width: 112px;
  padding: 13px 14px;
  border: 1px solid #dfebf0;
  border-radius: 8px;
  background: #f8fbfc;
}

.mini-stat span {
  color: #78879a;
  font-size: 12px;
  font-weight: 820;
}

.mini-stat b {
  color: #1f2a3d;
  font-size: 22px;
  line-height: 1;
}

.date-pair {
  display: grid;
  gap: 7px;
}

.date-pair p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.date-pair span {
  font-size: 11px;
}

.date-pair b {
  font-size: 18px;
}

.mini-stat.accent {
  background: var(--mint-soft);
}

.mini-stat.calm {
  background: var(--blue-soft);
}

.detail-board {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.process-card,
.timeline-panel,
.response-card {
  min-width: 0;
  padding: 16px;
}

.timeline-panel {
  overflow: hidden;
}

.process-card {
  position: sticky;
  top: 18px;
}

.process-list {
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.process-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 58px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.process-item:hover,
.process-item.active {
  border-color: #cde6f2;
  background: #f0f9fd;
}

.process-item.current,
.process-item.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.process-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: #eef3f5;
  color: #637586;
  font-size: 12px;
  font-weight: 950;
}

.process-item.completed .process-index,
.process-item.passed .process-index {
  background: var(--mint-soft);
  color: #238466;
}

.process-item.current .process-index,
.process-item.active .process-index {
  background: var(--blue);
  color: #ffffff;
}

.process-item strong {
  display: block;
  overflow: hidden;
  color: #213047;
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-item small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #8090a0;
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #bad4dd transparent;
}

.horizontal-timeline {
  --side-pad: 36px;
  --step-size: 162px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--step-count, 16), var(--step-size));
  align-items: start;
  width: max-content;
  min-width: 100%;
  min-height: 386px;
  padding: 38px var(--side-pad) 28px;
}

.horizontal-timeline::before {
  content: "";
  position: absolute;
  top: 65px;
  left: calc(var(--side-pad) + 52px);
  right: calc(var(--side-pad) + 52px);
  height: 10px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    #e7eef2 0,
    #e7eef2 46px,
    #d8e6ec 46px,
    #d8e6ec 48px
  );
}

.horizontal-step {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  align-content: start;
  min-width: 0;
  min-height: 390px;
  padding: 0 7px;
  color: inherit;
  outline: 0;
  text-align: center;
}

.step-trigger {
  appearance: none;
  display: grid;
  justify-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  outline: 0;
}

.timeline-node {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 2px 0 14px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: #b8c7d0;
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
  box-shadow: 0 0 0 1px rgba(111, 132, 148, 0.22);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.horizontal-step.current .timeline-node,
.horizontal-step.selected .timeline-node {
  background: var(--blue);
}

.horizontal-step.upcoming .timeline-node {
  background: #cfd9df;
  color: #617484;
}

.horizontal-step:hover .timeline-node,
.horizontal-step:focus-within .timeline-node,
.horizontal-step.selected .timeline-node {
  transform: scale(1.08);
  box-shadow:
    0 0 0 4px #ffffff,
    0 0 0 7px rgba(47, 140, 207, 0.24),
    0 12px 24px rgba(43, 100, 128, 0.16);
}

.step-name {
  display: block;
  width: 128px;
  min-height: 38px;
  margin-bottom: 6px;
  color: #263248;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

.horizontal-step time {
  color: #7d8ca0;
  font-size: 12px;
  font-weight: 500;
}

.step-thread {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 100%);
  justify-items: center;
  gap: 8px;
  width: 156px;
  min-height: 86px;
  margin-top: 18px;
  padding-top: 14px;
  overflow: visible;
}

.step-thread::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 22px;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: #cfe5ed;
  transform: translateX(-50%);
}

.thread-entry {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  width: 150px;
  padding: 8px;
  border: 1px solid #d9e7ec;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(42, 79, 102, 0.08);
  cursor: grab;
  transform-origin: center top;
  transition:
    width 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.thread-entry:active {
  cursor: grabbing;
}

.thread-entry.is-dragging {
  opacity: 0.72;
  transform: scale(1.03);
  box-shadow: 0 16px 34px rgba(42, 79, 102, 0.18);
}

.horizontal-step.is-drop-target .timeline-node {
  background: #1f8fb8;
  transform: scale(1.1);
  box-shadow:
    0 0 0 4px #ffffff,
    0 0 0 8px rgba(47, 140, 207, 0.2),
    0 12px 24px rgba(43, 100, 128, 0.16);
}

.horizontal-step.is-drop-target .step-thread::before {
  background: #74b8d9;
}

.horizontal-step.is-drop-target .step-thread {
  border-radius: 7px;
  background: rgba(240, 249, 253, 0.72);
}

.thread-entry img {
  display: block;
  width: 40px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #eef3f5;
}

.thread-entry:hover,
.thread-entry:focus-visible {
  border-color: #b7d8e6;
  box-shadow: 0 12px 26px rgba(42, 79, 102, 0.12);
}

.thread-entry:focus-visible {
  outline: 3px solid rgba(47, 140, 207, 0.22);
  outline-offset: 3px;
}

.thread-entry:has(img) {
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
}

.thread-entry p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #29364a;
  font-family: var(--note-font);
  font-size: 11px;
  font-weight: 300;
  line-height: 1.35;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.thread-entry:has(img) p {
  grid-column: 2;
}

body.modal-open {
  overflow: hidden;
}

.entry-modal[hidden] {
  display: none;
}

.entry-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.entry-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 31, 46, 0.46);
  cursor: zoom-out;
}

.entry-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid #d8e7ee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(17, 31, 46, 0.28);
}

.entry-modal-header,
.entry-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.entry-modal-header {
  border-bottom: 1px solid #edf3f6;
}

.entry-modal-header h2 {
  margin: 4px 0 0;
  color: #1f2b3d;
  font-size: 20px;
  letter-spacing: 0;
}

.entry-modal-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #d8e7ee;
  border-radius: 999px;
  background: #ffffff;
  color: #627286;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.entry-modal-body {
  display: grid;
  gap: 16px;
  max-height: min(68vh, 620px);
  overflow: auto;
  padding: 20px;
}

.entry-modal-image {
  display: block;
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border: 1px solid #e1ebef;
  border-radius: 8px;
  background: #f6fafc;
}

.entry-modal-text {
  margin: 0;
  color: #233044;
  font-family: var(--note-font);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.65;
  white-space: pre-wrap;
}

.entry-modal-actions {
  justify-content: flex-end;
  border-top: 1px solid #edf3f6;
  background: #fbfdfe;
}

.delete-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #f0b4bf;
  border-radius: 8px;
  background: #fff2f4;
  color: #c5354d;
  cursor: pointer;
  font-size: 14px;
  font-weight: 820;
}

.delete-button:hover,
.delete-button:focus-visible {
  border-color: #dd7184;
  background: #ffe5ea;
}

.thread-add {
  position: relative;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #9ed1e5;
  border-radius: 999px;
  background: #f0f9fd;
  color: var(--blue);
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
  outline: 0;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.thread-add:hover,
.horizontal-step.form-open .thread-add {
  background: #e0f3fb;
  transform: scale(1.06);
  box-shadow: 0 0 0 5px rgba(47, 140, 207, 0.1);
}

.thread-add:active {
  transform: scale(1.14);
}

.inline-upload-form {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: stretch;
  gap: 10px;
  width: 230px;
  max-width: calc(100vw - 48px);
  padding: 12px;
  border: 1px solid #d9e7ec;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(42, 79, 102, 0.12);
}

.inline-upload-form > * {
  min-width: 0;
  max-width: 100%;
}

.inline-upload-form[hidden] {
  display: none;
}

.image-picker {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #6d7a8b;
  font-size: 12px;
  font-weight: 850;
  text-align: left;
}

.image-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.file-button {
  display: inline-flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  padding: 0 10px;
  border: 1px solid #d9e7ec;
  border-radius: 7px;
  background: #f8fbfc;
  color: #4f5f70;
  font-size: 12px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-status {
  min-height: 15px;
  overflow-wrap: anywhere;
  color: #6f7f8f;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.25;
  text-align: left;
}

.inline-upload-form.has-error .ai-status {
  color: var(--rose);
}

.inline-upload-form.is-analyzing .file-button {
  border-color: #9ed1e5;
  background: #f0f9fd;
  color: #1f6f99;
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.upload-actions .ai-button,
.upload-actions .save-button.compact-save {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
}

.ai-button {
  min-height: 34px;
  min-width: 82px;
  padding: 0 12px;
  border: 1px solid #9ed1e5;
  border-radius: 7px;
  background: #eef8fc;
  color: #1f6f99;
  font-size: 12px;
  font-weight: 880;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.ai-button:not(:disabled):hover {
  border-color: #70b8d4;
  background: #e1f2fa;
  transform: translateY(-1px);
}

.ai-button:disabled {
  border-color: #d9e7ec;
  background: #f5f8fa;
  color: #a1aeb8;
  cursor: not-allowed;
}

.inline-upload-form.is-analyzing .ai-button {
  border-color: #1f6f99;
  background: #1f6f99;
  color: #ffffff;
}

.inline-upload-form textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  max-width: 100%;
  resize: vertical;
  padding: 8px 9px;
  border: 1px solid #d9e7ec;
  border-radius: 7px;
  background: #ffffff;
  color: #1d2939;
  font: inherit;
  font-size: 13px;
}

.save-button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: #1f6f99;
  color: #ffffff;
  font-weight: 880;
}

.save-button.compact-save {
  justify-self: end;
  min-width: 68px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.response-card {
  margin-top: 18px;
}

.task-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-item {
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #dfeaf0;
  border-radius: 8px;
  background: #f8fbfc;
}

.task-item > span {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #edf3f5;
  color: #647587;
  font-size: 12px;
  font-weight: 950;
}

.task-item.current {
  border-color: #b7daeb;
  background: #f0f9fd;
}

.task-item.current > span {
  background: var(--blue);
  color: #ffffff;
}

.task-item strong {
  display: block;
  color: #243047;
  font-size: 13px;
  font-weight: 880;
}

.task-item p {
  margin: 4px 0 0;
  color: #657486;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.4;
}

.task-item em {
  flex: 0 0 auto;
  max-width: 128px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

@media (max-width: 1180px) {
  .erp-topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
    padding: 14px;
  }

  .top-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .user-cluster {
    justify-content: flex-start;
  }

  .dashboard-grid,
  .detail-board {
    grid-template-columns: 1fr;
  }

  .process-card {
    position: static;
  }

  .process-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }
}

@media (max-width: 920px) {
  .metric-grid,
  .task-list,
  .detail-stat-pack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-table {
    overflow-x: auto;
  }

  .table-header,
  .sku-row {
    width: 960px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace-shell,
  .detail-workspace {
    width: calc(100vw - 20px);
    margin: 12px auto 28px;
  }

  .metric-grid,
  .task-list,
  .detail-stat-pack,
  .process-list {
    grid-template-columns: 1fr;
  }

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

  .filter-buttons {
    justify-content: flex-start;
  }

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

  .horizontal-timeline {
    --step-size: 148px;
  }
}
