:root {
  --bg: #f6faf9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0f766e;
  --primary-soft: #ecfdf5;
  --primary-strong: #115e59;
  --blue: #2563eb;
  --amber: #d97706;
  --green: #16a34a;
  --rose: #e11d48;
  --shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

.runtime-status { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 10px 0; min-height: 40px; font-size: 13px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.runtime-status[data-state="error"] { color: #b42318; }
.runtime-notice { margin: 6px 0 14px; color: #8a4b08; font-size: 12px; line-height: 1.6; }
.account-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.account-bar form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.account-bar label { display: grid; gap: 4px; font-size: 12px; min-width: 0; max-width: 100%; }
.account-bar input, .account-bar select { width: 220px; max-width: 100%; min-width: 0; height: 36px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); padding: 6px; }
.account-bar button { min-height: 36px; padding: 6px 12px; border-radius: 4px; }
.account-bar strong { font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.account-bar [hidden] { display: none; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }

.top-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand, .header-actions, .user-chip, .hero-stats, .section-head, .action-bar, .config-row {
  display: flex;
  align-items: center;
}

.brand { gap: 12px; }
.brand h1 { margin: 0; font-size: 17px; line-height: 1.2; }
.brand span { color: var(--muted); font-size: 12px; }
.brand em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  border-radius: 8px;
}

.header-actions { gap: 16px; }
.ghost-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
}
.ghost-icon:hover { background: #f1f5f9; color: var(--primary); }

.user-chip { gap: 8px; padding-left: 16px; border-left: 1px solid var(--line); font-size: 14px; }
.user-chip span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f766e, #38bdf8);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.22);
}

.app-layout {
  height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  overflow: hidden;
}

.icon-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 24px 0;
  background: #fff;
  border-right: 1px solid var(--line);
}

.nav-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  background: transparent;
  border-radius: 12px;
}
.nav-btn:hover { background: #f8fafc; color: var(--primary); }
.nav-btn.active { color: var(--primary); background: var(--primary-soft); }

.content {
  overflow: auto;
  padding: 26px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

#upload-panel.active {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
  align-items: stretch;
}

.hero-card {
  order: 2;
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(320px, 1.1fr);
  gap: 22px;
  min-height: 304px;
  padding: 26px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(236, 253, 245, .96), rgba(239, 246, 255, .94) 62%, #fff);
  border: 1px solid #ccfbf1;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero-copy { align-self: center; max-width: 720px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.hero-card .eyebrow { color: var(--primary); }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 12px; font-size: 28px; line-height: 1.25; }
h3 { margin-bottom: 12px; font-size: 18px; }
.hero-copy p { color: var(--muted); line-height: 1.8; }

.hero-stats { gap: 14px; flex-wrap: wrap; margin-top: 24px; }
.hero-stats span {
  min-width: 120px;
  padding: 12px 14px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(15, 118, 110, .12);
  border-radius: 12px;
  color: var(--muted);
}
.hero-stats strong { display: block; color: var(--primary-strong); font-size: 22px; }

.upload-box {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 30px;
  color: var(--primary);
  text-align: center;
  background: rgba(255,255,255,.78);
  border: 1px dashed rgba(15, 118, 110, .42);
  border-radius: 14px;
  cursor: pointer;
}
.upload-box input { display: none; }
.upload-box svg { width: 56px; height: 56px; }
.upload-box strong { color: var(--ink); font-size: 18px; }
.upload-box span { font-size: 13px; line-height: 1.6; }

.project-grid {
  order: 1;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-top: 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.project-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.project-grid input, .project-grid select {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
}

.action-bar {
  order: 4;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 0;
}
.primary-btn, .secondary-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 800;
}
.primary-btn { color: #fff; background: var(--primary); box-shadow: 0 10px 22px rgba(15,118,110,.2); }
.primary-btn:hover { background: var(--primary-strong); }
.secondary-btn { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.full { width: 100%; }

.security-panel {
  order: 3;
  margin-top: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.section-head.compact {
  align-items: flex-start;
  margin-bottom: 12px;
}

.section-head.compact h2 {
  font-size: 18px;
}

.security-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.security-grid article {
  min-height: 0;
  padding: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.security-grid strong {
  display: block;
  margin-bottom: 8px;
}

.security-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
}
.analysis-card, .chart-card, .publish-card, .qr-card, .metric-card, .scale-library-card, .visit-module-card, .visit-preview-card, .recognition-side-card, .form-prototype-card, .json-preview-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.analysis-card { padding: 22px; position: sticky; top: 0; align-self: start; }
.analysis-card p, .summary-list, .metric-card p, .qr-card p { color: var(--muted); line-height: 1.7; }
.summary-list { padding-left: 20px; margin-bottom: 0; }

.ocr-progress {
  margin: 18px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.ocr-progress span { color: var(--muted); font-size: 13px; }
.ocr-progress strong { float: right; }
.ocr-progress div {
  height: 8px;
  clear: both;
  margin-top: 12px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
}
.ocr-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width .25s ease;
}

.module-area { min-width: 0; }
.section-head { justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 24px; }
.count-badge {
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  white-space: nowrap;
}

.module-workbench {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(360px, 1.18fr);
  gap: 16px;
  align-items: start;
}

.module-grid {
  display: grid;
  gap: 12px;
}

.module-group {
  display: grid;
  gap: 8px;
}

.module-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.module-group + .module-group {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.module-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.module-card.selected { border-color: #5eead4; background: #f0fdfa; }
.module-card.active {
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(15, 118, 110, .12);
}
.module-card input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); }
.module-card strong { display: block; margin-bottom: 4px; font-size: 14px; }
.module-card p { margin-bottom: 8px; color: var(--muted); line-height: 1.45; font-size: 12px; }
.module-card small {
  color: var(--amber);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 700;
}
.module-card small.optional { color: var(--muted); background: #f8fafc; border-color: var(--line); }

.module-detail-panel {
  position: sticky;
  top: 0;
  min-height: 520px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.detail-head {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-head h3 {
  margin: 0;
  font-size: 22px;
}

.detail-status {
  justify-self: start;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.detail-status.optional {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--line);
}

.module-detail-panel > p {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.detail-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 12px;
}

.detail-meta strong {
  color: var(--primary);
  font-size: 20px;
}

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

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

.field-item {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.field-item.selected {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.field-item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.field-item span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: #ccfbf1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.field-item strong {
  font-size: 14px;
  line-height: 1.4;
}

.visit-hero {
  min-height: 360px;
  padding: 28px 34px 42px;
  color: #fff;
  background: radial-gradient(circle at 86% 0%, rgba(37, 99, 235, .22), transparent 32%), #0f172a;
  border-radius: 22px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, .18);
}

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

.visit-head .eyebrow {
  color: #93c5fd;
}

.visit-head h2 {
  margin: 0;
  font-size: 28px;
}

.visit-head .secondary-btn {
  color: #dbeafe;
  background: rgba(37, 99, 235, .18);
  border-color: rgba(147, 197, 253, .32);
}

.visit-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin-top: 118px;
}

.visit-timeline::before {
  content: "";
  position: absolute;
  top: 35px;
  left: 5%;
  right: 5%;
  height: 6px;
  background: rgba(148, 163, 184, .25);
  border-radius: 999px;
}

.visit-timeline::after {
  content: "";
  position: absolute;
  top: 35px;
  left: 5%;
  width: var(--progress-width, 45%);
  height: 6px;
  background: linear-gradient(90deg, #5eead4, #60a5fa);
  border-radius: 999px;
}

.visit-node {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  text-align: center;
  color: rgba(203, 213, 225, .42);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.visit-node span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: rgba(226, 232, 240, .64);
  background: #1e293b;
  border: 7px solid rgba(15, 23, 42, .72);
  border-radius: 50%;
  font-weight: 900;
}

.visit-node.active {
  color: #dbeafe;
}

.visit-node.active span {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
}

.visit-node.current span {
  outline: 4px solid rgba(94, 234, 212, .22);
  box-shadow: 0 0 0 8px rgba(96, 165, 250, .1);
}

.visit-node.current strong,
.visit-node.current em {
  color: #fff;
}

.visit-node strong {
  margin-top: 10px;
  color: inherit;
  font-size: 14px;
}

.visit-node em {
  color: inherit;
  font-style: normal;
  font-size: 16px;
  font-weight: 800;
}

.visit-config-grid {
  display: grid;
  grid-template-columns: minmax(290px, .85fr) minmax(360px, 1.35fr) minmax(300px, .85fr);
  gap: 22px;
  margin-top: 22px;
}

.scale-library-card, .visit-module-card, .visit-preview-card, .recognition-side-card {
  padding: 22px;
}

.visit-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.visit-card-head h3 {
  margin: 0;
  font-size: 20px;
}

.visit-card-head span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.scale-library, .visit-module-config {
  display: grid;
  gap: 12px;
}

.scale-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}

.scale-card.selected {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.scale-card input, .visit-config-row input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.scale-card strong, .scale-card small {
  display: block;
}

.scale-card small {
  margin-top: 4px;
  color: var(--muted);
}

.scale-card em {
  color: #15803d;
  background: #dcfce7;
  border-radius: 999px;
  padding: 6px 10px;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.scale-card:not(.selected) em {
  color: var(--muted);
  background: #f1f5f9;
}

.scale-library + .secondary-btn {
  margin-top: 16px;
}

.visit-config-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.visit-config-row.selected {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.visit-config-row span {
  font-weight: 700;
}

.visit-config-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.visit-empty-state {
  padding: 18px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.recognition-list {
  display: grid;
  gap: 12px;
}

.recognition-list article {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recognition-list strong,
.recognition-list span {
  display: block;
}

.recognition-list strong {
  margin-bottom: 6px;
}

.recognition-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.export-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin: -26px -26px 26px;
  padding: 24px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.export-toolbar h2 {
  margin: 0;
  font-size: 26px;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 12px;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-weight: 800;
}

.segmented-control button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.export-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.export-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  gap: 28px;
  align-items: stretch;
}

.form-prototype-card {
  overflow: hidden;
  min-height: 620px;
  background: #fff;
  border-radius: 20px;
}

.prototype-title {
  display: flex;
  align-items: center;
  padding: 24px 30px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
}

.prototype-title h3 {
  margin: 0;
  font-size: 24px;
}

.review-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.review-panel span,
.review-panel strong {
  display: block;
}

.review-panel span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-panel strong {
  color: var(--ink);
  font-size: 15px;
}

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

.review-actions button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}

.review-actions button:last-child {
  color: #fff;
  background: #0f766e;
  border-color: #0f766e;
}

.prototype-form {
  display: grid;
  place-items: center;
  padding: 34px;
}

.diary-phone-preview {
  width: min(100%, 360px);
  min-height: 620px;
  overflow: hidden;
  background: #f8fafc;
  border: 12px solid #111827;
  border-radius: 36px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

.diary-phone-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #2563eb);
}

.diary-phone-bar span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
  border-radius: 14px;
  font-weight: 900;
}

.diary-phone-bar strong {
  font-size: 17px;
}

.diary-phone-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.diary-phone-body label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.diary-phone-body input,
.diary-phone-body select,
.diary-phone-body textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: none;
}

.diary-phone-body textarea {
  min-height: 76px;
  line-height: 1.55;
}

.diary-task-block {
  display: grid;
  gap: 8px;
}

.diary-task-block small {
  color: var(--muted);
  font-weight: 900;
}

.diary-task-block p {
  margin: 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.diary-phone-body button {
  min-height: 44px;
  color: #fff;
  background: var(--primary);
  border-radius: 12px;
  font-weight: 900;
}

.live-diary-preview {
  width: min(100%, 390px);
}

.diary-module-section {
  display: grid;
  gap: 12px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}

.diary-module-section:last-of-type { border-bottom: 0; }

.diary-module-section h4 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.diary-field {
  display: grid;
  gap: 6px;
  margin: 0;
}

.diary-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.diary-field em {
  margin-left: 4px;
  color: var(--rose);
  font-style: normal;
}

.diary-field input[type="range"] {
  min-height: 28px;
  padding: 0;
}

.multi-choice-field {
  display: grid;
  gap: 8px;
}

.multi-choice-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}

.multi-choice-option input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.file-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.diary-field.has-error input,
.diary-field.has-error select,
.diary-field.has-error textarea {
  border-color: rgba(225, 29, 72, .75);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, .08);
}

.diary-field small {
  color: var(--rose);
  font-size: 12px;
  font-weight: 700;
}

.scale-value {
  justify-self: end;
  color: var(--primary);
  font-size: 12px;
}

.diary-submit {
  width: 100%;
  margin-top: 14px;
}

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

.prototype-grid label {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.prototype-grid input,
.prototype-grid select {
  min-height: 58px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 18px;
}

.radio-line {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--ink);
  font-size: 18px;
}

.radio-line em {
  width: 22px;
  height: 22px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
}

.logic-tip {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.logic-tip strong {
  display: block;
  margin-bottom: 14px;
  font-size: 18px;
}

.logic-tip p {
  margin: 0;
  padding: 18px 20px;
  color: #2563eb;
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  border-radius: 8px;
  line-height: 1.7;
}

.json-preview-card {
  overflow: hidden;
  color: #bfdbfe;
  background: #111827;
  border-color: #1f2937;
  border-radius: 20px;
}

.json-head {
  display: flex;
  justify-content: space-between;
  padding: 20px 22px;
  color: #93c5fd;
  border-bottom: 1px solid rgba(148, 163, 184, .18);
}

.json-preview-card pre {
  height: 560px;
  margin: 0;
  padding: 28px;
  overflow: auto;
  color: #bfdbfe;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.ai-draft-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-draft-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ai-draft-head strong {
  color: var(--primary-strong);
}

.ai-draft-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.ai-draft-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-draft-meta span {
  min-width: 0;
  padding: 8px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  word-break: break-word;
}

.visit-preview {
  display: grid;
  justify-items: center;
}

.preview-phone {
  width: min(100%, 280px);
  min-height: 440px;
  padding: 16px;
  background: #f8fafc;
  border: 10px solid #0f172a;
  border-radius: 32px;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.preview-phone-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.preview-phone-head span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 14px;
  font-weight: 900;
}

.preview-phone-head strong {
  font-size: 15px;
}

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

.preview-section small {
  color: var(--muted);
  font-weight: 800;
}

.preview-section p {
  margin: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
}

.preview-phone button {
  width: 100%;
  min-height: 40px;
  margin-top: 4px;
  color: #fff;
  background: var(--primary);
  border-radius: 12px;
  font-weight: 900;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.metric-card { padding: 20px; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 800; }
.metric-card strong { display: block; margin: 8px 0; font-size: 34px; }

.encryption-map {
  margin-top: 18px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.encryption-map div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
}

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

.encryption-map strong {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.chart-card { margin-top: 18px; padding: 22px; }
.bar-chart { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0,1fr) 48px; align-items: center; gap: 12px; }
.bar-row span { color: var(--muted); font-size: 13px; }
.bar-track { height: 30px; overflow: hidden; background: #f1f5f9; border-radius: 8px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #0f766e, #38bdf8); border-radius: inherit; }

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}
.publish-card, .qr-card { padding: 22px; }
.publish-list { display: grid; gap: 10px; }
.publish-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.publish-item span { color: var(--muted); }
.config-row { flex-wrap: wrap; gap: 16px; margin-top: 18px; color: var(--muted); font-weight: 700; }
.config-row input { accent-color: var(--primary); }

.publish-controls-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.publish-controls-status span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.release-gate-panel,
.release-repository-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.release-gate-row,
.release-version-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.release-gate-row strong,
.release-version-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.release-gate-row span,
.release-version-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.release-gate-badge {
  min-width: 48px;
  padding: 4px 8px;
  color: #fff;
  background: #b91c1c;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.release-gate-row.passed .release-gate-badge {
  background: #0f766e;
}

.release-repository-panel h4 {
  margin: 4px 0 0;
  text-align: left;
  font-size: 14px;
}

.encryption-package {
  margin-top: 18px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.encryption-package h3 {
  margin-bottom: 10px;
}

.encryption-package ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.75;
}

.qr-card { text-align: center; }

.qr-card .secondary-btn {
  margin-top: 10px;
}

.qr-box {
  width: 238px;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  gap: 3px;
  margin: 18px auto;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.qr-cell { background: #fff; border-radius: 1px; }
.qr-cell.on { background: #111827; }
code {
  display: block;
  margin: 12px 0 18px;
  padding: 10px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  word-break: break-all;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 14px;
  color: #fff;
  background: #111827;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  body { overflow: auto; height: auto; }
  .app-layout { height: auto; }
  #upload-panel.active { grid-template-columns: 1fr; }
  .hero-card, .workspace-grid, .preview-grid, .module-workbench { grid-template-columns: 1fr; }
  .visit-config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recognition-side-card { grid-column: 1 / -1; }
  .export-toolbar, .export-preview-grid { grid-template-columns: 1fr; }
  .export-actions { justify-content: flex-start; flex-wrap: wrap; }
  .project-grid, .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .security-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visit-timeline { overflow-x: auto; grid-template-columns: repeat(5, minmax(150px, 1fr)); }
}

@media (max-width: 720px) {
  .top-header { height: auto; min-height: 56px; align-items: flex-start; flex-direction: column; padding: 14px; }
  .app-layout { grid-template-columns: 1fr; }
  .icon-nav { position: sticky; top: 0; z-index: 5; flex-direction: row; justify-content: center; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 16px; }
  .hero-card, .project-grid { grid-template-columns: 1fr; padding: 18px; }
  .dashboard-grid, .security-grid, .field-list { grid-template-columns: 1fr; }
  .visit-config-grid { grid-template-columns: 1fr; }
  .recognition-side-card { grid-column: auto; }
  .prototype-grid { grid-template-columns: 1fr; }
  .export-toolbar { margin: -16px -16px 16px; padding: 18px 16px; }
  .visit-hero { padding: 22px; }
  .visit-head, .visit-card-head { flex-direction: column; }
  .encryption-map div { grid-template-columns: 1fr; }
}
