/* workspace — domain styles; order is declared in index.html. */
/* —— 一级工作区：门户、智能体、聊天室、阅览室统一为整页切换 —— */
:root { --workspace-sidebar-width: 292px; }
.workspace-view { min-width: 0; min-height: 0; flex: 1; display: flex; overflow: hidden; background: var(--zs-paper); animation: workspace-in .18s ease-out; }
.workspace-surface { width: 100% !important; height: 100% !important; max-width: none; max-height: none; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.workspace-view .chat-room-modal { height: 100% !important; max-width: none; border-radius: 0; }
.workspace-view .chat-room-layout, .workspace-view .chat-room-sidebar, .workspace-view .chat-room-main, .workspace-view .chat-room-info-panel, .workspace-view .chat-room-list, .workspace-view .chat-room-slot-map, .workspace-view .chat-room-messages { min-height: 0; }
.workspace-view .chat-room-list, .workspace-view .chat-room-slot-map, .workspace-view .chat-room-messages, .workspace-view .chat-room-info-panel { overflow-y: auto; }
.workspace-view #chatRoomMessages { max-height: none; margin: 0; }

.workspace-home, .agents-lobby { min-height: 0; flex: 1; overflow-y: auto; padding: clamp(28px, 5vw, 72px); background: #f8f7f3; }
.workspace-home { position: relative; isolation: isolate; }
.workspace-home::before { content: ""; position: absolute; z-index: -1; inset: 0; opacity: .32; background-image: linear-gradient(rgba(184, 134, 11, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(184, 134, 11, .07) 1px, transparent 1px); background-size: 42px 42px; }
.home-heading, .lobby-heading { max-width: 980px; margin: 0 auto 30px; }
.home-heading h1, .lobby-heading h1 { margin: 3px 0 8px; color: var(--zs-ink); font-family: var(--zs-serif); font-size: clamp(1.75rem, 4vw, 2.875rem); letter-spacing: 0; line-height: 1.2; }
.home-heading h1 span { color: var(--zs-xun-deep); }
.home-heading p:last-child, .lobby-heading p { margin: 0; color: #756a5a; }
.home-card-grid { max-width: 1120px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: stretch; gap: 14px; margin: 0 auto; }
.home-card { position: relative; min-height: 220px; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; padding: 23px; overflow: hidden; border: 1px solid rgba(139, 101, 8, .26); border-top: 2px solid var(--zs-xun); border-radius: 7px; background: var(--zs-card); color: var(--zs-ink); cursor: pointer; text-align: left; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.home-card::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(184, 134, 11, .15); pointer-events: none; }
.home-card:hover { transform: translateY(-4px); border-color: rgba(139, 101, 8, .62); box-shadow: 0 14px 26px rgba(64, 45, 20, .12); }
.home-card-icon { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(139, 101, 8, .32); border-radius: 5px; background: #fffaf0; color: var(--zs-xun-deep); }
.home-card-icon svg { width: 22px; height: 22px; }
.home-card-copy { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.home-card-copy strong { font-family: var(--zs-serif); font-size: 1.375rem; letter-spacing: .08em; }
.home-card-copy > span { color: #62584b; font-size: 0.875rem; }
.home-card-copy small { min-height: 21px; margin-top: 8px; color: var(--zs-xun-deep); font-size: 0.75rem; line-height: 1.45; }
.home-card-arrow { position: absolute; top: 21px; right: 20px; width: 18px; height: 18px; color: rgba(139, 101, 8, .7); }
.home-card-admin { background: var(--zs-card); border-color: rgba(139, 101, 8, .26); }
.home-card-admin::before { position: absolute; top: 12px; right: 14px; padding: 3px 6px; border: 1px solid rgba(139, 101, 8, .3); border-radius: 4px; color: var(--zs-xun-deep); content: "管理"; font-size: 0.625rem; font-weight: 750; }
.home-progress { width: 100%; height: 4px; overflow: hidden; margin-top: 2px; border-radius: 4px; background: rgba(139, 101, 8, .15); }
.home-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--zs-xun); transition: width .25s ease; }
.agents-lobby { background: #fbfbfd; }
.lobby-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.lobby-count { flex: 0 0 auto; padding: 5px 9px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-hover); font-size: 0.75rem; font-weight: 700; }
.recent-agent-strip { max-width: 1120px; margin: 0 auto 24px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.strip-heading { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; }
.strip-heading strong { font-size: 0.8125rem; }
.strip-heading span { color: var(--muted); font-size: 0.6875rem; }
.recent-agent-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.recent-agent-card { min-width: 150px; height: 40px; padding: 0 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--text); cursor: pointer; font-size: 0.75rem; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.recent-agent-card:hover { border-color: #aaa5ef; background: var(--primary-soft); color: var(--primary-hover); }
.agent-gallery { max-width: 1120px; display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 13px; margin: 0 auto; }
.agent-gallery-card { min-height: 170px; display: flex; flex-direction: column; align-items: flex-start; padding: 19px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.agent-gallery-card:hover { transform: translateY(-3px); border-color: #aaa5ef; box-shadow: 0 12px 26px rgba(67, 56, 202, .1); }
.agent-gallery-card.placeholder { background: #f5f4f0; color: var(--muted); cursor: default; }
.agent-gallery-card.placeholder:hover { transform: none; border-color: var(--line); box-shadow: none; }
.agent-gallery-card.placeholder .agent-gallery-icon { background: #e9e5d9; color: #8d8069; }
.agent-gallery-card.placeholder .agent-gallery-action { color: #8d8069; }
.admin-user-search { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.admin-user-search select, .admin-user-search input { min-width: 0; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
.admin-user-search input { flex: 1; }
.prompt-overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.prompt-overview-heading strong { font-size: 0.875rem; }
.prompt-overview-heading p { margin: 4px 0 0; color: var(--muted); font-size: 0.6875rem; }
.prompt-overview-search { width: min(240px, 100%); height: 36px; margin: 0; }
.feature-prompt-overview { display: grid; gap: 7px; }
.feature-prompt-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.feature-prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feature-prompt-row details { margin-top: 8px; }
.feature-prompt-row summary { color: var(--primary); cursor: pointer; font-size: 0.75rem; }
.feature-prompt-row pre { max-height: 220px; overflow: auto; margin: 8px 0; padding: 9px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); color: var(--text); font: 0.75rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.agent-gallery-icon { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: #ebeaff; color: var(--primary-hover); font-family: var(--zs-serif); font-size: 1.25rem; font-weight: 800; }
.agent-gallery-icon img { width: 100%; height: 100%; object-fit: cover; }
.agent-gallery-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 6px; margin-top: 14px; }
.agent-gallery-copy strong { font-size: 1rem; }
.agent-gallery-copy span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: 0.75rem; line-height: 1.55; }
.agent-gallery-action { margin-top: 14px; color: var(--primary); font-size: 0.75rem; font-weight: 750; }
.lobby-composer-disabled { max-width: 1120px; min-height: 56px; display: flex; align-items: center; gap: 9px; margin: 28px auto 0; padding: 0 16px; border: 1px dashed var(--line-strong); border-radius: 7px; background: #f5f5f8; color: var(--muted); font-size: 0.8125rem; }
.lobby-composer-disabled svg { width: 18px; height: 18px; }
.agents-chat-view { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.agent-context { min-width: 0; display: flex; align-items: center; gap: 7px; padding: 3px 7px 3px 3px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; text-align: left; }
.agent-context:hover { background: var(--surface-soft); }
.agent-context > span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 6px; background: var(--primary-soft); color: var(--primary-hover); font-family: var(--zs-serif); font-size: 0.8125rem; font-weight: 800; }
.agent-context strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; }
.agent-context svg { width: 15px; height: 15px; color: var(--muted); }
.agent-context-menu { position: absolute; z-index: 25; top: 48px; left: 0; width: min(300px, calc(100vw - 40px)); padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-lg); }
.agent-context-menu p { margin: 0 0 10px; color: var(--muted); font-size: 0.75rem; line-height: 1.55; }
.agent-context-menu button { width: 100%; height: 36px; border: 0; border-radius: 6px; background: var(--primary-soft); color: var(--primary-hover); cursor: pointer; font-size: 0.75rem; font-weight: 700; }
.chat-title { position: relative; }
.suggested-question-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; max-width: 620px; margin: 19px auto 0; }
.suggested-question-list button { min-height: 34px; padding: 6px 10px; border: 1px solid #cbc8f5; border-radius: 6px; background: var(--surface); color: var(--primary-hover); cursor: pointer; font-size: 0.75rem; text-align: left; }
.suggested-question-list button:hover { background: var(--primary-soft); }
.mobile-workspace-nav { display: none; }
@keyframes workspace-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 820px) {
    .app-view { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    .workspace-view { min-height: 0; }
    .workspace-home, .agents-lobby { padding: 27px 16px 24px; }
    .home-card-grid { grid-template-columns: 1fr; gap: 10px; }
    .home-card { min-height: 78px; flex-direction: row; align-items: center; gap: 14px; padding: 14px 17px; }
    .home-card-icon { width: 44px; height: 44px; flex: 0 0 44px; }
    .home-card-copy { padding-right: 18px; }
    .home-card-copy strong { font-size: 1.1875rem; }
    .home-card-copy small { margin-top: 3px; }
    .home-progress { position: static; width: 100%; }
    .prompt-overview-heading { display: block; }
    .prompt-overview-search { width: 100%; margin-top: 8px; }
    .admin-user-search { flex-wrap: wrap; }
    .admin-user-search select, .admin-user-search input { flex: 1 1 100%; }
    .lobby-heading { display: block; margin-bottom: 21px; }
    .lobby-count { display: inline-block; margin-top: 9px; }
    .agent-gallery { grid-template-columns: 1fr; gap: 9px; }
    .agent-gallery-card { min-height: 126px; display: grid; grid-template-columns: 42px minmax(0, 1fr); column-gap: 13px; padding: 15px; }
    .agent-gallery-copy { margin: 0; }
    .agent-gallery-action { grid-column: 2; margin-top: 8px; }
    .mobile-workspace-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; height: calc(64px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 5px 8px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .97); }
    .mobile-workspace-nav button { min-width: 0; display: grid; place-items: center; gap: 1px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.625rem; }
    .mobile-workspace-nav button svg { width: 18px; height: 18px; }
    .mobile-workspace-nav button.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 750; }
    .workspace-view .reading-room-modal, .workspace-view .chat-room-modal { height: 100% !important; }
    .workspace-view .reading-room-modal { border-radius: 0 !important; }
}

