/* 업종 데모(식품·화장품 GMP, 자동차부품) 공통 모양. 우정소프트웨어.
   두 데모가 같은 파일을 씁니다. 색은 각 index.html 의 :root --primary 로만 바꿉니다.
   ⛔대화창은 특정 메신저 브랜드 색을 쓰지 않습니다(육가공 데모와 같은 중립 색). */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6f8; --card: #fff; --line: #e3e7ec; --text: #1f2933; --muted: #6b7684;
  --primary: #2f6fd6; --primary-soft: #eaf1fd;
  --danger: #d94f3d; --danger-soft: #fdecea; --ok: #1a9e5c; --ok-soft: #e6f6ee;
  --warn: #c77700; --warn-soft: #fff3e0;
  --chat-bg: #c3ccd6; --chat-accent: #ffc93c; --radius: 12px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* 상단 */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 16px; }
.topbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; }
.topbar h1 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; flex: 1 1 auto; min-width: 0; }
.topbar .sub { font-size: 13px; color: var(--muted); max-width: 1180px; margin: 4px auto 0; }
.mode { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.mode button { border: 0; background: #fff; padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.mode button.on { background: var(--primary); color: #fff; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 700; font-size: 14px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 가입·맞춤 체험 줄 (첫 화면 필수) */
.cta-strip { background: var(--primary-soft); border-bottom: 1px solid var(--line); padding: 10px 16px; }
.cta-strip .inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.cta-strip .inner span { flex: 1 1 220px; color: var(--text); }
.cta-strip a { text-decoration: none; border-radius: 999px; padding: 7px 13px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.cta-strip a.signup { background: var(--primary); color: #fff; }
.cta-strip a.custom { background: #fff; color: var(--primary); border: 1px solid var(--primary); }

/* 본문 */
.layout { max-width: 1180px; margin: 0 auto; padding: 14px 16px 96px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; color: var(--muted); }
.tabs button.on { background: var(--text); border-color: var(--text); color: #fff; }
.tabs .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.kpi.bad .v { color: var(--danger); }
.kpi.warn .v { color: var(--warn); }
.kpi.good .v { color: var(--ok); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; min-width: 0; }
.card h2 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.card h3 { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.card .desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.mute { background: #eef0f3; color: var(--muted); }

/* 표: 좁은 화면에서는 카드 꼴로 바뀝니다 */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.alert td { background: var(--danger-soft); }
table.list tr.soon td { background: var(--warn-soft); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
@media (max-width: 720px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 6px 10px; background: #fff; }
  table.list td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  table.list td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 auto; }
  table.list tr.alert td, table.list tr.soon td { background: transparent; }
  table.list tr.alert { border-color: var(--danger); background: var(--danger-soft); }
  table.list tr.soon { border-color: var(--warn); background: var(--warn-soft); }
}

/* 태블릿 점검: 큰 단추 */
.check-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row .name { font-weight: 700; }
.check-row .lim { font-size: 12px; color: var(--muted); }
.check-row .ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.num { width: 92px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; text-align: right; }
.sel { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #fff; max-width: 100%; }
.txt { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; width: 100%; }
.big-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.big-btns button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 6px; font-weight: 800; font-size: 15px; }
.big-btns button .c { display: block; font-size: 20px; }
.big-btns button.good { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

.note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.warnbox { background: var(--warn-soft); border: 1px solid #f2d19c; color: #6b4300; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
.badbox { background: var(--danger-soft); border: 1px solid #f3b7ae; color: #7a2214; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
.okbox { background: var(--ok-soft); border: 1px solid #a9dcc0; color: #0d5a33; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }

/* 추적 사슬 */
.chain { display: flex; flex-direction: column; gap: 8px; }
.chain .node { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.chain .node .t { font-size: 12px; color: var(--muted); font-weight: 700; }
.chain .node .b { font-weight: 800; word-break: break-all; }
.chain .arrow { text-align: center; color: var(--muted); font-size: 13px; }
.chain .kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }

/* 막대 */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { background: #eef0f3; border-radius: 6px; height: 18px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--primary); border-radius: 6px; }
.bar .n { text-align: right; font-weight: 800; }

/* 성적서·라벨 미리보기 */
.paper { border: 1px solid #c9cfd6; border-radius: 6px; padding: 16px; background: #fff; max-width: 640px; }
.paper h4 { text-align: center; font-size: 18px; margin-bottom: 10px; letter-spacing: 2px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 13px; }
.paper td, .paper th { border: 1px solid #c9cfd6; padding: 5px 7px; text-align: left; }
.paper th { background: #f4f6f8; width: 30%; }
.paper .stamp { margin-top: 10px; text-align: right; font-size: 12px; color: var(--muted); }
.label { border: 2px solid #111; border-radius: 6px; padding: 10px; background: #fff; max-width: 420px; }
.label .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; border-bottom: 1px solid #111; padding: 4px 0; }
.label .row b { font-size: 15px; }
.label svg { display: block; width: 100%; height: 64px; margin-top: 8px; }
.label .hr { text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: 1px; }

/* 대화 시연 */
.chat-fab { position: fixed; right: 16px; bottom: 16px; z-index: 40; border: 0; border-radius: 999px; background: var(--text); color: #fff; padding: 13px 18px; font-weight: 800; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.chat { position: fixed; z-index: 50; right: 16px; bottom: 16px; width: 380px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 32px)); height: min(620px, calc(100dvh - 32px)); background: var(--chat-bg); border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { background: #fff; padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.chat-head b { flex: 1; font-size: 15px; }
.chat-head button { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 0 4px; }
.chat-demo-note { background: #fffbe6; font-size: 12px; padding: 6px 12px; color: #5c4b00; }
.chat-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 86%; padding: 8px 11px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--chat-accent); border-top-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.msg .who { display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.chat-sugg { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 0; background: #fff; scrollbar-width: none; }
.chat-sugg button { flex: 0 0 auto; border: 1px solid var(--chat-accent); background: #fff8dc; border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 700; }
.chat-input { display: flex; gap: 6px; padding: 8px 10px 10px; background: #fff; }
.chat-input input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; font-size: 15px; }
.chat-input button { border: 0; border-radius: 999px; background: var(--chat-accent); padding: 0 14px; font-weight: 800; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; max-width: calc(100vw - 32px); }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .topbar h1 { font-size: 16px; flex-basis: 100%; }
  .chat { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 82vh; height: 82dvh; border-radius: 16px 16px 0 0; }
  .big-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar { grid-template-columns: 74px minmax(0, 1fr) 40px; }
  .num { width: 80px; }
}
@media print {
  .topbar, .cta-strip, .tabs, .kpis, .chat, .chat-fab, .wj-nav, .no-print { display: none !important; }
  body { background: #fff; }
}
