﻿* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; color: #333; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }

.header { background: #25D366; color: white; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.header h1 { font-size: 20px; }
.status { padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.status.connected { background: white; color: #25D366; }
.status.disconnected { background: rgba(255,255,255,0.3); color: white; }
.copy-mobile-link { background: white; color: #16803a; border: none; border-radius: 18px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.copy-mobile-link:hover { background: #eafff1; }
.ios-install-hint { display: none; }

.card { background: white; border-radius: 12px; padding: 20px; margin: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.card h2 { font-size: 16px; color: #25D366; margin-bottom: 12px; }

.stats-bar { display: flex; gap: 20px; flex-wrap: wrap; background: white; margin: 16px; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.stats-bar b { color: #25D366; }
.mobile-quick-actions { display: none; }

#qrSection { text-align: center; }
#qrSection p { color: #666; font-size: 14px; margin-bottom: 16px; }
#qrContainer img { max-width: 260px; border: 2px solid #eee; border-radius: 8px; }
.loading { color: #999; padding: 40px; }

textarea { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 12px; font-size: 14px; resize: vertical; font-family: inherit; }
textarea:focus { outline: none; border-color: #25D366; }

.template-hint { background: #f0faf4; border-left: 3px solid #25D366; padding: 8px 12px; font-size: 13px; color: #555; margin-bottom: 10px; border-radius: 0 6px 6px 0; }
code { background: #e8f5e9; padding: 2px 6px; border-radius: 4px; color: #2e7d32; font-size: 13px; }

.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-primary { background: #25D366; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn-primary:hover { background: #1da851; }
.quick-output-button { background: #128C7E; }
.quick-output-button:hover { background: #0c6b61; }
.btn-outline { background: white; color: #25D366; border: 1.5px solid #25D366; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn-outline:hover { background: #f0faf4; }
.btn-send { width: 100%; background: #25D366; color: white; border: none; padding: 14px; border-radius: 10px; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 16px; }
.btn-send:hover { background: #1da851; }
.btn-send:disabled { background: #ccc; cursor: not-allowed; }
.btn-stop-send { background: #e53935; margin-top: 8px; }
.btn-stop-send:hover { background: #c62828; }
.btn-remove { background: #ff4444; color: white; border: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }

.ai-box { background: linear-gradient(135deg, #f0fff4, #e8f5e9); border: 1px solid #c8e6c9; border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.ai-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; color: #2e7d32; margin-bottom: 10px; }
.ai-status { font-size: 12px; font-weight: normal; color: #888; }
.ai-setup { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ai-setup input { flex: 1; border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; font-size: 13px; min-width: 200px; }
.ai-link { font-size: 12px; color: #25D366; text-decoration: none; }
.ai-link:hover { text-decoration: underline; }
.ai-options { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ai-options select { border: 1px solid #ddd; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.btn-ai { background: linear-gradient(135deg, #25D366, #128C7E); color: white; border: none; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn-ai:hover { opacity: 0.9; }
.btn-ai:disabled { opacity: 0.6; cursor: not-allowed; }

.paste-hint { color: #aaa; font-size: 12px; margin-top: 6px; }
.paste-hint b { color: #25D366; }
.media-paste-zone { margin-top: 10px; padding: 12px 14px; border: 2px dashed #25D366; border-radius: 10px; background: #f1fff6; color: #128C7E; cursor: text; outline: none; transition: .15s; }
.media-paste-zone:hover, .media-paste-zone:focus { border-color: #128C7E; background: #e3faec; box-shadow: 0 0 0 3px rgba(37,211,102,.12); }
.media-paste-zone b, .media-paste-zone span { display: block; pointer-events: none; }
.media-paste-zone span { margin-top: 4px; color: #5d7366; font-size: 12px; }
.media-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; background: #f9f9f9; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.media-preview #mediaName { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.media-pill { display: inline-flex; align-items: center; gap: 6px; background: white; border: 1px solid #e5e5e5; border-radius: 6px; padding: 4px 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-thumb-small { width: 42px; height: 42px; object-fit: cover; border-radius: 5px; border: 1px solid #eee; flex-shrink: 0; }
.media-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-remove { padding: 1px 6px; font-size: 11px; line-height: 1.2; }
.voice-mode-select { border: 1.5px solid #25D366; color: #128C7E; background: white; border-radius: 8px; padding: 8px 10px; font-size: 13px; }

.btn-record { background: white; color: #e53935; border: 1.5px solid #e53935; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn-record.recording { background: #e53935; color: white; animation: pulse-btn 1s infinite; }
@keyframes pulse-btn { 0%,100% { opacity:1; } 50% { opacity:0.7; } }
.rec-dot { display:inline-block; width:8px; height:8px; background:#e53935; border-radius:50%; animation: pulse-dot 1s infinite; }
@keyframes pulse-dot { 0%,100% { transform:scale(1); } 50% { transform:scale(1.4); } }
#recordingStatus { display:flex; align-items:center; gap:8px; margin-top:8px; font-size:13px; color:#e53935; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #eee; }
.tab { background: none; border: none; padding: 10px 16px; cursor: pointer; font-size: 14px; color: #999; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: #25D366; border-bottom-color: #25D366; font-weight: 600; }

.hint { color: #888; font-size: 13px; margin-bottom: 10px; }

.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.search-row input:focus { outline: none; border-color: #25D366; }

.groups-list { max-height: 300px; overflow-y: auto; }
.group-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid #f5f5f5; cursor: pointer; }
.group-item:hover { background: #f9f9f9; }
.group-item input[type=checkbox] { width: 18px; height: 18px; accent-color: #25D366; cursor: pointer; }
.group-item label { flex: 1; font-size: 14px; cursor: pointer; }

.match-item { border: 1px solid #eee; border-radius: 10px; padding: 14px; margin-top: 10px; }
.match-item.found { border-color: #c8e6c9; }
.match-item.not-found { border-color: #ffcdd2; }
.match-item.multiple { border-color: #fff9c4; }
.match-fullname { font-weight: 600; font-size: 14px; }
.match-shortname { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.match-shortname input { border: 1px solid #ddd; border-radius: 6px; padding: 4px 8px; font-size: 13px; width: 100px; }
.match-shortname input:focus { outline: none; border-color: #25D366; }
.inline-name-input { border: 1px solid #ddd; border-radius: 6px; padding: 3px 8px; font-size: 12px; width: 80px; flex-shrink: 0; }
.inline-name-input:focus { outline: none; border-color: #25D366; }
.inline-name-input:disabled { background: #f5f5f5; color: #bbb; }
.match-group { font-size: 13px; color: #666; margin-top: 4px; }
.match-group select { border: 1px solid #ddd; border-radius: 6px; padding: 4px 8px; font-size: 13px; width: 100%; margin-top: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge.green { background: #e8f5e9; color: #2e7d32; }
.badge.red { background: #ffebee; color: #c62828; }
.badge.yellow { background: #fffde7; color: #f57f17; }

.settings-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; font-size: 14px; margin-bottom: 12px; }
.settings-row select, .settings-row input { border: 1px solid #ddd; border-radius: 6px; padding: 4px 8px; font-size: 14px; }

.preview-list { max-height: 300px; overflow-y: auto; }
.preview-item { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.preview-top { display: flex; align-items: center; gap: 8px; }
.preview-item .name { font-weight: 600; width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-item .msg { color: #888; font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-item .remove-btn { color: #ff4444; cursor: pointer; font-size: 18px; line-height: 1; margin-left: auto; }
.display-name-input { border: 1px solid #ddd; border-radius: 6px; padding: 3px 8px; font-size: 12px; width: 80px; color: #333; }
.display-name-input:focus { outline: none; border-color: #25D366; }
.display-name-input::placeholder { color: #bbb; }
.empty-hint { color: #bbb; text-align: center; padding: 20px; font-size: 14px; }

.preset-box { background: #fffdf0; border: 1px solid #ffe082; border-radius: 10px; padding: 12px; margin: 12px 0; }
.preset-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; color: #f57f17; margin-bottom: 8px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-tag { display: flex; align-items: center; gap: 6px; background: white; border: 1px solid #ffe082; border-radius: 20px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.preset-tag:hover { background: #fff9c4; }
.preset-tag .del { color: #ccc; font-size: 16px; cursor: pointer; }
.preset-tag .del:hover { color: #f44336; }

.send-mode-row { display: flex; gap: 8px; margin: 12px 0 8px; }
.mode-btn { flex: 1; padding: 10px; border: 2px solid #ddd; background: white; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; color: #888; transition: all 0.2s; }
.mode-btn.active { border-color: #25D366; color: #25D366; background: #f0fff4; }
.mode-btn:last-child.active { border-color: #FF9800; color: #FF9800; background: #fff8f0; }
.schedule-options { background: #fff8f0; border: 1px solid #ffe0b2; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.schedule-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.schedule-row input[type=date], .schedule-row input[type=time] { border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.schedule-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.schedule-item.pending { border-color: #bbdefb; background: #f3f8ff; }
.schedule-item.done { border-color: #c8e6c9; background: #f1f8e9; color: #888; }
.schedule-info { flex: 1; }
.schedule-name { font-weight: 600; }
.schedule-time { color: #888; font-size: 12px; }

.section-group { border: 1px solid #eee; border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #f8f8f8; border-bottom: 1px solid #eee; }
.section-title { font-weight: 600; font-size: 14px; }

.progress-bar-wrap { background: #eee; border-radius: 10px; height: 10px; margin: 16px 0 8px; overflow: hidden; }
.progress-bar { background: #25D366; height: 100%; border-radius: 10px; transition: width 0.3s; }
.progress-log { max-height: 150px; overflow-y: auto; font-size: 13px; }
.log-item { padding: 4px 0; border-bottom: 1px solid #f5f5f5; display: flex; gap: 8px; }
.log-item.success { color: #2e7d32; }
.log-item.fail { color: #c62828; }

.phone-country { border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; font-size: 14px; background: #fff; }
.phone-results { margin-top: 12px; }
.phone-summary { font-weight: 600; margin: 8px 0 10px; color: #128C7E; }
.phone-section-title { font-size: 13px; font-weight: 600; color: #555; margin: 12px 0 6px; }
.phone-result-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid #f2f2f2; }
.phone-result-item label { flex: 1; font-size: 14px; }
.phone-result-item.invalid { color: #999; }
.phone-result-item.invalid small { color: #d33; margin-left: auto; }
.phone-add-btn { margin-top: 10px; }

.class-direct-search { margin-top: 9px; padding: 9px; border: 1px dashed #9ec5ff; border-radius: 8px; background: #f6faff; color: #1e4e8c; font-size: 12px; }
.class-direct-search b { display:block; margin-bottom:6px; }
.class-direct-search > div { display:flex; gap:6px; }
.class-direct-search input { flex:1; min-width:0; border:1px solid #a9c7f4; border-radius:7px; padding:7px 8px; font-size:13px; background:white; }
.class-direct-search .btn-outline { padding:7px 9px; white-space:nowrap; }
.class-direct-search > small { display:block; margin-top:6px; color:#52729c; }
.class-search-results { display:grid; gap:5px; margin-top:8px; }
.class-search-section { display:grid; gap:5px; }
.class-search-section > b { color:#2370bd; font-size:11px; margin-top:3px; }
.class-search-section > div { display:flex; align-items:center; gap:8px; padding:6px 7px; border-radius:7px; background:white; border:1px solid #dceaff; }
.class-search-section > .class-search-no-result { color:#74869c; font-size:11px; line-height:1.4; background:#fbfdff; border-style:dashed; }
.class-search-section span { flex:1; min-width:0; overflow-wrap:anywhere; }
.class-search-section em { color:#8a9ab0; font-size:11px; font-style:normal; }
.class-search-section .btn-outline { padding:4px 7px; font-size:11px; }
.class-search-added { color:#16803c; font-size:11px; white-space:nowrap; }
.class-search-empty { display:block; margin-top:7px; color:#9a5b00; }

.output-scan-card { border-top: 4px solid #128C7E; padding-top: 16px; margin-top: 14px; }
.output-scan-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.output-scan-heading h2 { margin-bottom:5px; }
.output-scan-heading .hint { margin:0; max-width:760px; }
.output-camera-button, .output-camera-choice { white-space:nowrap; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; text-decoration:none; }
.output-privacy-note { background: #fff8e1; color: #795548; border-radius: 7px; padding: 7px 9px; font-size: 11px; margin-bottom: 9px; }
.output-scan-settings { display: flex; gap: 8px; margin: 10px 0; }
.output-scan-settings select, .output-scan-settings input { border: 1px solid #ddd; border-radius: 8px; padding: 9px 11px; font-size: 13px; background: white; }
.output-scan-settings select:first-child { min-width:170px; }
.output-scan-settings input { flex: 1; min-width: 0; }
.output-scan-settings .output-assessment-date { flex: 0 0 145px; }
.output-workflow { display:flex; align-items:center; gap:8px; overflow-x:auto; padding:10px 12px; margin:10px 0; border:1px solid #d9d4ff; border-radius:10px; background:#fbfaff; color:#5f5a84; font-size:12px; white-space:nowrap; }
.output-workflow span { padding:5px 8px; }
.output-workflow span.active { border-radius:14px; background:#e8f8ee; color:#137a3d; font-weight:700; }
.output-scan-workspace { display:grid; grid-template-columns:minmax(220px, .72fr) minmax(0, 1.5fr); gap:12px; align-items:start; }
.output-intake-pane, .output-match-pane { border:1px solid #dedaf9; border-radius:12px; padding:12px; background:#fff; }
.output-intake-actions { margin:10px 0 0; }
.output-paste-zone { border: 2px dashed #25D366; background: #f1fff6; border-radius: 12px; padding: 20px 12px; text-align: center; cursor: pointer; color: #128C7E; outline: none; transition: 0.15s; }
.output-paste-zone:hover, .output-paste-zone:focus { background: #e3faec; border-color: #128C7E; box-shadow: 0 0 0 3px rgba(37,211,102,0.12); }
.output-paste-zone b, .output-paste-zone span { display: block; }
.output-paste-zone span { color: #777; font-size: 12px; margin-top: 5px; }
.output-pending-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; margin-top: 10px; }
.output-pending-thumb { position: relative; height: 74px; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #f5f5f5; }
.output-pending-thumb img { width: 100%; height: 100%; object-fit: cover; }
.output-pending-thumb span { position: absolute; left: 4px; bottom: 4px; min-width: 19px; height: 19px; border-radius: 10px; padding: 1px 5px; background: rgba(0,0,0,.65); color: white; text-align: center; font-size: 11px; }
.output-pending-thumb button { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(198,40,40,.9); color: white; font-size: 17px; line-height: 19px; cursor: pointer; }
.output-scan-status { color: #888; font-size: 13px; padding: 10px 0 0; }
.output-scan-status.scanning { color: #ef6c00; }
.output-scan-status.done { color: #128C7E; font-weight: 600; }
.output-scan-status.error, .scan-no-match { color: #c62828; }
.output-match-summary { display:grid; grid-template-columns:repeat(3, 1fr); gap:7px; margin-bottom:10px; }
.output-match-summary div { display:flex; flex-direction:column; gap:2px; padding:8px; border-radius:8px; background:#eefbf2; color:#166534; }
.output-match-summary div:nth-child(2) { background:#eff6ff; color:#1d4ed8; }
.output-match-summary div.needs-review { background:#fff8e9; color:#a16207; }
.output-match-summary b { font-size:21px; line-height:1; }
.output-match-summary span { font-size:11px; line-height:1.3; }
.output-result-section h3, .output-review-section h3 { font-size:14px; margin:0 0 7px; color:#374151; }
.output-result-section h3 span { color:#16803a; }
.output-result-list { display:grid; gap:7px; }
.output-review-section { margin-top:12px; border-top:1px solid #f6d78b; padding-top:10px; }
.output-review-section > p { margin:0 0 8px; font-size:12px; color:#8a6100; }
.output-scan-item { position:relative; border:1px solid #e8e8ef; border-left:4px solid #f3b548; border-radius:9px; margin-bottom:7px; background:#fff; overflow:hidden; }
.output-scan-item.ready { border-left-color:#25D366; }
.output-scan-item.review { border-left-color:#e9a517; }
.output-scan-remove { position:absolute; z-index:2; right:8px; top:8px; width:28px; height:28px; padding:0; border:1px solid #f0a6a6; border-radius:50%; background:#fff5f5; color:#d63031; font-size:23px; line-height:22px; cursor:pointer; }
.output-scan-remove:hover { background:#fee2e2; border-color:#d63031; }
.output-scan-item summary { display:flex; align-items:center; gap:9px; padding:7px 9px; cursor:pointer; list-style:none; }
.output-scan-item summary::-webkit-details-marker { display:none; }
.output-scan-item summary img { width:46px; height:46px; object-fit:cover; border:1px solid #e1e1e8; border-radius:6px; background:#f7f7f7; }
.output-scan-summary-text { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.output-scan-summary-text b, .output-scan-summary-text small { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.output-scan-summary-text small { color:#6b7280; font-size:11px; }
.output-scan-item-body { padding:0 10px 11px; display:grid; gap:8px; }
.output-student-name, .output-parent-label, .output-message-label { display:block; color:#5b6472; font-size:12px; }
.output-student-name input, .output-parent-label select { width:100%; margin-top:4px; border:1px solid #ddd; border-radius:7px; padding:8px 9px; font-size:14px; background:white; }
.output-include-toggle { font-size:12px; color:#176a38; }
.scan-confidence { display: inline-block; border-radius: 12px; padding: 2px 8px; margin-top: 6px; font-size: 11px; }
.scan-confidence.high { color: #2e7d32; background: #e8f5e9; }
.scan-confidence.medium { color: #ef6c00; background: #fff3e0; }
.scan-confidence.low { color: #c62828; background: #ffebee; }
.scan-result-summary { color: #555; font-size: 12px; margin-top: 6px; overflow-wrap: anywhere; }
.output-parent-label { margin-top: 10px; }
.output-target-candidates { margin-top: 8px; border: 1px solid #d5e7ff; border-radius: 8px; padding: 8px; background: #f7fbff; font-size: 12px; color: #416887; }
.output-target-candidates > span { display: block; margin-bottom: 6px; font-weight: 700; }
.output-target-candidate-row { display: grid; grid-template-columns: 82px 1fr; gap: 6px; align-items: start; margin-top: 6px; }
.output-target-candidate-row.group > b { color: #14794a; }
.output-target-candidate-row.contact > b { color: #7252a7; }
.output-target-candidate-row > div { display: flex; flex-wrap: wrap; gap: 5px; }
.output-target-chip { border: 1px solid #abd0f6; background: #fff; color: #235f96; border-radius: 999px; padding: 5px 8px; font-size: 12px; text-align: left; cursor: pointer; }
.output-target-chip:hover, .output-target-chip.selected { background: #e4f4ff; border-color: #169ee7; color: #075f97; }
.output-target-chip small { display: block; color: #68849a; margin-top: 2px; }
.output-name-lookup { margin-top: 10px; border: 1px dashed #c8b8ee; border-radius: 8px; padding: 9px; background: #faf8ff; color: #5e4c89; font-size: 12px; }
.output-name-lookup b { display: block; margin-bottom: 7px; }
.output-name-lookup > div { display: flex; gap: 6px; }
.output-name-input { flex: 1; min-width: 0; border: 1px solid #c8b8ee; border-radius: 7px; background: white; padding: 7px 8px; font-size: 13px; }
.output-name-lookup .btn-outline { padding: 7px 9px; white-space: nowrap; }
.output-name-lookup small { display: block; margin-top: 6px; color: #71688a; line-height: 1.35; }
.output-phone-lookup { margin-top: 10px; border: 1px dashed #b7d9c1; border-radius: 8px; padding: 9px; background: #f5fcf7; color: #176a38; font-size: 12px; }
.output-phone-lookup b { display: block; margin-bottom: 7px; }
.output-phone-lookup > div { display: flex; gap: 6px; }
.output-phone-country, .output-phone-input { border: 1px solid #b7d9c1; border-radius: 7px; background: white; padding: 7px 8px; font-size: 13px; }
.output-phone-input { flex: 1; min-width: 0; }
.output-phone-lookup .btn-outline { padding: 7px 9px; white-space: nowrap; }
.output-phone-lookup small { display: block; margin-top: 6px; color: #5f7866; line-height: 1.35; }
.scan-no-match { font-size: 12px; margin: 5px 0; }
.scan-analysis-status { margin: 7px 0; font-size: 12px; color: #8b5c00; }
.output-auto-target { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:10px 0; padding:9px 10px; border:1px solid #9be7ba; border-radius:9px; background:#f1fff6; color:#12683b; }
.output-auto-target span { flex:1; min-width:180px; font-weight:600; }
.output-auto-target .btn-outline { padding:4px 8px; font-size:12px; }
.output-message-label { margin-top: 9px; }
.output-message-label textarea { margin-top: 4px; }
.output-scan-send-box { border-top: 1px solid #eee; margin-top: 14px; padding-top: 12px; color: #128C7E; font-size: 13px; font-weight: 600; }
.output-scan-send-box .btn-send { margin-top: 9px; }
.output-scan-send-box .progress-log { margin-top: 10px; font-weight: normal; }

.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.history-heading h2 { margin-bottom: 3px; }
.history-subtitle { color: #888; font-size: 12px; }
.history-actions { display: flex; gap: 7px; flex-shrink: 0; }
.history-actions .btn-outline { padding: 6px 11px; }
.history-actions .history-clear { color: #d33; border-color: #ef9a9a; }
.history-summary { color: #128C7E; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.history-batch { border: 1px solid #e5e5e5; border-radius: 10px; margin-bottom: 10px; overflow: hidden; background: #fff; }
.history-batch.is-success { border-left: 4px solid #25D366; }
.history-batch.has-failure { border-left: 4px solid #e53935; }
.history-batch.is-pending { border-left: 4px solid #ff9800; }
.history-batch.is-recalled { border-left: 4px solid #607d8b; }
.history-batch summary { display: grid; grid-template-columns: minmax(135px, auto) 1fr auto; gap: 10px; align-items: center; padding: 12px; cursor: pointer; background: #fafafa; font-size: 13px; }
.history-batch summary::marker { color: #25D366; }
.history-batch-title { font-weight: 700; }
.history-batch-mode { color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-batch-state { color: #128C7E; font-weight: 600; text-align: right; }
.history-batch.has-failure .history-batch-state { color: #c62828; }
.history-batch.is-pending .history-batch-state { color: #ef6c00; }
.history-batch.is-recalled .history-batch-state { color: #546e7a; }
.history-body { padding: 12px; }
.history-message { background: #f4f8f5; border-radius: 7px; padding: 9px 10px; font-size: 12px; color: #555; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 8px; }
.history-targets { max-height: 330px; overflow-y: auto; }
.history-target { display: flex; gap: 9px; align-items: center; padding: 9px 4px; border-bottom: 1px solid #f1f1f1; font-size: 13px; }
.history-status-icon { width: 21px; height: 21px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700; background: #eee; color: #777; }
.history-target.success .history-status-icon { color: white; background: #25D366; }
.history-target.failed .history-status-icon { color: white; background: #e53935; }
.history-target.recalled .history-status-icon { color: white; background: #607d8b; }
.history-target-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.history-target-main b { overflow-wrap: anywhere; }
.history-target-main small { color: #888; margin-top: 2px; }
.history-target-main .history-error { color: #c62828; }
.history-target-main .history-personal-message { color: #555; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-target-time { color: #aaa; font-size: 11px; flex-shrink: 0; }
.history-target-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.btn-recall-small { border: 1px solid #ef6c00; background: #fff8f0; color: #ef6c00; border-radius: 6px; padding: 4px 9px; cursor: pointer; font-size: 11px; }
.btn-recall-small:hover { background: #fff3e0; }
.btn-recall-small:disabled, .history-recall-all:disabled { color: #999; border-color: #ccc; background: #f5f5f5; cursor: not-allowed; }
.recall-countdown { color: #e65100; background: #fff3e0; border-radius: 10px; padding: 3px 7px; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.recall-countdown.expired { color: #888; background: #eee; }
.recall-countdown.batch { display: inline-block; margin-top: 5px; }
.recall-done { color: #546e7a; background: #eceff1; border-radius: 10px; padding: 3px 7px; font-size: 11px; }
.recall-unavailable { color: #aaa; font-size: 10px; }
.history-recall-all { color: #ef6c00; border-color: #ffb74d; padding: 5px 10px; margin-top: 10px; margin-right: 6px; }
.history-recall-actions { display: inline-flex; flex-direction: column; align-items: flex-start; margin-right: 6px; vertical-align: top; }
.history-delete { color: #d33; border-color: #ef9a9a; padding: 5px 10px; margin-top: 10px; }

@media (max-width: 600px) {
    body { background: #f0f2f5; padding-bottom: env(safe-area-inset-bottom); }
    .header { padding: calc(12px + env(safe-area-inset-top)) 14px 12px; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
    .header h1 { font-size: 18px; }
    .header > div:nth-child(2) { order: 4; width: 100%; font-size: 11px !important; }
    .copy-mobile-link { margin-left: auto; padding: 6px 10px; font-size: 11px; }
    .status { margin-left: auto; padding: 5px 10px; font-size: 12px; }
    .ios-install-hint { display: flex; flex-direction: column; gap: 3px; margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; background: #e8f8ee; border: 1px solid #bceacb; color: #176a38; font-size: 12px; line-height: 1.45; }
    .ios-install-hint strong { font-size: 13px; }
    .card, .stats-bar { margin: 12px; border-radius: 10px; }
    .card { padding: 15px; }
    .mobile-quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 12px 12px; }
    .mobile-quick-actions button { min-height: 52px; padding: 7px 5px; border: 1px solid #bceacb; border-radius: 11px; background: #fff; color: #176a38; font-size: 12px; font-weight: 700; line-height: 1.35; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
    .mobile-quick-actions button:nth-child(2) { background: #128C7E; border-color: #128C7E; color: #fff; }
    textarea, input, select { font-size: 16px !important; }
    .btn-primary, .btn-outline, .btn-record, .btn-ai { min-height: 42px; }
    .quick-output-button { width: 100%; padding: 13px 16px; font-size: 15px; }
    .stats-bar { gap: 7px 14px; padding: 10px 12px; font-size: 12px; }
    .tabs { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 0 0 auto; padding: 10px 12px; font-size: 13px; }
    .search-row, .settings-row { align-items: stretch; flex-wrap: wrap; }
    .search-row input { flex: 1 0 100%; min-width: 0; min-height: 44px; }
    .search-row .btn-outline { flex: 1 1 auto; padding-left: 10px; padding-right: 10px; }
    .settings-row { gap: 10px; }
    .settings-row label { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
    .section-header { align-items: flex-start; gap: 9px; flex-wrap: wrap; }
    .section-header > div:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
    .group-item { align-items: flex-start; padding: 11px 4px; }
    .group-item label { line-height: 1.45; }
    .media-preview { align-items: flex-start; flex-wrap: wrap; }
    .media-preview #mediaName { min-width: 0; }
    .output-scan-heading { align-items:stretch; flex-direction:column; }
    .output-camera-button { width:100%; }
    .output-scan-settings { flex-direction: column; }
    .output-scan-settings .output-assessment-date { flex-basis: auto; }
    .output-scan-workspace { grid-template-columns:1fr; }
    .output-match-summary { grid-template-columns:1fr; }
    .class-direct-search > div { flex-wrap:wrap; }
    .class-direct-search input { min-width:180px; }
    .output-name-lookup > div { flex-wrap: wrap; }
    .output-target-candidate-row { grid-template-columns: 1fr; gap: 3px; }
    .output-name-input { min-width: 130px; }
    .output-phone-lookup > div { flex-wrap: wrap; }
    .output-phone-input { min-width: 130px; }
    .history-heading { align-items: stretch; flex-direction: column; }
    .history-actions .btn-outline { flex: 1; }
    .history-batch summary { grid-template-columns: 1fr auto; gap: 4px 8px; }
    .history-batch-mode { grid-column: 1; }
    .history-batch-state { grid-row: 1 / span 2; grid-column: 2; }
    .history-target { align-items: flex-start; }
    .history-target-time { display: none; }
}

@media (display-mode: standalone) {
    .ios-install-hint { display: none; }
    .header { padding-top: calc(14px + env(safe-area-inset-top)); }
}
