:root {
  --bg: #f6f6f4; --card: #fff; --ink: #1d1d1b; --muted: #6b6b66; --line: #e3e2de;
  --accent: #895896; --add: #e6f4ea; --del: #fdecec; --chg: #fff5dc; --warn: #b35c00;
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.err { color: #b00020; min-height: 1em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.login { max-width: 340px; margin: 0 auto 12vh; display: grid; gap: 12px; }
.conf-notice { max-width: 520px; margin: 9vh auto 20px; padding: 0 16px; text-align: center; }
.conf-notice strong { display: block; font-size: 30px; font-weight: 800; color: #d0021b; letter-spacing: .12em; }
.conf-notice p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: #333; word-break: keep-all; }
.login label { display: grid; gap: 4px; }
.login h1 { word-break: keep-all; }
input, select, textarea, button { font: inherit; }
input, select, textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
button, .btn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-flex; gap: 6px; align-items: center; }
button.primary, .btn.primary, form button { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { border-color: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }
.badge { background: #c0392b; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.badge.zero { background: #bbb; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
.top nav a { margin-right: 14px; text-decoration: none; color: var(--muted); font-weight: 600; }
.top nav a.on { color: var(--ink); border-bottom: 2px solid var(--accent); }
.top .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.layout { display: flex; align-items: flex-start; }
main { flex: 1; padding: 16px; min-width: 0; }
aside#nika { width: 380px; max-width: 100%; border-left: 1px solid var(--line); background: #fff; height: calc(100vh - 54px); position: sticky; top: 54px; display: flex; flex-direction: column; }
.nika-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
#chat { flex: 1; overflow: auto; padding: 12px; display: grid; gap: 10px; align-content: start; }
.msg { padding: 8px 10px; border-radius: 8px; line-height: 1.55; white-space: normal; }
.msg.user { background: #f3edf5; justify-self: end; max-width: 90%; }
.msg.assistant { background: #fafaf8; border: 1px solid var(--line); }
.msg ul { margin: 4px 0; padding-left: 18px; }
#askForm { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#askForm textarea { flex: 1; resize: vertical; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.company { text-decoration: none; color: inherit; display: grid; gap: 6px; }
.company:hover { border-color: var(--accent); }
.company .stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0efeb; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.add { background: var(--add); } tr.del { background: var(--del); } tr.chg { background: var(--chg); }
.timeline { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 16px; }
.step { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; cursor: pointer; min-width: 120px; }
.step.sel { border-color: var(--accent); box-shadow: 0 0 0 2px #89589622; }
.step .lbl { font-weight: 700; }
.section { margin: 18px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eee; }
.pill.active { background: #efe5f1; color: var(--accent); } .pill.done_proposed { background: #fff0d6; color: var(--warn); }
.pill.done, .pill.archive { background: #e9e9e9; color: #555; }
.proposal { border-color: #f0c36d; background: #fffaf0; }
.queue-item { display: grid; gap: 8px; margin-bottom: 12px; }
.queue-item .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.queue-item label { display: grid; gap: 3px; font-size: 13px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 90vw; white-space: pre-line; z-index: 9; }
.pct-in, .amt-in { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.doc-frame { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 12px; }
.ratio { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 12px; margin-bottom: 8px; text-align: center; }
.ratio-names { color: var(--muted); font-size: 13px; }
.ratio-values { font-size: 22px; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .color-grid { grid-template-columns: 1fr; } }
details summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  aside#nika { width: 100%; position: static; height: 70vh; border-left: 0; border-top: 1px solid var(--line); }
  .table-wrap { overflow-x: auto; }
}

/* ---------- 웹 수정 ---------- */
.edit-cta { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin: 4px 0 14px; border: 2px solid var(--accent); border-radius: 12px; background: #f5eff6; }
.edit-cta-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.edit-cta-text { flex: 1; display: grid; gap: 3px; min-width: 0; }
.edit-cta-text > b { font-size: 17px; }
.edit-cta-text span { color: var(--muted); font-size: 13px; }
.edit-cta-btn { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 14px 26px; font-size: 17px; font-weight: 700; border-radius: 10px; background: var(--accent); color: #fff; border: 0; cursor: pointer; box-shadow: 0 2px 6px #89589640; }
.edit-cta-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.edit-banner { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 8px; border-radius: 8px; background: #fff5dc; color: #6b4b00; border: 1px solid #f0d58c; }
#linesOut.editing table { box-shadow: 0 0 0 2px #f0d58c; border-radius: 6px; }
#linesOut.editing .pct-in, #linesOut.editing .amt-in { width: 130px; height: 38px; font-size: 16px; font-weight: 600; padding: 4px 10px; border: 2px solid #c9c7c0; border-radius: 8px; }
#linesOut.editing .pct-in:focus, #linesOut.editing .amt-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #89589630; }
#linesOut.editing tr.chg .pct-in, #linesOut.editing tr.chg .amt-in { border-color: #d39b00; background: #fffbea; }
#linesOut.editing td { vertical-align: middle; }
.edit-bar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -4px 16px #0000001a; flex-wrap: wrap; }
.edit-bar-status { flex: 1; display: flex; gap: 14px; font-size: 15px; font-weight: 600; color: var(--muted); }
.edit-bar-status .on { color: #8a6100; }
.edit-bar-status .ok { color: var(--accent); }
.edit-bar-status .warn { color: #b00020; }
.edit-bar-cancel { padding: 12px 18px; font-size: 15px; border-radius: 10px; }
.edit-bar-save { padding: 12px 24px; font-size: 16px; font-weight: 700; border-radius: 10px; background: var(--accent); color: #fff; border: 0; cursor: pointer; }
.edit-bar-save:disabled { background: #c2adc7; }
.revise-dialog { border: 0; border-radius: 14px; padding: 20px 22px; width: min(560px, 92vw); box-shadow: 0 20px 60px #00000040; }
.revise-dialog::backdrop { background: #0006; }
.revise-dialog h3 { font-size: 20px; }
.revise-dialog td.arrow { color: var(--muted); text-align: center; width: 24px; }
.warn-box { background: #fdecec; color: #8a1020; padding: 8px 10px; border-radius: 8px; }
@media (max-width: 700px) { .edit-cta { flex-wrap: wrap; } .edit-cta-btn { width: 100%; justify-content: center; } .edit-bar-save { width: 100%; } }
.revise-dialog button.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); padding: 12px 18px; font-size: 15px; border-radius: 10px; }

/* 원료 추가·삭제, 공정확인 */
.row-btn { padding: 6px 12px; font-size: 13px; border-radius: 8px; white-space: nowrap; }
.row-btn.danger { color: #b00020; border-color: #e5b5bd; }
.row-btn.danger:hover { background: #fdeef0; }
.del-pill { background: #fdeef0; color: #b00020; }
#linesOut.editing tr.del td { color: var(--muted); }
#linesOut.editing tr.del .pct-in, #linesOut.editing tr.del .amt-in { opacity: .45; }
#linesOut.editing .name-in { width: 100%; min-width: 160px; height: 38px; font-size: 15px; font-weight: 600; padding: 4px 10px; border: 2px solid #c7a9cc; border-radius: 8px; }
.sg-lbl { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--muted); }
#linesOut.editing .sg-in { width: 80px; height: 30px; font-size: 14px; padding: 2px 8px; border: 1px solid #c9c7c0; border-radius: 6px; text-align: right; }
.add-line-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; }
.add-line { padding: 10px 18px; font-size: 15px; font-weight: 700; border-radius: 10px; border: 2px dashed var(--accent); color: var(--accent); background: #f8f4f9; cursor: pointer; }
.add-line:hover { background: #efe5f1; }
.proc h3 { margin-bottom: 6px; }
.proc-table td { vertical-align: top; }
.proc-table .step-no { width: 44px; font-weight: 700; font-size: 16px; color: var(--accent); }
.proc-table .step-text { white-space: pre-wrap; line-height: 1.55; }
.proc-table .step-chips { min-width: 180px; max-width: 320px; }
.chip { display: inline-flex; align-items: center; gap: 5px; margin: 2px 4px 2px 0; padding: 3px 9px; border-radius: 999px; background: #f3eef4; border: 1px solid #e0d3e3; font-size: 13px; white-space: nowrap; }
.chip b { color: var(--accent); }
.chip.fresh { background: var(--add); border-color: #a9d8b8; }
.step-in { width: 100%; min-width: 260px; font: inherit; font-size: 15px; line-height: 1.5; padding: 8px 10px; border: 2px solid #c9c7c0; border-radius: 8px; resize: vertical; }
.step-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #89589630; }
.step-tools { white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; padding: 0; font-size: 16px; border-radius: 8px; }
.icon-btn.danger { color: #b00020; }
.warn-line { margin-top: 4px; font-size: 13px; color: #b00020; }
.proc-preview { margin: 6px 0 10px 20px; padding: 0; line-height: 1.5; }
@media (max-width: 700px) { .proc-table .step-chips { min-width: 0; } .step-in { min-width: 0; } }
#linesOut.editing th { white-space: nowrap; }
.chips-box { margin-bottom: 6px; }
.chip-x { margin-left: 2px; padding: 0 4px; border: 0; background: none; color: #b00020; font-size: 12px; line-height: 1; cursor: pointer; border-radius: 4px; }
.chip-x:hover { background: #fdeef0; }
.chip-add { max-width: 100%; height: 32px; font-size: 13px; padding: 2px 6px; border: 1px dashed var(--accent); border-radius: 8px; color: var(--accent); background: #f8f4f9; cursor: pointer; }
.link-btn { padding: 0 4px; border: 0; background: none; color: var(--accent); text-decoration: underline; font-size: 13px; cursor: pointer; }
.denied { max-width: 460px; margin: 10vh auto; text-align: center; padding: 32px 24px; }
.denied-icon { font-size: 34px; }
.denied h2 { margin: 8px 0; }
.denied p { margin: 0; font-size: 16px; font-weight: 600; color: #895896; }

/* ---------- 니카: 오른쪽 아래 떠 있는 버튼 + 패널 ---------- */
.layout { display: block; }
.fabs { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: flex; gap: 10px; align-items: center; }
.nika-fab { position: static; display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 20px 0 18px; border: 0; border-radius: 28px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 6px 20px #89589666; cursor: pointer; }
.nika-fab:hover { filter: brightness(1.08); }
.nika-fab.open { background: #5e3b67; }
aside#nika { position: fixed; right: 20px; bottom: 88px; z-index: 19; width: 400px; max-width: calc(100vw - 40px); height: min(640px, calc(100vh - 120px)); top: auto; border: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 16px 48px #00000033; overflow: hidden; display: flex; flex-direction: column; }
.nika-head { position: relative; padding-right: 44px; }
.nika-close { position: absolute; right: 8px; top: 6px; width: 32px; height: 32px; padding: 0; justify-content: center; border: 0; background: none; color: var(--muted); font-size: 16px; }
.edit-bar { margin-right: 84px; }
main { padding-bottom: 96px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#reviseBody { overflow-x: auto; }

/* ---------- 휴대폰·태블릿 ---------- */
@media (max-width: 900px) { /* 예전 '아래로 붙는 패널' 규칙을 덮어쓴다 */
  aside#nika { position: fixed; width: 400px; height: min(640px, calc(100vh - 120px)); top: auto; border: 1px solid var(--line); }
}
@media (max-width: 700px) {
  :root { font-size: 15px; }
  input, select, textarea { font-size: 16px; } /* iOS 확대 방지 */
  .top { padding: 8px 12px; gap: 6px; }
  .top nav { display: flex; overflow-x: auto; white-space: nowrap; width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .top nav a { margin-right: 16px; padding: 6px 0; }
  .top .right { width: 100%; gap: 6px; }
  .top .right .btn { padding: 6px 10px; font-size: 13px; }
  #who { display: none; }
  .login h1 { font-size: 22px; word-break: keep-all; }
  main { padding: 12px 12px 96px; }
  h2 { font-size: 19px; }
  .conf-notice { margin-top: 5vh; }
  .conf-notice strong { font-size: 26px; }
  .login { margin: 0 16px 8vh; }
  .timeline { flex-direction: column; }
  .timeline > .muted { display: none; }
  .step { min-width: 0; }
  th, td { padding: 6px 6px; }
  #linesOut.editing .pct-in, #linesOut.editing .amt-in { width: 92px; font-size: 16px; padding: 4px 6px; }
  #linesOut.editing .name-in { min-width: 120px; }
  .edit-banner { font-size: 13px; }
  .edit-bar { margin-right: 0; bottom: 76px; padding: 10px; }
  .edit-bar-status { flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
  .edit-bar-cancel { flex: 1; }
  /* 공정확인: 표 대신 단계별 카드 */
  .proc-table, .proc-table tbody { display: block; }
  .proc-table .proc-head { display: none; }
  .proc-table tr { display: grid; grid-template-columns: 34px 1fr; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .proc-table td { display: block; border: 0; padding: 0; }
  .proc-table td.step-no { grid-row: span 3; }
  .proc-table td:not(.step-no) { grid-column: 2; }
  .proc-table .step-chips { max-width: none; }
  .step-tools { display: flex; gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .ratio-values { font-size: 18px; }
  .fabs { right: 14px; bottom: 14px; gap: 8px; }
  .nika-fab { height: 52px; padding: 0 16px 0 14px; }
  body.nika-open .fabs .up-fab { display: none; }
  aside#nika { inset: 0; width: auto; height: auto; max-width: none; border-radius: 0; border: 0; }
  body.nika-open .nika-fab { display: none; }
  .nika-close { width: 40px; height: 40px; top: 2px; font-size: 18px; }
  #askForm textarea { font-size: 16px; }
  .revise-dialog { padding: 16px; }
  .queue-item .fields { grid-template-columns: 1fr; }
}
/* 휴대폰: 수정 표를 원료별 카드로 (윗줄 순서·원료명·삭제, 아랫줄 함량·투입량) */
@media (max-width: 700px) {
  #linesOut.editing table, #linesOut.editing tbody { display: block; }
  #linesOut.editing tr.edit-head { display: none; }
  #linesOut.editing tr[data-row], #linesOut.editing tr[data-add], #linesOut.editing tr.tot {
    display: grid; grid-template-columns: 30px 1fr 1fr auto; grid-template-areas: "seq name name btn" "seq opct pct pct" "seq oamt amt amt"; gap: 6px 8px; padding: 10px 8px; border-bottom: 1px solid var(--line); align-items: center; }
  #linesOut.editing tr td, #linesOut.editing tr th { border: 0; padding: 0; background: none; }
  #linesOut.editing .c-seq { grid-area: seq; align-self: start; font-weight: 700; color: var(--accent); text-align: left; }
  #linesOut.editing .c-name { grid-area: name; font-weight: 600; }
  #linesOut.editing .c-btn { grid-area: btn; }
  #linesOut.editing .c-pct { grid-area: pct; text-align: left; }
  #linesOut.editing .c-amt { grid-area: amt; text-align: left; }
  #linesOut.editing .c-opct { grid-area: opct; text-align: left; align-self: end; padding-bottom: 8px; }
  #linesOut.editing .c-oamt { grid-area: oamt; text-align: left; align-self: end; padding-bottom: 8px; }
  #linesOut.editing .c-opct::before, #linesOut.editing .c-oamt::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-bottom: 2px; }
  #linesOut.editing .c-pct::before, #linesOut.editing .c-amt::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-bottom: 2px; }
  #linesOut.editing .c-delta { display: none; }
  #linesOut.editing tr:not([data-row]):not([data-add]):not(.tot):not(.edit-head) { display: none; }
  #linesOut.editing .pct-in, #linesOut.editing .amt-in { width: 100%; }
  #linesOut.editing tr.tot { background: #f0efeb; font-weight: 700; }
  #linesOut.editing tr.tot > :not(.c-seq):not(.c-name):not(.c-pct):not(.c-amt):not(.c-opct):not(.c-oamt) { display: none; }
  #linesOut.editing table { box-shadow: 0 0 0 2px #f0d58c; }
}

/* ---------- 휴대폰: 글자가 세로로 서지 않게 + 카드 표 ---------- */
.nowrap { white-space: nowrap; }
@media (max-width: 700px) {
  th { white-space: nowrap; }
  td { word-break: keep-all; overflow-wrap: anywhere; } /* 한글은 단어 단위로만 줄바꿈, 너무 긴 낱말만 끊음 */
  .pill { white-space: nowrap; }
  .m-hide { display: none; }

  /* 카드 표: 머리글 줄을 숨기고 행마다 카드 한 장 (칸 위에 작은 이름표) */
  table.m-cards, table.m-cards tbody { display: block; background: none; }
  table.m-cards tr:first-child { display: none; }
  table.m-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 12px; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
  table.m-cards.cards-3 tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  table.m-cards.cards-1 tr { grid-template-columns: minmax(0, 1fr); }
  table.m-cards tr.add { background: var(--add); } table.m-cards tr.del { background: var(--del); } table.m-cards tr.chg { background: var(--chg); }
  table.m-cards td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  table.m-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; white-space: nowrap; }
  table.m-cards td.m-head, table.m-cards td.m-tag, table.m-cards td.m-full { grid-column: 1 / -1; }
  table.m-cards td.m-head { order: -1; font-size: 16px; font-weight: 700; }
  table.m-cards td.m-head::before, table.m-cards td.m-tag::before { display: none; }
  table.m-cards td.m-tag { order: -2; font-size: 12px; font-weight: 700; color: var(--accent); }
  table.m-cards td[colspan] { grid-column: 1 / -1; }

  /* 공정확인: 번호를 동그란 표로, 설명과 간격 */
  .proc-table tr { grid-template-columns: 30px 1fr; column-gap: 12px; }
  .proc-table td.step-no { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #f3eef4; color: var(--accent); font-size: 14px; text-align: center; }
}

/* 원료 구분 색 (엑셀 원본 칸 색) */
.chip[style] { border-color: #0000001f; }
.swatches { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 1px solid #00000033; cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.swatch-lbl { font-size: 12px; }

/* 분류코드 표시 */
.cat { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; border-radius: 999px; font-size: 12px; background: #f1f0ec; color: var(--ink); white-space: nowrap; }
.cat b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; }
.cat-A b { background: #c2185b; } .cat-B b { background: #5b8c2a; } .cat-C b { background: #d9822b; } .cat-D b { background: #3f6fb5; } .cat-E b { background: var(--accent); }
.ing-link { color: inherit; text-decoration: none; border-bottom: 1px dotted #0004; }
.ing-link:hover { color: var(--accent); }

/* 원료 백과사전 */
.ing-tools { display: grid; gap: 10px; margin: 12px 0 6px; }
#ingQ { max-width: 420px; height: 40px; font-size: 15px; }
.ing-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.ing-f { border-radius: 999px; padding: 6px 12px; }
.ing-f.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ing-f.on .muted { color: #fff; }
.ing-cat { margin: 18px 0; }
.ing-cat h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.ing-cat h3 .cat { font-size: 14px; padding: 3px 12px 3px 3px; } .ing-cat h3 .cat b { width: 22px; height: 22px; font-size: 13px; }
details.ing { padding: 0; margin-bottom: 8px; }
details.ing summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; list-style: none; flex-wrap: wrap; }
details.ing summary::-webkit-details-marker { display: none; }
details.ing summary::after { content: "▾"; margin-left: 4px; color: var(--muted); }
details.ing[open] summary::after { content: "▴"; }
details.ing[open] summary { border-bottom: 1px solid var(--line); }
.ing-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #00000026; background: #fff; flex: none; }
.ing-name { font-size: 15px; }
.ing-meta { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.ing-body { padding: 10px 14px 14px; display: grid; gap: 10px; }
.ver-pct { display: inline-block; padding: 1px 6px; border-radius: 6px; text-decoration: none; color: var(--ink); background: #f3f2ee; white-space: nowrap; }
.ver-pct.cur { background: #efe5f1; color: var(--accent); }
.ing-cat-edit { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 700px) { .ing-meta { margin-left: 22px; width: 100%; } }
@media (max-width: 700px) { #linesOut td .cat { padding: 1px; } #linesOut td .cat .cat-l { display: none; } }

/* ---------- 표 가독성: 칸 나눔을 분명하게, 원료 표는 내용 폭에 맞춰 (넓은 화면에서 열 사이가 벌어지지 않게) ---------- */
table { border: 1px solid #c9c6bf; }
th, td { border: 1px solid #d3d0c9; }
tr[style] > td, tr[style] > th, td[style] { border-color: #00000029; } /* 원료 색이 칠해진 칸도 경계가 보이게 */
th { border-bottom: 2px solid #b9b5ad; }
#linesOut table { width: auto; min-width: min(100%, 640px); max-width: 100%; }
#linesOut td, #linesOut th { padding: 7px 14px; }
#linesOut td:nth-last-child(-n+2).num, #linesOut th.num { white-space: nowrap; }
#linesOut:not(.editing) td:has(> .ing-link) { min-width: 200px; }
.proc-table td, .proc-table th { padding: 8px 12px; }
@media (max-width: 700px) {
  #linesOut td, #linesOut th { padding: 6px 8px; }
  table.m-cards, .proc-table { border: 0; }
  #linesOut.editing table { border: 0; }
}
.proc-table th { white-space: nowrap; }
@media (max-width: 700px) { #linesOut:not(.editing) td:has(> .ing-link) { min-width: 0; } #linesOut:not(.editing) th { white-space: normal; word-break: keep-all; } }
.cat-sel { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.cat-sel select { height: 30px; font-size: 13px; padding: 2px 6px; border-radius: 6px; }
#linesOut.editing tr.cchg .cat-sel select { border: 2px solid #d39b00; background: #fffbea; }
#linesOut.editing .nm { font-weight: 600; }
tr.ing-other td { opacity: .55; }
.ing-pcat { height: 30px; font-size: 13px; }

/* 비교하기 */
.edit-cta-btns { display: flex; gap: 10px; flex: none; flex-wrap: wrap; }
.edit-cta-btn.ghost-btn { background: #fff; color: var(--accent); border: 2px solid var(--accent); box-shadow: none; }
.edit-cta-btn.ghost-btn.on { background: #f5eff6; }
.edit-cta-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.cmp { margin: 0 0 14px; border: 2px solid var(--accent); }
.cmp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cmp-head b { font-size: 16px; }
.cmp-pick { display: flex; align-items: center; gap: 8px; }
.cmp-cur { font-weight: 700; color: var(--accent); }
#cmpWith { height: 34px; font-size: 14px; }
#cmpClose { margin-left: auto; border: 0; background: none; font-size: 16px; color: var(--muted); }
@media (max-width: 700px) { .edit-cta-btns { width: 100%; } .edit-cta-btns .edit-cta-btn { flex: 1; justify-content: center; } }

/* ---------- 수정완료 바: 화면에 떠 있게 (스크롤해도 오른쪽 아래, 니카 버튼 위에 항상 보임) ---------- */
.edit-bar { position: fixed; right: 20px; bottom: 88px; left: auto; z-index: 18; width: 300px; margin: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 2px solid var(--accent); border-radius: 14px; box-shadow: 0 12px 32px #00000033; }
.edit-bar-status { width: 100%; flex: none; flex-direction: row; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; }
.edit-bar-cancel { order: 1; flex: 1; padding: 10px 8px; font-size: 14px; }
.edit-bar-save { order: 2; flex: 2.4; padding: 10px 8px; font-size: 15px; }
body.nika-open .edit-bar { right: 440px; } /* 니카 창이 열려 있으면 그 왼쪽에 */
@media (max-width: 1100px) { body.nika-open .edit-bar { display: none; } }
body:has(.edit-bar) main { padding-bottom: 260px; }
@media (max-width: 700px) {
  .edit-bar { left: 8px; right: 8px; bottom: 74px; width: auto; padding: 10px; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .edit-bar-status { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; width: 100%; font-size: 13px; }
  .edit-bar-save { order: 2; flex: 2; width: auto; padding: 12px; }
  .edit-bar-cancel { order: 1; flex: 1; width: auto; padding: 12px; }
  body.nika-open .edit-bar { display: none; }
}
.edit-bar-save { white-space: nowrap; }

/* ---------- 새 프로젝트 ---------- */
.np { margin-bottom: 14px; }
.np h3 { display: flex; align-items: baseline; gap: 10px; }
.np-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#npTpl { min-width: 280px; max-width: 100%; height: 36px; }
.np-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.np-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.np-grid label.wide { grid-column: span 2; }
.np-grid input { height: 36px; font-size: 15px; color: var(--ink); }
.np-calc { align-self: end; padding: 8px 0; }
.np-lines { display: grid; gap: 4px; margin-bottom: 10px; }
.np-line { display: grid; grid-template-columns: 40px 120px minmax(160px, 2fr) minmax(100px, 1fr) 100px 80px 100px auto; gap: 6px; align-items: center; padding: 5px 6px; border-radius: 8px; border: 1px solid var(--line); background: linear-gradient(90deg, var(--cat, transparent) 0 6px, #fff 6px); }
.np-line input, .np-line select { height: 34px; font-size: 14px; min-width: 0; }
.np-line input[type=number], .np-line input[data-comma] { text-align: right; }
.np-head { background: #f0efeb; font-size: 12px; font-weight: 600; color: var(--muted); border: 0; }
.np-seq { text-align: center; font-weight: 700; color: var(--accent); }
.np-amt { text-align: right; font-variant-numeric: tabular-nums; }
.np-tools { display: flex; gap: 4px; justify-content: flex-end; }
.np-step { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(160px, 260px) auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.np-step .step-no { font-weight: 700; color: var(--accent); font-size: 16px; text-align: center; }
.np-step textarea { width: 100%; font: inherit; font-size: 15px; padding: 8px; border: 2px solid #c9c7c0; border-radius: 8px; resize: vertical; }
.ok-text { color: var(--accent); } .warn-text { color: #b00020; }
.np-bar { width: 300px; }
.np-bar .edit-bar-save { flex: 1; }
.np-f { display: block; min-width: 0; } .np-f input { width: 100%; } .np-l { display: none; }
@media (max-width: 900px) {
  .np-line { grid-template-columns: 30px 1fr 1fr; grid-template-areas: "seq cat tools" "seq name name" "seq cas cas" "seq pct sg" "seq amt amt"; padding: 10px 8px 10px 12px; }
  .np-line .np-seq { grid-area: seq; align-self: start; padding-top: 8px; }
  .np-line select { grid-area: cat; } .np-line [data-k="name"] { grid-area: name; } .np-line [data-k="cas"] { grid-area: cas; }
  .np-line .np-pct { grid-area: pct; } .np-line .np-sg { grid-area: sg; } .np-line .np-amtw { grid-area: amt; display: flex; justify-content: space-between; align-items: center; }
  .np-line .np-tools { grid-area: tools; }
  .np-l { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
  .np-amtw .np-l { margin: 0; }
  .np-head { display: none; }
  .np-step { grid-template-columns: 26px minmax(0, 1fr); }
  .np-step .np-chips, .np-step .np-tools { grid-column: 2; }
  .np-grid label.wide { grid-column: auto; }
  .np-bar { width: auto; }
}

/* ---------- 차수별 코멘트 (레시피 표 옆) ---------- */
.recipe-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.recipe-row > #linesOut { flex: 0 1 auto; max-width: 100%; }
.cmt { flex: 1 1 320px; max-width: 520px; padding: 14px; position: sticky; top: 64px; }
#linesOut.editing + .cmt { flex-basis: 100%; max-width: none; position: static; } /* 수정 중에는 표 아래로 */
.cmt h3 { font-size: 16px; display: flex; gap: 8px; align-items: baseline; }
.cmt-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.cmt-item { padding: 8px 10px; border-radius: 10px; background: #f8f4f9; border: 1px solid #ebe1ee; }
.cmt-item.del { background: none; border-style: dashed; font-size: 12px; }
.cmt-meta { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.cmt-act { margin-left: auto; display: flex; gap: 2px; }
.link-btn.danger { color: #b00020; }
.cmt-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.cmt-body textarea, .cmt-form textarea { width: 100%; font: inherit; font-size: 14px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.cmt-form-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; }
.cmt-empty { font-size: 13px; padding: 4px 0; }
.step-cmt { margin-top: 4px; font-size: 12px; color: var(--accent); font-weight: 600; }
@media (max-width: 700px) { .cmt { max-width: none; position: static; } .cmt-list { max-height: none; } }

/* ---------- 메뉴 개편: 상단 · 첫 화면 4개 큰 메뉴 · 세부 메뉴 ---------- */
.top { justify-content: flex-start; }
.brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; color: var(--accent); padding-right: 14px; border-right: 1px solid var(--line); }
.brand b { font-size: 17px; } .brand span { font-size: 11px; color: var(--muted); }
.crumbs { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; min-width: 0; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs [aria-current] { font-weight: 700; color: var(--ink); }
.crumbs .sep { color: #b9b5ad; }
.hub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 1100px; margin: 3vh auto; }
.hub-card, .sub-card { display: flex; flex-direction: column; gap: 8px; padding: 28px 26px; background: #fff; border: 2px solid var(--line); border-radius: 18px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.hub-card { min-height: 200px; }
.hub-card:hover, .sub-card:hover { border-color: var(--accent); box-shadow: 0 10px 28px #89589624; transform: translateY(-2px); }
.hub-icon { font-size: 34px; }
.hub-title { font-size: 24px; font-weight: 800; color: var(--accent); } .hub-title small, .sub-title small { font-size: 15px; font-weight: 600; color: var(--muted); }
.sub-title { font-size: 20px; font-weight: 800; color: var(--accent); }
.hub-sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
.hub-stat { margin-top: auto; font-size: 14px; font-weight: 600; }
.hub-alert { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: #fdecec; color: #b00020; font-size: 13px; font-weight: 700; }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; max-width: 1100px; margin: 14px 0; }
.sub-card { min-height: 170px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
/* 단계 표시 */
.stage-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eee; color: #555; white-space: nowrap; vertical-align: middle; }
.stage-pill.st-sampling { background: #fff0d6; color: #8a5a00; }
.stage-pill.st-confirmed { background: #efe5f1; color: var(--accent); }
.stage-pill.st-recent { background: #e6f4ea; color: #2c6b3c; }
.stage-pill.st-archived { background: #e9e9e9; color: #555; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 6px 0 12px; border-radius: 12px; background: #fffaf0; border: 1px solid #f0d58c; }
.stage-bar.st-confirmed { background: #f8f4f9; border-color: #d9c4de; }
.stage-bar.st-recent, .stage-bar.st-archived { background: #f3f9f4; border-color: #bfe0c8; }
/* 제조 요청 카드 */
.req-list { display: grid; gap: 10px; }
.req { padding: 12px 14px; }
.req-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.req-meta { margin-top: 4px; font-size: 14px; }
.req-act { margin-top: 8px; }
.req-form .np-grid { margin-top: 8px; }
/* 원료 표 옆에 공정확인, 코멘트는 아래 */
.recipe-row { gap: 18px; }
.recipe-row > #procOut { flex: 1 1 320px; min-width: 0; }
.recipe-row > #procOut .proc-table .step-chips { min-width: 120px; }
.recipe-row { flex-wrap: nowrap; }
#linesOut.editing { flex: 0 1 auto; }
@media (max-width: 980px) { .recipe-row { flex-wrap: wrap; } }
body:has(#linesOut.editing) .recipe-row { flex-wrap: wrap; } /* 수정 중에는 표가 넓어 공정은 아래로 */
.recipe-row > #procOut .section { margin-top: 0; }
.cmt { position: static; max-width: 820px; flex: none; margin-top: 14px; }
@media (max-width: 700px) {
  .hub { grid-template-columns: 1fr; gap: 12px; margin: 8px 0; }
  .hub-card { min-height: 0; padding: 18px; } .hub-title { font-size: 20px; } .hub-icon { font-size: 26px; }
  .sub-card { min-height: 0; padding: 18px; }
  .brand { border: 0; padding: 0; }
  .crumbs { width: 100%; font-size: 13px; order: 3; }
}

/* 니카 분할 요청 · 분할 지시서 · 용량 단위 */
.nika-task { padding: 8px 12px; background: #f3edf5; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nika-task .btn { margin-left: auto; }
.msg-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.req-batches { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.req-batches .batch { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.unit-in { display: flex; gap: 6px; }
.unit-in input { flex: 1; min-width: 0; }
.unit-in select { width: auto; }

/* 품목 구분 · 제조 요청 표 */
.np-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.np-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 600; color: var(--muted); }
.np-tabs button.on { background: var(--accent, #895896); border-color: var(--accent, #895896); color: #fff; }
.item-type-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; font-size: 14px; }
.item-type-row select { width: auto; }
.req-table td { vertical-align: middle; }
.req-table tr.req-sub td { background: #faf7fb; padding-top: 6px; padding-bottom: 8px; }
.req-table tr.req-sub .batch { display: inline-flex; gap: 6px; align-items: center; margin: 2px 14px 2px 0; white-space: nowrap; }
.req-table .batch-title { margin-right: 10px; }
.req-table th { white-space: nowrap; }
.req-table td.m-full:nth-child(2) { min-width: 170px; }
.req-ops { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.req-ops .btn { justify-content: center; white-space: nowrap; }
@media (max-width: 760px) { .req-ops { flex-direction: row; flex-wrap: wrap; } .req-table .batch-title { display: none; } }
@media (max-width: 760px) { .req-table tr.req-sub { margin-top: -8px; background: #faf7fb; } .req-table tr.req-sub td { background: none; } }

/* 감사 로그 (한글) */
.audit-filter { gap: 8px; margin: 6px 0 10px; flex-wrap: wrap; }
.audit-filter input { flex: 1 1 260px; }
.audit-filter select { width: auto; }
.audit-act { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #f3edf5; font-size: 13px; font-weight: 600; }
.audit-act.a-download { background: #e8f0fb; } .audit-act.a-download_denied, .audit-act.a-login_failed, .audit-act.a-audit_denied, .audit-act.a-password_change_failed { background: #fdecec; color: #a02020; }
.audit-act.a-view { background: #f2f2f0; color: var(--muted); font-weight: 500; }
.audit-table tr[hidden] { display: none !important; }

/* 캘린더 */
.hub-wide { grid-column: 1 / -1; min-height: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav .btn { text-decoration: none; }
.cal-month { font-size: 18px; min-width: 110px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 12px; }
.cal-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
button.cal-pill { cursor: pointer; } button.cal-pill.off { opacity: .4; text-decoration: line-through; }
.ct-due { --c: #c62828; --b: #fdecec; } .ct-order { --c: #8a6100; --b: #fff4c2; } .ct-confirm { --c: #895896; --b: #f3edf5; } .ct-done { --c: #2b7a3d; --b: #e6f4ea; }
.cal-pill, .cal-chip { color: var(--c); background: var(--b); }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); gap: 1px; }
.cal-dow { background: #faf8fb; text-align: center; font-size: 13px; font-weight: 700; padding: 6px 0; }
.cal-dow.sun, .cal-day.sun .cal-num { color: #c0392b; } .cal-dow.sat, .cal-day.sat .cal-num { color: #2d5ea8; }
.cal-day { all: unset; box-sizing: border-box; background: #fff; min-height: 104px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; overflow: hidden; }
.cal-day:hover { background: #fcfafd; } .cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day.out { background: #fafafa; } .cal-day.out .cal-num { opacity: .4; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { font-size: 13px; font-weight: 700; }
.cal-day.today .cal-num { background: var(--accent); color: #fff !important; border-radius: 999px; padding: 1px 7px; align-self: flex-start; }
.cal-chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { display: block; font-size: 12px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; } .cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.hide-due .ct-due, .hide-order .ct-order, .hide-confirm .ct-confirm, .hide-done .ct-done { display: none !important; }
.cal-detail { margin-top: 14px; }
.cal-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cal-ev { display: flex; gap: 10px; align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cal-ev:last-child { border-bottom: 0; padding-bottom: 0; }
.cal-ev-body { min-width: 0; }
.cal-side h3 { margin-top: 0; }
.cal-soon { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 10px; }
.cal-soon li { display: flex; gap: 10px; align-items: flex-start; }
.cal-dday { flex: none; min-width: 52px; text-align: center; font-weight: 800; font-size: 13px; padding: 3px 6px; border-radius: 8px; background: #f2f2f0; }
.cal-dday.near { background: #fff1e0; color: #c25e00; } .cal-dday.late { background: #fdecec; color: #b00020; }
@media (max-width: 980px) { .cal-wrap { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .cal-day { min-height: 54px; padding: 4px; align-items: center; }
  .cal-chips { display: none; } .cal-dots { display: flex; justify-content: center; }
  .cal-ev { flex-direction: column; gap: 4px; }
}
.cal-more { font-size: 12px; color: var(--muted); padding-left: 4px; }
.cal-top { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.cal-hol { font-size: 11px; color: #c0392b; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-day.hol { background: #fff8f7; }
.cal-hol-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 10px; }
.cal-hol-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #fdecec; color: #c0392b; font-size: 12px; font-weight: 700; }
@media (max-width: 760px) { .cal-top { flex-direction: column; align-items: center; gap: 0; } .cal-hol { font-size: 9px; max-width: 100%; } }

/* 비밀번호 칸 (한글 자판 허용, 글자는 가림) */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 68px; }
.pw-field { -webkit-text-security: disc; text-security: disc; }
.pw-field.show { -webkit-text-security: none; text-security: none; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 13px; padding: 4px 8px; cursor: pointer; }
.pw-note { margin: -4px 0 4px; font-size: 12px; }

/* 앱으로 설치 */
.install-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 10px 0 14px; }
.install-card ol { padding-left: 20px; line-height: 1.7; margin: 0; }
.install-card.mine { border: 2px solid var(--accent); }
.kbd { display: inline-block; min-width: 1.4em; text-align: center; padding: 0 5px; border: 1px solid var(--line); border-radius: 6px; background: #faf8fb; }
.ok-box { padding: 10px 14px; border-radius: 10px; background: #e6f4ea; color: #2b7a3d; font-weight: 600; }
@media (max-width: 980px) { .install-grid { grid-template-columns: 1fr; } }
/* 앱(전체 화면)으로 실행할 때 아이폰 아래 홈 막대에 버튼이 가리지 않게 */
@media (display-mode: standalone) { .fabs { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); } .edit-bar { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); } }

/* 로고 (Herb Family · Herb Collection) */
.login-logo { display: block; width: 160px; height: auto; margin: 0 auto 4px; }
.brand { flex-direction: row; align-items: center; gap: 8px; }
.brand img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
@media (max-width: 760px) { .brand img { width: 34px; height: 34px; } .login-logo { width: 120px; } }
.brand .brand-text { color: var(--accent); font-size: inherit; }

/* 기본 레시피 템플릿 · 공통 레시피 추리기 */
.tpl-actions { gap: 8px; margin: 8px 0 14px; flex-wrap: wrap; }
.tpl-actions .btn { text-decoration: none; }
.tpl-lines input, .tpl-lines select { width: 100%; min-width: 70px; }
.tpl-lines td.num input { text-align: right; max-width: 110px; }
.an-up .btn input[hidden] { display: none; }
.an-up label.btn { cursor: pointer; }
.pw-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.pw-inline .pw-wrap { display: inline-block; width: 180px; }
.an-ctrl { gap: 10px; margin: 14px 0 8px; flex-wrap: wrap; align-items: center; }
.an-ctrl select { width: auto; } .an-ctrl input { flex: 1 1 200px; }
.an-groups tr.sel td { background: #f8f4f9; }
.an-detail { margin-top: 14px; }
.an-detail details { margin: 6px 0 12px; }
.an-detail input[data-mv], .an-detail select[data-mv] { min-width: 90px; width: 100%; }
.an-ings tr.muted td { opacity: .55; }
.an-bar { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: #eee; vertical-align: middle; overflow: hidden; }
.an-bar i { display: block; height: 100%; background: var(--accent); }
.an-save { position: sticky; bottom: 0; padding-right: 260px !important; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0 2px; background: #fff; border-top: 1px solid var(--line); margin-top: 10px; }
.an-save input { flex: 1 1 220px; }
/* 샘플 요청서 › 템플릿 칸 */
.np-tpl-links { gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.np-tpl-links .btn { text-decoration: none; }
.np-tpl-prev { margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; background: #fcfbfd; }
.np-tpl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.np-tpl-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--cat, #f2f2f0); border: 1px solid #0000000d; }
.need-review { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #fff1e0; color: #c25e00; font-size: 12px; font-weight: 700; }

/* ---------- 생산공장 화면 (2026-10-19): 큰 글씨·큰 버튼, 할 일 카드 ---------- */
.ui-pick { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.ui-pick legend { padding: 0 4px; color: var(--muted); font-size: 13px; }
.ui-pick label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
button.sub-card { font: inherit; text-align: left; cursor: pointer; align-items: flex-start; }
.ftabs { display: flex; gap: 6px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 61px; z-index: 1; }
.ftabs a { flex: 0 0 auto; padding: 10px 18px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 16px; border: 2px solid var(--line); background: #fff; }
.ftabs a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
body.factory-ui { font-size: 16px; }
body.factory-ui .crumbs:empty { display: none; }
.fhome { max-width: 1100px; margin: 0 auto; }
.fsum { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.fsum span { padding: 8px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 16px; }
.fsum b { font-size: 20px; }
.fsum .late { background: #fdecec; color: #b00020; border-color: #f5c2c2; }
.fhelp { margin: 4px 0 14px; line-height: 1.6; }
.fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 14px; align-items: start; }
.fcard { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.fcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.fno { font-weight: 800; font-size: 15px; color: var(--accent); background: #f3edf5; padding: 3px 10px; border-radius: 8px; }
.fdue { font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eee; color: #555; }
.fdue.soon { background: #fff0d6; color: #8a5a00; }
.fdue.late { background: #fdecec; color: #b00020; }
.fname { font-size: 20px; margin: 0; word-break: keep-all; }
.fnote { background: #fff8e6; border-radius: 8px; padding: 6px 10px; }
.fnums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.fnums div { background: #fafaf8; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.fnums dt { font-size: 12px; color: var(--muted); }
.fnums dd { margin: 2px 0 0; font-size: 17px; white-space: nowrap; }
.fbatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: #f3edf5; }
.fbatch { display: inline-flex; gap: 6px; align-items: center; background: #fff; border-radius: 8px; padding: 4px 8px; }
.fops { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.big { padding: 12px 16px; font-size: 16px; font-weight: 700; border-radius: 10px; min-height: 48px; }
.fops .primary { margin-left: auto; }
.flink { align-self: flex-end; font-size: 14px; }
.fempty { background: #fff; border: 2px dashed var(--line); border-radius: 16px; padding: 40px 20px; text-align: center; font-size: 18px; line-height: 1.8; }
@media (max-width: 700px) {
  .ftabs { padding: 8px 12px; top: 0; position: relative; }
  .ftabs a { padding: 8px 14px; font-size: 15px; }
  .fnums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fops .btn.big { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .fops .primary { margin-left: 0; flex-basis: 100%; }
}

/* 추천 원료 (2026-10-19) */
.sug-card { border-color: #e9d9a8; background: #fffcf2; }
.np-sug { margin-top: 14px; padding: 12px; border: 1px dashed #e0c878; border-radius: 10px; }
.np-sug h4 { margin: 0 0 4px; }
.sug-table td, .sug-table th { padding: 6px 8px; }

/* 과거 레시피 일괄 등록 (2026-10-19) */
.arc-pick { display: grid; gap: 12px; }
.arc-pick label.btn { cursor: pointer; }
.arc-pw { display: grid; gap: 4px; max-width: 420px; }
.arc-notes { margin: 0; padding-left: 18px; line-height: 1.7; }
.arc-bar { height: 12px; background: #eee; border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.arc-bar > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.arc-sum { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.arc-chip { padding: 4px 10px; border-radius: 999px; background: #eee; }
.arc-chip.arc-saved { background: #e6f4ea; color: #2c6b3c; }
.arc-chip.arc-queued, .arc-chip.arc-password_required { background: #fff0d6; color: #8a5a00; }
.arc-chip.arc-error { background: #fdecec; color: #b00020; }

/* 업로드 버튼·창 (2026-10-19) */
.up-fab { background: #fff; color: var(--accent); border: 2px solid var(--accent) !important; box-shadow: 0 6px 20px #89589633; }
.up-fab:hover { background: #f8f3f9; filter: none; }
.up-dialog { width: min(720px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 20px; box-shadow: 0 20px 60px #0004; }
.up-dialog::backdrop { background: #0005; }
.up-form { display: grid; gap: 12px; }
.up-head { display: flex; justify-content: space-between; align-items: center; }
.up-head h3 { margin: 0; }
.up-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 10px; justify-items: center; text-align: center; background: #fafaf8; }
.up-drop.over { border-color: var(--accent); background: #f3edf5; }
.up-drop label.btn { cursor: pointer; }
.up-mode { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; display: grid; gap: 6px; }
.up-mode legend { padding: 0 4px; color: var(--muted); font-size: 13px; }
.up-mode label { display: flex; gap: 6px; align-items: baseline; cursor: pointer; line-height: 1.5; }
.up-pw { display: grid; gap: 4px; }
.up-list { max-height: 40vh; overflow: auto; display: grid; gap: 6px; }
.up-item { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: #fafaf8; border: 1px solid var(--line); line-height: 1.5; }
.up-item.saved { background: #f2faf4; border-color: #cfe8d6; }
.up-item.queued, .up-item.password_required { background: #fffaf0; border-color: #f0dcae; }
.up-item.error { background: #fdf3f3; border-color: #f2caca; }
.up-item .up-file { color: var(--muted); font-size: 12px; display: block; }
.up-actions { justify-content: flex-end; }
.kind-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #f3edf5; color: var(--accent); font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.kind-head { margin: 18px 0 6px; display: flex; gap: 8px; align-items: baseline; }
.up-actions .up-close { background: #fff; color: var(--ink); border-color: var(--line); }

/* 문서함 (2026-10-19) */
.doc-tools { gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.doc-tools form { gap: 6px; flex: 1 1 280px; }
.doc-tools form input { flex: 1; min-width: 0; }
.doc-filter { margin: 8px 0 14px; }
.doc-filter a { text-decoration: none; color: inherit; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.doc-card { display: flex; gap: 12px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; align-items: flex-start; }
.doc-card:hover { border-color: var(--accent); }
.doc-thumb { flex: 0 0 64px; height: 64px; border-radius: 8px; background: #f3edf5; display: grid; place-items: center; font-size: 28px; overflow: hidden; position: relative; }
.doc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.doc-body { min-width: 0; display: grid; gap: 2px; }
.doc-body b { word-break: keep-all; }
.doc-snip { font-size: 13px; background: #fff8e6; border-radius: 6px; padding: 2px 6px; }
.doc-meta { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-detail { display: grid; gap: 12px; }
.doc-view { display: grid; gap: 10px; justify-items: start; }
.doc-view img { max-width: 100%; max-height: 70vh; border-radius: 8px; border: 1px solid var(--line); }
.doc-big { font-size: 64px; }
.doc-fields { margin-top: 12px; padding: 10px 12px; background: #f3edf5; border-radius: 10px; display: grid; gap: 8px; justify-items: start; }
.doc-text { white-space: pre-wrap; word-break: break-word; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 50vh; overflow: auto; font-size: 13px; margin: 0; }
.prod-docs { display: flex; flex-wrap: wrap; gap: 8px; }
.prod-docs a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; color: var(--ink); }

/* 확인 대기 일괄 확인 (2026-10-19) */
.q-bulk { position: sticky; top: 64px; z-index: 1; display: grid; gap: 8px; margin-bottom: 12px; border-color: var(--accent); }
.q-bulk p { margin: 0; }
.queue-item .q-pick { width: 18px; height: 18px; }

/* 추천 원료: '원료 추가' 옆 버튼 (2026-10-19) */
.sug-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sug-lbl { font-size: 13px; color: #8a5a00; font-weight: 700; }
.sug-chip { display: inline-flex; align-items: stretch; border: 1px solid #e9d9a8; border-radius: 999px; background: #fffcf2; overflow: hidden; }
.sug-chip button { border: 0; background: transparent; padding: 6px 10px; font-size: 13px; color: var(--ink); cursor: pointer; border-radius: 0; }
.sug-chip button:hover { background: #fff3cf; }
.sug-chip button small { color: var(--muted); }
.sug-chip .sug-x { padding: 6px 8px; color: var(--muted); border-left: 1px solid #f0e3bd; }

.fsec { margin: 18px 0 8px; font-size: 20px; }
.fhome .fsec:first-child { margin-top: 4px; }

/* 생산 스케줄 표 (2026-10-19) */
.board-tools input#bQ { flex: 1 1 260px; min-width: 0; }
.board-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.board-table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.board-table th { position: sticky; top: 0; background: #f3edf5; z-index: 1; white-space: nowrap; text-align: left; padding: 6px 8px; }
.board-table td { padding: 5px 8px; border-top: 1px solid var(--line); vertical-align: top; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-table td.b-wide, .board-table th.b-wide { max-width: 340px; }
.board-table tr.b-row { cursor: pointer; }
.board-table tr.b-row:hover td { background: #faf6fb; }
.board-dlg { width: min(860px, calc(100vw - 32px)); }
.board-form { display: grid; gap: 10px; }
.board-form textarea { width: 100%; resize: vertical; font: inherit; }
@media (max-width: 700px) { .board-table { width: 100%; } .board-table td { max-width: none; white-space: normal; } .board-wrap { max-height: none; } }

.b-orig { display: block; font-size: 12px; margin-top: 2px; }
.b-check { display: inline-flex; gap: 6px; align-items: center; padding: 6px 0; }

/* 생산 스케줄 드롭다운 칩 (시트와 같은 색) */
.b-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; line-height: 1.6; }
.b-check-chip { background: #d4edbc; color: #11734b; }

/* 안전신고: 대표 아래 파생 (2026-10-19) */
.b-tog { border: 1px solid var(--line); background: #f3edf5; color: var(--accent); border-radius: 999px; padding: 0 8px; font-size: 12px; margin-right: 6px; cursor: pointer; white-space: nowrap; }
.board-table tr.b-sub td { background: #fbf9fc; }
.board-table tr.b-sub td:first-child { padding-left: 22px; }
.b-indent { color: var(--muted); margin-right: 4px; }

/* =====================================================================
   MES 화면 (2026-10-19) — 시안 A(밝은 업무형). 위의 예전 규칙을 이 아래에서 덮어쓴다.
   왼쪽 고정 메뉴 · 위 상태 줄 · 선 아이콘 · 촘촘한 표 · 의미가 있는 색만 (초록 완료 / 파랑 진행 / 노랑 주의 / 빨강 지연)
   ===================================================================== */
:root {
  --bg: #f3f5f8; --card: #fff; --ink: #1b2330; --ink-2: #4a5566; --muted: #7b8698; --line: #e2e6ec; --line-2: #eef1f5; --panel-2: #f8f9fb;
  --accent: #7a4a88; --accent-soft: #f2eaf5;
  --side: #1d2738; --side-ink: #c5ccd8; --side-on: #2b3850; --side-line: #2a3549;
  --ok: #15803d; --ok-bg: #e7f6ec; --warn: #b45309; --warn-bg: #fdf3e2; --bad: #c62828; --bad-bg: #fdecec; --info: #1d5fd1; --info-bg: #e8f0fd; --idle: #5b6577; --idle-bg: #eef0f4;
  font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif; font-size: 13px; color: var(--ink);
}
body { background: var(--bg); line-height: 1.45; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
h1, h2, h3 { letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h3 { font-size: 14px; }
a { color: var(--accent); }

/* 버튼 · 입력 */
button, .btn { height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 500; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: #c9d0da; background: #fafbfc; }
button.primary, .btn.primary, form button, .edit-bar-save { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover, form button:hover { background: #6b3f78; border-color: #6b3f78; }
.btn.ghost, button.ghost { border-color: transparent; background: transparent; }
.btn.sm, button.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.big { height: 44px; font-size: 14px; border-radius: 6px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 13px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #7a4a8833; border-color: var(--accent); }
.badge { border-radius: 4px; }

/* 카드 · 표 */
.card, .np.card { border-radius: 6px; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
table { border: 1px solid var(--line); border-radius: 6px; background: #fff; font-variant-numeric: tabular-nums; }
th, td { border: 0; border-bottom: 1px solid var(--line-2); padding: 7px 10px; }
th { background: var(--panel-2); color: var(--ink-2); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover td, table tr:hover td { background: #fafbfc; }
.table-wrap { border-radius: 6px; }
.stage-pill { border-radius: 4px; padding: 1px 8px; font-size: 11.5px; }
.stage-pill.st-sampling { background: var(--warn-bg); color: var(--warn); }
.stage-pill.st-confirmed { background: var(--info-bg); color: var(--info); }
.stage-pill.st-recent { background: var(--ok-bg); color: var(--ok); }
.stage-pill.st-archived { background: var(--idle-bg); color: var(--idle); }
.kind-chip { border-radius: 4px; background: var(--idle-bg); color: var(--ink-2); font-weight: 600; }
.hub-alert { border-radius: 4px; }
.fdue { border-radius: 4px; }
#toast { border-radius: 6px; background: #1b2330; font-size: 13px; }

/* ---------- 틀: 왼쪽 메뉴 + 위 상태 줄 ---------- */
#app:not([hidden]) { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.side { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; border-right: 1px solid var(--side-line); z-index: 6; }
.side-brand { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--side-line); text-decoration: none; }
.side-brand img { width: 30px; height: 30px; border-radius: 6px; background: #fff; object-fit: contain; }
.side-brand b { display: block; color: #fff; font-size: 14px; letter-spacing: -.2px; }
.side-brand small { display: block; color: var(--side-ink); font-size: 11px; }
.side-nav { flex: 1; overflow: auto; padding: 8px 8px 16px; }
.side-nav h6 { margin: 14px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .3px; color: #7b8698; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--side-ink); text-decoration: none; position: relative; font-size: 13px; }
.side-nav a:hover { background: var(--side-on); color: #fff; }
.side-nav a.on { background: var(--side-on); color: #fff; font-weight: 600; }
.side-nav a.on::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: #b07cc0; }
.side-nav .cnt { margin-left: auto; font-size: 11px; padding: 0 6px; border-radius: 4px; background: rgba(255,255,255,.08); color: var(--side-ink); font-variant-numeric: tabular-nums; }
.side-nav .cnt.bad { background: #c62828; color: #fff; }
.side-foot { flex: none; padding: 10px 16px; border-top: 1px solid var(--side-line); font-size: 11px; color: #7b8698; }
header.top { grid-column: 2; grid-row: 1; height: 52px; padding: 0 18px; gap: 12px; flex-wrap: nowrap; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .right { flex-wrap: nowrap; gap: 6px; }
.top-menu { display: none; height: 32px; width: 32px; padding: 0; justify-content: center; }
.top-sp { flex: 1; }
.crumbs { white-space: nowrap; overflow: hidden; min-width: 0; flex: 0 1 auto; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; margin: 0; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { margin: 0 6px; color: #b6bdc8; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.top-chips { display: flex; gap: 6px; }
.tchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink-2); font-size: 12px; white-space: nowrap; text-decoration: none; }
.tchip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tchip.bad b { color: var(--bad); } .tchip.warn b { color: var(--warn); }
.top-user { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); white-space: nowrap; margin-left: 4px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
#who { font-size: 13px; }
.layout { grid-column: 2; grid-row: 2; min-width: 0; }
main { padding: 18px 20px 90px; }
#ftabs { display: none !important; }
aside#nika { top: 52px; height: calc(100vh - 52px); }

/* 니카 · 업로드 버튼: 작고 반듯하게 */
.fabs { right: 18px; bottom: 18px; gap: 8px; }
.nika-fab { height: 40px; padding: 0 14px; border-radius: 8px; font-size: 13px; gap: 6px; box-shadow: 0 4px 14px rgba(16,24,40,.18); }
.nika-fab svg { width: 18px; height: 18px; }
.up-fab { box-shadow: 0 4px 14px rgba(16,24,40,.12); }

/* ---------- 페이지 머리 ---------- */
.pg-h { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pg-h h1 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.pg-h p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.pg-h .sp { flex: 1; }

/* ---------- 대시보드 ---------- */
.d-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.d-kpi { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; position: relative; overflow: hidden; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.d-kpi:hover { border-color: #c9d0da; }
.d-kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.d-kpi.ok::after { background: var(--ok); } .d-kpi.warn::after { background: var(--warn); } .d-kpi.bad::after { background: var(--bad); } .d-kpi.info::after { background: var(--info); }
.d-kpi .l { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.d-kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.d-kpi .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.d-kpi.bad .v { color: var(--bad); } .d-kpi.warn .v { color: var(--warn); } .d-kpi.ok .v { color: var(--ok); }
.d-kpi .d { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.d-grid > div { min-width: 0; display: grid; gap: 12px; }
.d-panel { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 2px rgba(16,24,40,.05); overflow: hidden; }
.d-ph { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.d-ph h3 { margin: 0; font-size: 13px; }
.d-ph .muted { font-size: 12px; }
.d-ph .sp { flex: 1; }
.d-panel table { border: 0; border-radius: 0; }
.d-panel .table-wrap { overflow-x: auto; }
.d-empty { padding: 18px 14px; color: var(--muted); font-size: 12px; }
.d-list { list-style: none; margin: 0; padding: 0; }
.d-list li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.d-list li:last-child { border-bottom: 0; }
.d-list .t { flex: 1; min-width: 0; }
.d-list .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-list .t small { color: var(--muted); }
.d-st { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.d-st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.d-st.ok { color: var(--ok); background: var(--ok-bg); } .d-st.warn { color: var(--warn); background: var(--warn-bg); } .d-st.bad { color: var(--bad); background: var(--bad-bg); }
.d-st.info { color: var(--info); background: var(--info-bg); } .d-st.idle { color: var(--idle); background: var(--idle-bg); }
.d-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.d-week > div { border-right: 1px solid var(--line-2); min-height: 112px; padding: 8px; min-width: 0; }
.d-week > div:last-child { border-right: 0; }
.d-week .dd { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.d-week .dd.today { color: var(--accent); font-weight: 700; }
.d-week .dd.hol { color: var(--bad); }
.d-ev { font-size: 11px; padding: 3px 6px; border-radius: 4px; margin-bottom: 4px; border-left: 3px solid var(--line); background: var(--panel-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-ev.ok { border-color: var(--ok); } .d-ev.info { border-color: var(--info); } .d-ev.warn { border-color: var(--warn); } .d-ev.bad { border-color: var(--bad); }
.due-bad { color: var(--bad); font-weight: 600; } .due-warn { color: var(--warn); font-weight: 600; }

/* ---------- 음성 생산공장 (현장 단말) ---------- */
.fhome { max-width: none; }
.fsec { font-size: 15px; margin: 16px 0 10px; display: flex; align-items: center; gap: 8px; }
.fsum span { border-radius: 6px; font-size: 13px; }
.fcard { border-radius: 8px; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.fcard.late, .fcard:has(.fdue.late) { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad) inset; }
.fno { border-radius: 4px; font-family: ui-monospace, "SF Mono", Menlo, monospace; background: var(--accent-soft); }
.fnums div { border-radius: 6px; }
.fempty { border-radius: 8px; border-style: solid; font-size: 14px; }

/* ---------- 로그인 (MES) ---------- */
.mes-login:not([hidden]) { display: grid; grid-template-columns: minmax(320px, 44%) 1fr; min-height: 100vh; background: var(--bg); }
.ml-brand { background: var(--side); color: var(--side-ink); padding: 48px 48px 28px; display: flex; flex-direction: column; gap: 32px; }
.ml-top { display: flex; align-items: center; gap: 14px; }
.ml-logo { width: 56px; height: 56px; border-radius: 10px; background: #fff; object-fit: contain; padding: 4px; }
.ml-top b { display: block; color: #fff; font-size: 22px; letter-spacing: -.4px; }
.ml-top span { display: block; font-size: 13px; color: var(--side-ink); }
.ml-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ml-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #dfe4ec; }
.ml-points svg.i { width: 18px; height: 18px; color: #b07cc0; }
.ml-conf { margin: auto 0 0; padding: 14px 16px; max-width: none; text-align: left; border: 1px solid #3a2730; border-left: 3px solid #e35d6a; border-radius: 6px; background: rgba(227, 93, 106, .08); }
.ml-conf strong { font-size: 13px; color: #ff8a95; letter-spacing: .2em; display: block; }
.ml-conf p { color: #c9cfda; font-size: 12px; line-height: 1.6; margin: 6px 0 0; }
.ml-foot { font-size: 11px; color: #7b8698; }
.ml-form-wrap { display: grid; place-items: center; padding: 32px 20px; }
.ml-form { width: min(380px, 100%); display: grid; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 8px 30px rgba(16,24,40,.06); }
.ml-form h1 { margin: 0; font-size: 20px; }
.ml-form > .muted { margin: -8px 0 4px; font-size: 13px; }
.ml-form label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ml-form select, .ml-form input { height: 38px; font-size: 14px; font-weight: 400; }
.ml-form .pw-wrap { display: flex; }
.ml-form .pw-note { margin: -6px 0 0; font-size: 11.5px; }
.ml-form .ui-pick { border: 0; padding: 0; margin: 0; display: block; }
.ml-form .ui-pick legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 5px; }
.ml-form .seg2 { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ml-form .ui-pick label { display: block; font-weight: 500; margin: 0; cursor: pointer; }
.ml-form .ui-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ml-form .ui-pick span { display: block; text-align: center; padding: 9px 6px; font-size: 13px; color: var(--ink-2); background: #fff; }
.ml-form .ui-pick label + label span { border-left: 1px solid var(--line); }
.ml-form .ui-pick input:checked + span { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.ml-form .ui-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.ml-submit { justify-content: center; height: 42px !important; font-size: 15px !important; font-weight: 700 !important; }
.ml-form .err { margin: 0; min-height: 1em; font-size: 12px; }

/* ---------- 좁은 화면: 메뉴는 서랍으로 ---------- */
@media (max-width: 900px) {
  #app:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .side-scrim:not([hidden]) { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 5; }
  header.top, .layout { grid-column: 1; }
  header.top { padding: 0 10px; gap: 8px; }
  .top-menu { display: inline-flex; }
  .top-chips, .hide-sm, #who { display: none; }
  main { padding: 14px 12px 90px; }
  .d-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-grid { grid-template-columns: minmax(0, 1fr); }
  .d-week { grid-template-columns: repeat(7, minmax(84px, 1fr)); overflow-x: auto; }
  .mes-login:not([hidden]) { grid-template-columns: 1fr; }
  .ml-brand { padding: 24px 20px; gap: 16px; }
  .ml-points { display: none; }
}
@media (min-width: 901px) and (max-width: 1280px) { .d-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .top-chips .tchip:nth-child(n+3) { display: none; } }

.hub-icon svg.i { width: 22px; height: 22px; color: var(--accent); }
.sub-card { border-radius: 6px; border-width: 1px; padding: 18px; min-height: 0; }
.sub-card:hover { transform: none; box-shadow: 0 2px 8px rgba(16,24,40,.08); }
.hub-card { border-radius: 6px; border-width: 1px; }
.doc-thumb svg.i, .doc-big svg.i { width: 26px; height: 26px; color: var(--accent); }
h2 svg.i { width: 18px; height: 18px; color: var(--accent); }
.crumbs { display: flex; align-items: center; flex-wrap: nowrap; }
.crumbs > * { flex: 0 0 auto; }
/* 예전 좁은 화면 규칙(경로를 아래 줄로 · 오른쪽 메뉴 줄바꿈) 덮어쓰기 */
@media (max-width: 900px) {
  header.top .crumbs { order: 0; width: auto; flex: 1 1 auto; font-size: 13px; }
  header.top .right { width: auto; flex-wrap: nowrap; gap: 2px; }
  header.top .right .btn { padding: 0 8px; }
  .top-sp { display: none; }
}
header.top { justify-content: flex-start; }
.d-panel td, .d-panel th { white-space: nowrap; }
.d-panel td:nth-child(2) { white-space: normal; min-width: 140px; }

/* 생산 스케줄: 진행 중 / 아카이브 탭 */
.b-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 2px 0 10px; background: #fff; }
.b-tabs a { padding: 6px 14px; font-size: 13px; color: var(--ink-2); text-decoration: none; cursor: pointer; border-right: 1px solid var(--line); }
.b-tabs a:last-child { border-right: 0; }
.b-tabs a span { margin-left: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.b-tabs a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.b-tabs a.on span { color: var(--accent); }

/* 끌어서 순서 바꾸기 (2026-10-19) */
.drag-h { width: 22px; height: 28px; padding: 0; border: 0; background: transparent; color: #9aa3b2; cursor: grab; touch-action: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; flex: none; }
.drag-h:hover { background: var(--line-2); color: var(--ink-2); border: 0; }
.drag-h:active { cursor: grabbing; }
.drag-h svg.i { width: 16px; height: 16px; stroke-width: 2.4; }
.drag-cell { width: 28px; padding: 4px 2px 4px 6px !important; }
.dragging { opacity: .45; }
tr.drop-before > td { box-shadow: inset 0 2px 0 var(--accent); }
tr.drop-after > td { box-shadow: inset 0 -2px 0 var(--accent); }
div.drop-before { box-shadow: 0 -2px 0 var(--accent); }
div.drop-after { box-shadow: 0 2px 0 var(--accent); }
.np-seq { display: inline-flex; align-items: center; justify-content: center; gap: 0; }
.np-seq .drag-h { width: 16px; }
.np-line { grid-template-columns: 52px 120px minmax(160px, 2fr) minmax(100px, 1fr) 100px 80px 100px auto; }
.step-no { display: inline-flex; align-items: center; gap: 2px; }
.np-step { grid-template-columns: 46px minmax(0, 1fr) minmax(160px, 260px) auto; }
@media (max-width: 700px) { .np-line { grid-template-columns: 44px 1fr 1fr; } .np-step { grid-template-columns: 44px minmax(0, 1fr); } }

/* ---------- 현장 작업 진행 (아이패드, 2026-10-19) ---------- */
.frun { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.frun-go { min-height: 52px; font-size: 16px; padding: 0 20px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.frun-st { font-weight: 600; color: var(--ink-2); }
.frun-bar { flex: 1 1 120px; height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.frun-bar i { display: block; height: 100%; background: var(--ok); }
.run { max-width: 1100px; margin: 0 auto; padding-bottom: 80px; }
.run-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.run-title h2 { margin: 6px 0 2px; font-size: 22px; }
.run-batch { margin-left: 8px; padding: 2px 8px; border-radius: 4px; background: var(--info-bg); color: var(--info); font-weight: 600; }
.run-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.run-tools .btn { min-height: 44px; }
.run-wake.on { border-color: var(--ok); color: var(--ok); }
.run-batches { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.run-bt { display: flex; flex-direction: column; padding: 8px 14px; min-height: 48px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; }
.run-bt small { color: var(--muted); font-weight: 400; }
.run-bt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.run-steps { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 14px 0 8px; }
.run-steps li { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; }
.run-steps li b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-size: 12px; flex: none; }
.run-steps li.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.run-steps li.on b { background: var(--accent); color: #fff; }
.run-steps li.ok { color: var(--ok); } .run-steps li.ok b { background: var(--ok); color: #fff; }
.run-prog { position: relative; height: 26px; border-radius: 6px; background: var(--line-2); overflow: hidden; margin-bottom: 14px; }
.run-prog i { position: absolute; inset: 0 auto 0 0; background: var(--ok-bg); border-right: 2px solid var(--ok); }
.run-prog span { position: relative; display: block; line-height: 26px; padding: 0 10px; font-weight: 600; color: var(--ink-2); }
.run-closed { padding: 12px 14px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); font-weight: 600; margin-bottom: 12px; }
.run-sec { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.run-sec.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.run-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 16px; }
.run-sec h3 > b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--side); color: #fff; font-size: 12px; }
.run-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line-2); min-height: 64px; flex-wrap: wrap; }
.run-row:first-of-type { border-top: 0; }
.run-row.next { background: #fff8e6; border-radius: 8px; box-shadow: 0 0 0 2px var(--warn) inset; }
.run-row.done { opacity: .75; }
.run-row.done .run-name, .run-row.done .run-text { text-decoration: line-through; text-decoration-color: var(--ok); }
.run-no { display: inline-grid; place-items: center; min-width: 32px; height: 32px; border-radius: 50%; background: var(--line-2); font-weight: 700; color: var(--ink-2); }
.run-row.done .run-no { background: var(--ok); color: #fff; }
.run-main { flex: 1 1 220px; min-width: 0; }
.run-name { font-size: 17px; font-weight: 600; }
.run-text { font-size: 16px; white-space: pre-wrap; }
.run-kg { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 120px; text-align: right; }
.run-act { width: 120px; height: 52px; font-size: 18px; text-align: right; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.run-go { min-height: 56px; min-width: 128px; font-size: 18px; font-weight: 700; border-radius: 10px; touch-action: manipulation; }
.run-who { color: var(--ok); font-weight: 600; white-space: nowrap; }
.run-undo { min-height: 44px; }
.run-empty { padding: 8px; }
.run-log { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.run-log summary { cursor: pointer; font-weight: 600; min-height: 32px; line-height: 32px; }
.run-log div { padding: 4px 0; border-top: 1px solid var(--line-2); } .run-log .undone { color: var(--muted); text-decoration: line-through; }
@media (max-width: 900px) {
  .run-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); } .run-steps li { flex-direction: column; font-size: 12px; text-align: center; padding: 8px 4px; }
}
@media (max-width: 640px) {
  .run-kg { min-width: 0; text-align: left; font-size: 18px; } .run-go { flex: 1 1 auto; } .run-steps li { font-size: 11px; }
}
/* 캘린더 색 (2026-10-19): 지시서 노랑 · 납기 빨강 · 제조완료 초록 — 칸 안 표시는 왼쪽 굵은 띠로도 구분 */
.cal-chip.ct-order, .cal-chip.ct-due, .cal-chip.ct-done { border-left: 3px solid var(--c); font-weight: 600; }
.ct-order { --c: #a37200; --b: #fff4c2; } .ct-due { --c: #c62828; --b: #fdecec; } .ct-done { --c: #15803d; --b: #e3f5e8; }
.d-ev.warn { border-color: #e0a800; background: #fff8d6; } .d-ev.bad { background: var(--bad-bg); } .d-ev.ok { background: var(--ok-bg); }

/* ---------- 알림 종 · 샘플 요청서 (2026-10-20) ---------- */
.bell-wrap { position: relative; display: inline-flex; }
.bell { position: relative; }
.bell.has svg.i { color: var(--accent); }
.bell-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-panel { position: absolute; top: calc(100% + 8px); right: 0; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); z-index: 60; }
.noti-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.noti-h .sp { flex: 1; }
.noti { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.noti:hover { background: var(--panel-2); }
.noti.unread { background: #f7f2fa; } .noti.unread b::before { content: "● "; color: var(--accent); font-size: 10px; }
.noti-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .noti-b small { color: var(--ink-2); }
.noti-k { flex: none; align-self: flex-start; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; background: var(--idle-bg); color: var(--idle); }
.nk-sr_approve { background: var(--warn-bg); color: var(--warn); } .nk-sr_sample { background: var(--info-bg); color: var(--info); } .nk-sr_done { background: var(--ok-bg); color: var(--ok); } .nk-sr_reject, .nk-sr_cancel { background: var(--bad-bg); color: var(--bad); }
.noti-more { display: block; padding: 10px; text-align: center; font-weight: 600; }
.noti-page { padding: 0; overflow: hidden; }
.sr-st { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.sr-pending { background: var(--warn-bg); color: var(--warn); } .sr-rejected { background: var(--bad-bg); color: var(--bad); } .sr-approved, .sr-sampling { background: var(--info-bg); color: var(--info); } .sr-done { background: var(--ok-bg); color: var(--ok); }
tr.sr-turn td { background: #fff8e6; }
.sr-form { margin-bottom: 12px; }
.sr-title { display: grid; gap: 4px; margin-bottom: 12px; font-weight: 600; }
.sr-title input { font-size: 16px; font-weight: 700; background: var(--panel-2); }
.sr-form textarea { width: 100%; }
.sr-item { display: flex; gap: 6px; } .sr-item select, .sr-item input { flex: 1; }
.sr-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.sr-line > .muted:first-child { min-width: 86px; }
.sr-ap, .sr-vw { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; }
.sr-vw.fixed { background: var(--accent-soft); border-color: transparent; }
.sr-vw button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; }
.sr-banner { margin-bottom: 12px; border-left: 4px solid var(--info); }
.sr-grid .sr-card { display: block; text-decoration: none; color: var(--ink); }
.sr-grid .sr-card.st-approved { border-color: var(--info); box-shadow: 0 0 0 1px var(--info) inset; }
.sr-doc .card { margin-bottom: 12px; }
.sr-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.sr-f.wide { grid-column: span 2; } .sr-f dt { color: var(--muted); font-size: 12px; } .sr-f dd { margin: 2px 0 0; font-weight: 600; white-space: pre-wrap; }
.sr-aps { display: flex; gap: 10px; flex-wrap: wrap; }
.sr-apbox { display: flex; flex-direction: column; gap: 2px; min-width: 150px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.sr-apbox.approved { border-color: var(--ok); background: var(--ok-bg); } .sr-apbox.rejected { border-color: var(--bad); background: var(--bad-bg); } .sr-apbox.cur { border-color: var(--warn); background: var(--warn-bg); }
.sr-turnbox { border: 2px solid var(--warn); background: #fffaf0; display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.sr-turnbox textarea { width: 100%; }
.sr-work h4 { margin: 14px 0 4px; }
.print-box { width: 22px; height: 22px; border: 2px solid var(--ink-2); border-radius: 4px; }
@media (max-width: 760px) { .sr-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print {
  .side, header.top, .no-print, .fabs, .edit-bar, #sideScrim, .ftabs, dialog { display: none !important; }
  body, .layout, main, #view { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .sr-doc .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .run-row.next { box-shadow: none; background: none; }
}
/* 설정의 버튼형 카드: 일반 버튼 높이·줄바꿈 규칙 덮어쓰기 */
button.sub-card { height: auto; min-height: 0; white-space: normal; justify-content: flex-start; }
button.sub-card.on { border-color: var(--ok); }
button.sub-card .hub-sub { white-space: normal; }
/* 대시보드 '이번 주 생산 일정': 제품명이 잘리지 않게 줄바꿈 (2026-10-20) */
.d-ev { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.35; }
/* 삭제 버튼 (샘플 요청서 · 제조 요청, 2026-10-20) */
.btn.danger { color: #b00020; border-color: #e5b5bd; }
.btn.danger:hover { background: #fdeef0; }
/* 원가 계산 · 견적서 (2026-10-29) */
.q-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.q-form { display: grid; gap: 14px; min-width: 0; } .q-form > .card { margin: 0; }
.q-side { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.q-lines { width: 100%; border-collapse: collapse; margin: 6px 0 8px; } .q-lines th { font-size: 12px; color: var(--mute, #7b8698); font-weight: 600; text-align: left; padding: 4px 6px; }
.q-lines td { padding: 3px 6px; vertical-align: middle; } .q-lines input, .q-lines select { width: 100%; min-width: 0; } .q-lines td.num input { text-align: right; }
.q-lines .num { text-align: right; } .q-ro td { font-size: 13px; padding: 5px 6px; border-bottom: 1px solid #eef0f3; } .q-miss td { color: #b00020; }
.q-sum { width: 100%; border-collapse: collapse; } .q-sum th { text-align: left; font-weight: 500; padding: 5px 4px; } .q-sum td { padding: 5px 4px; }
.q-sum .q-sub th, .q-sum .q-sub td { color: #7b8698; font-size: 13px; padding-left: 14px; } .q-sum .q-strong th, .q-sum .q-strong td { font-weight: 700; border-top: 1px solid #e2e6ec; }
.q-sum .q-big th, .q-sum .q-big td { font-size: 18px; font-weight: 800; color: #7a4a88; border-top: 2px solid #7a4a88; padding: 8px 4px; } .q-sum .q-cap { font-size: 12px; color: #7b8698; padding-top: 12px; }
.seg { display: inline-flex; border: 1px solid #d5dae2; border-radius: 8px; overflow: hidden; margin: 4px 0 10px; } .seg button { border: 0; background: #fff; padding: 6px 14px; cursor: pointer; } .seg button.on { background: #7a4a88; color: #fff; }
.e-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.e-cos { display: grid; gap: 2px; padding: 10px; position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; } .e-cos input { margin-bottom: 6px; }
.e-co { display: grid; grid-template-columns: 1fr auto; padding: 7px 10px; border-radius: 8px; color: inherit; text-decoration: none; } .e-co small { grid-column: 1 / -1; color: #7b8698; font-size: 12px; }
.e-co span { background: #f2eaf5; color: #7a4a88; border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 700; } .e-co:hover { background: #f6f4f8; } .e-co.on { background: #f2eaf5; }
.e-list { display: grid; gap: 10px; } .e-item { display: block; color: inherit; text-decoration: none; margin: 0; } .e-item:hover { border-color: #7a4a88; } .e-item .row { gap: 10px; } .e-src { margin-left: auto; font-size: 12px; }
.e-line { display: flex; gap: 12px; justify-content: space-between; padding-top: 6px; font-size: 14px; } .e-line span:first-child { font-weight: 600; }
.e-doc .e-head { text-align: right; font-size: 12px; } .e-title { text-align: center; letter-spacing: .4em; border: 0; padding: 0; font-size: 20px; }
.e-itembox .sp { flex: 1; } .e-photo { display: flex; gap: 8px; align-items: center; } .e-photo img { max-height: 80px; border-radius: 6px; border: 1px solid #e2e6ec; }
.e-hist { display: block; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; border: 1px solid #eef0f3; margin-bottom: 6px; } .e-hist:hover { border-color: #7a4a88; } .e-hist.on { background: #f2eaf5; } .e-hist .row { justify-content: space-between; }
.small { font-size: 12px; }
@media (max-width: 900px) { .q-wrap, .e-wrap { grid-template-columns: 1fr; } .q-side, .e-cos { position: static; max-height: none; } }
@media print { .q-form .card { break-inside: avoid; } .q-side { position: static; max-height: none; } }
/* 예상 견적 계산기 */
.nc-wrap { max-width: 760px; } .nc-log { display: flex; flex-direction: column; gap: 10px; }
.nc-b { align-self: flex-start; max-width: 88%; background: #f6f0f8; border-radius: 4px 14px 14px 14px; padding: 10px 14px; line-height: 1.55; }
.nc-b.nc-note { background: #fff; border: 1px dashed #d9c7df; color: #5b4a63; font-size: 14px; }
.nc-me { align-self: flex-end; max-width: 80%; background: #7a4a88; color: #fff; border: 0; border-radius: 14px 4px 14px 14px; padding: 8px 14px; cursor: pointer; font: inherit; text-align: left; } .nc-me:hover { background: #683b76; }
.nc-chips { display: flex; flex-wrap: wrap; gap: 6px; } .nc-chip { border: 1px solid #cdb6d6; background: #fff; color: #7a4a88; border-radius: 999px; padding: 7px 14px; cursor: pointer; font: inherit; font-size: 14px; } .nc-chip:hover { background: #f2eaf5; } .nc-chip.nc-own { border-style: dashed; color: #5b4a63; }
.nc-in { display: flex; gap: 8px; } .nc-in input { flex: 1; min-width: 0; }
.nc-res { max-width: 100%; width: 100%; } .nc-res .q-cmp { margin: 10px 0; background: #fff; } .nc-price { font-size: 22px; color: #7a4a88; } .nc-tip { margin: 12px 0 0; }
.qc-3 { display: grid; grid-template-columns: 1fr 1.6fr .7fr; gap: 12px; } .qc-3 label { display: grid; gap: 4px; } @media (max-width: 700px) { .qc-3 { grid-template-columns: 1fr; } }
.qc-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; } .qc-line .i { width: 16px; height: 16px; color: #7a4a88; flex: none; } .qc-line > span { flex: 1 1 260px; } .qc-line select { font-size: 12px; padding: 2px 6px; max-width: 160px; color: #7b8698; }
.qc-more > summary { cursor: pointer; font-weight: 600; padding: 10px 2px; } .qc-more[open] > summary { margin-bottom: 4px; }
.qc-break { margin-top: 10px; } .qc-break > summary { cursor: pointer; color: #7b8698; font-size: 13px; }
.qc-rec { margin-top: 10px; border: 1px solid #e3d6e8; background: #faf6fb; border-radius: 10px; padding: 10px 12px; }
.qc-rec-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #7a4a88; margin-bottom: 6px; } .qc-rec-h .i { width: 16px; height: 16px; }
.qc-rec-t { width: 100%; border-collapse: collapse; font-size: 14px; } .qc-rec-t th { text-align: left; white-space: nowrap; color: #7b8698; font-weight: 500; padding: 4px 12px 4px 0; vertical-align: top; width: 1%; } .qc-rec-t td { padding: 4px 0; }
.qc-tpl { margin-top: 4px; } .qc-tpl select { font-size: 13px; padding: 3px 6px; max-width: 100%; } .qc-warn { color: #b4581d; }
.qc-big { display: grid; gap: 2px; padding: 4px 0 12px; border-bottom: 1px solid #e2e6ec; margin-bottom: 8px; } .qc-big b { font-size: 30px; color: #7a4a88; font-variant-numeric: tabular-nums; } .qc-big small { color: #7b8698; }
.qc-acts { margin-top: 12px; flex-wrap: wrap; gap: 8px; } #qcSim { margin-top: 14px; border-top: 1px solid #e2e6ec; padding-top: 6px; }

/* 니카가 배운 제품 종류 */
.pk-t th, .pk-t td { vertical-align: top; } .pk-m { display: inline-block; padding: 2px 8px; margin: 2px 2px 2px 0; border-radius: 999px; background: #f1f2f5; color: #7b8698; font-size: 13px; }
.pk-m.on { background: #f2eaf5; color: #7a4a88; font-weight: 600; } .pk-un { margin-top: 12px; } .pk-un summary { cursor: pointer; font-weight: 600; } .pk-un ul { columns: 2; margin: 8px 0 0; padding-left: 18px; } @media (max-width: 700px) { .pk-un ul { columns: 1; } }

/* 리오더 (제조지시서 생성 · 제조 요청) */
.ro-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; } @media (max-width: 900px) { .ro-wrap { grid-template-columns: 1fr; } }
.ro-list input#roQ { width: 100%; margin-bottom: 10px; } #roItems { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow: auto; } #roItems > * { flex: none; }
.ro-item { flex: none; text-align: left; border: 1px solid #e3e6ec; background: #fff; border-radius: 10px; padding: 9px 12px; cursor: pointer; font: inherit; display: grid; gap: 2px; } .ro-item .row { justify-content: space-between; gap: 8px; }
.ro-item { width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; } #roItems { overflow-x: hidden; }
.ro-form .np-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ro-form .np-grid > .wide { grid-column: 1 / -1; } .ro-form input, .ro-form select { width: 100%; min-width: 0; box-sizing: border-box; }
.ro-form .unit-in { display: flex; gap: 6px; } .ro-form .unit-in select { width: auto; } @media (max-width: 520px) { .ro-form .np-grid { grid-template-columns: 1fr; } }
.ro-item:hover { border-color: #cdb6d6; } .ro-item.on { border-color: #7a4a88; background: #f6f0f8; } .ro-item.off { opacity: .6; }
.ro-form { position: sticky; top: 72px; } .ro-warn { background: #fff4e5; border: 1px solid #f3d3a6; color: #8a4b0f; border-radius: 8px; padding: 8px 12px; }

/* 견적 단가표에서 고르기 (왼쪽 목록 → 오른쪽 선택된 재료) */
.nc-wrap.wide { max-width: 1180px; }
.pk-box { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; align-self: stretch; } @media (max-width: 900px) { .pk-box { grid-template-columns: 1fr; } }
.pk-pane { border: 1px solid #e3d6e8; border-radius: 12px; padding: 12px; background: #fff; min-width: 0; } .pk-sel { background: #fcfafd; }
.pk-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; } .pk-tabs, .pk-seg { display: inline-flex; border: 1px solid #cdb6d6; border-radius: 999px; overflow: hidden; }
.pk-tabs button, .pk-seg button { border: 0; background: #fff; color: #7a4a88; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; } .pk-tabs button.on, .pk-seg button.on { background: #7a4a88; color: #fff; }
.pk-seg button { padding: 3px 9px; font-size: 12px; white-space: nowrap; }
#pkQ { width: 100%; margin-bottom: 8px; } .pk-hints { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; } .pk-hints .nc-chip { padding: 3px 10px; font-size: 13px; }
.pk-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow: auto; } .pk-list > * { flex: none; } .pk-li { display: flex; justify-content: space-between; gap: 10px; text-align: left; border: 1px solid #eceef2; background: #fff; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.pk-li:hover { border-color: #7a4a88; background: #f6f0f8; } .pk-li b { white-space: nowrap; color: #5b4a63; }
.pk-sel h4 { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 6px; } .pk-t2 { width: 100%; border-collapse: collapse; font-size: 14px; } .pk-t2 th { text-align: left; color: #7b8698; font-weight: 500; font-size: 12px; padding: 2px 4px; }
.pk-t2 td { padding: 3px 4px; vertical-align: middle; } .pk-t2 input { width: 100%; min-width: 0; padding: 4px 6px; } .pk-t2 td.num input { max-width: 110px; text-align: right; } .pk-t2 td small { display: block; }
.pk-t2 td:first-child { min-width: 150px; } .pk-t2 td.num input { max-width: 96px; } .pk-t2 td.pk-q input { max-width: 56px; }
.pk-x { border: 0; background: none; color: #b4581d; cursor: pointer; font-size: 15px; } .pk-tot { margin: 10px 0; color: #5b4a63; }
/* 여러 줄 버튼은 공통 버튼 높이(30px)를 풀어 준다 */
.ro-item, .pk-li, .nc-me, .nc-chip { height: auto; min-height: 30px; white-space: normal; }
.ro-item { display: grid; padding: 9px 12px; } .pk-li { padding: 7px 10px; } .nc-me { padding: 8px 14px; } .nc-chip { padding: 7px 14px; }

/* 필수 입력 표시: 비워서 못 넘어간 칸 */
.need-in, input.need-in, select.need-in, textarea.need-in { border-color: #d93025 !important; background: #fff6f5 !important; box-shadow: 0 0 0 3px rgba(217, 48, 37, .14) !important; }
label.need { color: #d93025 !important; } .need-msg { display: block; color: #d93025; font-size: 12px; font-weight: 600; margin-top: 2px; }
h3 .need-msg, h4 .need-msg, legend .need-msg { display: inline; margin-left: 6px; }
.need-box { outline: 2px solid #d93025; outline-offset: 2px; border-radius: 10px; } .need-box h3, .need-box h4, .need-box legend { color: #d93025; }
.soft-off { opacity: .55; } /* 필수 칸이 비어 있음 — 눌리지만 빈 칸을 빨갛게 알려 줌 */

/* 리오더: 큰 검색창 + 업체별 폴더 (2026-10-30) */
.ro-search { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #cdb6d6; border-radius: 14px; padding: 6px 16px; margin: 4px 0 16px; box-shadow: 0 2px 10px rgba(122, 74, 136, .08); }
.ro-search:focus-within { border-color: #7a4a88; box-shadow: 0 0 0 4px rgba(122, 74, 136, .12); }
.ro-search .ro-si { font-size: 22px; } .ro-search input#roQ { flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; font-size: 20px; background: transparent; padding: 0; margin: 0; box-shadow: none; }
.ro-search .ro-cnt { white-space: nowrap; font-size: 13px; } @media (max-width: 520px) { .ro-search .ro-cnt { display: none; } .ro-search input#roQ { font-size: 17px; height: 46px; } }
#roItems { max-height: 70vh; }
.ro-folder { flex: none; border: 1px solid #e3e6ec; border-radius: 10px; background: #fafbfc; }
.ro-folder.open { background: #fff; border-color: #d9c8e0; }
.ro-fh { width: 100%; height: auto; min-height: 42px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 12px; cursor: pointer; font: inherit; text-align: left; white-space: normal; }
.ro-fh:disabled { cursor: default; opacity: 1; color: inherit; } .ro-fh .ro-fi { font-size: 18px; } .ro-fh b { overflow-wrap: anywhere; } .ro-fh .ro-fn { margin-left: auto; white-space: nowrap; }
.ro-fh .pill { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #eef0f4; color: #666; }
.ro-fitems { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px 10px; } .ro-fitems > * { flex: none; }

/* 구글 시트 동기화 줄 (2026-10-30) */
.sync-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #f2f7fd; border: 1px solid #cfe0f3; color: #24496e; border-radius: 8px; padding: 7px 12px; font-size: 13px; margin: 0 0 10px; }
.sync-line.bad { background: #fff1f0; border-color: #f3c3bf; color: #9b1c12; } .sync-line .btn { margin-left: auto; }

/* ================= 가독성 정리 (2026-10-30 대표: "난잡해 보인다 — 읽기 쉽고 깔끔하게") =================
   글자를 한 단계 키우고, 여백을 넓히고, 표 줄 간격을 넉넉하게. 색은 강조색 하나 + 상태색만. */
:root { font-size: 15px; line-height: 1.55; }
main { padding: 24px 32px 96px; }
#view { max-width: 1480px; }
#view > h2, .page-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin: 0 0 6px; }
#view > h2 .muted, .page-head h2 .muted { font-size: 15px; font-weight: 500; }
.page-head { margin-bottom: 8px; }
#view h3 { font-size: 16px; letter-spacing: -.2px; }
h3.section, #view > h3 { margin-top: 28px; }
/* 제목 아래 설명: 한 줄, 누르면 펼침 */
.pg-desc { font-size: 13.5px; margin: 0 0 18px; max-width: 980px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.pg-desc.open { display: block; }
.pg-desc:not(.open):hover { color: var(--ink-2); }
/* 표 */
th, td { padding: 10px 12px; }
th { font-size: 13px; }
td { font-size: 14px; }
/* 카드 */
.card { padding: 18px 20px; border-radius: 10px; }
.grid { gap: 16px; }
/* 입력·버튼 */
input, select, textarea { padding: 7px 10px; border-radius: 8px; }
button, .btn { border-radius: 8px; }
button, .btn { height: 34px; }
.btn.sm, button.sm { height: 28px; }
/* 왼쪽 메뉴: 글자 키우고 묶음 이름 또렷하게 */
.side-nav { padding: 10px 10px 18px; }
.side-nav h6 { font-size: 12px; color: #93a0b4; margin: 18px 10px 6px; }
.side-nav a { font-size: 14px; padding: 8px 10px; }
.nav-more { display: block; width: 100%; height: auto; text-align: left; background: none; border: 0; color: #8793a7; font-size: 12.5px; padding: 5px 10px 5px 38px; cursor: pointer; }
.nav-more:hover { color: #fff; }
.nav-more::after { content: " ▾"; } .nav-more.open::after { content: " ▴"; }
.nav-more-list a { font-size: 13.5px; }
/* 위 상태 줄 */
.tchip { font-size: 13px; }
/* 위 줄: 위치(빵부스러기)가 가려지지 않게 — 설정·로그아웃은 아이콘만, 좁으면 상태 칩은 숨김(왼쪽 메뉴 숫자와 같은 내용) */
header.top .crumbs { flex: 1 1 auto; min-width: 140px; text-overflow: ellipsis; }
header.top .top-sp { flex: 0 0 8px; }
header.top .hide-sm { display: none; } header.top #uiToggle .hide-sm { display: inline; }
@media (max-width: 1360px) { header.top .top-chips { display: none; } }
/* 제품 화면 등에서 쓰는 큰 보라 상자 → 차분하게 */
.edit-cta, .fx-cta { box-shadow: none; }

/* 예상 견적 계산기: 샘플 불러오기 · 빠른 계산 (2026-11-02) */
.page-head .btn.on { background: #f2eaf5; border-color: #cdb6d6; color: #7a4a88; }
.qp { margin-bottom: 16px; border-color: #cdb6d6; }
.qp-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; } .qp-h h3 { margin: 0; }
.qp-q { width: 100%; font-size: 15px; padding: 9px 12px; margin: 6px 0 10px; }
.qp-list { display: grid; gap: 6px; max-height: 380px; overflow: auto; }
.qp-li { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; height: auto; min-height: 40px; padding: 8px 12px; white-space: normal; background: #fff; }
.qp-li:hover { background: #f7f2f9; }
.qp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.qp-chip { height: auto; padding: 8px 18px; border-radius: 999px; border: 1px solid #cdb6d6; background: #fff; color: #7a4a88; font-size: 15px; font-weight: 600; cursor: pointer; }
.qp-chip small { font-weight: 400; color: #9aa3b2; } .qp-chip.on { background: #7a4a88; border-color: #7a4a88; color: #fff; } .qp-chip.on small { color: #e6d8ec; }
.qp-odors { margin: 0 0 8px; color: #5b4a63; font-size: 14px; }
.qp-t { width: 100%; } .qp-t th.num { text-align: right; } .qp-t th, .qp-t td { white-space: nowrap; }
.qp-rec { margin: 8px 0; } .qp-rec summary { cursor: pointer; padding: 4px 0; }
.qp-acts { gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; } .qp-acts .sp { flex: 1; }
.qp-od { display: grid; gap: 4px; margin-bottom: 8px; } .qp-edit td:first-child { min-width: 220px; }
.qp-empty { padding: 8px 0; }
.qc-mini { margin: 10px 0; background: #fff; }
.pk-t2 input.pk-miss { border-color: #e0a14a; background: #fff8ec; }

/* 예상 견적 계산기 = '제품 공급가 계산' 엑셀 견적서 양식 (2026-11-02) */
.xq-card { padding: 20px 22px; }
.xq-title { text-align: center; font-size: 24px; letter-spacing: 6px; margin: 0 0 14px; }
.xq-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.xq-meta label, .xq-pname label, .xq-rcin label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2, #5b6472); }
.xq-pname { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; } .xq-pname label { flex: 1; max-width: 640px; }
.xq-wrap { overflow-x: auto; }
.xq { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.xq col.c-no { width: 44px; } .xq col.c-h { width: 92px; } .xq col.c-g { width: 72px; } .xq col.c-s { width: 104px; } .xq col.c-name { width: auto; }
.xq col.c-p { width: 110px; } .xq col.c-q { width: 80px; } .xq col.c-a { width: 120px; } .xq col.c-note { width: 130px; }
.xq th, .xq td { border: 1px solid #c9d0da; padding: 3px 6px; height: 32px; vertical-align: middle; }
.xq-head th { background: #eef1f5; font-weight: 600; text-align: center; } .xq th.num { text-align: right; }
.xq-no, .xq-h, .xq-g, .xq-s { text-align: center; background: #f7f8fa; font-weight: 500; }
.xq-h { font-weight: 600; } .xq-l { text-align: left; padding-left: 12px; }
.xq input { width: 100%; min-width: 0; height: 28px; border: 1px solid transparent; background: transparent; padding: 2px 6px; font: inherit; border-radius: 4px; }
.xq input:hover { border-color: #d8dde5; } .xq input:focus { border-color: #7a4a88; background: #fff; outline: none; }
.xq input.num { text-align: right; } .xq input.note { font-size: 12px; color: #7b8698; }
.xq input.ro { color: #5b4a63; background: #f6f1f8; cursor: default; }
.xq input.xq-miss, .xq-rcin input.xq-miss, .xq-rct input.xq-miss { border-color: #e0a14a; background: #fff8ec; }
.xq-amt { font-variant-numeric: tabular-nums; } .xq-calc { color: #7b8698; text-align: right; }
.xq-sub td { background: #fafbfc; font-weight: 600; } .xq-sub .xq-s, .xq-sub td:first-child { text-align: center; }
.xq-sum td { background: #f2f4f7; } .xq-top td, .xq-top th { border-top: 2px solid #9aa3b2; }
.xq-col { text-align: center; color: #7b8698; font-size: 13px; }
.xq-supply td { background: #f2eaf5; font-weight: 700; font-size: 15px; } .xq-supply .xq-amt { color: #7a4a88; }
.xq-note { font-size: 12px; color: #7b8698; }
.xq-add { height: 20px !important; min-height: 0; width: 20px; padding: 0; margin-left: 4px; border: 1px solid #cdb6d6; border-radius: 50%; background: #fff; color: #7a4a88; font-size: 12px; line-height: 1; cursor: pointer; vertical-align: middle; }
.xq-final { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.xq-final div { display: grid; gap: 2px; min-width: 180px; padding: 10px 14px; border: 1px solid #c9d0da; border-radius: 8px; text-align: right; }
.xq-final span { font-size: 13px; color: #7b8698; } .xq-final b { font-size: 20px; font-variant-numeric: tabular-nums; }
.xq-final .on { border-color: #7a4a88; background: #f7f2f9; } .xq-final .on b { color: #7a4a88; }
.xq-rc { margin-bottom: 16px; } .xq-rcin { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 10px 0 6px; }
#xqTpl { height: 34px; max-width: 200px; }
.xq input.xq-pct { width: 64px; display: inline-block; height: 26px; margin: 0 2px; border-color: #cdb6d6; background: #fff; color: #7a4a88; font-weight: 600; }
@media (max-width: 900px) { .xq-meta, .xq-rcin { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 킁박사 (2026-11-02): 니카 옆 향 포뮬러 상담 창 — 니카 창과 같은 자리·모양 */
aside#kung { position: fixed; right: 20px; bottom: 88px; z-index: 19; width: 440px; max-width: calc(100vw - 40px); height: min(680px, calc(100vh - 120px)); border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 16px 48px #00000033; overflow: hidden; display: flex; flex-direction: column; }
aside#kung[hidden] { display: none; }
aside#kung .nika-head { background: #f3f7f4; } aside#kung .nika-head strong { color: #2f6b4f; }
.kung-new { margin-left: auto; height: 28px; } .kung-new2 { height: 28px; }
#kungChat { flex: 1; overflow: auto; padding: 12px; display: grid; gap: 10px; align-content: start; }
#kungChat .msg.user { background: #e9f3ed; }
#kungChat .msg .k-att { display: block; margin-top: 4px; font-size: 12px; color: #6b7a72; }
#kungChat .msg.err { background: #fff6ec; border-color: #f0c99a; }
#kungChat .k-hello { color: #5b6472; font-size: 14px; line-height: 1.6; }
.kung-att { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.kung-att:empty { display: none; }
.kung-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: #e9f3ed; color: #2f6b4f; font-size: 13px; }
.kung-chip button { height: 22px !important; min-height: 0; width: 22px; padding: 0; border: 0; background: none; color: #6b7a72; cursor: pointer; }
.kung-pick { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-top: 6px; background: #fafbfa; }
.kung-pick input { width: 100%; margin-bottom: 6px; }
.kung-pick .k-list { max-height: 200px; overflow: auto; display: grid; gap: 4px; }
.kung-pick .k-li { display: flex; justify-content: space-between; gap: 8px; text-align: left; height: auto; min-height: 34px; padding: 6px 8px; white-space: normal; background: #fff; }
.kung-pick select { height: 28px; }
#kungForm { display: grid; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.kung-tools { display: flex; gap: 6px; }
.kung-in { display: flex; gap: 6px; } .kung-in textarea { flex: 1; resize: vertical; }
.kung-fab { background: #2f6b4f; box-shadow: 0 6px 20px #2f6b4f55; } .kung-fab.open { background: #234f3b; }
body.kung-open .fabs .up-fab { display: none; }


/* 답 글자 꾸밈 (니카·킁박사 공통, 2026-11-02): 읽기 쉬운 줄 간격 · 목록 들여쓰기 · 옆으로 밀리는 표 */
.msg.assistant { line-height: 1.7; overflow-wrap: anywhere; word-break: keep-all; }
.msg.assistant > :first-child { margin-top: 0; } .msg.assistant > :last-child { margin-bottom: 0; }
.msg p { margin: 0 0 8px; }
.md-h { font-weight: 700; margin: 14px 0 6px; line-height: 1.45; } .md-h1, .md-h2 { font-size: 1.08em; } .md-h3, .md-h4 { font-size: 1em; }
.md-h2 { padding-bottom: 4px; border-bottom: 1px solid var(--line, #e3e7ec); }
.msg .md-l { margin: 4px 0 8px; padding-left: 1.35em; } .msg .md-l .md-l { margin: 2px 0; } .msg .md-l li { margin: 3px 0; } .msg ol.md-l > li::marker { font-weight: 600; color: #5b6472; }
.md-tw { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 10px; border: 1px solid var(--line, #e3e7ec); border-radius: 8px; }
.md-t { border-collapse: collapse; font-size: 13.5px; width: 100%; } .md-t th, .md-t td { border-bottom: 1px solid var(--line, #e3e7ec); padding: 7px 10px; text-align: left; vertical-align: top; }
.md-t th { background: #f3f5f8; font-weight: 600; white-space: nowrap; } .md-t tr:last-child td { border-bottom: 0; } .md-t td:first-child { white-space: nowrap; font-weight: 500; }
.md-q { margin: 8px 0; padding: 6px 12px; border-left: 3px solid #e0a14a; background: #fff8ec; border-radius: 0 6px 6px 0; }
.md-hr { border: 0; border-top: 1px solid var(--line, #e3e7ec); margin: 12px 0; }
.msg code { background: #f1f3f6; padding: 1px 5px; border-radius: 4px; font-size: .92em; } .md-pre { background: #f6f7f9; padding: 8px 10px; border-radius: 6px; overflow-x: auto; font-size: 12.5px; }

/* 킁박사 창: 컴퓨터는 넓게(펼치기 가능), 휴대폰은 전체 화면 · 키보드가 올라와도 입력칸이 보이게 */
aside#kung { width: 560px; }
aside#kung.wide { width: min(980px, calc(100vw - 40px)); height: calc(100vh - 110px); }
#kungChat { gap: 12px; padding: 14px; } #kungChat .msg { max-width: 100%; } #kungChat .msg.user { max-width: 88%; }
.kung-wide { height: 28px; } .kung-tools { flex-wrap: wrap; align-items: center; }
.kung-mic.on { background: #c0392b; border-color: #c0392b; color: #fff; animation: kungPulse 1.2s ease-in-out infinite; }
@keyframes kungPulse { 50% { box-shadow: 0 0 0 6px #c0392b33; } }
.kung-say { display: inline-flex; gap: 6px; margin-top: 8px; } .kung-say button { height: 28px; min-height: 0; padding: 0 10px; font-size: 12.5px; }
.kung-say button.on { background: #2f6b4f; color: #fff; border-color: #2f6b4f; }
.kung-auto { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted, #6b7380); margin-left: auto; }
#kungForm { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.kung-in button { height: auto; min-height: 44px; }
@media (max-width: 700px) {
  aside#kung, aside#kung.wide { inset: 0; top: 0; width: auto; height: var(--kung-vh, 100dvh); max-width: none; border-radius: 0; border: 0; }
  body.kung-open .nika-fab { display: none; }
  .kung-wide { display: none; }
  #kungChat { padding: 12px; } #kungChat .msg { font-size: 15.5px; } .md-t { font-size: 13px; }
  .kung-in textarea { font-size: 16px; min-height: 48px; }
  .kung-tools .btn { height: 36px; }
  aside#kung .nika-head { padding-top: max(10px, env(safe-area-inset-top)); }
}
/* 넓은 표가 대화 칸을 밀어내지 않게 (표는 자기 상자 안에서만 옆으로 밀림) */
#kungChat, #chat { grid-template-columns: minmax(0, 1fr); } #kungChat .msg, #chat .msg { min-width: 0; }
aside#kung .nika-head { flex-wrap: nowrap; align-items: center; gap: 6px; } aside#kung .nika-head #kungMode { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
aside#kung .nika-head .kung-new { margin-left: 0; }
@media (max-width: 700px) { aside#kung .nika-head #kungMode { display: none; } aside#kung .nika-head .kung-new { margin-left: auto; } }
/* 휴대폰 위쪽 줄이 화면보다 넓어져 페이지 전체가 옆으로 밀리던 문제 (2026-11-02): 위치 표시는 줄어들게, 화면 바꾸기 버튼은 짧은 이름 */
#uiToggle .ui-short { display: none; }
@media (max-width: 700px) {
  header.top { min-width: 0; max-width: 100vw; }
  header.top .crumbs { min-width: 0; flex: 1 1 0; }
  header.top .right { flex: 0 0 auto; width: auto; gap: 4px; }
  header.top #uiToggle .ui-long { display: none; } header.top #uiToggle .ui-short { display: inline; }
  header.top #uiToggle { padding: 0 8px; }
  html, body { overflow-x: clip; } /* hidden은 위쪽 줄 고정(sticky)을 깨뜨려 clip */
}
.md-t td.nw { white-space: nowrap; } /* 0.2%·90.45% 같은 짧은 칸은 한 줄로 */

/* 보관함 폴더 (2026-11-03): 레시피 / MSDS, MSDS 안은 네 폴더 */
.vault-tabs { display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.vault-tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--line, #dde2e8); border-radius: 10px; background: #fff; color: inherit; text-decoration: none; font-weight: 600; }
.vault-tab.on { border-color: var(--accent, #7a4a88); background: #f7f2f9; color: var(--accent, #7a4a88); }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.vault-folder { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line, #dde2e8); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; }
.vault-folder:hover { border-color: var(--accent, #7a4a88); background: #fbf8fc; }
.vault-ic { font-size: 26px; line-height: 1; } .vault-folder b { font-size: 16px; } .vault-n { margin-top: 4px; font-weight: 700; color: var(--accent, #7a4a88); }
.vault-sub { flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; } .vault-sub form { margin-left: auto; gap: 6px; } .vault-sub input { min-width: 200px; }
@media (max-width: 700px) { .vault-grid { grid-template-columns: 1fr 1fr; } .vault-folder { padding: 12px; } .vault-sub form { margin-left: 0; width: 100%; } .vault-sub input { flex: 1; min-width: 0; } }
/* MSDS 회사 폴더 (2026-11-03): 끌어 놓기 · 이름 입력 창 */
.msds-page { position: relative; min-height: 60vh; }
.msds-over { display: none; position: absolute; inset: 0; border: 3px dashed var(--accent, #7a4a88); border-radius: 14px; background: rgba(247, 242, 249, .85); z-index: 5; pointer-events: none; align-items: center; justify-content: center; font-size: 17px; color: var(--accent, #7a4a88); }
.msds-page.drag .msds-over { display: flex; }
.vault-folder.drop { position: relative; z-index: 6; border-color: var(--accent, #7a4a88); background: #f3e9f7; box-shadow: 0 0 0 3px rgba(122, 74, 136, .25); }
.msds-prog { margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: #f7f2f9; color: var(--accent, #7a4a88); font-weight: 600; }
.msds-empty { padding: 28px; text-align: center; }
.name-dlg { border: 0; border-radius: 14px; padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.name-dlg h3 { margin: 0 0 12px; } .name-dlg input { width: 100%; box-sizing: border-box; font-size: 16px; padding: 10px 12px; }
.name-dlg::backdrop { background: rgba(0, 0, 0, .35); }
/* 문서 리더 (2026-11-03): 원본 모양 그대로 PDF를 화면 가득 */
.doc-reader-wrap { display: block; } .doc-reader-wrap > #docReader { width: 100%; } .doc-reader-wrap > .row { margin-top: 4px; }
.doc-frame.doc-reader { height: calc(100vh - 220px); min-height: 520px; }
/* 문서 목록 (2026-11-03): 카드·아이콘 대신 한 줄씩 */
.doc-list { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px; gap: 14px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.doc-row:first-child { border-top: 0; }
.doc-row:hover { background: #fbf8fc; }
.doc-name { display: grid; gap: 2px; min-width: 0; } .doc-name b { overflow-wrap: anywhere; font-weight: 600; } .doc-name .muted { font-size: 13px; }
.doc-fmt { font-size: 12px; font-weight: 600; color: var(--accent, #7a4a88); background: #f7f2f9; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.doc-when { font-size: 13px; text-align: right; white-space: nowrap; }
@media (max-width: 700px) { .doc-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; } .doc-when { display: none; } }
/* 같은 파일 대치 (2026-11-04): 파일마다 대치하기/건너뛰기 + 모두 선택 */
.rep-dlg { width: min(640px, calc(100vw - 32px)); }
.rep-all { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: #f7f2f9; border-radius: 8px; margin: 10px 0; }
.rep-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.rep-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); }
.rep-row:first-child { border-top: 0; }
.rep-name { display: grid; min-width: 0; } .rep-name b { overflow-wrap: anywhere; font-weight: 600; } .rep-name .muted { font-size: 12px; overflow-wrap: anywhere; }
.rep-dlg label { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; cursor: pointer; }
@media (max-width: 560px) { .rep-row { grid-template-columns: 1fr 1fr; } .rep-name { grid-column: 1 / -1; } }

/* MSDS · 포뮬러: 구글 드라이브처럼 (2026-11-12) — 클릭 고르기 · 더블클릭 열기 · ⋯/오른쪽 클릭 메뉴 · 끌어서 이동 · 목록/바둑판 */
.drive-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 40px; margin: 8px 0 4px; padding: 6px 12px; border-radius: 10px; background: #f7f8fa; position: sticky; top: 0; z-index: 4; }
.dv-hint { font-size: 13px; } .dv-right { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.dv-sel { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; } .dv-sel b { margin-right: 4px; color: var(--accent, #7a4a88); }
.dv-view { display: inline-flex; border: 1px solid var(--line, #dde2e8); border-radius: 8px; overflow: hidden; background: #fff; }
.dv-view button { border: 0; background: transparent; padding: 5px 10px; font-size: 13px; cursor: pointer; color: #555; } .dv-view button + button { border-left: 1px solid var(--line, #dde2e8); }
.dv-view button[aria-pressed="true"] { background: #f3e9f7; color: var(--accent, #7a4a88); font-weight: 700; }
.drive-item { position: relative; cursor: default; user-select: none; -webkit-user-select: none; outline: none; }
.drive-item:focus-visible { box-shadow: 0 0 0 2px var(--accent, #7a4a88); }
.vault-folder.drive-item { padding-right: 36px; } .vault-folder.drive-item .dv-more { position: absolute; top: 6px; right: 6px; }
.file-tile { align-content: start; } .file-tile .doc-fmt { justify-self: start; } .file-tile b { overflow-wrap: anywhere; font-size: 15px; } .file-tile .muted { font-size: 13px; } .dv-day { font-size: 12px; }
.dv-more { border: 0; background: transparent; font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 8px; color: #666; cursor: pointer; }
.dv-more:hover, .dv-more:focus-visible { background: #eceef2; color: #222; }
.drive-item.on, .drive-item.on:hover { border-color: var(--accent, #7a4a88); background: #f0e4f5; }
.doc-row.drive-item { grid-template-columns: 26px minmax(0, 1fr) auto 96px 34px; } .dv-ic { font-size: 18px; text-align: center; }
@media (max-width: 700px) { .doc-row.drive-item { grid-template-columns: 26px minmax(0, 1fr) auto 34px; } }
.dv-group { padding: 14px 4px 6px; font-weight: 700; font-size: 14px; color: #333; } .dv-list .dv-group { padding: 10px 16px 6px; background: #fafbfc; border-top: 1px solid var(--line); }
.dv-files { margin-top: 4px; }
.drive-item.drop { position: relative; z-index: 6; border-color: var(--accent, #7a4a88); background: #f3e9f7; box-shadow: 0 0 0 3px rgba(122, 74, 136, .25); }
.dv-menu { position: fixed; z-index: 1000; min-width: 150px; padding: 6px; border: 1px solid var(--line, #dde2e8); border-radius: 10px; background: #fff; box-shadow: 0 8px 28px rgba(0, 0, 0, .16); display: grid; }
.dv-menu button { text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 7px; font-size: 14px; cursor: pointer; color: inherit; }
.dv-menu button:hover, .dv-menu button:focus-visible { background: #f3eef6; outline: none; } .dv-menu button.danger { color: #c0392b; }
#crumbs a.drop { background: #f3e9f7; outline: 2px solid var(--accent, #7a4a88); border-radius: 6px; padding: 2px 6px; }
.move-dlg { width: min(520px, calc(100vw - 32px)); } .move-dlg input[type="radio"] { width: auto; flex: none; margin: 0; padding: 0; accent-color: var(--accent, #7a4a88); }
.move-tree { max-height: 52vh; overflow: auto; border: 1px solid var(--line, #dde2e8); border-radius: 10px; padding: 6px 0; }
.move-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; } .move-row:hover { background: #f7f2f9; } .move-row.off { opacity: .45; cursor: default; }
.unlock-form { display: grid; gap: 10px; max-width: 520px; padding: 18px; } .unlock-form p { margin: 0; line-height: 1.6; } .unlock-form .row { gap: 8px; flex-wrap: nowrap; } .unlock-form input { flex: 1; min-width: 0; font-size: 16px; padding: 10px 12px; }
.move-head { padding: 10px 12px 4px; font-weight: 700; font-size: 13px; color: #555; border-top: 1px solid var(--line, #dde2e8); } .move-head:first-child { border-top: 0; }
