*{box-sizing:border-box}body{margin:0;font-family:Segoe UI,Arial,sans-serif;color:#202123}.app{height:100vh;display:flex}.side{width:260px;background:#f7f7f8;border-right:1px solid #ddd;padding:16px;display:flex;flex-direction:column;gap:12px}.brand{display:flex;gap:10px;align-items:center}.logo,.biglogo{background:#111827;color:#fff;border-radius:10px;display:flex;align-items:center;justify-content:center;font-weight:700}.logo{width:38px;height:38px}.brand small{display:block;color:#777;font-size:11px}.side button{border:1px solid #ddd;background:#fff;padding:10px;border-radius:9px;text-align:left;cursor:pointer}.bottom{margin-top:auto;display:grid;gap:7px}main{flex:1;display:flex;flex-direction:column}header{height:58px;border-bottom:1px solid #eee;padding:0 22px;display:flex;align-items:center;justify-content:space-between}#status{display:none}#chat{flex:1;overflow:auto;padding:35px 12%}#welcome{text-align:center;margin-top:8vh}.biglogo{width:56px;height:56px;margin:auto;font-size:22px}h1{margin:16px 0 8px}.cards{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:25px}.cards button{border:1px solid #ddd;background:#fff;border-radius:10px;padding:10px;cursor:pointer}.message{display:flex;gap:12px;margin:18px 0}.avatar{width:30px;height:30px;flex:0 0 30px;border-radius:8px;background:#111827;color:#fff;display:flex;align-items:center;justify-content:center;font-size:12px}.bubble{max-width:850px;white-space:pre-wrap;line-height:1.55}.user .avatar{background:#ddd;color:#222}.source{font-size:11px;color:#777;margin-top:7px}.composer{border:1px solid #ccc;border-radius:14px;padding:8px;display:flex}.composer textarea{border:0;outline:0;resize:none;flex:1;font:inherit;padding:9px}.composer button{width:40px;height:40px;border:0;border-radius:9px;background:#111827;color:#fff}.main{}.side+main form{padding:12px 12% 20px}form>small{display:block;text-align:center;color:#999;margin-top:7px}.modal{position:fixed;inset:0;background:#0008;display:flex;align-items:center;justify-content:center}.hidden{display:none}.modalbox{background:#fff;border-radius:14px;padding:25px;width:min(430px,92vw);position:relative}.x{position:absolute;right:15px;top:10px;border:0;background:none;font-size:25px}.modalbox label{display:block;margin:14px 0 6px;font-size:13px}.modalbox input[type=password],.modalbox input[type=text]{width:100%;padding:10px;border:1px solid #ccc;border-radius:8px}.modalbox #model{width:100%;padding:10px;border:1px solid #ccc;border-radius:8px}.modalbox #save{width:100%;padding:11px;border:0;border-radius:8px;background:#111827;color:#fff;margin-top:16px}.modalbox p{font-size:11px;color:#777}@media(max-width:700px){.side{display:none}#chat{padding:25px 5%}.side+main form{padding:10px 5%}}

.history-item{padding:9px;border-radius:8px;font-size:13px;color:#555;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:3px}
.history-item:hover{background:#eee}
.history-item.active{background:#e8e8e8;color:#222}
.bubble strong{font-weight:700}
.bubble em{font-style:italic}
.bubble h1,.bubble h2,.bubble h3{margin:12px 0 6px}
.bubble ul{margin:7px 0 7px 20px;padding:0}
.bubble li{margin:4px 0}
.bubble code{background:#f1f1f1;border-radius:4px;padding:2px 5px;font-family:Consolas,monospace}

.login-page{min-height:100vh;background:#f7f7f8;display:flex;align-items:center;justify-content:center}.login-card{width:min(390px,92vw);background:#fff;border:1px solid #ddd;border-radius:16px;padding:32px;box-shadow:0 10px 30px #00000012;text-align:center}.login-card .biglogo{width:58px;height:58px;margin:0 auto}.login-card h1{margin:14px 0 5px}.login-card p{color:#777}.login-card input{display:block;width:100%;padding:12px;margin:10px 0;border:1px solid #ccc;border-radius:9px;font-size:15px}.login-card button{width:100%;padding:12px;border:0;border-radius:9px;background:#111827;color:#fff;font-size:15px;cursor:pointer}.login-card #error{color:#b42318;font-size:13px;margin-top:10px;min-height:18px}

.login-links{margin-top:15px;font-size:13px}.login-links a{color:#2563eb;text-decoration:none}
.admin-page{margin:0;background:#f7f7f8;font-family:Segoe UI,Arial,sans-serif}.admin-wrap{max-width:1250px;margin:auto;padding:25px}.admin-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.admin-header h1{margin:0}.admin-header span{color:#777}.admin-header a{color:#2563eb;text-decoration:none}.admin-card{background:#fff;border:1px solid #ddd;border-radius:14px;padding:20px}.toolbar{display:flex;justify-content:space-between;align-items:center}.toolbar button,.table-wrap button{border:0;background:#111827;color:#fff;border-radius:7px;padding:8px 10px;cursor:pointer}.table-wrap{overflow:auto;margin-top:15px}table{border-collapse:collapse;width:100%;min-width:900px}th,td{border-bottom:1px solid #eee;padding:11px;text-align:left;font-size:13px}th{background:#f7f7f8}.table-wrap button{font-size:11px;margin:2px}.modalbox select{width:100%;padding:10px;border:1px solid #ccc;border-radius:8px}.modalbox #formError{color:#b42318;font-size:13px;margin-top:10px}

.modalbox select{width:100%;padding:10px;border:1px solid #ccc;border-radius:8px;font-size:14px}

.muted{font-size:12px;color:#777;margin:6px 0 14px}
.modalbox select{width:100%;padding:10px;border:1px solid #ccc;border-radius:8px;font-size:14px}
.auth-tabs{display:flex;gap:8px;margin:0 0 18px}.auth-tabs button{flex:1;background:#f3f4f6;color:#333;border:1px solid #ddd}.auth-tabs button.active{background:#111;color:#fff}.form-error{color:#c62828;margin-top:10px;font-size:13px}.form-success{color:#2e7d32;margin-top:10px;font-size:13px}.login-note{font-size:11px;color:#777;margin-top:16px;line-height:1.4;text-align:center}

.history{overflow:auto;min-height:0}.history-empty{font-size:12px;color:#999;padding:8px}.error-hint{color:#b42318!important}.web-source a{color:#2563eb;text-decoration:none}.web-source a:hover{text-decoration:underline}.error-source{color:#b42318}.busy .composer button{opacity:.6;cursor:wait}.message.user .bubble{background:#f3f4f6;padding:9px 12px;border-radius:12px}.history-item{user-select:none}.history-item.active{font-weight:600}

/* MSDGS AI light blue + white chat theme */
body{background:#f4f9ff;color:#18324a}
.app{background:#f4f9ff}
.side{width:280px;background:#ffffff;border-right:1px solid #d8e8f5;padding:16px;box-shadow:2px 0 12px rgba(30,100,160,.05)}
.brand{padding-bottom:4px}.logo,.biglogo{background:#2d8fd5}
.side button{border:1px solid #d9eaf7;background:#fff;color:#23415b}.side button:hover{background:#edf7ff;border-color:#b9dcf4}
#new{background:#eaf6ff;border-color:#b9ddf5;color:#176ca5;font-weight:600}
.history{overflow:auto;min-height:0;flex:1;padding-right:3px}
.history-item{display:block;width:100%;border:0;background:transparent;padding:10px 11px;border-radius:9px;font-size:13px;color:#4b6478;cursor:pointer;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:4px}
.history-item:hover{background:#eef8ff;color:#176ca5}.history-item.active{background:#dff1ff;color:#126da9;font-weight:600;border-left:3px solid #2d8fd5;padding-left:8px}
main{background:#f7fbff}header{background:#fff;border-bottom:1px solid #dcebf6}#chat{padding:35px 12%;background:linear-gradient(180deg,#f8fcff 0%,#f2f9ff 100%)}
#welcome p{color:#668096}.cards button{border:1px solid #cfe5f5;background:#fff;color:#24516e}.cards button:hover{background:#eaf6ff}
.message{margin:20px 0}.avatar{background:#2d8fd5}.user .avatar{background:#cfeaff;color:#176ca5}.bubble{max-width:900px;color:#18324a}.message.user .bubble{background:#e5f4ff;color:#174a69;border:1px solid #d0e9f8;border-radius:14px}
.message.assistant .bubble{background:#fff;border:1px solid #e0edf6;border-radius:14px;padding:12px 15px;box-shadow:0 2px 8px rgba(30,100,160,.04)}
.composer{background:#fff;border:1px solid #bcdced;box-shadow:0 4px 15px rgba(30,100,160,.07)}.composer:focus-within{border-color:#65addb;box-shadow:0 0 0 3px rgba(45,143,213,.12)}.composer button{background:#2d8fd5}.composer button:hover{background:#1677bd}
.side+main form{padding:12px 12% 20px;background:#f7fbff}form>small{color:#6f8799}.source{color:#6c8293}.web-source a{color:#1877bd}.modal{background:rgba(16,55,85,.35)}.modalbox{border:1px solid #cfe5f5;box-shadow:0 18px 50px rgba(20,80,120,.18)}.modalbox #save{background:#2d8fd5}.modalbox #save:hover{background:#1677bd}

.admin-tabs{display:flex;gap:8px;margin:18px 0}.admin-tabs .tab{background:#fff;border:1px solid #c9def7;color:#245b93;padding:11px 18px;border-radius:10px;cursor:pointer}.admin-tabs .tab.active{background:#dff1ff;font-weight:700}.admin-tab-panel{display:none}.admin-tab-panel.active{display:block}.muted{color:#63788c}.knowledge-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:18px 0}.knowledge-box{background:#f5fbff;border:1px solid #d3e8fa;border-radius:14px;padding:18px}.knowledge-box input[type=text],.knowledge-box input[type=url],.knowledge-box input[type=file]{width:100%;margin:8px 0;padding:10px;box-sizing:border-box}.knowledge-box button{margin-top:8px}.knowledge-box small{display:block;margin-top:10px;color:#6d7f8e;line-height:1.45}.admin-card h3{margin-top:22px}@media(max-width:800px){.knowledge-grid{grid-template-columns:1fr}}

.cursor{display:inline-block;color:#2d8fd5;animation:msdgs-blink 1s steps(1) infinite}
@keyframes msdgs-blink{0%,50%{opacity:1}50.01%,100%{opacity:0}}

.history-row{display:flex;align-items:center;gap:2px;margin-bottom:3px}.history-row .history-item{flex:1;margin-bottom:0}.history-delete{border:0!important;background:transparent!important;color:#8a9aaa!important;padding:7px 6px!important;font-size:12px!important;opacity:.55}.history-delete:hover{opacity:1!important;background:#ffecec!important;color:#b42318!important}
.attach-btn{display:flex;align-items:center;justify-content:center;width:40px;cursor:pointer;font-size:20px;border-radius:9px}.attach-btn:hover{background:#edf7ff}.attachment-names{display:flex;gap:6px;flex-wrap:wrap;margin:5px 2px 0}.attachment-names span{font-size:12px;background:#eaf6ff;border:1px solid #cfe5f5;border-radius:8px;padding:4px 7px;color:#24516e}
.export-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;padding-top:8px;border-top:1px solid #e4eef6}.export-actions button{border:1px solid #cfe5f5;background:#f8fcff;color:#24516e;border-radius:7px;padding:5px 8px;font-size:11px;cursor:pointer}.export-actions button:hover{background:#eaf6ff;border-color:#9ccde9}.export-actions button:disabled{opacity:.6;cursor:wait}

.image-btn{width:40px;height:40px;border:1px solid #cfe5f5!important;border-radius:9px;background:#f8fcff!important;color:#24516e!important;margin-right:5px;cursor:pointer}.image-btn:hover{background:#eaf6ff!important}.generated-image-wrap{margin-top:12px;max-width:720px}.generated-image{display:block;width:min(100%,680px);height:auto;border-radius:12px;border:1px solid #d5e5ef;box-shadow:0 4px 16px rgba(30,100,160,.10)}.image-loading{padding:12px;border:1px dashed #bcdced;border-radius:10px;color:#66839a;background:#f8fcff}.image-actions{display:flex;gap:7px;margin-top:8px}.image-actions button{border:1px solid #cfe5f5;background:#f8fcff;color:#24516e;border-radius:7px;padding:7px 10px;cursor:pointer;font-size:12px}.image-actions button:hover{background:#eaf6ff}

.monitor-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:18px 0}.monitor-card{background:#f5fbff;border:1px solid #d3e8fa;border-radius:12px;padding:15px}.monitor-card div{font-size:12px;color:#63788c}.monitor-card strong{display:block;font-size:22px;margin-top:7px;color:#176ca5}.audit-status{margin:12px 0;font-weight:600}.audit-detail{white-space:pre-wrap;max-width:520px;max-height:180px;overflow:auto;font-size:11px}@media(max-width:800px){.monitor-grid{grid-template-columns:1fr 1fr}}

.knowledge-image-wrap{margin-top:12px;padding:10px;border:1px solid #d9e7f5;border-radius:12px;background:#fff;max-width:680px}.knowledge-image-label{font-size:13px;color:#45617a;margin-bottom:8px}.knowledge-image{display:block;max-width:100%;max-height:420px;width:auto;height:auto;border-radius:9px;object-fit:contain}.knowledge-image-open{display:inline-block;margin-top:7px;font-size:13px;text-decoration:none}

.bulk-toolbar{display:flex;align-items:center;gap:18px;margin:12px 0;padding:10px 12px;border:1px solid #d9e6f5;border-radius:10px;background:#f7fbff}.bulk-toolbar label{font-weight:600}.bulk-toolbar span{color:#60758c;font-size:13px}.danger{background:#b42318!important;color:#fff!important;border-color:#b42318!important}.bulk-toolbar input[type=checkbox],table input[type=checkbox]{width:16px;height:16px;vertical-align:middle}

.brand-logo-wrap{display:flex;justify-content:center;align-items:center;margin-bottom:10px}.brand-logo{max-width:180px;max-height:100px;object-fit:contain;border-radius:8px}.branding-panel{display:flex;gap:24px;align-items:center;flex-wrap:wrap}.branding-preview{min-width:220px;min-height:120px;border:1px dashed #b8d0ee;border-radius:12px;display:flex;align-items:center;justify-content:center;padding:12px;background:#f8fbff}.admin-brand-preview{max-width:220px;max-height:120px;object-fit:contain}

.login-logo{display:block;max-width:180px;max-height:110px;width:auto;height:auto;object-fit:contain;margin:0 auto 10px;border-radius:8px}


/* Responsive mobile chat shell: history/new chat remain accessible in a slide-out drawer. */
.app{min-height:100vh;min-height:100dvh;height:100vh;height:100dvh}
main{min-width:0;min-height:0}
#chat{min-width:0}
.composer{min-width:0}
.composer textarea{min-width:0;width:100%}
.mobile-menu{display:none;border:0;background:transparent;color:#24516e;font-size:22px;width:40px;height:40px;border-radius:9px;cursor:pointer;align-items:center;justify-content:center;margin-right:8px}
.mobile-menu:hover{background:#edf7ff}
.mobile-backdrop{display:none}
@media(max-width:700px){
  body.menu-open{overflow:hidden}
  .side{display:flex;position:fixed;left:-310px;top:0;bottom:0;width:290px;max-width:86vw;z-index:1200;transition:left .22s ease;box-shadow:8px 0 28px rgba(30,100,160,.18);padding:14px}
  .side.mobile-open{left:0}
  .mobile-backdrop{display:block;position:fixed;inset:0;background:rgba(16,55,85,.28);z-index:1100}
  .mobile-backdrop.hidden{display:none}
  .mobile-menu{display:flex}
  header{height:54px;padding:0 12px;gap:4px}
  header>b{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #chat{padding:18px 12px 20px;scroll-padding-bottom:20px}
  #welcome{margin-top:7vh}
  #welcome h1{font-size:25px}
  #welcome .cards button{width:100%;max-width:360px}
  .message{gap:8px;margin:14px 0;align-items:flex-start}
  .avatar{width:28px;height:28px;flex-basis:28px}
  .bubble{max-width:calc(100vw - 60px);overflow-wrap:anywhere;word-break:break-word}
  .message.assistant .bubble{padding:11px 12px}
  .side+main form{padding:8px 10px 10px}
  .composer{padding:6px;border-radius:12px;align-items:flex-end;gap:2px}
  .composer textarea{padding:8px;line-height:1.35;max-height:120px}
  .composer button,.image-btn,.attach-btn{width:38px;height:38px;flex:0 0 38px}
  .attach-btn{font-size:18px}
  .attachment-names{max-height:54px;overflow:auto}
  .generated-image-wrap,.knowledge-image-wrap{max-width:100%}
  .knowledge-image{max-height:340px;max-width:100%}
}
@media(min-width:701px){.mobile-backdrop{display:none!important}}


/* v15.8: visible generation state + readable progressive answer */
#hint.generating-hint{display:block!important;text-align:center;color:#3d6b89;margin:7px 0 3px;min-height:18px}
.hint-dots,.stream-dots{display:inline-flex;gap:3px;vertical-align:middle;margin-left:4px}
.hint-dots i,.stream-dots i{width:5px;height:5px;border-radius:50%;background:#2d8fd5;display:block;animation:msdgs-dot 1.1s infinite ease-in-out}
.hint-dots i:nth-child(2),.stream-dots i:nth-child(2){animation-delay:.15s}.hint-dots i:nth-child(3),.stream-dots i:nth-child(3){animation-delay:.3s}
@keyframes msdgs-dot{0%,80%,100%{opacity:.25;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}
.streaming-bubble{min-width:min(680px,70vw);min-height:82px;overflow:auto;max-height:68vh;scroll-behavior:smooth}
.stream-status{display:flex;align-items:center;gap:8px;color:#4b6d84;font-size:13px;padding:3px 0 11px;border-bottom:1px solid #edf4f9;margin-bottom:11px;position:sticky;top:0;background:#fff;z-index:2}
.stream-dot{width:8px;height:8px;border-radius:50%;background:#2d8fd5;box-shadow:0 0 0 5px #e6f5ff;animation:msdgs-pulse 1.3s infinite}
@keyframes msdgs-pulse{0%,100%{opacity:.45}50%{opacity:1}}
.stream-skeleton{display:grid;gap:8px;opacity:.8}.stream-skeleton span{height:10px;border-radius:6px;background:linear-gradient(90deg,#eef6fb,#dcecf7,#eef6fb);background-size:200% 100%;animation:msdgs-shimmer 1.4s infinite}.stream-skeleton span:nth-child(1){width:88%}.stream-skeleton span:nth-child(2){width:72%}.stream-skeleton span:nth-child(3){width:54%}
@keyframes msdgs-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
.stream-live{white-space:normal;line-height:1.55;overflow:visible}
.streaming-bubble .knowledge-image-wrap{max-height:none}
.streaming-bubble .knowledge-image{max-height:360px}
@media(max-width:700px){.streaming-bubble{min-width:0;max-width:calc(100vw - 60px);max-height:62vh}.stream-status{font-size:12px}}

/* Clickable PDF/Google Maps links in knowledge answers */
.bubble{overflow-wrap:anywhere;word-break:break-word;min-width:0}
.bubble .map-link{display:inline-flex;align-items:center;gap:6px;color:#176ca5;background:#eef8ff;border:1px solid #b9def5;border-radius:8px;padding:3px 8px;font-weight:600;text-decoration:none;cursor:pointer;overflow-wrap:anywhere;word-break:break-word}
.bubble .map-link::before{content:"📍"}
.bubble .map-link:hover{background:#dff2ff;border-color:#8ec9ef;text-decoration:none}
