/* Unified media picker for the agent workbench and visitor chat window. */
.agent-page .aw-tool-panel {
    width: min(330px, calc(100vw - 24px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
}
.support-tool-panel {
    width: min(236px, calc(100vw - 24px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
}
.support-tool-panel:has([data-support-tool="file"]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.agent-page .aw-tool-panel button {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 34px auto auto;
    align-content: center;
    justify-items: center;
    gap: 3px;
    text-align: center;
}
.agent-page .aw-tool-panel button > .composer-media-icon,
.agent-page .aw-tool-panel button > b,
.agent-page .aw-tool-panel button > small {
    grid-column: 1;
    justify-self: center;
}
.agent-page .aw-tool-panel button > b,
.agent-page .aw-tool-panel button > small {
    white-space: nowrap;
    line-height: 1.25;
}

.support-tool-panel button {
    min-height: 88px;
    padding: 9px 5px;
    border: 1px solid rgba(80, 114, 150, .09);
    border-radius: 14px;
    background: linear-gradient(155deg, rgba(255, 255, 255, .98), rgba(232, 242, 253, .82));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 7px 18px rgba(35, 78, 121, .07);
}
.agent-page .aw-tool-panel button:hover,
.support-tool-panel button:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--support-color, #1682f3), transparent 72%);
    background: #fff;
}
.agent-page .aw-tool-panel .composer-media-icon,
.support-tool-panel .composer-media-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #187be5;
    background: linear-gradient(145deg, #e9f5ff, #d9ecff);
    box-shadow: inset 0 1px 0 #fff;
}
.agent-page .aw-tool-panel .composer-media-icon svg,
.support-tool-panel .composer-media-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.agent-page .aw-tool-panel [data-aw-tool="video"] .composer-media-icon svg path,
.support-tool-panel [data-support-tool="video"] .composer-media-icon svg path {
    fill: currentColor;
    stroke: none;
}
.agent-page .aw-tool-panel [data-aw-tool="file"] .composer-media-icon,
.support-tool-panel [data-support-tool="file"] .composer-media-icon {
    color: #8556d9;
    background: linear-gradient(145deg, #f3edff, #e7dcff);
}
.agent-page .aw-tool-panel b,
.support-tool-panel b {
    color: #243b55;
    font-size: 12px;
    font-weight: 800;
}
.agent-page .aw-tool-panel small,
.support-tool-panel small {
    font-size: 9px;
    line-height: 1.25;
}
.agent-page .aw-tool-panel > .aw-material-hint,
.support-tool-panel > .support-material-hint {
    grid-column: 1 / -1;
    padding: 1px 4px 0;
    color: #76879a;
    text-align: left;
}
@media (max-width: 380px) {
    .agent-page .aw-tool-panel,
    .support-tool-panel { width: calc(100vw - 16px); gap: 5px; padding: 7px; }
    .agent-page .aw-tool-panel button,
    .support-tool-panel button { min-height: 80px; padding-inline: 2px; }
}

@media (min-width: 701px) {
    .agent-page .aw-composer { position: relative; }
    .agent-page .aw-image-draft-strip[hidden] { display: none !important; }
    .agent-page .aw-image-draft-strip {
        display: flex;
        gap: 8px;
        margin: 0 0 7px;
        padding: 7px 2px 2px;
        overflow-x: auto;
        scrollbar-width: thin;
    }
    .agent-page .aw-image-draft-item {
        position: relative;
        flex: 0 0 auto;
        width: 74px;
        height: 58px;
        overflow: hidden;
        border: 1px solid rgba(126, 171, 218, .34);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 5px 14px rgba(26, 73, 126, .10);
    }
    .agent-page .aw-image-draft-item img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .agent-page .aw-image-draft-item button {
        position: absolute;
        top: 3px;
        right: 3px;
        width: 19px;
        height: 19px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        color: #fff;
        background: rgba(20, 34, 52, .72);
        font-size: 14px;
        line-height: 19px;
        cursor: pointer;
    }
    .agent-page .aw-image-draft-item small {
        position: absolute;
        left: 3px;
        bottom: 3px;
        max-width: calc(100% - 6px);
        padding: 1px 4px;
        overflow: hidden;
        border-radius: 999px;
        color: #fff;
        background: rgba(15, 31, 49, .64);
        font-size: 8px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .agent-page .aw-composer.is-image-dragover .aw-compose-row {
        position: relative;
        border-radius: 14px;
        box-shadow: 0 0 0 2px rgba(20, 127, 243, .28), 0 8px 20px rgba(20, 127, 243, .12);
    }
    .agent-page .aw-composer.is-image-dragover .aw-compose-row::after {
        content: "松开添加图片，点击发送";
        position: absolute;
        inset: -2px;
        display: grid;
        place-items: center;
        border: 1px dashed rgba(20, 127, 243, .58);
        border-radius: 14px;
        color: #126fe8;
        background: rgba(235, 246, 255, .82);
        font-size: 12px;
        font-weight: 800;
        pointer-events: none;
    }
}

@media (max-width: 700px) {
    .agent-page .aw-image-draft-strip { display: none !important; }
}

/* Location preview uses the top layer, clear of the mobile header and bottom navigation. */
.kb-location-dialog { box-sizing:border-box; width:min(440px,calc(100vw - 28px)); max-width:440px; max-height:calc(100vh - 32px); max-height:calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); margin:auto; padding:0; border:1px solid #e0e9f3; border-radius:22px; background:#fff; color:#243b55; box-shadow:0 20px 80px #0e294b40; font:14px/1.6 system-ui,sans-serif; text-align:left; overflow:hidden; }
.kb-location-dialog[open] { display:flex; flex-direction:column; }
.kb-location-dialog::backdrop { background:#122c4b70; }
.kb-location-dialog * { box-sizing:border-box; }
.kb-location-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; border-bottom:1px solid #e8eef5; flex:none; }
.kb-location-header h2 { margin:0; font-size:18px; color:#243b55; }
.kb-location-dialog button { cursor:pointer; min-height:44px; padding:10px 16px; border:1px solid #dce5ef; border-radius:12px; background:#fff; color:#344a63; font:inherit; }
.kb-location-dialog button:disabled { opacity:.55; cursor:default; }
.kb-location-dialog .kb-location-close { font-size:24px; width:44px; padding:0; background:#f3f6fa; border:0; }
.kb-location-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:18px 20px; -webkit-overflow-scrolling:touch; }
.kb-location-body p { margin:0 0 12px; }
.kb-location-status { color:#16734f; }
.kb-location-status.is-error { color:#b14d25; }
.kb-location-preview { display:flex; flex-direction:column; align-items:flex-start; gap:6px; border:1px solid #dfebf5; border-radius:14px; padding:14px; background:#f5f9fd; margin:12px 0; overflow-wrap:anywhere; }
.kb-location-preview[hidden],.kb-location-dialog [hidden] { display:none!important; }
.kb-location-label { display:block; font-size:13px; color:#667b91; }
.kb-location-label input { display:block; width:100%; min-width:0; min-height:44px; padding:10px 12px; margin:6px 0 12px; border:1px solid #dce5ef; border-radius:10px; font:16px/1.5 system-ui,sans-serif; background:#fff; color:#243b55; }
.kb-location-dialog .kb-location-hint { font-size:12px; color:#6b7e92; margin:12px 0 0; }
.kb-location-fallback { display:block; margin-top:10px; }
.kb-location-footer { flex:none; display:flex; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid #e8eef5; background:#fff; }
.kb-location-dialog .kb-location-confirm { background:#1677ef; border-color:#1677ef; color:#fff; font-weight:600; }
.kb-location-dialog a { color:#1677df; text-decoration:none; }
.kb-location-dialog :focus-visible,.kb-location-card:focus-visible { outline:3px solid #5199ee; outline-offset:2px; }
.kb-location-legacy { position:fixed; inset:0; z-index:2147483647; box-shadow:0 0 0 100vmax #122c4b70; }
.kb-location-card { display:grid; grid-template-columns:32px minmax(0,1fr); align-items:center; column-gap:9px; row-gap:4px; width:240px; max-width:100%; padding:6px 4px; color:inherit!important; text-decoration:none!important; overflow-wrap:anywhere; }
.kb-location-pin { display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:#e0efff; color:#176bc6; font-size:25px; line-height:1; }
.kb-location-card .kb-location-pin { grid-row:1 / 4; }
.kb-location-card strong { font-size:14px; line-height:1.5; }
.kb-location-card small { font-size:11px; opacity:.8; line-height:1.5; }
.kb-location-card-action { grid-column:1 / -1; border-top:1px solid currentColor; padding-top:8px; margin-top:6px; font-size:12px; opacity:.85; }
.agent-page .aw-tool-panel:has([data-aw-tool="location"]),.support-tool-panel:has([data-support-tool="location"]) { width:min(330px,calc(100vw - 24px)); grid-template-columns:repeat(4,minmax(0,1fr)); }
@media(max-width:380px) { .agent-page .aw-tool-panel:has([data-aw-tool="location"]),.support-tool-panel:has([data-support-tool="location"]) { grid-template-columns:repeat(2,minmax(0,1fr)); width:min(250px,calc(100vw - 24px)); } .kb-location-body { padding:14px 16px; } .kb-location-header,.kb-location-footer { padding:12px 16px; } }

/* The open state rotates only the plus glyph, keeping its hit area square. */
@media(max-width:700px) {
    body.agent-page-workbench .aw-tool-toggle.active { transform:none; }
    body.agent-page-workbench .aw-tool-toggle.active::before {
        transform:rotate(45deg);
        background:
            linear-gradient(#fff,#fff) center/2px 20px no-repeat,
            linear-gradient(#fff,#fff) center/20px 2px no-repeat;
    }
}
.kb-location-card .kb-location-pin{grid-column:1;grid-row:1 / 4}.kb-location-card strong,.kb-location-card small{grid-column:2}.kb-location-card .kb-location-address{font-size:12px;line-height:1.65;opacity:.9}.kb-location-dialog .kb-location-address-status{font-size:12px;color:#6b7e92;margin:0 0 12px}.kb-location-label input[aria-invalid="true"]{border-color:#bc562e}.kb-location-preview .kb-location-place{font-size:17px;line-height:1.5}.kb-location-preview .kb-location-address{font-size:13px;color:#63758a}
/* Location picker: native top layer keeps all site navigation below the dialog. */
.kb-location-dialog.kb-location-picker{width:min(880px,calc(100vw - 40px));height:min(680px,calc(100dvh - 40px));max-width:none;max-height:none;margin:auto;padding:0;border:0;border-radius:22px;overflow:hidden;background:#fff;color:#20344c;font:14px/1.5 system-ui,-apple-system,sans-serif;box-shadow:0 24px 80px #172b4d40}
.kb-location-picker[open]{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(280px,1fr);grid-template-rows:64px minmax(0,1fr)}
.kb-location-picker *{box-sizing:border-box}.kb-picker-header{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 18px;border-bottom:1px solid #e8edf3;background:#fff;z-index:3}.kb-picker-header strong{font-size:17px}.kb-location-picker button{font:inherit;cursor:pointer;touch-action:manipulation}.kb-location-picker button:disabled{opacity:.5;cursor:default}.kb-picker-header button{min-height:42px;min-width:64px;padding:8px 14px;border:0;border-radius:10px;background:transparent;color:#52647a}.kb-picker-header .kb-location-confirm{background:#1677ef;color:#fff}
.kb-picker-map-panel{position:relative;min-width:0;min-height:0;overflow:hidden;background:#edf2f7}.kb-picker-map{position:absolute;inset:0}.kb-picker-center-pin{position:absolute;left:50%;top:50%;width:26px;height:26px;border:5px solid #1677ef;border-radius:50% 50% 50% 0;background:#fff;transform:translate(-50%,-100%) rotate(-45deg);box-shadow:0 2px 7px #164b7860;pointer-events:none;z-index:100}.kb-picker-center-pin[hidden]{display:none}.kb-picker-locate{position:absolute;bottom:34px;left:16px;z-index:101!important;width:46px;height:46px;min-height:46px;padding:0!important;border:1px solid #dfe7f1!important;border-radius:50%!important;background:#fff!important;color:#1677ef!important;box-shadow:0 3px 14px #21344e20;font-size:28px!important;line-height:1!important}.kb-picker-map-error{padding:60px 24px;text-align:center;color:#6d7d90;font-size:14px}
.kb-picker-content{display:flex;flex-direction:column;min-height:0;min-width:0;background:#fff;overflow:hidden}.kb-picker-search{display:flex;gap:8px;flex:none;margin:16px 16px 6px}.kb-picker-search input{display:block;min-width:0;flex:1;height:44px;padding:9px 12px;border:1px solid #e3e9f1;border-radius:10px;background:#f5f7fa;font:16px/1.4 system-ui;color:#263c53;outline-offset:2px}.kb-picker-search button{border:0!important;min-width:50px;padding:8px!important;background:transparent!important;color:#1677ef!important}.kb-picker-status{flex:none;min-height:36px;margin:0!important;padding:5px 17px 9px;color:#718198;font-size:12px;line-height:1.5}.kb-picker-places{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:0 16px 12px}.kb-location-picker .kb-picker-place{display:flex;align-items:center;gap:12px;width:100%;min-height:78px;padding:15px 2px;border:0;border-bottom:1px solid #edf1f5;border-radius:0;background:#fff;text-align:left;color:#24394f}.kb-picker-place-text{min-width:0;flex:1}.kb-picker-place strong{display:block;font-weight:600;font-size:15px;overflow-wrap:anywhere}.kb-picker-place small{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:12px;line-height:1.65;margin-top:5px;color:#8290a2}.kb-picker-check{width:22px;color:#1677ef;font-size:23px;visibility:hidden}.kb-picker-place[aria-selected=true] .kb-picker-check{visibility:visible}.kb-picker-place[aria-selected=true] strong{color:#176dd0}.kb-picker-external{display:block;padding:20px 0}
.kb-location-card{display:flex;flex-direction:column;align-items:stretch;gap:0;width:264px;max-width:100%;padding:0;overflow:hidden;border:1px solid #dae4ef;border-radius:12px;background:#fff;color:#23384e!important;text-align:left;box-shadow:0 2px 6px #18334f08}.kb-location-card strong{display:block;font-size:15px;padding:11px 12px 2px;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kb-location-card .kb-location-address{display:block;padding:0 12px 10px;font-size:12px;color:#718096;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;opacity:1}.kb-location-thumbnail{display:block;position:relative;width:100%;height:132px;background:#eef3f8;overflow:hidden}.kb-location-thumbnail img{display:block!important;width:100%!important;height:100%!important;max-width:none!important;object-fit:cover;border-radius:0!important}.kb-location-map-fallback{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:12px;text-align:center;font-size:12px;color:#65829e}.kb-location-card .kb-location-card-action{margin:0;border:0;padding:7px 12px;font-size:11px;color:#7a8797;opacity:1}
@media(max-width:600px){.kb-location-dialog.kb-location-picker{position:fixed;inset:var(--kb-location-top,0px) 0 auto;margin:0;width:100%;height:var(--kb-location-vh,100dvh);border-radius:0;max-height:var(--kb-location-vh,100dvh)}.kb-location-picker[open]{grid-template-columns:minmax(0,1fr);grid-template-rows:calc(58px + env(safe-area-inset-top,0px)) minmax(110px,40%) minmax(0,1fr)}.kb-picker-header{padding:calc(7px + env(safe-area-inset-top,0px)) 14px 7px}.kb-picker-content{padding-bottom:env(safe-area-inset-bottom,0px)}.kb-picker-search{margin:12px 14px 4px}.kb-picker-places{padding:0 16px 16px}.kb-location-card{width:252px}}
@media(max-height:460px){.kb-location-picker[open]{grid-template-columns:minmax(0,1fr) minmax(240px,1fr);grid-template-rows:54px minmax(0,1fr)}.kb-picker-search{margin-top:8px}.kb-picker-header{padding:5px 14px}.kb-location-dialog.kb-location-picker{height:100dvh;max-height:100dvh}.kb-picker-status{font-size:11px}.kb-location-picker .kb-picker-place{min-height:64px;padding:10px 0}}

.kb-picker-map-loading{position:absolute;left:12px;top:12px;right:12px;margin:0!important;padding:8px 12px;background:#ffffffed;border-radius:8px;font-size:12px;color:#60788f;z-index:102;pointer-events:none}

/* The SVG tip is exactly the map center, without a rotation/anchor offset. */
.kb-picker-center-pin{width:32px;height:40px;border:0;border-radius:0;background:none;transform:translate(-50%,-100%);box-shadow:none;filter:drop-shadow(0 2px 3px #164b7850)}
.kb-picker-center-pin svg{display:block;width:32px;height:40px}

.kb-location-picker .kb-picker-query-retry{margin-left:8px;min-height:32px;padding:4px 9px;border:1px solid #d7e7fa;border-radius:7px;background:#f0f6ff;color:#1677ef;font-size:12px}

/* Map reload controls remain usable while location search is available. */
.kb-picker-map-loading {display:flex;align-items:center;justify-content:space-between;gap:10px;pointer-events:auto}
.kb-picker-map-loading[hidden],.kb-picker-static-map[hidden],.kb-picker-map-retry[hidden]{display:none!important}
.kb-location-picker .kb-picker-map-retry {flex:none;min-height:34px;padding:6px 10px;border:1px solid #cadcf3;border-radius:7px;background:#f1f6ff;color:#1268c8;font-size:12px}
.kb-picker-static-map {position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain;background:#edf2f7}
