#kds-assistant-root{font:15px/1.5 system-ui,sans-serif;color:#20332f}#kds-assistant-root *{box-sizing:border-box}#kds-assistant-root [hidden]{display:none!important}#kds-assistant-root .chat-fab{position:fixed;right:24px;bottom:24px;z-index:100000;background:#16735b;color:white;border:0;border-radius:50%;width:60px;height:60px;padding:17px;box-shadow:0 3px 18px #0004}#kds-assistant-root .chat-fab svg{fill:currentColor;width:26px;height:26px}#kds-assistant-root .chat-drawer{position:fixed;right:0;top:0;bottom:0;width:min(480px,100vw);z-index:100001;background:white;border-left:1px solid #d6dfda;box-shadow:-4px 0 30px #0002;display:none;flex-direction:column}#kds-assistant-root .chat-drawer.open{display:flex}#kds-assistant-root .chat-drawer-header,#kds-assistant-root .chat-mode-tabs{display:flex;justify-content:space-between;padding:12px;gap:8px;border-bottom:1px solid #eee}#kds-assistant-root button:not(.history-button){font:inherit;cursor:pointer;border:1px solid #ccd8d0;border-radius:9px;padding:7px 10px;background:#f4f7f5;color:#20332f}#kds-assistant-root button:disabled{opacity:.5;cursor:default}#kds-assistant-root button[aria-selected=true]{background:#ddefe5}#kds-assistant-root .kds-assistant-tools{padding:12px;border-bottom:1px solid #eee;font-size:12px;display:flex;flex-wrap:wrap;gap:8px}#kds-assistant-root .kds-assistant-tools a{color:#166b59}#kds-assistant-root .kds-assistant-tools form{display:flex;flex-wrap:wrap;gap:6px}#kds-assistant-root .kds-assistant-tools input[type=email],#kds-assistant-root input[type=password]{width:100%}#kds-assistant-root #kds-assistant-notice{color:#8b3e12;width:100%;margin:0}#kds-assistant-root .customer-chat-panel,#kds-assistant-root #advanced-chat-panel{display:flex;flex:1;flex-direction:column;min-height:0}#kds-assistant-root .chat-drawer-body,#kds-assistant-root #kds-advanced-log{overflow:auto;flex:1;padding:14px;min-height:0}#kds-assistant-root .chat-composer{padding:12px;border-top:1px solid #eee}#kds-assistant-root .chat-compose-row{display:flex;gap:6px;align-items:center}#kds-assistant-root input:not([type=checkbox]){font:inherit;border:1px solid #d3dcd6;border-radius:9px;padding:8px;min-width:0}#kds-assistant-root .chat-compose-row input{flex:1}#kds-assistant-root .mic-icon{width:22px;height:22px;fill:currentColor}#kds-assistant-root .kds-message{padding:12px 0;white-space:pre-wrap;overflow-wrap:anywhere}#kds-assistant-root .kds-message.user{background:#eff5f0;border-radius:12px;padding:12px}#kds-assistant-root .kds-message strong{font-size:12px;color:#587161}#kds-assistant-root .kds-script-proposal{padding:12px;border:1px solid #ccd9cf;border-radius:12px}#kds-assistant-root .kds-script-proposal pre{max-height:300px;overflow:auto;white-space:pre-wrap;background:#f2f5f3;padding:10px;color:#20332f}#kds-assistant-root .kds-script-proposal h3{font-size:16px}#kds-assistant-root .kds-script-proposal button{margin:4px}#kds-assistant-root #kds-chat-history{width:100%;max-height:180px;overflow:auto}

/* Match the shared Taiwan Tax tab presentation; scope against legacy KDS CSS. */
#kds-assistant-root .chat-drawer{width:min(460px,100vw);background:#f6f7f9}
#kds-assistant-root .chat-drawer-header{align-items:center;padding:11px 14px;background:#fff;border-bottom:1px solid #c9ddd6}
#kds-assistant-root .chat-mode-tabs{gap:8px;padding:8px 12px;background:#fff;border-bottom:1px solid #c9ddd6}
#kds-assistant-root .chat-mode-tabs button{flex:1;padding:8px;background:transparent;color:#31594e}
#kds-assistant-root .chat-mode-tabs button[aria-selected="true"]{background:#176b57;color:#fff}
#kds-assistant-root .chat-mode-tabs button:focus-visible{outline:2px solid #176b57;outline-offset:2px}
#kds-assistant-root .kds-assistant-tools{background:#fff;flex-shrink:0}
#kds-assistant-root .chat-composer{background:#fff}
#kds-assistant-root .kds-chat-progress{padding:12px 0;color:#587161;font-size:13px}
#kds-assistant-root button.mic.active{background:#b42318;border-color:#b42318;color:#fff}

#kds-assistant-root .kds-message:has(>.usage-icon),#kds-assistant-root .kds-chat-progress:has(>.usage-icon){position:relative;padding-bottom:36px}
#kds-assistant-root .usage-icon{position:absolute;right:6px;bottom:4px;border:0;padding:2px 8px;font-size:21px;line-height:26px;background:transparent;color:#567465}

#kds-assistant-root .kds-proposal-feedback{margin:8px 0 0;color:#176b57;font-size:13px}#kds-assistant-root .kds-proposal-feedback:empty{display:none}#kds-assistant-root .kds-proposal-feedback.error{color:#b42318}

/* Primary assistant entry: distinguish it from the neighboring edit-mode controls. */
#tutorialHeader #kds-open-chat{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:44px;margin:0;padding:6px 20px!important;background:linear-gradient(180deg,#28334e,#101827);border:1px solid #d6ad59;border-radius:999px;color:#fff;font:800 17px/1.15 system-ui,sans-serif;white-space:nowrap;cursor:pointer;box-shadow:0 2px 7px #121c4080,inset 0 -2px 6px #e8bf5530}
#tutorialHeader #kds-open-chat:hover{background:linear-gradient(180deg,#354465,#18243b);border-color:#ffe19a}
#tutorialHeader #kds-open-chat,body:has(.kds-header-controls) #dockFab{transition:border-color .15s}
#tutorialHeader #kds-open-chat:focus-visible,body:has(.kds-header-controls) #dockFab:focus-visible{outline:3px solid white;outline-offset:2px}
#kds-open-chat[hidden],#scriptEditingMethodLabel{display:none!important}
#kds-open-chat .kds-open-chat-icon{width:26px;height:26px;flex:none;fill:#ffe18a;vertical-align:middle}
body:has(.kds-header-controls):not(.tutorial-header-hidden) #dockFab{top:4px!important;right:8px!important;width:44px!important;height:44px!important;margin:0!important;background:linear-gradient(155deg,#4a5ab0,#121b3a 78%);border:1px solid #b89b61;color:#fff;box-shadow:0 2px 7px #121c4080!important}
body:has(.kds-header-controls):not(.tutorial-header-hidden) #dockFab:hover,body:has(.kds-header-controls):not(.tutorial-header-hidden) #dockFab[aria-expanded=true]{background:linear-gradient(155deg,#6071c7,#1d2a50 78%);border-color:#ffe19a}
body:has(.kds-header-controls):not(.tutorial-header-hidden) #dockFab svg{fill:currentColor}

/* Keep editor intent above the independently scrolling history list. */
#kds-assistant-root .kds-assistant-tools{flex-direction:column;flex-wrap:nowrap;align-items:stretch}
#kds-assistant-root .kds-history-actions{display:flex;flex-wrap:nowrap;gap:5px;margin-left:auto}
#kds-assistant-root .kds-editor-mode{flex:none;display:flex;align-items:center;gap:6px;min-width:0}
#kds-assistant-root .kds-editor-mode label{display:flex;align-items:center;gap:5px;margin:0;flex:none;white-space:nowrap}
#kds-assistant-root .kds-editor-mode small{display:block;flex:1;min-width:0;margin:0;font-size:10px;color:#587161;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#kds-assistant-root #kds-chat-history{flex:none;min-height:0;max-height:min(180px,25dvh);overflow:auto}

#kds-assistant-root #kds-chat-new[aria-pressed="true"],
#kds-assistant-root #kds-history-toggle[aria-expanded="true"]{background:#176b57;border-color:#176b57;color:#fff}

#kds-assistant-root .chat-drawer-header{position:relative;gap:7px;padding:8px 49px 8px 10px;min-height:48px;flex:none;flex-wrap:wrap}
#kds-assistant-root .chat-drawer-header>strong{font-size:14px;white-space:nowrap;flex:none}
#kds-assistant-root .chat-drawer-header button{padding:5px 7px;font-size:12px;white-space:nowrap}
#kds-assistant-root .kds-assistant-tools{padding:8px 10px;gap:6px}
#kds-assistant-root #kds-assistant-notice:empty{display:none}

/* Reserve real page space for desktop chat; narrow screens switch full views. */
@media(min-width:1100px){
 body.kds-assistant-docked{padding-right:calc(var(--kds-assistant-width) + 6px);box-sizing:border-box}
 body.kds-assistant-docked #tutorialHeader{margin-right:calc(-1 * (var(--kds-assistant-width) + 6px))}
 body.kds-assistant-docked #kds-assistant-root .chat-drawer,
 body.kds-assistant-docked #kds-assistant-root #kds-assistant-divider{top:var(--kds-assistant-top,0px)}
 body.kds-assistant-docked #kds-assistant-root .chat-drawer{width:var(--kds-assistant-width);box-shadow:none}
}
@media(max-width:1099px){#kds-assistant-root .chat-drawer{width:100vw}}
#kds-assistant-root #kds-assistant-divider{position:fixed;top:0;bottom:0;right:var(--kds-assistant-width);width:6px;z-index:100002;cursor:col-resize;touch-action:none;background:#d6e3dd}
#kds-assistant-root #kds-assistant-divider:hover,#kds-assistant-root #kds-assistant-divider:focus-visible{background:#176b57;outline:none}
body.kds-assistant-resizing{cursor:col-resize;user-select:none}
body.kds-assistant-resizing:after{content:'';position:fixed;inset:0;z-index:100000;cursor:col-resize}
/* Fill the allocated editor pane instead of Tutorial's bottom-mode 200px. */
body #dockContainer #editorPane{display:flex;flex-direction:column;min-height:0}
body #editorPane>.tabs{flex:none}
body #editorPane>div:not(.tabs){flex:1;min-height:0;display:flex;flex-direction:column}
body #editorPane #scriptSection:not([style*="display: none"]):not([style*="display:none"]),
body #editorPane #uiTemplateSection:not([style*="display: none"]):not([style*="display:none"]){display:flex!important;flex-direction:column;flex:1;min-height:0}
body #editorPane .script-editor-commandbar,body #editorPane .editorToolbar{flex:none}
body #editorPane .editorSplit{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
body #dockContainer #editorPane .editorMainCol{flex:1 1 0!important;min-height:0!important;overflow:hidden;display:flex;flex-direction:column}
body #editorPane .editorMainCol>.CodeMirror{height:100%!important;flex:1;min-height:0}
body #editorPane .editorNL{flex:0 1 auto!important;max-height:30%;min-height:0!important;overflow:auto}
/* Neutralize inherited KDS button padding inside the compact visual editor. */
body #actionScriptUiClose{display:inline-flex;align-items:center;justify-content:center;gap:5px;padding:6px 10px!important;margin:0;box-sizing:border-box;line-height:1.3;flex:none}

#kds-editor-toggle{padding:8px 12px;border:1px solid #176b57;border-radius:8px;background:white;color:#176b57;cursor:pointer}
body #dockContainer.kds-editor-collapsed #editorPane,body #dockContainer.kds-editor-collapsed #divider{display:none!important}
body #dockContainer.kds-editor-collapsed #previewPane{display:block!important;flex:1 1 auto!important;width:100%!important;height:100%!important;min-width:0;min-height:0}
#kds-assistant-root .kds-editor-mode{flex-wrap:wrap}


#tutorialHeader #langSwitcherContainer{display:flex;align-items:center;gap:8px}
#tutorialHeader .tutorial-header-row:has(.kds-header-controls){display:grid;grid-template-columns:minmax(max-content,1fr) minmax(0,auto) minmax(max-content,1fr)}
#tutorialHeader .tutorial-header-row:has(.kds-header-controls) .kds-tutorial-title{grid-column:2;grid-row:1;position:static;transform:none;justify-content:center}
#tutorialHeader .tutorial-header-row:has(.kds-header-controls) #headTitle{white-space:normal;text-align:center}
#tutorialHeader .kds-header-controls{grid-column:3;grid-row:1;justify-self:end;display:flex;align-items:center;gap:8px;padding-right:52px}
#tutorialHeader .kds-header-controls #langSwitcherContainer{position:static}
#dockMenu .kds-language-setting{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;margin-bottom:6px;border-bottom:1px solid #e5e7eb;font-size:14px}
#dockMenu .kds-language-setting label{margin:0;font-weight:600;white-space:nowrap}
#dockMenu #langSwitcher{min-width:96px;height:34px!important;padding:4px 8px!important;font:inherit!important;box-shadow:none!important}
@media(max-width:760px){
 #tutorialHeader .tutorial-header-row:has(.kds-header-controls){grid-template-columns:minmax(0,1fr) auto}
 #tutorialHeader .tutorial-header-row:has(.kds-header-controls) .kds-tutorial-title{grid-column:1;justify-content:start}
 #tutorialHeader .tutorial-header-row:has(.kds-header-controls) #headTitle{text-align:left}
 #tutorialHeader .tutorial-header-row:has(.kds-header-controls) .tutorial-header-actions{grid-column:1;grid-row:2;flex-wrap:wrap}
 #tutorialHeader .kds-header-controls{display:contents}
 #tutorialHeader #kds-open-chat{grid-column:2;grid-row:1;justify-self:end;align-self:start;margin-right:52px!important;padding-inline:14px!important}
 #tutorialHeader .kds-header-controls #langSwitcherContainer{grid-column:2;grid-row:2;justify-self:end}
}

body #editorPane>.tabs{display:flex;align-items:center}
body #editorPane #kds-editor-close{flex:none;margin:0 4px 0 auto;padding:0;width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #ccd8d0;border-radius:6px;background:white;color:#20332f;font:24px/1 system-ui;cursor:pointer}
body #editorPane #kds-editor-close:hover{background:#eef4f0}
body #editorPane #kds-editor-close:focus-visible{outline:2px solid #176b57;outline-offset:2px}

#kds-editor-toggle{display:inline-flex;align-items:center;gap:5px}.kds-editor-icon{display:inline-flex;width:16px;height:16px;flex:none}.kds-editor-icon svg{width:100%;height:100%}
#tutorialHeader #kds-header-editor-toggle{display:inline-flex;align-items:center;gap:5px;min-height:34px;border:1px solid #ffffff80;border-radius:8px;background:#ffffff14;color:#fff;font-weight:700;cursor:pointer}
#tutorialHeader #kds-header-editor-toggle:hover,#tutorialHeader #kds-header-editor-toggle[aria-expanded=true]{background:#ffffff2e;border-color:#fff}
#tutorialHeader #kds-header-editor-toggle:focus-visible{outline:2px solid white;outline-offset:2px}

/* Keep both panel close buttons identical despite inherited button styles. */
body #editorPane #kds-editor-close,body #kds-assistant-root #chat-close{display:inline-flex;align-items:center;justify-content:center;flex:0 0 32px;box-sizing:border-box;width:32px;height:32px;min-width:32px;min-height:32px;padding:0!important;border:1px solid #ccd8d0;border-radius:8px;background:#fff;color:#20332f;box-shadow:none;cursor:pointer;line-height:1}
body #editorPane #kds-editor-close{margin:0 4px 0 auto}
body #kds-assistant-root #chat-close{position:absolute;top:8px;right:10px;margin:0}
.kds-panel-close svg{display:block;width:18px;height:18px;pointer-events:none}
body #editorPane #kds-editor-close:hover,body #kds-assistant-root #chat-close:hover{background:#eef4f0;border-color:#176b57}
body #editorPane #kds-editor-close:focus-visible,body #kds-assistant-root #chat-close:focus-visible{outline:2px solid #176b57;outline-offset:2px}

#kds-assistant-root .kds-knowledge-controls{display:flex;align-items:center;gap:6px;flex-wrap:wrap;width:100%;min-width:0}
#kds-assistant-root .kds-knowledge-controls label{margin:0;white-space:nowrap;font-weight:600}
#kds-assistant-root #kds-knowledge-base{max-width:100%;min-width:0;padding:5px 8px;border:1px solid #ccd8d0;border-radius:7px;background:#fff;color:#20332f;font:inherit}
#kds-assistant-root #kds-knowledge-help{flex-basis:100%;font-size:10px;color:#587161}
#kds-assistant-root #kds-knowledge-version{font-size:10px;color:#587161;overflow-wrap:anywhere}

#kds-assistant-root .kds-chat-more{position:relative;flex:none}
#kds-assistant-root .kds-chat-more>summary{list-style:none;cursor:pointer;border:1px solid #ccd8d0;border-radius:9px;padding:5px 9px;background:#f4f7f5;color:#20332f;white-space:nowrap}
#kds-assistant-root .kds-chat-more>summary::-webkit-details-marker{display:none}
#kds-assistant-root .kds-chat-more>summary::after{content:" ▾"}
#kds-assistant-root .kds-chat-more-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:100010;display:flex;flex-direction:column;gap:5px;min-width:max-content;padding:8px;background:#fff;border:1px solid #ccd8d0;border-radius:10px;box-shadow:0 6px 20px #0002}
#kds-assistant-root .kds-chat-more-menu a{padding:6px 10px;color:#166b59;text-decoration:none}
#kds-assistant-root .kds-tutorial-info{box-sizing:border-box;width:min(34rem,calc(100vw - 2rem));padding:1.25rem;border:1px solid #ccd8d0;border-radius:12px;background:#fff;color:#20332f}
#kds-assistant-root .kds-tutorial-info::backdrop{background:#0005}
#kds-assistant-root .kds-tutorial-info h2{margin:0;font-size:1.2rem}
#kds-assistant-root .kds-tutorial-info code:not([hidden]){display:block;padding:.75rem;background:#f4f7f5;overflow-wrap:anywhere}
#kds-assistant-root .kds-tutorial-info form{margin-top:1rem;text-align:right}
#tutorialHeader .kds-tutorial-title{position:absolute;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:6px;min-width:0}
#tutorialHeader .kds-tutorial-title #headTitle{position:static!important;transform:none!important}
#tutorialHeader .kds-tutorial-info-icon{display:inline-grid;place-items:center;flex:none;width:20px;height:20px;padding:0;border:1px solid #ffffff38;border-radius:50%;background:#ffffff18;color:#f0f3ff;cursor:pointer}
#tutorialHeader .kds-tutorial-info-icon:hover,#tutorialHeader .kds-tutorial-info-icon:focus-visible{background:#ffffff30}
