/* widget.css ― 画面右下の ANDY(業務アプリに常駐する改善・入力支援ウィジェット)。アプリ本体のスタイルには依存しない */
.andy-fab { position: fixed; right: 22px; bottom: 22px; width: 68px; height: 68px; border-radius: 50%; border: 3px solid #caf1a2; background: #fff url(../assets/andy_face.png) center/cover no-repeat; box-shadow: 0 8px 24px rgba(0,0,0,0.25); cursor: pointer; z-index: 45; padding: 0; transition: transform .15s; }
.andy-fab:hover, .andy-fab:focus, .andy-fab:active { background: #fff url(../assets/andy_face.png) center/cover no-repeat; transform: scale(1.06); }
.andy-fab .andy-fab-tag { position: absolute; left: -8px; bottom: -6px; background: #111; color: #caf1a2; font-size: 11px; font-weight: bold; letter-spacing: .08em; padding: 2px 8px; border-radius: 10px; border: 2px solid #fff; }
.andy-fab.busy::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid transparent; border-top-color: #caf1a2; border-right-color: #caf1a2; animation: andy-spin 1s linear infinite; }
.andy-fab .andy-badge { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%; background: #e2432f; border: 2px solid #fff; display: none; }
.andy-fab.alert .andy-badge { display: block; }
@keyframes andy-spin { to { transform: rotate(360deg); } }

.andy-panel { position: fixed; right: 22px; bottom: 104px; width: 400px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 130px)); background: #fff; border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,0.28); z-index: 46; display: none; flex-direction: column; overflow: hidden; font-size: 14px; color: #1b2430; font-family: var(--font-ui); }
.andy-panel.open { display: flex; }
.andy-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #111; color: #fff; }
.andy-head img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #caf1a2; background: #fff; }
.andy-head .andy-title { font-weight: bold; font-size: 16px; letter-spacing: .06em; min-width: 0; flex: 1; }
.andy-head .andy-title small { display: block; font-weight: normal; font-size: 12px; color: #c6c6c6; letter-spacing: 0; margin-top: 2px; }
.andy-head button { white-space: nowrap; flex: none; background: transparent; border: 1px solid #555; color: #ddd; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.andy-head button:hover { background: #2e2e2e; color: #fff; }
.andy-head button.cur { background: #caf1a2; color: #111; border-color: #caf1a2; font-weight: bold; }
.andy-head button.cur:hover { background: #caf1a2; color: #111; }

.andy-body { flex: 1; overflow-y: auto; padding: 14px; background: #f4f6f8; display: flex; flex-direction: column; gap: 10px; }
.andy-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.andy-msg.user { align-self: flex-end; background: #1f5fbf; color: #fff; border-bottom-right-radius: 4px; }
.andy-msg.andy { align-self: flex-start; background: #fff; border: 1px solid #dde3ea; border-bottom-left-radius: 4px; }
.andy-msg.andy.hello { border-color: #caf1a2; background: #f7fdee; }
.andy-time { font-size: 11px; color: #8c8c8c; margin: -4px 4px 0; }
.andy-time.r { align-self: flex-end; }
.andy-msg-files { font-size: 12px; opacity: .85; margin-top: 4px; }

.andy-card { align-self: stretch; background: #fff; border: 1px solid #dde3ea; border-radius: 12px; padding: 10px 12px; }
.andy-card h4 { margin: 0 0 8px; font-size: 13px; color: #5b6672; font-weight: bold; letter-spacing: .04em; }
.andy-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.andy-steps li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #3a3a3a; }
.andy-steps li .ic { flex: none; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: #e3e8ef; color: #5b6672; margin-top: 1px; }
.andy-steps li.read .ic, .andy-steps li.note .ic, .andy-steps li.ui .ic, .andy-steps li.search .ic { background: #e6eefb; color: #1f5fbf; }
.andy-steps li.edit .ic { background: #fff3c4; color: #9a6700; }
.andy-steps li.gate .ic, .andy-steps li.end .ic { background: #e3f5e9; color: #1a7f37; }
.andy-steps li.error .ic { background: #fbe4e1; color: #c0392b; }
.andy-steps li.say { color: #5b6672; }
.andy-steps li.say .ic { background: transparent; }
.andy-steps li.live .ic { border: 2px solid #1f5fbf; border-top-color: transparent; background: transparent; animation: andy-spin .9s linear infinite; }
.andy-elapsed { font-size: 12px; color: #8c8c8c; margin-top: 8px; }

.andy-result { border-left: 4px solid #caf1a2; }
.andy-result .andy-sum { white-space: pre-wrap; line-height: 1.6; margin-bottom: 8px; }
.andy-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.andy-files span { font-size: 12px; background: #eef2f7; border-radius: 6px; padding: 2px 8px; font-family: var(--font-mono); }
.andy-files span b.plus { color: #1a7f37; } .andy-files span b.minus { color: #c0392b; }
.andy-gate { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 7px 10px; border-radius: 8px; background: #e3f5e9; color: #1a7f37; margin: 6px 0; }
.andy-gate.ng { background: #fbe4e1; color: #c0392b; }
.andy-gate .ic { font-weight: bold; }
.andy-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.andy-actions button { font-size: 13px; padding: 6px 12px; border-radius: 6px; border: 1px solid #cfd6e0; background: #fff; color: #1b2430; cursor: pointer; }
.andy-actions button:hover { background: #eef2f7; }
.andy-actions button.danger { color: #c0392b; border-color: #e8b4ae; }
.andy-actions button.danger:hover { background: #fbe4e1; }
.andy-reverted { font-size: 12px; color: #9a6700; background: #fff3c4; padding: 4px 8px; border-radius: 6px; display: inline-block; margin-top: 6px; }

.andy-mode { display: flex; align-items: center; gap: 6px; padding: 8px 14px 0; background: #fff; border-top: 1px solid #e3e8ef; }
.andy-mode-label { font-size: 12px; color: #8c8c8c; margin-right: 2px; }
.andy-mode button { font-size: 13px; padding: 4px 12px; border-radius: 14px; border: 1px solid #cfd6e0; background: #fff; color: #3a3a3a; cursor: pointer; }
.andy-mode button.cur { background: #111; color: #caf1a2; border-color: #111; font-weight: bold; }
.andy-mode button:hover { color: #111; background: #eef2f7; } .andy-mode button.cur:hover { background: #111; color: #caf1a2; }
.andy-mode button:disabled { opacity: .5; cursor: default; }
.andy-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; background: #fff; }
.andy-chips button { font-size: 12px; padding: 5px 10px; border-radius: 14px; border: 1px solid #cfd6e0; background: #f7f9fb; color: #1b2430; cursor: pointer; text-align: left; }
.andy-chips button:hover { background: #e6eefb; border-color: #8fb5f0; }
.andy-attlist { display: none; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; background: #fff; }
.andy-att { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: #e6eefb; color: #174a97; border-radius: 6px; padding: 3px 6px 3px 8px; }
.andy-att button { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 13px; padding: 0 2px; }
.andy-input { display: flex; gap: 8px; padding: 10px 14px 4px; background: #fff; align-items: flex-end; }
.andy-input textarea { flex: 1; min-width: 0; resize: none; height: 64px; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #cfd6e0; border-radius: 10px; outline: none; line-height: 1.5; }
.andy-input textarea:focus { border-color: #8fb5f0; box-shadow: 0 0 0 2px rgba(143,181,240,.35); }
.andy-input button { height: 40px; padding: 0 16px; border-radius: 10px; border: none; background: #111; color: #caf1a2; font-weight: bold; font-size: 14px; cursor: pointer; }
.andy-input button:hover { background: #2e2e2e; }
.andy-input button:disabled { background: #c6c6c6; color: #fff; cursor: default; }
.andy-input .andy-attach { width: 40px; height: 40px; padding: 0; background: #fff; border: 1px solid #cfd6e0; color: #3a3a3a; font-size: 18px; flex: none; }
.andy-input .andy-attach:hover { background: #eef2f7; color: #111; }
.andy-hint { font-size: 11px; color: #8c8c8c; padding: 0 14px 10px; background: #fff; }

/* 履歴 */
.andy-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.andy-hist li { background: #fff; border: 1px solid #dde3ea; border-radius: 10px; padding: 8px 12px; }
.andy-hist .andy-hmsg { font-weight: bold; line-height: 1.4; }
.andy-hist .andy-hmeta { font-size: 12px; color: #8c8c8c; margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.andy-st { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: #e3e8ef; color: #3a3a3a; }
.andy-st.done { background: #e3f5e9; color: #1a7f37; } .andy-st.reverted { background: #fff3c4; color: #9a6700; } .andy-st.running { background: #e6eefb; color: #1f5fbf; }

/* 差分モーダル */
.andy-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 47; display: flex; align-items: center; justify-content: center; padding: 16px; }
.andy-modal { width: 860px; max-width: 100%; max-height: 86vh; background: #fff; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); color: #1b2430; }
.andy-modal .andy-mhead { display: flex; align-items: center; padding: 10px 16px; background: #111; color: #fff; font-weight: bold; }
.andy-modal .andy-mhead .andy-spacer { flex: 1; }
.andy-modal .andy-mhead button { background: transparent; border: 1px solid #555; color: #ddd; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.andy-modal .andy-mbody { overflow: auto; padding: 12px 16px; font-size: 13px; }
.andy-modal h5 { margin: 12px 0 6px; font-size: 13px; font-family: var(--font-mono); }
.andy-modal pre { margin: 0; background: #f7f9fb; border: 1px solid #e3e8ef; border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; overflow-x: auto; font-family: var(--font-mono); white-space: pre-wrap; }
.andy-modal pre .p { color: #1a7f37; background: #e3f5e9; display: block; } .andy-modal pre .m { color: #c0392b; background: #fbe4e1; display: block; } .andy-modal pre .h { color: #8c8c8c; display: block; }

.andy-toast { position: fixed; right: 22px; bottom: 104px; z-index: 48; background: #111; color: #caf1a2; padding: 10px 16px; border-radius: 10px; font-weight: bold; box-shadow: 0 8px 24px rgba(0,0,0,.3); font-size: 14px; max-width: calc(100vw - 44px); }
@media (max-width: 760px) { .andy-panel { right: 12px; bottom: 92px; height: min(560px, calc(100vh - 110px)); } .andy-fab { right: 14px; bottom: 14px; width: 60px; height: 60px; } .andy-toast { right: 12px; bottom: 90px; } }

/* 2026-11-15: approval flow / panel must not hide the app / clear close for the diff */
.andy-panel { height: min(620px, calc(100vh - 112px - var(--frame-top, 0px))); }
@media (max-width: 760px) { .andy-panel { height: min(560px, calc(100vh - 100px - var(--frame-top, 0px))); } }
@media (min-width: 761px) { body.andy-open .frame-body { padding-right: 432px; } }
.andy-modenote { font-size: 13px; color: #3a4350; padding: 6px 14px 0; background: #fff; line-height: 1.5; }
.andy-approval { background: #e6eefb; color: #174a97; }
.andy-approval small { font-size: 12px; color: #3a4350; }
.andy-steps li.send .ic, .andy-steps li.wait .ic { background: #e6eefb; color: #1f5fbf; }
.andy-modal .andy-mhead button.andy-mclose { font-size: 14px; padding: 6px 14px; border-color: #caf1a2; color: #caf1a2; font-weight: bold; }
.andy-modal .andy-mhead button.andy-mclose:hover { background: #caf1a2; color: #111; }
.andy-mfoot { display: flex; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid #e3e8ef; }
.andy-mfoot button { font-size: 14px; padding: 8px 20px; border-radius: 8px; border: none; background: #111; color: #caf1a2; font-weight: bold; cursor: pointer; }
@media (min-width: 761px) { body.andy-open .frame-body > .est { min-width: 0; } }
body.andy-open .frame-bar .frame-note, body.andy-open .est-top .save-state { display: none; }
body.andy-open .est-top .hd-case { min-width: 7em; }
