:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --surface-green: #e7f4ed;
  --surface-blue: #e8f2f8;
  --surface-amber: #fff3df;
  --surface-red: #fdebea;
  --text: #17211e;
  --muted: #66726e;
  --line: #d7e0dc;
  --green: #257d58;
  --blue: #276d9a;
  --amber: #a45d12;
  --red: #ae3d37;
  --shadow: 0 12px 28px rgba(23, 33, 30, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

p,
h1,
h2,
h3,
span,
strong,
dd,
button,
a {
  overflow-wrap: anywhere;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.app-header h1 {
  margin: 5px 0 0;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: 0;
}

.app-header p {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

body.role-customer .header-meta,
body.role-master .header-meta {
  display: none;
}

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-amber);
  color: var(--amber);
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.database {
  background: var(--surface-blue);
  color: var(--blue);
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px clamp(10px, 3vw, 26px) 36px;
}

.app-shell,
.workspace,
.view,
.panel,
.customer-hero,
.master-hero,
.master-layout,
.master-main,
.summary-box,
.sop-info,
.part-card > *,
.customer-hero > *,
.master-hero > * {
  min-width: 0;
}

.role-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.role-nav[hidden] {
  display: none;
}

.role-nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.role-nav a.active {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
}

.view {
  display: none;
  gap: 14px;
}

.view.active {
  display: grid;
}

.panel,
.customer-hero,
.master-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.customer-hero,
.master-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 22px;
  background:
    linear-gradient(120deg, rgba(232, 242, 248, 0.96), rgba(231, 244, 237, 0.88)),
    var(--surface);
}

.customer-hero h2,
.master-hero h2 {
  margin: 12px 0 8px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

.customer-hero p,
.master-hero p {
  margin: 0;
  color: #263a34;
  line-height: 1.7;
}

.hero-stat {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 126px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.78);
}

.hero-stat strong {
  color: var(--green);
  font-size: 32px;
  line-height: 1;
}

.hero-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green {
  color: var(--green);
  background: var(--surface-green);
}

.badge.blue {
  color: var(--blue);
  background: var(--surface-blue);
}

.badge.amber {
  color: var(--amber);
  background: var(--surface-amber);
}

.badge.red {
  color: var(--red);
  background: var(--surface-red);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.step {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #edf1ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.step.active {
  background: var(--green);
  color: #fff;
}

.issue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.issue-card {
  min-height: 148px;
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.issue-card:hover {
  border-color: var(--blue);
  box-shadow: 0 10px 22px rgba(39, 109, 154, 0.12);
}

.issue-card.active {
  border-color: var(--green);
  background: var(--surface-green);
}

.issue-card strong {
  display: block;
  font-size: 17px;
  line-height: 1.3;
}

.issue-card span,
.issue-card small {
  color: var(--muted);
  line-height: 1.45;
}

.issue-card small {
  font-size: 12px;
}

.repair-form,
.triage-list,
.sop-list,
.checklist-list,
.timeline,
.summary-list {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
.role-nav a:focus-visible {
  outline: 3px solid rgba(39, 109, 154, 0.24);
  outline-offset: 2px;
}

.summary-box {
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  line-height: 1.65;
}

.summary-box h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.summary-box p {
  margin: 6px 0;
}

.customer-next {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.guide-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-chip,
.checklist-chip,
.mini-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-blue);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.triage-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fffdfa;
}

.triage-card.done {
  border-color: #b9d9c9;
  background: #fbfffd;
}

.triage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.triage-card h3,
.sop-card h3,
.part-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.triage-card p,
.sop-card p,
.part-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.check-tip,
.sop-tip {
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-amber);
  color: #6c4217;
}

.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-buttons button,
.button-row button,
.master-actions button,
.sop-nav button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.result-buttons button.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.result-buttons button[data-result="fail"].active {
  background: var(--red);
  border-color: var(--red);
}

.result-buttons button[data-result="uncertain"].active {
  background: var(--amber);
  border-color: var(--amber);
}

.step-note {
  display: grid;
  gap: 7px;
}

.mini-upload {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mini-upload ul,
.evidence-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.evidence-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.evidence-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button-row,
.master-actions,
.sop-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary {
  color: #fff !important;
  background: var(--green) !important;
  border-color: var(--green) !important;
}

.secondary {
  color: var(--text) !important;
  background: #fff !important;
}

.success-card {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #b8d9c9;
  border-radius: 8px;
  background: var(--surface-green);
}

.success-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
}

.success-card p {
  margin: 4px 0 0;
  line-height: 1.6;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  background: #cbd5d1;
}

.timeline-item.done .timeline-dot {
  background: var(--green);
}

.timeline-item strong {
  display: block;
  margin-bottom: 2px;
}

.timeline-item span {
  color: var(--muted);
  font-size: 13px;
}

.master-layout {
  display: grid;
  grid-template-columns: minmax(250px, 330px) 1fr;
  gap: 14px;
}

.task-panel {
  align-self: start;
  position: sticky;
  top: 12px;
}

.task-priority {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--blue);
  font-weight: 800;
}

.master-main {
  display: grid;
  gap: 14px;
}

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

.part-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.part-visual,
.sop-visual {
  min-height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(39, 109, 154, 0.12), rgba(37, 125, 88, 0.1)),
    var(--surface-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  padding: 8px;
}

.part-card dl,
.summary-list {
  margin: 0;
}

.part-card dt,
.summary-list dt {
  color: var(--muted);
  font-size: 12px;
}

.part-card dd,
.summary-list dd {
  margin: 3px 0 8px;
  font-weight: 800;
  word-break: break-word;
}

.sop-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.sop-step-pill {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.sop-step-pill.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--surface-blue);
}

.sop-step-pill.done {
  border-color: #b8d9c9;
  color: var(--green);
}

.sop-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

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

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

.sop-info {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.sop-info strong {
  color: var(--text);
}

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

.completion-note {
  margin-top: 16px;
}

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

.admin-grid h3 {
  margin: 0 0 10px;
}

.summary-list div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.admin-dashboard,
.integration-grid,
.sync-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.admin-metric,
.integration-item,
.sync-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.admin-metric strong,
.integration-item strong,
.sync-item strong {
  display: block;
  margin-bottom: 6px;
}

.admin-metric span,
.integration-item span,
.sync-item span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.payload-preview {
  min-height: 420px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #10231b;
  color: #dbf5e8;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

@media (max-width: 920px) {
  .customer-hero,
  .master-hero,
  .master-layout,
  .admin-grid,
  .admin-dashboard,
  .integration-grid,
  .sync-summary,
  .form-row,
  .sop-location-grid {
    grid-template-columns: 1fr;
  }

  .task-panel {
    position: static;
  }

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

@media (max-width: 620px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header h1 {
    font-size: 25px;
  }

  .app-shell {
    padding-inline: 10px;
  }

  .panel,
  .customer-hero,
  .master-hero {
    padding: 14px;
  }

  .role-nav,
  .stepper,
  .issue-grid,
  .parts-grid,
  .sop-progress,
  .sop-visual-grid {
    grid-template-columns: 1fr;
  }

  .part-card {
    grid-template-columns: 1fr;
  }

  .button-row button,
  .master-actions button,
  .sop-nav button {
    width: 100%;
  }
}

.assistant-panel[hidden],
.master-panel[hidden] {
  display: none !important;
}

.assistant-input {
  margin-bottom: 14px;
}

.category-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.category-chip,
.master-task-chip,
.master-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.category-chip {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  text-align: left;
}

.category-chip span,
.master-task-chip span,
.master-task-chip small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.category-chip.active,
.master-task-chip.active,
.master-tabs button.active {
  border-color: var(--green);
  background: var(--surface-green);
  color: var(--green);
}

.review-box {
  margin-bottom: 14px;
}

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

.review-grid > div {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.review-grid strong {
  font-size: 13px;
}

.review-grid span {
  color: var(--muted);
  line-height: 1.5;
}

.compact-actions {
  margin-top: 12px;
}

.master-task-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.master-task-chip {
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 10px;
  text-align: left;
}

.master-tabs {
  position: sticky;
  top: 10px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.master-tabs button {
  min-height: 42px;
  padding: 8px 10px;
}

.asset-placeholder {
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--blue);
  text-align: center;
  padding: 10px;
}

.asset-placeholder strong,
.asset-placeholder span,
.asset-placeholder small,
.asset-placeholder em {
  line-height: 1.25;
}

.asset-placeholder span,
.asset-placeholder small {
  color: var(--muted);
  font-size: 12px;
}

.asset-placeholder em {
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-amber);
  color: var(--amber);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.summary-box.compact {
  padding: 10px;
  font-size: 13px;
}

@media (max-width: 920px) {
  .category-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  body.role-customer .app-shell,
  body.role-master .app-shell {
    padding-bottom: 78px;
  }

  body.role-master .app-shell {
    padding-bottom: 40px;
  }

  body.role-customer .customer-hero,
  body.role-master .master-hero {
    gap: 10px;
  }

  body.role-customer .customer-hero h2,
  body.role-master .master-hero h2 {
    font-size: 22px;
  }

  body.role-customer .hero-stat {
    min-width: 96px;
    padding: 12px;
  }

  body.role-customer .hero-stat strong {
    font-size: 26px;
  }

  .category-row,
  body.role-customer .issue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.role-customer .issue-card {
    min-height: 124px;
    gap: 7px;
    padding: 11px;
  }

  body.role-customer .issue-card strong {
    font-size: 15px;
  }

  body.role-customer .issue-card span,
  body.role-customer .issue-card small {
    font-size: 12px;
  }

  .category-chip {
    min-height: 58px;
    padding: 8px;
  }

  .master-tabs {
    position: sticky;
    top: 8px;
    right: auto;
    bottom: auto;
    left: auto;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 6px;
  }

  .master-tabs button {
    min-height: 42px;
    padding: 6px 4px;
    font-size: 12px;
  }

  .asset-placeholder {
    min-height: 84px;
  }

  .sop-location-grid,
  .sop-visual-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  body.role-customer .app-header {
    padding: 12px 14px;
  }

  body.role-customer .app-header h1 {
    font-size: 21px;
  }

  body.role-customer .app-header p {
    display: none;
  }

  body.role-customer .customer-hero {
    grid-template-columns: 1fr auto;
    padding: 12px;
  }

  body.role-customer .customer-hero p {
    line-height: 1.45;
    font-size: 13px;
  }

  body.role-customer .category-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
    margin: 0 0 10px;
    padding: 0;
  }

  body.role-customer .category-chip {
    min-height: 52px;
    padding: 7px 8px;
  }

  body.role-customer .category-chip span {
    display: block;
    font-size: 11px;
  }

  body.role-customer .category-chip.unknown-category {
    grid-column: 1 / -1;
    min-height: 48px;
    text-align: center;
  }

  body.role-customer .issue-card {
    min-height: 104px;
    padding: 10px;
  }

  body.role-customer .issue-card > span:not(.mini-chip) {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.role-customer .issue-card small {
    display: none;
  }
}
@media (max-width: 620px) {
  body.role-master[data-master-tab="parts"] .task-panel,
  body.role-master[data-master-tab="sop"] .task-panel,
  body.role-master[data-master-tab="finish"] .task-panel {
    display: none;
  }

  body.role-master .app-header {
    padding: 12px 14px;
  }

  body.role-master .app-header h1 {
    font-size: 21px;
  }

  body.role-master .app-header p,
  body.role-master .master-hero p {
    display: none;
  }

  body.role-master .master-hero {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  body.role-master .master-hero h2 {
    font-size: 21px;
    margin-bottom: 0;
  }

  body.role-master .master-actions {
    margin-top: 8px;
  }

  body.role-master .sop-progress {
    display: flex;
    overflow-x: auto;
    margin-bottom: 10px;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  body.role-master .sop-progress::-webkit-scrollbar {
    display: none;
  }

  body.role-master .sop-step-pill {
    flex: 0 0 104px;
    min-height: 36px;
    font-size: 12px;
  }

  body.role-master .sop-card {
    gap: 10px;
    padding: 12px;
  }

  body.role-master .sop-card-header {
    gap: 8px;
  }

  body.role-master .sop-card h3 {
    font-size: 16px;
  }

  body.role-master .sop-location-grid,
  body.role-master .sop-visual-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.role-master .sop-info {
    gap: 5px;
    padding: 9px;
  }

  body.role-master .sop-info p,
  body.role-master .sop-tip {
    font-size: 12px;
    line-height: 1.38;
  }

  body.role-master .sop-tip {
    padding: 8px;
  }

  body.role-master .asset-placeholder {
    min-height: 68px;
    padding: 7px;
  }

  body.role-master .asset-placeholder em,
  body.role-master .asset-placeholder small {
    display: none;
  }

  body.role-master .sop-card .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  body.role-master .sop-card .chip-row::-webkit-scrollbar {
    display: none;
  }

  body.role-master .sop-card .guide-chip {
    flex: 0 0 auto;
    min-height: 28px;
    font-size: 12px;
  }

  body.role-master .step-note textarea {
    min-height: 62px;
  }

  body.role-master .mini-upload {
    padding: 8px;
  }

  body.role-master .sop-nav {
    margin-top: 6px;
  }
}
@media (max-width: 620px) {
  body.role-master[data-master-tab="parts"] .master-hero,
  body.role-master[data-master-tab="sop"] .master-hero,
  body.role-master[data-master-tab="finish"] .master-hero {
    display: none;
  }

  body.role-master[data-master-tab="sop"] #masterSopPanel > .panel-heading {
    display: none;
  }

  body.role-master[data-master-tab="sop"] .app-shell {
    padding-top: 8px;
  }

  body.role-master[data-master-tab="sop"] #masterSopPanel {
    padding: 10px;
  }
}
.text-first-part {
  grid-template-columns: minmax(180px, 0.95fr) 1fr;
}

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

.text-location-card {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.text-location-card strong {
  color: var(--text);
}

.text-location-card span {
  color: var(--blue);
  font-weight: 800;
}

.text-location-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.text-location-card small {
  color: var(--amber);
  font-weight: 800;
  line-height: 1.35;
}

@media (max-width: 620px) {
  .text-first-part,
  .sop-text-grid {
    grid-template-columns: 1fr;
  }

  body.role-master .text-location-card {
    min-height: auto;
    padding: 9px;
  }

  body.role-master .text-location-card p,
  body.role-master .text-location-card small {
    font-size: 12px;
  }
}
.secondary-parts {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.secondary-parts summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

.nested-parts {
  margin-top: 10px;
}
.admin-workbench {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 14px;
}

.admin-list-panel,
.admin-detail-panel {
  min-width: 0;
}

.admin-list-toolbar,
.admin-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-detail-title h3 {
  margin: 8px 0 0;
  font-size: 18px;
}

.admin-work-order-list,
.trace-list {
  display: grid;
  gap: 10px;
}

.admin-work-order {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-weight: 800;
}

.admin-work-order.active {
  border-color: var(--red);
  background: var(--surface-red);
  color: var(--red);
}

.admin-work-order span,
.admin-work-order small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.admin-trace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.admin-trace-grid h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.trace-item {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.trace-item strong {
  color: var(--text);
}

.trace-item span {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 920px) {
  .admin-workbench,
  .admin-trace-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  body.role-admin .header-meta,
  body.role-admin .app-header p,
  body.role-admin .admin-integration-panel {
    display: none;
  }

  body.role-admin .app-header {
    padding: 12px 14px;
  }

  body.role-admin .app-header h1 {
    font-size: 21px;
  }

  body.role-admin .app-shell {
    padding: 8px 10px 20px;
  }

  body.role-admin .panel {
    padding: 12px;
  }

  body.role-admin .panel-heading {
    align-items: flex-start;
    margin-bottom: 10px;
  }

  body.role-admin .admin-workbench {
    gap: 10px;
  }

  body.role-admin .admin-list-toolbar,
  body.role-admin .admin-detail-title {
    margin-bottom: 8px;
  }

  body.role-admin .admin-detail-title h3 {
    margin-top: 6px;
    font-size: 16px;
  }

  body.role-admin .admin-work-order {
    min-height: 62px;
    padding: 9px;
  }

  body.role-admin .admin-grid {
    gap: 8px;
  }

  body.role-admin .summary-list {
    gap: 4px;
  }

  body.role-admin .summary-list div {
    padding: 6px 0;
  }

  body.role-admin .admin-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  body.role-admin .admin-metric {
    padding: 8px;
  }

  body.role-admin .admin-trace-grid {
    gap: 8px;
    margin-top: 10px;
  }

  body.role-admin .admin-trace-grid h3 {
    margin-bottom: 6px;
    font-size: 14px;
  }

  body.role-admin .trace-list {
    gap: 6px;
  }

  body.role-admin .trace-item {
    gap: 4px;
    padding: 8px;
  }

  body.role-admin .trace-item strong {
    font-size: 13px;
  }

  body.role-admin .trace-item span {
    font-size: 12px;
    line-height: 1.32;
  }
}
@media (max-width: 360px) {
  body.role-customer .category-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.master-next-action {
  display: grid;
  gap: 9px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--surface-blue);
}

.master-next-action p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.master-next-action ol,
.replacement-coach ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.next-action-head {
  display: grid;
  gap: 6px;
}

.next-action-head strong {
  font-size: 17px;
}

.novice-guide-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.novice-guide-card > div,
.replacement-coach,
.required-evidence,
.finish-gate,
.part-coach {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.novice-guide-card p,
.replacement-coach p,
.part-coach p,
.finish-gate span {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.replacement-coach {
  border-color: var(--amber);
  background: var(--surface-amber);
}

.required-evidence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.required-evidence strong {
  flex: 1 0 100%;
}

.checklist-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.checklist-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.checklist-toggle span {
  line-height: 1.45;
}

.part-coach {
  margin-top: 8px;
}

.part-coach p {
  font-size: 13px;
}

@media (max-width: 620px) {
  body.role-master .novice-guide-card,
  body.role-master .sop-text-grid {
    grid-template-columns: 1fr;
  }

  body.role-master .master-next-action,
  body.role-master .novice-guide-card > div,
  body.role-master .replacement-coach,
  body.role-master .required-evidence,
  body.role-master .finish-gate,
  body.role-master .part-coach {
    padding: 8px;
  }

  body.role-master .master-task-list {
    gap: 6px;
    margin-bottom: 8px;
  }

  body.role-master .master-task-chip {
    min-height: 58px;
    padding: 8px;
  }

  body.role-master .master-next-action {
    gap: 6px;
    margin: 8px 0;
  }

  body.role-master .master-next-action p {
    line-height: 1.36;
  }

  body.role-master .master-next-action ol,
  body.role-master .replacement-coach ol {
    line-height: 1.38;
  }
}
@media (max-width: 620px) {
  body.role-master[data-master-tab="sop"] .sop-find-grid,
  body.role-master[data-master-tab="sop"] .sop-outcome-grid {
    display: none;
  }
}
.assistant-device-card,
.assistant-question-card,
.master-model-gate,
.resource-detail {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.assistant-device-card > div,
.assistant-question-head,
.master-model-head,
.resource-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.assistant-device-card strong,
.assistant-question-card strong,
.master-model-gate strong,
.resource-detail strong {
  line-height: 1.35;
}

.assistant-device-card span,
.assistant-question-card p,
.assistant-question-card span,
.master-model-gate p,
.master-model-gate span,
.resource-detail p,
.resource-detail span,
.asset-status {
  color: var(--muted);
  line-height: 1.55;
}

.inline-check {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.inline-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

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

.assistant-option,
.resource-card,
.part-use-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.assistant-option {
  min-height: 72px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 10px;
  text-align: left;
}

.assistant-option.active,
.resource-card:hover,
.resource-card:focus-visible {
  border-color: var(--green);
  background: var(--surface-green);
}

.manual-picker {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.manual-picker summary {
  min-height: 44px;
  padding: 12px;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.manual-picker[open] {
  padding: 0 12px 12px;
}

.manual-picker[open] summary {
  margin: 0 -12px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-green);
}

.submit-warning,
.asset-status.warning {
  padding: 10px 12px;
  border: 1px solid #efc9a0;
  border-radius: 8px;
  background: var(--surface-amber);
  color: #6c4217;
  font-weight: 800;
  line-height: 1.45;
}

.master-model-gate.locked {
  border-color: #efc9a0;
  background: var(--surface-amber);
}

.master-model-actions,
.resource-actions,
.part-use-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resource-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: left;
}

.resource-detail[hidden] {
  display: none !important;
}

.resource-detail-grid {
  display: grid;
  gap: 10px;
}

.resource-detail-grid > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.locked-tab {
  opacity: 0.55;
}

.part-use-row {
  align-items: center;
  margin-top: 10px;
}

.part-use-button {
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 800;
}

.part-use-button.used {
  border-color: var(--green);
  background: var(--surface-green);
  color: var(--green);
}

@media (max-width: 620px) {
  .assistant-options,
  .category-row,
  .review-grid,
  .resource-detail-grid {
    grid-template-columns: 1fr;
  }

  .assistant-device-card,
  .assistant-question-card,
  .master-model-gate,
  .resource-detail {
    padding: 10px;
  }

  .assistant-device-card > div,
  .assistant-question-head,
  .master-model-head,
  .resource-detail-head {
    display: grid;
  }

  .category-chip,
  .assistant-option {
    min-height: 58px;
  }

  .manual-picker[open] {
    padding-inline: 10px;
  }

  .manual-picker[open] summary {
    margin-inline: -10px;
  }
}
.manual-picker:not([open]) > :not(summary) {
  display: none !important;
}
@media (max-width: 620px) {
  .stepper {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 5px;
  }

  .step {
    min-height: 30px;
    padding: 4px 3px;
    font-size: 12px;
  }
}