:root{
  --bg:#f3f6fa;--panel:#fff;--text:#172033;--muted:#667085;--line:#dce3ed;
  --brand:#173f73;--brand2:#245a9a;--ok:#14794b;--warn:#aa6100;--danger:#b42318;
  --shadow:0 8px 26px rgba(23,32,51,.09)
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans TC","Microsoft JhengHei",sans-serif;color:var(--text);background:var(--bg)}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}
.app{max-width:1180px;margin:auto;padding:16px}
.hero{background:linear-gradient(135deg,var(--brand),var(--brand2));color:#fff;border-radius:20px;padding:20px;box-shadow:var(--shadow)}
.hero-top{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;flex-wrap:wrap}
.hero h1{margin:0 0 5px;font-size:24px}.hero p{margin:0;color:#dbe9f7}
.header-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.sync-status{font-size:12px;background:rgba(255,255,255,.15);padding:8px 10px;border-radius:10px}
.sync-status.error{background:rgba(180,35,24,.45)}
.header-btn{background:rgba(255,255,255,.16);color:#fff;border:1px solid rgba(255,255,255,.25)}
.stats{display:grid;grid-template-columns:repeat(5,1fr);gap:9px;margin-top:17px}
.stat{background:rgba(255,255,255,.12);padding:11px;border-radius:13px}.stat strong{display:block;font-size:24px}.stat span{font-size:12px;color:#dce9f5}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0;background:#fff;border:1px solid var(--line);border-radius:15px;padding:11px;box-shadow:var(--shadow)}
.toolbar input{flex:1;min-width:220px}
input,select,textarea{width:100%;border:1px solid #cbd5e1;border-radius:10px;padding:10px 11px;background:#fff;color:var(--text);outline:none}
input:focus,select:focus,textarea:focus{border-color:#6c96c5;box-shadow:0 0 0 3px rgba(36,90,154,.12)}
textarea{min-height:110px;resize:vertical;line-height:1.55}
.btn{border:none;border-radius:10px;padding:10px 13px;font-weight:750;background:#e8edf4;color:#27364c}
.btn.primary{background:var(--brand2);color:#fff}.btn.ghost{background:#fff;border:1px solid var(--line)}.btn.danger{background:#fee4e2;color:var(--danger)}
.btn.quick{background:#7041d8;color:#fff}.btn.full{width:100%}.top-gap{margin-top:10px}
.filters{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:15px}
.chip{border:1px solid var(--line);background:#fff;border-radius:999px;padding:8px 12px;color:#475467}
.chip.active{background:var(--brand);border-color:var(--brand);color:#fff}
.date-section{margin:18px 0 25px}.date-title{display:flex;align-items:center;gap:8px;margin:0 0 10px;font-size:19px}.date-title small{font-size:12px;color:var(--muted)}
.slot-heading{background:#e7eff8;color:#173f73;font-weight:850;padding:8px 11px;border-radius:10px;margin:13px 0 9px}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:14px;box-shadow:0 4px 14px rgba(23,32,51,.05)}
.card.arrived{border-left:6px solid #d18800}.card.completed{border-left:6px solid var(--ok)}.card.no-show{opacity:.72;border-left:6px solid #98a2b3}
.card-top{display:flex;justify-content:space-between;gap:10px}.code{font-size:12px;font-weight:850;background:#edf4fb;color:var(--brand);padding:5px 8px;border-radius:7px}
.company{font-size:18px;font-weight:850;margin-top:7px;line-height:1.35}.schedule{font-size:13px;color:var(--muted);margin-top:5px}
.status{white-space:nowrap;height:29px;border-radius:999px;padding:6px 9px;font-size:12px;font-weight:800;background:#f2f4f7;color:#475467}
.status.arrived{background:#fff1d6;color:#8a4b00}.status.completed{background:#dcfae6;color:#096b3a}.status.cancelled{background:#fee4e2;color:#b42318}
.meta{display:flex;gap:6px;flex-wrap:wrap;margin:11px 0}.tag,.priority{font-size:12px;padding:5px 7px;border-radius:7px;font-weight:700}
.tag{background:#f2f5f8;color:#475467}.priority.S{background:#fde7b2;color:#714000}.priority.A{background:#dceeff;color:#174f8c}.priority.B{background:#e9ecf2;color:#475467}
.preview{font-size:13px;color:#566176;line-height:1.55;min-height:39px;margin-bottom:11px}.actions{display:flex;gap:7px;flex-wrap:wrap}.actions .btn{flex:1;min-width:100px}
footer{text-align:center;color:var(--muted);font-size:12px;line-height:1.6;padding:16px}
.center-screen{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:linear-gradient(145deg,#eef4fb,#f7f9fc)}
.auth-card{width:min(420px,100%);background:#fff;border:1px solid var(--line);border-radius:20px;padding:24px;box-shadow:var(--shadow)}
.logo-mark{width:52px;height:52px;border-radius:15px;display:grid;place-items:center;background:var(--brand);color:#fff;font-size:26px;font-weight:900}.logo-mark.warn{background:#b54708}
.auth-card h1{margin:16px 0 5px}.auth-card>p{color:var(--muted);line-height:1.55}.auth-card label{display:block;font-size:12px;font-weight:750;color:#475467;margin:12px 0 6px}
.link-btn{border:none;background:none;color:var(--brand2);font-weight:750;width:100%;padding:13px}.auth-help{font-size:12px;text-align:center}.message{border-radius:9px;background:#fff3e0;color:#8b4d00;padding:10px;font-size:13px;margin-top:8px}
dialog{border:none;border-radius:18px;padding:0;width:min(790px,calc(100% - 20px));box-shadow:0 24px 70px rgba(0,0,0,.28)}
dialog::backdrop{background:rgba(15,23,42,.58)}
.dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:17px 19px;border-bottom:1px solid var(--line)}.dialog-head h2{margin:0}.dialog-head p{font-size:12px;color:var(--muted);margin:5px 0 0}
.dialog-body{padding:17px 19px;max-height:72vh;overflow:auto}.dialog-foot{display:flex;justify-content:flex-end;gap:8px;padding:13px 19px;border-top:1px solid var(--line);background:#fbfcfe}
.x{border:none;background:#f2f4f7;border-radius:9px;width:35px;height:35px;font-size:20px}
.research-box{border:1px solid #cddbeb;background:#f7faff;border-radius:14px;padding:13px;margin-bottom:15px}.research-head{display:flex;justify-content:space-between;gap:10px}.research-head h3{margin:0;color:var(--brand)}.research-head p{font-size:12px;color:var(--muted);margin:5px 0}
.research-box dl{margin:10px 0}.research-box dt{font-size:12px;font-weight:850;color:#475467;margin-top:9px}.research-box dd{font-size:13px;line-height:1.6;color:#344054;margin:3px 0 0}
.question-box{background:#fff8e5;border-left:4px solid #d59a1d;padding:9px 10px;border-radius:8px;font-size:13px;line-height:1.55}.identity-warning{background:#fff0ee;border-left:4px solid #d92d20;padding:9px 10px;border-radius:8px;margin-top:9px;color:#7a271a;font-size:12px;line-height:1.55}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.form-grid label{font-size:12px;font-weight:750;color:#475467}.form-grid label input,.form-grid label select,.form-grid label textarea{margin-top:6px}.form-grid .full{grid-column:1/-1}
.section-title{font-size:15px;margin:18px 0 8px}.help{font-size:12px;color:var(--muted);line-height:1.5}
.visitor-list{display:flex;flex-direction:column;gap:8px;margin-bottom:8px}.visitor-row{display:grid;grid-template-columns:1.1fr .8fr 1.2fr 1fr auto;gap:6px;background:#f7f9fc;padding:8px;border:1px solid var(--line);border-radius:11px}.visitor-row input{padding:8px}.remove{border:none;background:#fee4e2;color:var(--danger);border-radius:8px;width:32px}
.photo-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.photo-item{border:1px solid var(--line);border-radius:12px;background:#f8fafc;padding:8px}.photo-item img{width:100%;height:155px;object-fit:contain;background:#fff;border:1px solid var(--line);border-radius:8px}.photo-item input{margin-top:6px;padding:8px}.photo-time{font-size:11px;color:var(--muted);margin-top:6px}.empty{padding:28px;text-align:center;background:#fff;border:1px dashed var(--line);border-radius:13px;color:var(--muted)}
.member-form{display:flex;gap:8px}.member-form input{flex:1}.member-list{margin-top:13px}.member-row{display:flex;justify-content:space-between;gap:10px;align-items:center;border-bottom:1px solid var(--line);padding:10px 0}.member-row small{color:var(--muted)}
.toast{position:fixed;right:17px;bottom:17px;background:#172033;color:#fff;padding:11px 14px;border-radius:10px;opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s;z-index:9999}.toast.show{opacity:1;transform:none}
@media(max-width:820px){.grid{grid-template-columns:1fr}.stats{grid-template-columns:repeat(3,1fr)}.visitor-row{grid-template-columns:1fr 1fr}.visitor-row .remove{grid-column:1/-1;width:100%}}
@media(max-width:560px){.app{padding:9px}.hero{border-radius:15px;padding:16px}.hero h1{font-size:21px}.stats{grid-template-columns:repeat(2,1fr)}.toolbar>*{width:100%}.form-grid{grid-template-columns:1fr}.form-grid .full{grid-column:auto}.photo-grid{grid-template-columns:1fr}.visitor-row{grid-template-columns:1fr}.dialog-body{padding:14px}.dialog-foot{flex-wrap:wrap}.dialog-foot .btn{flex:1}.actions .btn{min-width:0}}

.meeting-photo-btn{background:#0f766e;color:#fff}
.face-photo-tag{background:#dcf7f3;color:#0f675f}
.meeting-photo-item{border-color:#b8ded9;background:#f3fbfa}
.photo-actions-main .btn{min-width:112px}
@media(max-width:560px){
  .photo-actions-main{display:grid;grid-template-columns:1fr 1fr}
  .photo-actions-main .btn{width:100%}
}

.section-upload-row{display:flex;justify-content:flex-start;gap:8px;margin:8px 0 11px}
.gallery-btn{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}
.gallery-btn:hover{background:#e0e7ff}
.gallery-btn:disabled{opacity:.5;cursor:not-allowed}

.speech-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:7px 0 7px}
.speech-toolbar select{width:auto;min-width:135px;padding:8px 10px}
.speech-btn{background:#eaf2ff;color:#174f8c;border:1px solid #bdd2eb;white-space:nowrap}
.speech-btn.recording{background:#fee4e2;color:#b42318;border-color:#f5b7b1;animation:speechPulse 1.2s infinite}
.speech-status{font-size:12px;font-weight:500;color:var(--muted);line-height:1.4}
@keyframes speechPulse{0%,100%{box-shadow:0 0 0 0 rgba(180,35,24,.12)}50%{box-shadow:0 0 0 5px rgba(180,35,24,.10)}}
@media(max-width:560px){
  .speech-toolbar select,.speech-toolbar .speech-btn{width:100%}
}
