:root {
    --zy-bg: #f6f7f8;
    --zy-surface: #ffffff;
    --zy-surface-soft: #f3f5f4;
    --zy-surface-raised: #ffffff;
    --zy-sidebar: #f2f4f3;
    --zy-border: #e1e5e4;
    --zy-border-strong: #c9d0ce;
    --zy-text: #151719;
    --zy-text-soft: #4f5755;
    --zy-muted: #66706e;
    --zy-primary: #0f766e;
    --zy-primary-strong: #0b5f59;
    --zy-primary-soft: #e7f2f0;
    --zy-success: #15805d;
    --zy-warning: #b36b00;
    --zy-danger: #c93f4b;
    --zy-shadow-sm: none;
    --zy-shadow-lg: 0 18px 54px rgba(18, 27, 25, .18);
    --zy-radius-sm: 6px;
    --zy-radius-md: 8px;
    --zy-radius-lg: 12px;
    --zy-rail-width: 52px;
    --zy-explorer-width: 228px;
    --zy-topbar-height: 56px;
    --zy-tabs-height: 38px;
    --zy-content-max: 960px;
    --zy-base-accent: #0f766e;
}

:root[data-theme="dark"] {
    --zy-bg: #101312;
    --zy-surface: #151918;
    --zy-surface-soft: #1b201f;
    --zy-surface-raised: #1c2220;
    --zy-sidebar: #121615;
    --zy-border: #29302e;
    --zy-border-strong: #3d4744;
    --zy-text: #f2f5f4;
    --zy-text-soft: #c0c8c6;
    --zy-muted: #9ba5a2;
    --zy-primary: #42b7aa;
    --zy-primary-strong: #68c9bd;
    --zy-primary-soft: #173835;
    --zy-success: #52c69b;
    --zy-warning: #e9a94c;
    --zy-danger: #ff7782;
    --zy-shadow-sm: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .18);
    --zy-shadow-lg: 0 24px 72px rgba(0, 0, 0, .46);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
    margin: 0;
    color: var(--zy-text);
    background: var(--zy-bg);
    font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--zy-primary) 34%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.zy-shell { display: grid; grid-template-columns: var(--zy-rail-width) var(--zy-explorer-width) minmax(0, 1fr); width: 100vw; height: 100vh; background: var(--zy-bg); }
.zy-shell.explorer-collapsed { grid-template-columns: var(--zy-rail-width) 0 minmax(0, 1fr); }
.zy-shell.explorer-collapsed .zy-explorer { visibility: hidden; overflow: hidden; opacity: 0; pointer-events: none; transform: translateX(-10px); }
.zy-shell.explorer-collapsed .explorer-open { display: inline-grid !important; }

/* Product rail */
.product-rail {
    position: relative;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: var(--zy-rail-width);
    padding: 14px 8px 12px;
    border-right: 1px solid var(--zy-border);
    background: var(--zy-surface);
}
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 14px; }
.brand-mark img { width: 44px; height: 44px; object-fit: contain; }
.rail-link { position: relative; display: grid; place-items: center; width: 48px; height: 48px; color: var(--zy-text-soft); border-radius: 13px; text-decoration: none; }
.rail-link:hover { color: var(--zy-text); background: var(--zy-surface-soft); }
.rail-link.active { color: var(--zy-primary); background: var(--zy-primary-soft); }
.rail-link.active::before { content: ""; position: absolute; left: -8px; width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: var(--zy-primary); }
.rail-link span { position: absolute; left: calc(100% + 8px); z-index: 80; min-width: max-content; padding: 6px 9px; color: var(--zy-surface); background: var(--zy-text); border-radius: 7px; font-size: 12px; opacity: 0; pointer-events: none; transform: translateX(-3px); }
.rail-link:hover span { opacity: 1; transform: translateX(0); }
.account-anchor { margin-top: auto; }
.account-button { width: 46px; height: 46px; border: 1px solid var(--zy-border); border-radius: 50%; color: var(--zy-text); background: var(--zy-surface-soft); }

/* Explorer */
.zy-explorer { position: relative; z-index: 30; display: flex; min-width: 0; flex-direction: column; height: 100vh; overflow: visible; border-right: 1px solid var(--zy-border); background: var(--zy-sidebar); }
.explorer-header { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 12px 0 14px; }
.explorer-brand { display: flex; align-items: center; gap: 10px; }
.explorer-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--zy-primary); background: var(--zy-primary-soft); }
.explorer-brand > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.explorer-brand strong { font-size: 18px; line-height: 1.2; }
.explorer-brand small { color: var(--zy-muted); font-size: 11px; }
.explorer-close { display: inline-grid !important; }
.explorer-open { display: none !important; }
.explorer-launcher {
    position: fixed;
    top: 10px;
    left: calc(var(--zy-rail-width) + 10px);
    z-index: 41;
    border-radius: 6px;
}

.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--zy-text-soft); border: 1px solid transparent; border-radius: 10px; background: transparent; }
.icon-button:hover { color: var(--zy-text); border-color: var(--zy-border); background: var(--zy-surface); }
.primary-button, .secondary-button, .text-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border-radius: 10px; font-weight: 650; white-space: nowrap; }
.primary-button { color: #f8fbff; background: var(--zy-primary); box-shadow: 0 5px 14px color-mix(in srgb, var(--zy-primary) 22%, transparent); }
.primary-button:hover { background: var(--zy-primary-strong); }
.secondary-button { color: var(--zy-text); border: 1px solid var(--zy-border); background: var(--zy-surface); }
.secondary-button:hover { border-color: var(--zy-border-strong); background: var(--zy-surface-soft); }
.secondary-button.square { width: 44px; padding: 0; }
.primary-button.compact, .secondary-button.compact { min-height: 36px; padding: 0 12px; font-size: 13px; }
.text-button { color: var(--zy-text-soft); background: transparent; }
.text-button:hover { color: var(--zy-primary); background: var(--zy-primary-soft); }
.danger-text-button { min-height: 40px; padding: 0 8px; color: var(--zy-danger); background: transparent; font-weight: 650; }

.base-directory { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 10px 8px 0; }
.base-directory > header { display: flex; min-height: 32px; align-items: center; padding: 0 8px; color: var(--zy-muted); font-size: 12px; font-weight: 650; }
.base-directory-tools { display: flex; align-items: center; gap: 6px; padding: 0 6px 10px; }
.base-search { display: flex; min-width: 0; height: 34px; flex: 1; align-items: center; gap: 7px; padding: 0 9px; color: var(--zy-muted); border: 1px solid var(--zy-border); border-radius: 6px; background: var(--zy-surface); }
.base-search:focus-within { border-color: var(--zy-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--zy-primary) 14%, transparent); }
.base-search svg { width: 15px; height: 15px; flex: 0 0 auto; }
.base-search input { width: 100%; min-width: 0; color: var(--zy-text); border: 0; outline: 0; background: transparent; font: inherit; font-size: 12px; }
.base-search input::placeholder { color: var(--zy-muted); }
.base-search input::-webkit-search-cancel-button { display: none; }
.base-create-button { width: 34px; height: 34px; flex: 0 0 34px; color: var(--zy-primary); border-color: color-mix(in srgb, var(--zy-primary) 24%, var(--zy-border)); background: color-mix(in srgb, var(--zy-primary) 10%, var(--zy-surface)); }
.base-create-button:hover, .base-create-button:focus-visible { color: #fff; border-color: var(--zy-primary); background: var(--zy-primary); }
.base-list { display: grid; gap: 2px; min-height: 0; overflow: auto; padding-bottom: 14px; scrollbar-width: thin; scrollbar-color: var(--zy-border-strong) transparent; }
.base-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; min-height: 40px; align-items: center; }
.base-option { display: grid; grid-template-columns: 30px minmax(0, 1fr); min-width: 0; align-items: center; gap: 9px; min-height: 40px; padding: 0 8px; color: var(--zy-text-soft); border-radius: 0; text-align: left; background: transparent; }
.base-option:hover { color: var(--zy-text); background: transparent; }
.base-row.active .base-option { color: var(--zy-primary); background: transparent; box-shadow: inset 1px 0 var(--zy-primary); }
.base-row.active .base-option strong { font-weight: 700; }
.base-option-avatar { display: grid; width: 30px; height: 30px; place-items: center; overflow: hidden; color: #f8fbff; border-radius: 5px; background: var(--zy-base-accent); }
.base-option-avatar svg { width: 17px; height: 17px; }
.base-option-avatar img { width: 100%; height: 100%; object-fit: cover; }
.base-option strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.base-menu { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; color: var(--zy-muted); border-radius: 5px; background: transparent; opacity: 0; }
.base-menu:hover, .base-menu:focus-visible { color: var(--zy-text); background: var(--zy-surface-soft); opacity: 1; }
.base-row:hover .base-menu, .base-row:focus-within .base-menu, .base-row.active .base-menu { opacity: 1; }
.base-menu svg { width: 16px; height: 16px; }
.base-filter-empty { margin: 4px 8px; color: var(--zy-muted); font-size: 12px; line-height: 1.5; }

/* Main chrome */
.zy-main { position: relative; display: flex; min-width: 0; height: 100vh; flex-direction: column; overflow: hidden; background: var(--zy-bg); }
.zy-topbar { position: relative; z-index: 12; display: flex; min-height: var(--zy-topbar-height); align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--zy-border); background: color-mix(in srgb, var(--zy-surface) 94%, transparent); backdrop-filter: blur(18px); }
.breadcrumb { display: flex; min-width: 0; align-items: center; gap: 4px; color: var(--zy-text-soft); font-size: 13px; }
.breadcrumb button { display: inline-flex; max-width: 190px; min-height: 34px; align-items: center; gap: 7px; padding: 0 7px; overflow: hidden; color: inherit; background: transparent; border-radius: 8px; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb button:hover { color: var(--zy-text); background: var(--zy-surface-soft); }
.breadcrumb i { color: var(--zy-muted); font-style: normal; }
.global-search { display: flex; width: min(370px, 34vw); height: 40px; align-items: center; gap: 8px; margin-left: auto; padding: 0 10px; color: var(--zy-muted); border: 1px solid var(--zy-border); border-radius: 10px; background: var(--zy-surface-soft); }
.global-search:focus-within { border-color: var(--zy-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--zy-primary) 14%, transparent); }
.global-search svg { width: 16px; }
.global-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; }
.global-search kbd { padding: 2px 5px; color: var(--zy-muted); border: 1px solid var(--zy-border); border-radius: 5px; background: var(--zy-surface); font-size: 10px; }
.topbar-actions { display: flex; gap: 8px; }
.top-import-action { color: var(--zy-primary); border-color: color-mix(in srgb, var(--zy-primary) 22%, var(--zy-border)); background: var(--zy-primary-soft); }
.top-import-action:hover { color: var(--zy-primary-strong); border-color: color-mix(in srgb, var(--zy-primary) 40%, var(--zy-border)); background: color-mix(in srgb, var(--zy-primary-soft) 82%, var(--zy-surface)); }

/* Browser */
.browser-view, .search-view { flex: 1; overflow: auto; padding: 18px clamp(22px, 3.2vw, 52px) 64px; }
.browser-view > *, .search-view > * { width: min(100%, var(--zy-content-max)); margin-right: auto; margin-left: auto; }
.collection-header { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 18px; }
.collection-heading-copy { min-width: 0; }
.collection-context { display: block; margin-bottom: 6px; color: var(--zy-muted); font-size: 12px; font-weight: 650; }
.collection-header h1, .search-view h1 { margin: 0; font-size: 30px; line-height: 1.18; letter-spacing: -.02em; }
.collection-header p, .search-view p { max-width: 650px; margin: 9px 0 0; color: var(--zy-text-soft); font-size: 14px; line-height: 1.7; }
.collection-actions { display: flex; align-items: center; gap: 7px; }
.header-new-document { flex: 0 0 auto; }
.view-toggle { display: flex; padding: 3px; border: 1px solid var(--zy-border); border-radius: 10px; background: var(--zy-surface); }
.view-toggle button { display: grid; width: 34px; height: 32px; place-items: center; color: var(--zy-muted); border-radius: 7px; background: transparent; }
.view-toggle button.active { color: var(--zy-primary); background: var(--zy-primary-soft); }
.view-toggle svg { width: 16px; }
.sort-select select { height: 40px; padding: 0 31px 0 11px; color: var(--zy-text-soft); border: 1px solid var(--zy-border); border-radius: 10px; outline: 0; background: var(--zy-surface); font-size: 12px; }
.welcome-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; min-height: 76px; margin-top: 12px; padding: 16px 0; border-bottom: 1px solid var(--zy-border); }
.welcome-visual { display: none; }
.welcome-visual svg { width: 22px; height: 22px; }
.welcome-card strong { font-size: 16px; }
.welcome-card p { margin: 6px 0 0; color: var(--zy-text-soft); font-size: 13px; }
.welcome-actions { display: flex; gap: 8px; }
.content-section { margin-top: 28px; }
.content-section > header { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 8px; }
.content-section > header > div { min-width: 0; }
.content-section h2 { margin: 0; font-size: 15px; }
.content-section header p { margin: 3px 0 0; color: var(--zy-muted); font-size: 12px; }
.content-section header small { min-width: 22px; padding: 2px 7px; color: var(--zy-muted); border-radius: 999px; background: var(--zy-surface-soft); font-size: 11px; text-align: center; }
.folder-collection, .document-collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; margin-top: 10px; }
.folder-card, .document-card { position: relative; min-width: 0; border: 1px solid var(--zy-border); border-radius: 13px; background: var(--zy-surface); box-shadow: var(--zy-shadow-sm); }
.folder-card:hover, .document-card:hover { border-color: color-mix(in srgb, var(--zy-base-accent) 34%, var(--zy-border)); transform: translateY(-1px); }
.folder-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) 34px; min-height: 80px; align-items: center; gap: 10px; padding: 12px; text-align: left; }
.folder-card > button:first-child { position: absolute; inset: 0; z-index: 1; border-radius: inherit; background: transparent; }
.folder-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--zy-base-accent); border-radius: 11px; background: color-mix(in srgb, var(--zy-base-accent) 11%, var(--zy-surface)); }
.folder-card-copy { min-width: 0; }
.folder-card-copy strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.folder-card .card-menu, .document-card .card-menu { position: relative; z-index: 2; }
.card-menu { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; color: var(--zy-muted); border-radius: 8px; background: transparent; }
.card-menu:hover { color: var(--zy-text); background: var(--zy-surface-soft); }
.card-menu svg { width: 16px; }
.document-card { display: flex; min-height: 154px; flex-direction: column; padding: 15px; text-align: left; }
.document-card-open { position: absolute; inset: 0; z-index: 1; border-radius: inherit; background: transparent; }
.document-card-head { display: flex; align-items: flex-start; justify-content: space-between; }
.file-badge { display: grid; width: 36px; height: 36px; place-items: center; color: var(--zy-primary); border-radius: 10px; background: var(--zy-primary-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.file-badge.pdf { color: var(--zy-danger); background: color-mix(in srgb, var(--zy-danger) 10%, var(--zy-surface)); }
.file-badge.docx { color: #2f64d6; background: #edf3ff; }
.file-badge.xlsx { color: var(--zy-success); background: color-mix(in srgb, var(--zy-success) 10%, var(--zy-surface)); }
.document-card .card-menu { z-index: 2; }
.document-card h3 { margin: 15px 0 7px; overflow: hidden; font-size: 14px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.document-card p { display: -webkit-box; min-height: 34px; margin: 0; overflow: hidden; color: var(--zy-text-soft); font-size: 12px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.document-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 13px; color: var(--zy-muted); font-size: 10px; }
.editable-pill { padding: 3px 7px; color: var(--zy-success); border-radius: 999px; background: color-mix(in srgb, var(--zy-success) 10%, var(--zy-surface)); }
.empty-collection { grid-column: 1 / -1; display: grid; min-height: 180px; place-items: center; padding: 28px; color: var(--zy-muted); border: 1px dashed var(--zy-border-strong); border-radius: 14px; text-align: center; }
.empty-collection div { display: flex; align-items: center; flex-direction: column; gap: 9px; }
.empty-collection svg { width: 28px; height: 28px; }
.empty-collection strong { color: var(--zy-text-soft); font-size: 14px; }
.empty-collection p { max-width: 330px; margin: 0; font-size: 12px; line-height: 1.6; }
.document-collection.list, .folder-collection.list { grid-template-columns: 1fr; gap: 7px; }
.recent-collection { margin-top: 8px; }
.document-collection.list .document-card { display: grid; grid-template-columns: 42px minmax(200px, 1fr) minmax(220px, 1.4fr) auto; min-height: 66px; align-items: center; gap: 12px; padding: 9px 12px; }
.document-collection.list .document-card-head { display: contents; }
.document-collection.list .file-badge { grid-column: 1; grid-row: 1; }
.document-collection.list .document-card h3 { grid-column: 2; grid-row: 1; margin: 0; }
.document-collection.list .document-card p { grid-column: 3; grid-row: 1; min-height: auto; -webkit-line-clamp: 1; }
.document-collection.list .document-card footer { grid-column: 4; grid-row: 1; margin: 0; padding: 0; }
.document-collection.list .document-card .card-menu { position: absolute; right: 8px; }
.document-collection.list .document-card footer { padding-right: 35px; }
.folder-collection.list .folder-card { min-height: 62px; }

/* Document workspace */
.document-workspace { position: relative; display: flex; min-height: 0; flex: 1; flex-direction: column; background: var(--zy-bg); }
.document-header { position: relative; z-index: 6; display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 18px 8px 22px; border-bottom: 1px solid var(--zy-border); background: color-mix(in srgb, var(--zy-surface) 94%, transparent); backdrop-filter: blur(16px); }
.document-identity { display: flex; min-width: 0; align-items: center; gap: 12px; }
.document-format-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; color: var(--zy-primary); border-radius: 10px; background: var(--zy-primary-soft); }
.document-identity > div:last-child { min-width: 0; }
.document-title-input { display: block; width: min(620px, 48vw); padding: 2px 4px; color: var(--zy-text); border: 1px solid transparent; border-radius: 6px; outline: 0; background: transparent; font-size: 16px; font-weight: 720; }
.document-title-input:hover, .document-title-input:focus { border-color: var(--zy-border); background: var(--zy-surface-soft); }
.document-identity p { margin: 4px 4px 0; color: var(--zy-muted); font-size: 11px; }
.document-header-actions { display: flex; align-items: center; gap: 6px; }
.document-outline-button svg { width: 17px; height: 17px; }
.document-outline-panel { position: absolute; top: 72px; right: 16px; z-index: 18; display: flex; width: min(348px, calc(100% - 32px)); max-height: min(560px, calc(100% - 88px)); flex-direction: column; overflow: hidden; border: 1px solid var(--zy-border-strong); border-radius: 10px; background: var(--zy-surface-raised); box-shadow: 0 18px 48px rgba(15, 23, 42, .16), 0 3px 10px rgba(15, 23, 42, .08); }
.document-outline-panel[hidden] { display: none; }
.document-outline-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--zy-border); }
.document-outline-header > div { display: flex; min-width: 0; align-items: center; gap: 10px; }
.document-outline-icon { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; color: var(--zy-primary); border-radius: 7px; background: var(--zy-primary-soft); }
.document-outline-icon svg { width: 16px; height: 16px; }
.document-outline-header strong, .document-outline-header small { display: block; }
.document-outline-header strong { font-size: 13px; }
.document-outline-header small { margin-top: 2px; color: var(--zy-muted); font-size: 10px; }
.document-outline-list { min-height: 0; overflow: auto; padding: 8px; scrollbar-color: var(--zy-border-strong) transparent; }
.document-outline-list button { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 8px; padding-top: 6px; padding-right: 10px; padding-bottom: 6px; color: var(--zy-text-soft); border: 0; border-radius: 6px; background: transparent; font-size: 12px; text-align: left; }
.document-outline-list button:hover, .document-outline-list button:focus-visible { color: var(--zy-text); background: var(--zy-surface-soft); }
.document-outline-list button svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--zy-primary); }
.document-outline-list button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-status { min-width: 48px; margin-right: 5px; color: var(--zy-muted); font-size: 11px; text-align: right; }
.save-status.saving { color: var(--zy-warning); }
.save-status.error { color: var(--zy-danger); }
.document-toolbar { position: relative; z-index: 5; display: flex; min-height: 48px; align-items: center; gap: 12px; padding: 6px 18px 6px 22px; border-bottom: 1px solid var(--zy-border); background: var(--zy-surface); }
.mode-switch { display: flex; padding: 3px; border: 1px solid var(--zy-border); border-radius: 9px; background: var(--zy-surface); }
.mode-switch button { min-width: 56px; height: 30px; padding: 0 11px; color: var(--zy-text-soft); border-radius: 6px; background: transparent; font-size: 12px; font-weight: 600; }
.mode-switch button.active { color: var(--zy-text); background: var(--zy-primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--zy-primary) 16%, transparent); }
.readonly-banner { display: flex; align-items: center; gap: 9px; color: var(--zy-text-soft); font-size: 12px; }
.readonly-banner > svg { width: 15px; color: var(--zy-warning); }
.document-toolbar-spacer { flex: 1; }
.document-stage { position: relative; min-height: 0; flex: 1; overflow: hidden; background: radial-gradient(circle at 50% -20%, color-mix(in srgb, var(--zy-base-accent) 7%, transparent), transparent 42%), var(--zy-bg); }
.document-stage[data-mode="read"] { overflow: auto; }
.markdown-reader, .markdown-preview { width: min(calc(100% - 44px), 900px); min-height: calc(100% - 56px); margin: 28px auto 52px; padding: 58px clamp(34px, 6vw, 76px) 92px; color: var(--zy-text); border: 1px solid var(--zy-border); border-radius: 16px; background: var(--zy-surface); box-shadow: 0 20px 60px rgba(15, 23, 42, .07), 0 2px 8px rgba(15, 23, 42, .04); font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif; font-size: 16px; line-height: 1.86; }
.markdown-reader > :first-child, .markdown-preview > :first-child { margin-top: 0; }
.markdown-reader h1, .markdown-preview h1 { margin: 0 0 28px; font-family: "SF Pro Display", "PingFang SC", system-ui, sans-serif; font-size: 34px; line-height: 1.24; letter-spacing: -.025em; }
.markdown-reader h2, .markdown-preview h2 { margin: 38px 0 16px; font-family: "SF Pro Display", "PingFang SC", system-ui, sans-serif; font-size: 24px; line-height: 1.3; }
.markdown-reader h3, .markdown-preview h3 { margin: 30px 0 12px; font-family: "SF Pro Display", "PingFang SC", system-ui, sans-serif; font-size: 19px; }
.markdown-reader :is(h1, h2, h3, h4, h5, h6), .markdown-preview :is(h1, h2, h3, h4, h5, h6), .toastui-editor-contents :is(h1, h2, h3, h4, h5, h6) { padding-bottom: 0 !important; border-bottom: 0 !important; }
.markdown-reader p, .markdown-preview p { margin: 0 0 18px; }
.markdown-reader a, .markdown-preview a { color: var(--zy-primary); text-underline-offset: 3px; }
.markdown-reader blockquote, .markdown-preview blockquote { margin: 22px 0; padding: 2px 0 2px 18px; color: var(--zy-text-soft); border-left: 1px solid var(--zy-base-accent); }
.markdown-reader code, .markdown-preview code { padding: 2px 5px; border-radius: 5px; background: var(--zy-surface-soft); font-family: "SFMono-Regular", Consolas, monospace; font-size: .88em; }
.markdown-reader pre, .markdown-preview pre { overflow: auto; padding: 17px; border: 1px solid var(--zy-border); border-radius: 11px; background: var(--zy-surface-soft); }
.markdown-reader pre code, .markdown-preview pre code { padding: 0; background: transparent; }
.markdown-reader table, .markdown-preview table { width: 100%; margin: 20px 0; border-collapse: collapse; font-family: "SF Pro Display", "PingFang SC", system-ui, sans-serif; font-size: 13px; }
.markdown-reader th, .markdown-reader td, .markdown-preview th, .markdown-preview td { padding: 10px 12px; border: 1px solid var(--zy-border); text-align: left; }
.markdown-reader th, .markdown-preview th { background: var(--zy-surface-soft); }
.markdown-reader img, .markdown-preview img { max-width: 100%; border-radius: 10px; }
.markdown-editor, .split-editor, #markdownSourceEditor { width: 100%; height: 100%; }
.markdown-editor { width: min(calc(100% - 44px), 1120px); height: calc(100% - 44px); margin: 22px auto; overflow: hidden; border: 1px solid var(--zy-border); border-radius: 14px; background: var(--zy-surface); box-shadow: 0 18px 52px rgba(15, 23, 42, .08); }
.split-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split-editor > article { width: 100%; height: 100%; margin: 0; overflow: auto; border: 0; border-left: 1px solid var(--zy-border); border-radius: 0; box-shadow: none; }
.document-stage[data-mode="split"] .split-editor { width: min(calc(100% - 44px), 1360px); height: calc(100% - 44px); margin: 22px auto; overflow: hidden; border: 1px solid var(--zy-border); border-radius: 14px; background: var(--zy-surface); box-shadow: 0 18px 52px rgba(15, 23, 42, .08); }
.toastui-editor-defaultUI { height: 100% !important; border: 0 !important; border-radius: inherit !important; background: var(--zy-surface) !important; }
.toastui-editor-toolbar { border-bottom-color: var(--zy-border) !important; background: var(--zy-surface-soft) !important; }
.toastui-editor-main, .toastui-editor-main-container, .toastui-editor-ww-container, .toastui-editor-md-container { background: var(--zy-surface) !important; }
.toastui-editor-contents, .toastui-editor-md-container .CodeMirror { color: var(--zy-text) !important; font-size: 15px !important; }
.toastui-editor-ww-container .toastui-editor-contents { width: min(calc(100% - 56px), 820px); margin: 0 auto; padding: 42px 0 90px !important; }
.toastui-editor-md-container .CodeMirror-lines { padding: 28px 24px 80px !important; }
#markdownSourceEditor .toastui-editor-md-tab-container { display: none !important; }
#markdownSourceEditor .toastui-editor-md-container { width: 100% !important; }
#markdownSourceEditor .toastui-editor-md-preview { display: none !important; }
:root[data-theme="dark"] .toastui-editor-defaultUI { color: var(--zy-text); background: var(--zy-surface); }
:root[data-theme="dark"] .toastui-editor-toolbar-icons { filter: invert(.8); }
.original-preview { width: 100%; height: 100%; overflow: auto; }
.original-preview iframe { width: 100%; height: 100%; border: 0; background: #fbfdff; }
.original-summary { display: flex; align-items: center; gap: 12px; margin: 20px auto; padding: 14px 16px; width: min(calc(100% - 40px), 920px); border: 1px solid var(--zy-border); border-radius: 12px; background: var(--zy-surface-soft); }
.original-summary > div { min-width: 0; flex: 1; }
.original-summary strong, .original-summary p { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.original-summary p { margin-top: 4px; color: var(--zy-muted); font-size: 11px; }
.original-summary .secondary-button { margin-left: auto; }
.pdf-preview { height: calc(100% - 110px) !important; border-top: 1px solid var(--zy-border) !important; }
.plain-document-preview { width: min(calc(100% - 40px), 920px); min-height: 420px; margin: 0 auto 80px; padding: 30px; white-space: pre-wrap; color: var(--zy-text); border: 1px solid var(--zy-border); border-radius: 12px; background: var(--zy-surface-soft); font-family: "SF Pro Display", "PingFang SC", system-ui, sans-serif; font-size: 14px; line-height: 1.75; }
.markdown-reader.embedded { min-height: auto; padding-top: 20px; }
.editor-load-error { display: grid; min-height: 420px; place-items: center; color: var(--zy-danger); }
.text-preview { width: min(100%, 920px); min-height: 100%; margin: 0 auto; padding: 44px 56px 90px; }
.original-file-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; padding: 14px 16px; border: 1px solid var(--zy-border); border-radius: 12px; background: var(--zy-surface-soft); }
.original-file-summary .file-badge { flex: 0 0 auto; }
.original-file-summary div { min-width: 0; }
.original-file-summary strong, .original-file-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.original-file-summary small { margin-top: 4px; color: var(--zy-muted); font-size: 11px; }
.extracted-content { white-space: pre-wrap; color: var(--zy-text); font-size: 14px; line-height: 1.75; }
.zy-shell.immersive { grid-template-columns: 0 0 minmax(0, 1fr); background: var(--zy-bg); }
.zy-shell.immersive .product-rail, .zy-shell.immersive .zy-explorer { visibility: hidden; overflow: hidden; }
.zy-shell.immersive .zy-topbar { display: none; }
.zy-shell.immersive .document-workspace { position: relative; }
.zy-shell.immersive .document-header { position: absolute; top: 14px; right: 16px; z-index: 30; min-height: 42px; padding: 3px; border: 1px solid color-mix(in srgb, var(--zy-border) 82%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--zy-surface) 86%, transparent); box-shadow: var(--zy-shadow-sm); backdrop-filter: blur(18px); }
.zy-shell.immersive .document-identity, .zy-shell.immersive #documentMeta { display: none; }
.zy-shell.immersive .save-status { margin: 0 5px 0 8px; }
.zy-shell.immersive .document-toolbar { display: none; }
.zy-shell.immersive .document-header-actions #askDocumentButton,
.zy-shell.immersive .document-header-actions #moveDocumentButton,
.zy-shell.immersive .document-header-actions #downloadOriginalButton,
.zy-shell.immersive .document-header-actions #documentOutlineButton { display: none; }
.zy-shell.immersive .document-outline-panel { display: none; }
.zy-shell.immersive .document-stage { height: 100%; }
.zy-shell.immersive .markdown-reader { width: min(calc(100% - 64px), 940px); min-height: calc(100% - 64px); margin: 32px auto; padding: 76px clamp(48px, 7vw, 92px) 120px; }
.zy-shell.immersive .markdown-editor,
.zy-shell.immersive .document-stage[data-mode="split"] .split-editor { width: min(calc(100% - 36px), 1440px); height: calc(100% - 36px); margin: 18px auto; border-radius: 16px; }

/* Search */
.search-view > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--zy-border); }
.search-results { display: grid; gap: 10px; margin-top: 20px; }
.search-result { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: start; gap: 13px; padding: 15px; text-align: left; border: 1px solid var(--zy-border); border-radius: 12px; background: var(--zy-surface); }
.search-result:hover { border-color: color-mix(in srgb, var(--zy-base-accent) 36%, var(--zy-border)); }
.search-result > span:nth-child(2) { min-width: 0; }
.search-result > span:nth-child(2) strong { display: block; margin-bottom: 5px; font-size: 14px; }
.search-result > span:nth-child(2) p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--zy-text-soft); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.search-result > span:nth-child(2) small { display: block; margin-top: 7px; color: var(--zy-muted); font-size: 10px; }
.search-loading { display: flex; justify-content: center; gap: 6px; padding: 50px; }
.search-loading span { width: 7px; height: 7px; border-radius: 50%; background: var(--zy-primary); animation: zyPulse 1.2s infinite ease-in-out; }
.search-loading span:nth-child(2) { animation-delay: .14s; }.search-loading span:nth-child(3) { animation-delay: .28s; }
@keyframes zyPulse { 0%, 80%, 100% { opacity: .25; transform: scale(.75); } 40% { opacity: 1; transform: scale(1); } }
.search-result-copy strong { display: block; margin-bottom: 5px; font-size: 14px; }
.search-result-copy p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--zy-text-soft); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.search-result em { padding: 3px 7px; color: var(--zy-success); border-radius: 999px; background: color-mix(in srgb, var(--zy-success) 10%, var(--zy-surface)); font-size: 10px; font-style: normal; }

/* Dialogs and overlays */
dialog { color: var(--zy-text); }
dialog::backdrop { background: rgba(12, 18, 28, .48); backdrop-filter: blur(4px); }
.zy-dialog { width: min(94vw, 590px); max-height: 88vh; padding: 0; overflow: hidden; border: 1px solid var(--zy-border); border-radius: 18px; background: var(--zy-surface); box-shadow: var(--zy-shadow-lg); }
.zy-dialog.compact-dialog { width: min(92vw, 470px); }
.zy-dialog form { display: flex; max-height: 88vh; flex-direction: column; }
.zy-dialog header, .import-drawer header { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 16px 13px 20px; border-bottom: 1px solid var(--zy-border); }
.zy-dialog header > div, .import-drawer header > div { display: flex; align-items: center; gap: 11px; }
.zy-dialog .base-dialog-header { min-height: 56px; padding: 10px 16px 10px 22px; }
.dialog-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; color: var(--zy-primary); border-radius: 10px; background: var(--zy-primary-soft); }
.zy-dialog header strong, .import-drawer header strong { display: block; font-size: 15px; }
.zy-dialog header small, .import-drawer header small { display: block; margin-top: 3px; color: var(--zy-muted); font-size: 11px; }
.dialog-body { display: grid; gap: 18px; padding: 22px; overflow: auto; }
.field { display: grid; gap: 7px; }
.field > span, fieldset legend { color: var(--zy-text-soft); font-size: 12px; font-weight: 650; }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--zy-text); border: 1px solid var(--zy-border); border-radius: 10px; outline: 0; background: var(--zy-surface-soft); resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--zy-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--zy-primary) 13%, transparent); }
.icon-picker, .color-picker { margin: 0; padding: 0; border: 0; }
.icon-picker { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 14px; }
.icon-picker legend, .color-picker legend { margin-bottom: 8px; }
.icon-preview { display: grid; width: 52px; height: 52px; place-items: center; overflow: hidden; color: #f8fbff; border-radius: 10px; background: var(--zy-base-accent); }
.icon-preview svg { width: 23px; height: 23px; }
.icon-preview img { width: 100%; height: 100%; object-fit: cover; }
.icon-picker-controls { display: grid; gap: 9px; min-width: 0; }
.base-icon-options { display: grid; grid-template-columns: repeat(6, 36px); gap: 6px; }
.base-icon-options button { display: grid; width: 36px; height: 36px; place-items: center; overflow: hidden; padding: 0; border: 1px solid var(--zy-border); border-radius: 7px; background: var(--zy-surface-soft); }
.base-icon-options button img { width: 100%; height: 100%; object-fit: cover; }
.base-icon-options button:hover, .base-icon-options button.active { border-color: var(--zy-primary); box-shadow: 0 0 0 2px var(--zy-primary-soft); }
.custom-icon-upload { display: grid; width: 36px; height: 36px; place-items: center; padding: 0; color: var(--zy-text-soft); border: 1px dashed var(--zy-border-strong); border-radius: 7px; background: transparent; cursor: pointer; }
.custom-icon-upload:hover, .custom-icon-upload:focus-within, .custom-icon-upload.active { color: var(--zy-primary); border-color: color-mix(in srgb, var(--zy-primary) 52%, var(--zy-border)); background: var(--zy-primary-soft); }
.custom-icon-upload.loading { cursor: progress; opacity: .58; pointer-events: none; }
.custom-icon-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.custom-icon-upload svg { width: 16px; height: 16px; }
.color-picker > div { display: flex; align-items: center; gap: 11px; }
.color-picker #baseColorOptions { display: flex; gap: 9px; }
.color-picker button { width: 28px; height: 28px; border: 3px solid var(--zy-surface); border-radius: 50%; background: var(--color); box-shadow: 0 0 0 1px var(--zy-border); }
.color-picker button:nth-child(1) { --color: #2563eb; }.color-picker button:nth-child(2) { --color: #0f766e; }.color-picker button:nth-child(3) { --color: #7c3aed; }.color-picker button:nth-child(4) { --color: #b45309; }.color-picker button:nth-child(5) { --color: #be123c; }.color-picker button:nth-child(6) { --color: #334155; }
.color-picker button.active { box-shadow: 0 0 0 2px var(--zy-text), 0 0 0 4px var(--zy-surface); }
.custom-color-control { display: inline-flex; min-height: 30px; align-items: center; gap: 6px; padding: 0 8px; color: var(--zy-text-soft); border: 1px solid var(--zy-border); border-radius: 7px; background: var(--zy-surface-soft); cursor: pointer; font-size: 11px; }
.custom-color-control:hover, .custom-color-control:focus-within, .custom-color-control.active { color: var(--zy-primary); border-color: color-mix(in srgb, var(--zy-primary) 45%, var(--zy-border)); }
.custom-color-control input { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.zy-dialog footer, .import-drawer footer { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 9px; min-height: 66px; padding: 10px 18px; border-top: 1px solid var(--zy-border); background: var(--zy-surface-soft); }
.zy-dialog .base-dialog-footer { display: flex; justify-content: space-between; }
.base-dialog-footer .dialog-footer-actions { display: flex; gap: 8px; margin-left: auto; }
.base-dialog-footer .secondary-button, .base-dialog-footer .primary-button { min-width: 76px; }
.compact-dialog footer { display: flex; justify-content: flex-end; }
.compact-dialog footer .dialog-footer-actions { display: grid; grid-template-columns: repeat(2, minmax(88px, 1fr)); gap: 8px; }

.import-drawer { width: min(96vw, 760px); max-width: none; height: 100vh; max-height: none; margin: 0 0 0 auto; padding: 0; overflow: hidden; border: 0; border-left: 1px solid var(--zy-border); background: var(--zy-surface); box-shadow: var(--zy-shadow-lg); }
.import-drawer article { display: flex; height: 100%; flex-direction: column; }
.import-body { min-height: 0; flex: 1; overflow: auto; padding: 22px; }
.import-target { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.import-tabs, .source-tabs { display: flex; gap: 3px; margin-top: 22px; padding: 3px; border-radius: 10px; background: var(--zy-surface-soft); }
.import-tabs button, .source-tabs button { min-height: 34px; padding: 0 14px; color: var(--zy-text-soft); border-radius: 7px; background: transparent; font-size: 12px; font-weight: 650; }
.import-tabs button.active, .source-tabs button.active { color: var(--zy-text); background: var(--zy-surface); box-shadow: var(--zy-shadow-sm); }
.upload-dropzone { display: flex; min-height: 270px; align-items: center; justify-content: center; flex-direction: column; gap: 9px; width: 100%; margin-top: 14px; color: var(--zy-text); border: 1px dashed var(--zy-border-strong); border-radius: 15px; background: var(--zy-surface-soft); }
.upload-dropzone:hover, .upload-dropzone.dragging { color: var(--zy-primary); border-color: var(--zy-primary); background: var(--zy-primary-soft); }
.dropzone-icon { display: grid; width: 58px; height: 58px; place-items: center; margin-bottom: 5px; color: var(--zy-primary); border-radius: 17px; background: var(--zy-primary-soft); }
.dropzone-icon svg { width: 26px; height: 26px; }
.upload-dropzone strong { font-size: 15px; }
.upload-dropzone small { color: var(--zy-muted); font-size: 11px; }
.format-pills { display: flex; gap: 5px; margin-top: 7px; }
.format-pills em { padding: 4px 7px; color: var(--zy-text-soft); border: 1px solid var(--zy-border); border-radius: 6px; background: var(--zy-surface); font-size: 9px; font-style: normal; font-weight: 750; }
.selected-files, .source-list { display: grid; gap: 7px; margin-top: 12px; }
.selected-file, .source-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; min-height: 58px; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--zy-border); border-radius: 10px; background: var(--zy-surface); }
.source-row { display: grid; grid-template-columns: 18px 34px minmax(0, 1fr); min-height: 58px; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--zy-border); border-radius: 10px; background: var(--zy-surface); cursor: pointer; }
.source-row:hover { border-color: color-mix(in srgb, var(--zy-primary) 35%, var(--zy-border)); }
.source-row input { width: 17px; height: 17px; accent-color: var(--zy-primary); }
.source-icon { display: grid; width: 34px; height: 34px; place-items: center; color: var(--zy-primary); border-radius: 9px; background: var(--zy-primary-soft); }
.source-row > span:last-child { min-width: 0; }
.source-row strong, .source-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-row strong { font-size: 12px; }.source-row small { margin-top: 3px; color: var(--zy-muted); font-size: 10px; }
.selected-file-copy, .source-item-copy { min-width: 0; }
.selected-file strong, .selected-file small, .source-item strong, .source-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file strong, .source-item strong { font-size: 12px; }
.selected-file small, .source-item small { margin-top: 3px; color: var(--zy-muted); font-size: 10px; }
.selected-file button { width: 32px; height: 32px; }
.source-item input { width: 18px; height: 18px; accent-color: var(--zy-primary); }
.import-selection-summary { color: var(--zy-muted); font-size: 11px; }

.context-menu { position: fixed; z-index: 250; min-width: 188px; padding: 6px; border: 1px solid var(--zy-border); border-radius: 11px; background: var(--zy-surface-raised); box-shadow: var(--zy-shadow-lg); }
.context-menu button { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 9px; padding: 0 10px; color: var(--zy-text); border-radius: 7px; background: transparent; text-align: left; font-size: 12px; }
.context-menu button:hover { background: var(--zy-surface-soft); }
.context-menu button.danger { color: var(--zy-danger); }
.context-menu button:disabled { cursor: not-allowed; opacity: .46; }
.context-menu button:disabled:hover { background: transparent; }
.context-menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--zy-border); }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 400; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; max-width: 380px; min-height: 46px; align-items: center; gap: 9px; padding: 10px 14px; color: var(--zy-text); border: 1px solid var(--zy-border); border-radius: 11px; background: var(--zy-surface-raised); box-shadow: var(--zy-shadow-lg); font-size: 12px; pointer-events: auto; }
.toast.success svg { color: var(--zy-success); }.toast.error svg { color: var(--zy-danger); }
.mobile-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(10, 15, 24, .45); }

@media (max-width: 1180px) {
    :root { --zy-explorer-width: 252px; }
    .topbar-actions .secondary-button span, .document-header-actions .secondary-button span { display: none; }
    .topbar-actions .secondary-button, .document-header-actions .secondary-button { width: 40px; padding: 0; }
    .global-search { width: min(300px, 31vw); }
}

@media (max-width: 900px) {
    :root { --zy-rail-width: 68px; }
    .zy-shell { grid-template-columns: var(--zy-rail-width) minmax(0, 1fr); }
    .zy-shell.explorer-collapsed, .zy-shell.immersive { grid-template-columns: var(--zy-rail-width) minmax(0, 1fr); }
    .product-rail { padding-right: 7px; padding-left: 7px; }
    .zy-explorer { position: fixed; top: 0; bottom: 0; left: var(--zy-rail-width); z-index: 35; width: min(84vw, 320px); transform: translateX(-110%); box-shadow: var(--zy-shadow-lg); }
    .zy-explorer.open { transform: translateX(0); }
    .explorer-open, .explorer-close { display: inline-grid !important; }
    .zy-main { grid-column: 2; }
    .zy-topbar { padding: 0 13px; }
    .breadcrumb { display: none; }
    .global-search { width: auto; flex: 1; margin-left: 0; }
    .browser-view, .search-view { padding: 24px 20px 60px; }
    .welcome-card { grid-template-columns: minmax(0, 1fr) auto; }
    .welcome-actions { grid-column: auto; }
    .document-title-input { width: min(52vw, 460px); }
    .document-header-actions .save-status, .document-header-actions #askDocumentButton, .document-header-actions #moveDocumentButton { display: none; }
    .document-outline-panel { top: 68px; right: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 84px); }
    .zy-shell.immersive { grid-template-columns: 0 minmax(0, 1fr); }
}

@media (max-width: 640px) {
    :root { --zy-rail-width: 0px; --zy-topbar-height: 58px; }
    .zy-shell { display: block; }
    .product-rail { position: fixed; right: 0; bottom: 0; left: 0; z-index: 80; display: flex; flex-direction: row; height: 64px; min-width: 0; justify-content: space-around; gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--zy-border); border-right: 0; background: color-mix(in srgb, var(--zy-surface) 94%, transparent); box-shadow: 0 -8px 24px rgba(15, 23, 42, .08); backdrop-filter: blur(16px); }
    .brand-mark, .account-anchor { display: none; }
    .rail-link { width: 44px; height: 46px; }
    .rail-link.active::before { top: auto; bottom: -6px; left: 50%; width: 20px; height: 3px; transform: translateX(-50%); border-radius: 4px 4px 0 0; }
    .rail-link span { position: static; display: block; min-width: 0; max-width: 48px; padding: 0; overflow: hidden; color: inherit; background: transparent; font-size: 9px; line-height: 1.1; text-align: center; text-overflow: ellipsis; white-space: nowrap; opacity: 1; transform: none; }
    .rail-link { grid-template-rows: 20px 12px; gap: 3px; }
    .rail-link:hover span { transform: none; }
    .zy-explorer { left: 0; }
    .zy-main { height: 100dvh; }
    .zy-topbar { min-height: 58px; gap: 8px; }
    .topbar-actions { display: none; }
    .global-search kbd { display: none; }
    .browser-view, .search-view { padding: 21px 14px 86px; }
    .collection-header { min-height: 44px; align-items: flex-start; }
    .collection-header h1, .search-view h1 { font-size: 27px; }
    .collection-header p { font-size: 12px; }
    .collection-actions .sort-select, .collection-actions > .icon-button, .collection-actions .view-toggle { display: none; }
    .header-new-document { width: 40px; padding: 0; }
    .header-new-document span { display: none; }
    .welcome-card { grid-template-columns: 1fr; margin-top: 3px; padding: 17px 0; }
    .welcome-card strong { font-size: 15px; }
    .welcome-actions { display: flex; width: 100%; }
    .welcome-actions .secondary-button { width: 100%; }
    .folder-collection, .document-collection { grid-template-columns: 1fr; }
    .document-collection.list .document-card { grid-template-columns: 36px minmax(0, 1fr) auto; min-height: 58px; gap: 10px; padding: 8px 10px; }
    .document-collection.list .file-badge { width: 36px; height: 36px; }
    .document-collection.list .document-card p, .document-collection.list .editable-pill { display: none; }
    .document-collection.list .document-card footer { grid-column: 3; padding-right: 28px; font-size: 10px; }
    .document-header { min-height: 64px; padding: 8px 10px; }
    .document-format-icon { width: 36px; height: 36px; }
    .document-title-input { width: 52vw; font-size: 14px; }
    .document-identity p { display: none; }
    .document-header-actions #documentOutlineButton, .document-header-actions #downloadOriginalButton { display: inline-grid; }
    .document-toolbar { min-height: 48px; padding: 6px 10px; overflow-x: auto; }
    .document-toolbar .text-button { display: none; }
    .mode-switch button { min-width: 50px; padding: 0 8px; }
    .readonly-banner span { display: none; }
    .markdown-reader, .markdown-preview { width: calc(100% - 20px); min-height: calc(100% - 20px); margin: 10px auto 28px; padding: 34px 22px 72px; border-radius: 12px; font-size: 15px; }
    .markdown-editor, .document-stage[data-mode="split"] .split-editor { width: calc(100% - 16px); height: calc(100% - 16px); margin: 8px auto; border-radius: 10px; }
    .split-editor { grid-template-columns: 1fr; }
    .split-editor > article { display: none; }
    .import-drawer { width: 100vw; }
    .import-target { grid-template-columns: 1fr; }
    .upload-dropzone { min-height: 210px; }
    .zy-dialog footer { grid-template-columns: auto 1fr auto; }
    .zy-dialog footer .danger-text-button + span { display: none; }
    .icon-picker { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; }
    .icon-preview { width: 46px; height: 46px; }
    .base-icon-options { grid-template-columns: repeat(auto-fit, minmax(34px, 1fr)); }
    .base-icon-options button, .custom-icon-upload { width: 100%; }
    .color-picker > div { align-items: flex-start; flex-direction: column; gap: 10px; }
    .zy-shell.immersive .document-header { top: 8px; right: 8px; }
    .zy-shell.immersive .markdown-reader { width: 100%; min-height: 100%; margin: 0; padding: 64px 22px 84px; border: 0; border-radius: 0; box-shadow: none; }
    .zy-shell.immersive .markdown-editor,
    .zy-shell.immersive .document-stage[data-mode="split"] .split-editor { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: no-preference) {
.rail-link, .base-option, .base-menu, .icon-button, .primary-button, .secondary-button, .folder-card, .document-card, .zy-explorer, .toast { transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease, transform .16s ease; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Document workspace: source-on-focus Markdown editing and unblocked feedback. */
.document-header { gap: 10px; }
.document-back { flex: 0 0 auto; }
.document-identity { flex: 1; }
.document-format-icon { background: transparent; }
.document-format-icon img { display: block; width: 28px; height: 28px; object-fit: contain; }
.document-identity p { max-width: min(640px, 48vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zy-shell.explorer-collapsed .document-header { padding-left: 56px; }


.toast-region { z-index: 2147483647; }
.toast-region[popover] { inset: auto 22px 22px auto; margin: 0; padding: 0; overflow: visible; border: 0; background: transparent; }

@media (max-width: 900px) {
    .document-header { padding-left: 56px; }
}

@media (max-width: 640px) {
    .document-header { padding-left: 52px; }
    .document-identity p { display: block; max-width: calc(100vw - 76px); }
}

/* Command-center redesign */
* { letter-spacing: 0 !important; }
::selection { color: #ffffff; background: var(--zy-primary); }
html { scrollbar-color: var(--zy-border-strong) transparent; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--zy-primary); outline-offset: 2px; }

.zy-shell { grid-template-columns: var(--zy-rail-width) var(--zy-explorer-width) minmax(0, 1fr); }
.zy-shell.explorer-collapsed { grid-template-columns: var(--zy-rail-width) 0 minmax(0, 1fr); }

.product-rail {
    gap: 4px;
    padding: 8px;
    background: var(--zy-surface);
}
.brand-mark { width: 36px; height: 36px; margin-bottom: 10px; border-radius: 6px; }
.brand-mark img { width: 34px; height: 34px; }
.rail-link { width: 36px; height: 36px; border-radius: 6px; }
.rail-link svg { width: 17px; height: 17px; }
.rail-link.active { color: var(--zy-primary); background: var(--zy-primary-soft); }
.rail-link.active::before { left: -8px; width: 2px; height: 18px; border-radius: 0; }
.rail-link span { left: calc(100% + 10px); padding: 6px 8px; border-radius: 5px; }
.account-button { width: 36px; height: 36px; border-radius: 50%; font-size: 12px; }

.zy-explorer {
    background: var(--zy-sidebar);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.explorer-header { height: 52px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--zy-border); }
.explorer-header > strong { font-size: 13px; font-weight: 700; }
.explorer-close, .explorer-open { width: 32px; height: 32px; }
.base-directory { padding: 18px 8px 0; }
.base-option { min-height: 38px; }

.zy-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 520px) 36px minmax(0, 1fr);
    min-height: var(--zy-topbar-height);
    gap: 10px;
    padding: 0 14px;
    background: var(--zy-surface);
    backdrop-filter: none;
}
.topbar-location { display: flex; min-width: 0; align-items: center; gap: 8px; }
.breadcrumb { flex: 1; }
.breadcrumb button { min-height: 32px; border-radius: 5px; }
.command-launcher {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    width: min(520px, 48vw);
    height: 38px;
    align-items: center;
    gap: 9px;
    margin-left: 0;
    padding: 0 8px 0 11px;
    color: var(--zy-muted);
    border: 1px solid var(--zy-border);
    border-radius: 6px;
    background: var(--zy-bg);
    text-align: left;
    font-size: 13px;
}
.command-launcher:hover { color: var(--zy-text); border-color: var(--zy-border-strong); background: var(--zy-surface-soft); }
.command-launcher svg { width: 16px; }
.command-launcher span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-launcher kbd, .command-actions kbd, .command-search-action kbd {
    padding: 2px 5px;
    color: var(--zy-muted);
    border: 1px solid var(--zy-border);
    border-radius: 4px;
    background: var(--zy-surface);
    font-size: 10px;
    font-family: inherit;
}
.command-create {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    color: #ffffff;
    border-radius: 6px;
    background: var(--zy-primary);
}
.command-create:hover { background: var(--zy-primary-strong); }
.command-create svg { width: 18px; }

/* Knowledge base content index */
.browser-view { padding: 48px clamp(24px, 5vw, 72px) 88px; }
.browser-view > * { width: min(100%, 1120px); }
.base-overview { display: flex; min-height: 132px; align-items: center; gap: 20px; padding: 0 12px 28px; border-bottom: 1px solid var(--zy-border); }
.base-overview-avatar { display: grid; width: 96px; height: 96px; flex: 0 0 auto; place-items: center; overflow: hidden; color: #ffffff; border: 1px solid var(--zy-border); border-radius: 14px; background: var(--zy-primary); box-shadow: inset 0 0 0 7px var(--zy-surface); }
.base-overview-avatar img { width: 100%; height: 100%; object-fit: cover; }
.base-overview-avatar svg { width: 38px; height: 38px; stroke-width: 1.55; }
.base-overview h1 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.3; letter-spacing: 0; }
.content-list-section { margin-top: 20px; }
.content-list-section > .content-list-header { min-height: 46px; padding: 0; border-bottom: 0; }
.content-list-header h2 { display: flex; align-items: baseline; gap: 0; font-size: 15px; font-weight: 700; }
.content-total-count { color: var(--zy-text); font: inherit; font-variant-numeric: tabular-nums; }
.content-pathbar { display: flex; min-height: 54px; align-items: center; gap: 4px; border-bottom: 1px solid var(--zy-border); }
.content-path-controls { display: flex; align-items: center; gap: 2px; }
.content-pathbar .icon-button { width: 32px; height: 32px; color: var(--zy-muted); border-radius: 5px; }
.content-pathbar .icon-button:hover:not(:disabled) { color: var(--zy-text); border-color: transparent; background: var(--zy-surface-soft); }
.content-pathbar .icon-button:disabled { opacity: .34; }
.content-pathbar .icon-button svg { width: 17px; height: 17px; }
.content-pathbar .breadcrumb { display: flex; min-width: 0; flex: 1; align-items: center; gap: 2px; padding: 0 4px; color: var(--zy-muted); font-size: 13px; overflow: hidden; }
.content-pathbar .breadcrumb button { max-width: 220px; min-height: 32px; padding: 0 7px; border-radius: 5px; }
.content-pathbar .breadcrumb button:last-child { color: var(--zy-text); font-weight: 650; }
.content-pathbar .content-toolbar { margin-left: auto; }
.content-toolbar { display: flex; align-items: center; gap: 4px; }
.content-toolbar .icon-button { width: 32px; height: 32px; color: var(--zy-muted); border-radius: 5px; }
.content-toolbar .icon-button:hover { color: var(--zy-text); border-color: transparent; background: var(--zy-surface-soft); }
.content-toolbar .icon-button svg { width: 17px; height: 17px; }
.content-collection { border-top: 0; }
.content-collection > .folder-collection, .content-collection > .document-collection { display: contents; }
.content-collection .folder-card, .content-collection .document-card, .content-collection .document-collection.list .document-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 104px 90px 92px 34px;
    min-height: 56px;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    border: 0;
    border-bottom: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.content-collection .folder-card:hover, .content-collection .document-card:hover { border-color: var(--zy-border); background: color-mix(in srgb, var(--zy-surface-soft) 72%, transparent); transform: none; }
.content-collection .folder-icon, .content-collection .document-symbol { width: 28px; height: 28px; grid-column: 1; color: var(--zy-base-accent); border-radius: 4px; background: transparent; }
.content-collection .folder-icon svg, .content-collection .document-symbol svg { width: 18px; height: 18px; }
.content-collection .folder-icon img { width: 26px; height: 26px; object-fit: contain; }
.content-collection .document-symbol img { width: 25px; height: 25px; object-fit: contain; }
.content-collection .document-symbol.pdf { color: var(--zy-danger); }
.content-collection .document-symbol.xlsx { color: var(--zy-success); }
.content-collection .folder-card-copy, .content-collection .document-card-copy { grid-column: 2; min-width: 0; }
.content-collection .folder-card-copy strong, .content-collection .document-card h3, .content-collection .document-collection.list .document-card h3 { font-size: 14px; font-weight: 500; }
.content-collection .document-card p, .content-collection .document-collection.list .document-card p { display: none; }
.content-row-meta, .content-collection .document-card time, .content-collection .folder-card time { overflow: hidden; color: var(--zy-muted); font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.content-row-kind { grid-column: 3; }
.content-row-size { grid-column: 4; }
.content-collection .document-card time, .content-collection .folder-card time { grid-column: 5; }
.content-collection .card-menu, .content-collection .document-collection.list .document-card .card-menu { position: relative; right: auto; z-index: 2; width: 32px; height: 32px; grid-column: 6; opacity: 0; }
.content-collection .card-menu { transition: opacity .16s ease, background-color .16s ease, color .16s ease; }
.content-collection .folder-card:hover .card-menu, .content-collection .document-card:hover .card-menu, .content-collection .folder-card:focus-within .card-menu, .content-collection .document-card:focus-within .card-menu, .content-collection .document-collection.list .document-card:hover .card-menu, .content-collection .document-collection.list .document-card:focus-within .card-menu { opacity: 1; }
.content-collection .welcome-card { min-height: 112px; margin: 0; border: 0; border-bottom: 1px solid var(--zy-border); border-radius: 0; }


.browser-view, .search-view { padding: 40px clamp(24px, 5vw, 72px) 80px; }
.collection-header { min-height: 36px; }
.collection-header h1, .search-view h1 { font-size: 24px; line-height: 1.3; }
.welcome-card {
    display: flex;
    min-height: 140px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
    padding: 24px;
    color: var(--zy-muted);
    border: 1px dashed var(--zy-border-strong);
    border-radius: 6px;
}
.welcome-card svg { width: 18px; height: 18px; }
.welcome-card strong { color: var(--zy-text-soft); font-size: 13px; font-weight: 600; }
.content-section { margin-top: 34px; }
.content-section > header { min-height: 30px; padding: 0 2px; border-bottom: 1px solid var(--zy-border); }
.content-section h2 { font-size: 13px; font-weight: 700; }
.content-section header small { min-width: 20px; padding: 0; background: transparent; font-variant-numeric: tabular-nums; }
.folder-collection, .document-collection,
.document-collection.list, .folder-collection.list { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 0; }
.folder-card, .document-card {
    position: relative;
    border: 0;
    border-bottom: 1px solid var(--zy-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.folder-card:hover, .document-card:hover { border-color: var(--zy-border); background: var(--zy-surface); transform: none; }
.folder-card {
    grid-template-columns: 34px minmax(0, 1fr) 36px;
    min-height: 52px;
    gap: 10px;
    padding: 0 4px;
}
.folder-icon { width: 30px; height: 30px; color: var(--zy-muted); border-radius: 5px; background: transparent; }
.folder-icon svg { width: 17px; }
.folder-card-copy { display: flex; min-width: 0; align-items: baseline; }
.folder-card-copy strong { font-size: 13px; }
.card-menu { width: 32px; height: 32px; border-radius: 5px; opacity: 0; }
.folder-card:hover .card-menu, .document-card:hover .card-menu,
.folder-card:focus-within .card-menu, .document-card:focus-within .card-menu { opacity: 1; }
.document-card,
.document-collection.list .document-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto 36px;
    min-height: 58px;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
}
.document-symbol { display: grid; width: 30px; height: 30px; place-items: center; color: var(--zy-muted); border-radius: 5px; background: transparent; }
.document-symbol svg { width: 17px; }
.document-symbol.pdf { color: var(--zy-danger); }
.document-symbol.xlsx { color: var(--zy-success); }
.document-card-copy { min-width: 0; }
.document-card h3,
.document-collection.list .document-card h3 { display: flex; min-width: 0; align-items: center; gap: 6px; margin: 0; overflow: hidden; font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.document-card h3 svg { width: 12px; height: 12px; flex: 0 0 auto; color: var(--zy-primary); fill: color-mix(in srgb, var(--zy-primary) 16%, transparent); }
.document-card p,
.document-collection.list .document-card p { display: block; min-height: 0; margin: 3px 0 0; overflow: hidden; color: var(--zy-muted); font-size: 11px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.document-card time { color: var(--zy-muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.document-card .card-menu,
.document-collection.list .document-card .card-menu { position: relative; right: auto; z-index: 2; }
.document-card-open { border-radius: 0; }
.empty-collection { min-height: 92px; grid-auto-flow: column; gap: 8px; padding: 20px; border: 0; border-radius: 0; }
.empty-collection svg { width: 17px; height: 17px; }
.empty-collection strong { font-size: 12px; font-weight: 600; }

.document-header { min-height: 58px; padding: 7px 14px; background: var(--zy-surface); backdrop-filter: none; }
.document-format-icon { width: 32px; height: 32px; border-radius: 5px; }
.document-title-input { font-size: 15px; }
.document-toolbar { min-height: 44px; padding: 5px 14px; }
.document-toolbar:not(:has(.readonly-banner:not([hidden]))) { display: none; }
.mode-switch { padding: 2px; border-radius: 6px; }
.mode-switch button { height: 28px; border-radius: 4px; }
.mode-switch button.active { color: var(--zy-primary); background: var(--zy-primary-soft); box-shadow: none; }
.document-stage { background: var(--zy-bg); }
.markdown-reader, .markdown-preview { border: 0; border-radius: 0; box-shadow: none; }
.icon-button { width: 36px; height: 36px; border-radius: 6px; }
.primary-button, .secondary-button, .text-button { min-height: 36px; border-radius: 6px; box-shadow: none; }
.context-menu { border-radius: 7px; }
.context-menu button { min-height: 36px; border-radius: 5px; }

.command-palette {
    width: min(620px, calc(100vw - 32px));
    max-height: min(560px, calc(100dvh - 64px));
    margin: 13vh auto auto;
    padding: 0;
    overflow: hidden;
    color: var(--zy-text);
    border: 1px solid var(--zy-border-strong);
    border-radius: 8px;
    background: var(--zy-surface-raised);
    box-shadow: var(--zy-shadow-lg);
}
.command-palette::backdrop { background: rgba(18, 24, 22, .36); }
.command-palette form { display: flex; max-height: inherit; flex-direction: column; }
.command-input-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 34px; min-height: 58px; align-items: center; gap: 10px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--zy-border); }
.command-input-row > svg { width: 18px; color: var(--zy-muted); }
.command-input-row input { width: 100%; height: 48px; padding: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.command-input-row input::placeholder { color: var(--zy-muted); }
.command-actions { display: grid; gap: 1px; overflow: auto; padding: 8px; }
.command-actions button, .command-search-action {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    min-height: 48px;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    color: var(--zy-text);
    border-radius: 5px;
    background: transparent;
    text-align: left;
}
.command-actions button:hover, .command-actions button:focus-visible, .command-search-action:hover { background: var(--zy-surface-soft); }
.command-actions button > svg, .command-search-action > svg { width: 17px; color: var(--zy-primary); }
.command-actions button > span { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.command-actions strong { font-size: 13px; }
.command-actions small { color: var(--zy-muted); font-size: 11px; }
.command-search-action { width: calc(100% - 16px); margin: 0 8px 8px; border-top: 1px solid var(--zy-border); }
.command-search-action span { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
    .command-palette[open] { animation: command-enter .18s cubic-bezier(.2, .8, .2, 1); }
    @keyframes command-enter { from { opacity: .65; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }
}

@media (max-width: 900px) {
    :root { --zy-rail-width: 52px; --zy-explorer-width: 228px; }
    .zy-shell, .zy-shell.explorer-collapsed, .zy-shell.immersive { grid-template-columns: var(--zy-rail-width) minmax(0, 1fr); }
    .zy-explorer { left: var(--zy-rail-width); width: min(82vw, 280px); }
    .zy-main { grid-column: 2; }
    .zy-topbar { grid-template-columns: minmax(0, 1fr) minmax(260px, 440px) 36px minmax(0, 1fr); }
    .breadcrumb { display: none; }
    .command-launcher { width: auto; flex: 1; margin-left: 0; }
    .browser-view, .search-view { padding: 34px 24px 72px; }
}

@media (max-width: 640px) {
    :root { --zy-rail-width: 0px; --zy-topbar-height: 52px; }
    .zy-shell { display: block; }
    .product-rail {
        height: calc(58px + env(safe-area-inset-bottom));
        justify-content: stretch;
        padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
        box-shadow: none;
        backdrop-filter: none;
    }
    .product-rail .brand-mark, .product-rail .account-anchor,
    .product-rail .rail-link:not([data-mobile-primary]) { display: none; }
    .product-rail .rail-link[data-mobile-primary] {
        display: grid;
        width: 25%;
        height: 48px;
        grid-template-rows: 21px 13px;
        gap: 2px;
        border-radius: 5px;
    }
    .product-rail .rail-link span { position: static; display: block; min-width: 0; max-width: none; padding: 0; color: inherit; background: transparent; font-size: 10px; line-height: 1.2; text-align: center; opacity: 1; transform: none; }
    .product-rail .rail-link.active::before { bottom: -4px; left: 50%; width: 18px; height: 2px; transform: translateX(-50%); }
    .zy-explorer { left: 0; }
    .zy-main { height: 100dvh; }
    .zy-topbar { min-height: 52px; padding: 0 8px; }
    .zy-topbar { grid-template-columns: 36px minmax(0, 1fr) 36px; }
    .command-launcher { height: 36px; }
    .command-launcher kbd { display: none; }
    .command-create { width: 36px; height: 36px; }
    .browser-view, .search-view { padding: 26px 14px 82px; }
    .collection-header h1, .search-view h1 { font-size: 22px; }
    .welcome-card { min-height: 116px; margin-top: 18px; }
    .content-section { margin-top: 28px; }
    .document-card, .document-collection.list .document-card { grid-template-columns: 32px minmax(0, 1fr) auto 34px; min-height: 56px; gap: 8px; }
    .document-card p { display: none; }
.document-card time { font-size: 10px; }
    .card-menu { width: 34px; height: 44px; opacity: 1; }
    .folder-card { min-height: 52px; }
    .folder-card .card-menu { opacity: 1; }
    .command-palette { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); margin-top: 8px; border-radius: 7px; }
    .command-input-row { min-height: 54px; padding-left: 13px; }
    .command-actions button, .command-search-action { min-height: 50px; }
    .document-header { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 56px; gap: 6px; }
    .document-header-actions { width: 100%; justify-content: space-between; gap: 4px; }
    .document-header-actions .mode-switch button { min-width: 46px; padding: 0 7px; }
    .document-header-actions #documentOutlineButton { display: inline-flex; }
    .document-header-actions #askDocumentButton, .document-header-actions .save-status { display: none; }
    .document-outline-panel { top: 112px; right: 10px; width: calc(100% - 20px); max-height: calc(100% - 126px); }
    .document-title-input { width: calc(100vw - 84px); }
    .markdown-reader, .markdown-preview { border-radius: 0; }
    .toast-region { right: 12px; bottom: 72px; left: 12px; }
    .toast { max-width: none; }
}

/* The reading surface owns its scroll; the outline becomes a true sibling pane on wide screens. */
.document-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
}
.document-stage[data-mode="read"] { overflow: hidden; }
.document-content-pane {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    --document-font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
}
.document-content-pane[data-document-font="sans"] { --document-font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
.document-content-pane[data-document-font="kai"] { --document-font-family: "KaiTi", "STKaiti", "Kaiti SC", serif; }
.document-content-pane :is(.markdown-reader, .markdown-preview, .toastui-editor-ww-container .toastui-editor-contents) {
    font-family: var(--document-font-family) !important;
}
.document-content-pane :is(.markdown-reader, .markdown-preview, .toastui-editor-ww-container .toastui-editor-contents) :is(h1, h2, h3, h4, h5, h6, table, th, td) {
    font-family: inherit !important;
}
.document-stage[data-mode="read"] .document-content-pane {
    display: grid;
    padding: 28px 22px 52px;
    overflow: hidden;
}
.document-stage[data-mode="read"] .markdown-reader {
    width: min(100%, 900px);
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    overflow: auto;
    scrollbar-color: var(--zy-border-strong) transparent;
    scrollbar-gutter: stable;
    zoom: var(--document-zoom, 1);
}
.document-content-pane .markdown-preview { zoom: var(--document-zoom, 1); }
.document-stage[data-mode="edit"] .markdown-editor {
    width: min(100%, 1400px);
    height: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 0;
    box-shadow: none;
}
.document-stage[data-mode="edit"] .toastui-editor-main,
.document-stage[data-mode="edit"] .toastui-editor-main-container { overflow: hidden !important; }
.document-stage[data-mode="edit"] .toastui-editor-ww-container {
    padding: 28px 22px 52px;
    overflow: auto !important;
    background: var(--zy-bg) !important;
    scrollbar-color: var(--zy-border-strong) transparent;
    scrollbar-gutter: stable;
}
.document-stage[data-mode="edit"] .toastui-editor-ww-container .toastui-editor-contents {
    box-sizing: border-box;
    width: min(900px, calc(100% - 44px));
    min-height: calc(100% - 56px);
    height: auto;
    margin: 0 auto;
    padding: 58px clamp(34px, 6vw, 76px) 92px !important;
    overflow: visible !important;
    color: var(--zy-text) !important;
    border: 1px solid var(--zy-border);
    border-radius: 0;
    background: var(--zy-surface) !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .07), 0 2px 8px rgba(15, 23, 42, .04);
    font-size: 15px !important;
    zoom: var(--document-zoom, 1);
}
.document-stage[data-mode="edit"] .toastui-editor-ww-container .toastui-editor-contents table {
    width: 100% !important;
    table-layout: fixed;
    border-collapse: collapse;
}
.document-stage[data-mode="edit"] .toastui-editor-ww-container .toastui-editor-contents :is(th, td) {
    height: auto !important;
    padding: 9px 11px !important;
    color: inherit !important;
    border: 1px solid var(--zy-border) !important;
    background: transparent !important;
}
.document-stage[data-mode="split"] .document-content-pane {
    padding: 14px 18px 22px;
}
.document-stage[data-mode="split"] .split-editor {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    border-radius: 8px;
    box-shadow: none;
}
.document-stage[data-mode="split"] .markdown-preview {
    zoom: 1;
    padding: 34px clamp(28px, 4vw, 56px) 72px;
    font-size: calc(16px * var(--document-zoom, 1));
    line-height: 1.8;
    scrollbar-color: var(--zy-border-strong) transparent;
    scrollbar-gutter: stable;
}
.document-stage[data-mode="split"] #markdownSourceEditor .toastui-editor-md-container .ProseMirror {
    font-size: calc(16px * var(--document-zoom, 1)) !important;
    line-height: 1.8 !important;
}
.split-scroll-sync-button.active { color: var(--zy-primary); background: var(--zy-primary-soft); }
.document-stage.outline-open { grid-template-columns: minmax(0, 1fr) 10px var(--document-outline-width, 320px); }
.document-stage.assistant-open { grid-template-columns: minmax(0, 1fr) 10px var(--document-assistant-width, 420px); }
.document-stage.assistant-open.assistant-left { grid-template-columns: var(--document-assistant-width, 420px) 10px minmax(0, 1fr); }
.document-stage.assistant-open.assistant-left .document-content-pane { grid-column: 3; }
.document-stage.assistant-open.assistant-left .document-assistant-panel { grid-column: 1; }
.document-outline-resizer {
    display: none;
    grid-column: 2;
    grid-row: 1;
    width: 10px;
    min-height: 0;
    cursor: col-resize;
    background: var(--zy-surface);
    touch-action: none;
}
.document-outline-resizer::before {
    display: block;
    width: 1px;
    height: 100%;
    margin: 0 auto;
    background: var(--zy-border);
    content: "";
}
.document-outline-resizer:hover::before,
.document-outline-resizer:focus-visible::before { width: 2px; background: var(--zy-primary); }
.document-stage.outline-open .document-outline-resizer { display: block; }
.document-outline-panel {
    position: static;
    z-index: auto;
    display: flex;
    grid-column: 3;
    grid-row: 1;
    width: auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    border: 0;
    border-left: 1px solid var(--zy-border);
    border-radius: 0;
    background: var(--zy-surface);
    box-shadow: none;
}
.document-outline-panel[hidden] { display: none; }
.document-assistant-resizer {
    display: block;
    grid-column: 2;
    grid-row: 1;
    width: 10px;
    min-height: 0;
    cursor: col-resize;
    background: var(--zy-surface);
    touch-action: none;
}
.document-assistant-resizer[hidden] { display: none; }
.document-assistant-resizer::before {
    display: block;
    width: 1px;
    height: 100%;
    margin: 0 auto;
    background: var(--zy-border);
    content: "";
}
.document-assistant-resizer:hover::before,
.document-assistant-resizer:focus-visible::before { width: 2px; background: var(--zy-primary); }
.document-assistant-panel {
    display: grid;
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-left: 1px solid var(--zy-border);
    background: var(--zy-surface);
}
.document-assistant-panel[hidden] { display: none; }
.document-stage.assistant-left .document-assistant-panel { border-right: 1px solid var(--zy-border); border-left: 0; }
.document-assistant-header {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 8px 7px 12px;
    border-bottom: 1px solid var(--zy-border);
}
.document-assistant-header > div { display: flex; min-width: 0; align-items: center; gap: 9px; }
.document-assistant-header strong,
.document-assistant-header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-assistant-header strong { color: var(--zy-text); font-size: 14px; }
.document-assistant-header small { margin-top: 2px; color: var(--zy-muted); font-size: 11px; }
.document-assistant-mark {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--zy-primary);
    border-radius: 6px;
    background: var(--zy-primary-soft);
}
.document-assistant-mark svg { width: 16px; height: 16px; }
.document-assistant-header-actions { margin-left: auto; gap: 2px !important; }
.document-assistant-header-actions .icon-button { width: 30px; height: 30px; color: var(--zy-muted); }
.document-assistant-messages {
    min-height: 0;
    padding: 18px 18px 26px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--zy-border-strong) transparent;
    scrollbar-gutter: stable;
}
.document-assistant-empty {
    display: grid;
    min-height: 100%;
    place-content: center;
    justify-items: center;
    gap: 7px;
    padding: 28px;
    color: var(--zy-muted);
    text-align: center;
}
.document-assistant-empty svg { width: 22px; height: 22px; }
.document-assistant-empty strong { color: var(--zy-text-soft); font-size: 14px; }
.document-assistant-empty span { max-width: 260px; font-size: 12px; line-height: 1.6; }
.document-assistant-message {
    margin-bottom: 20px;
    contain: layout style;
}
.document-assistant-message.user { display: grid; justify-items: end; }
.document-assistant-message-label { margin-bottom: 6px; color: var(--zy-muted); font-size: 10px; font-weight: 650; }
.document-assistant-message.assistant .document-assistant-message-label { display: none; }
.document-assistant-bubble { color: var(--zy-text); font-size: 13px; line-height: 1.72; overflow-wrap: anywhere; }
.document-assistant-message.user .document-assistant-bubble {
    max-width: 82%;
    padding: 8px 10px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--zy-primary) 8%, var(--zy-surface-soft));
}
.document-assistant-message.streaming .document-assistant-bubble { white-space: pre-wrap; }
.document-assistant-message.assistant .document-assistant-bubble > :first-child { margin-top: 0; }
.document-assistant-message.assistant .document-assistant-bubble > :last-child { margin-bottom: 0; }
.document-assistant-message.assistant .document-assistant-bubble :is(h1, h2, h3, h4) { margin: 18px 0 7px; font-size: 14px; line-height: 1.45; }
.document-assistant-message.assistant .document-assistant-bubble :is(p, ul, ol, blockquote, table) { margin: 9px 0; }
.document-assistant-message.assistant .document-assistant-bubble table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.document-assistant-message.assistant .document-assistant-bubble :is(th, td) { padding: 5px 7px; border: 1px solid var(--zy-border); text-align: left; }
.document-assistant-message.assistant .document-assistant-bubble pre { max-width: 100%; padding: 10px; overflow: auto; border-radius: 5px; background: var(--zy-surface-soft); }
.document-assistant-operation {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 0;
    color: var(--zy-text-soft);
    border-top: 1px solid var(--zy-border);
    border-bottom: 1px solid var(--zy-border);
    font-size: 12px;
}
.document-assistant-operation > svg { width: 16px; height: 16px; color: var(--zy-primary); }
.document-assistant-operation > span { min-width: 0; }
.document-assistant-operation strong,
.document-assistant-operation small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-assistant-operation strong { font-size: 12px; font-weight: 650; }
.document-assistant-operation small { margin-top: 2px; color: var(--zy-muted); font-size: 10px; }
.document-assistant-operation button { height: 28px; padding: 0 8px; color: var(--zy-primary); border-radius: 5px; background: transparent; font-size: 11px; }
.document-assistant-operation button:hover,
.document-assistant-operation button:focus-visible { background: var(--zy-primary-soft); }
.document-assistant-operation.undone > svg,
.document-assistant-operation.undone strong { color: var(--zy-muted); }
.document-assistant-message-actions { display: flex; gap: 2px; margin-top: 8px; }
.document-assistant-message-actions button {
    display: inline-flex;
    min-width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 7px;
    color: var(--zy-muted);
    border-radius: 5px;
    background: transparent;
    font-size: 11px;
}
.document-assistant-message-actions button:hover,
.document-assistant-message-actions button:focus-visible { color: var(--zy-text); background: var(--zy-surface-soft); }
.document-assistant-message-actions svg { width: 14px; height: 14px; }
.document-assistant-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: end;
    gap: 8px;
    padding: 8px 12px 12px;
    border-top: 1px solid var(--zy-border);
    background: var(--zy-surface);
}
.document-assistant-composer-context {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 5px;
    min-width: 0;
    color: var(--zy-muted);
    font-size: 10px;
    line-height: 1;
}
.document-assistant-composer-context svg { width: 12px; height: 12px; }
.document-assistant-composer textarea {
    width: 100%;
    min-height: 40px;
    max-height: 144px;
    resize: none;
    padding: 9px 10px;
    color: var(--zy-text);
    border: 1px solid var(--zy-border-strong);
    border-radius: 6px;
    outline: 0;
    background: var(--zy-surface);
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
}
.document-assistant-composer textarea:focus { border-color: var(--zy-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--zy-primary) 15%, transparent); }
.document-assistant-send { width: 34px; height: 34px; min-width: 34px; padding: 0; border-radius: 6px; }
.document-assistant-send svg { width: 16px; height: 16px; }
.document-assistant-send.is-stopping { color: var(--zy-primary); border: 1px solid color-mix(in srgb, var(--zy-primary) 35%, var(--zy-border)); background: var(--zy-primary-soft); }
#askDocumentButton.active { color: var(--zy-primary); border-color: color-mix(in srgb, var(--zy-primary) 32%, var(--zy-border)); background: var(--zy-primary-soft); }
.document-append-dialog { width: min(620px, calc(100vw - 24px)); }
.document-append-dialog .dialog-body { display: grid; gap: 14px; }
.document-append-dialog textarea { min-height: 160px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.6; }
.document-append-heading-options { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 10px; }
.document-append-heading-options[hidden] { display: none; }
.document-outline-header {
    min-height: 48px;
    padding: 0 10px 0 16px;
    background: var(--zy-surface);
}
.document-outline-header > div { gap: 8px; }
.document-outline-icon { display: none; }
.document-outline-header strong { color: var(--zy-text-soft); font-size: 12px; font-weight: 650; }
.document-outline-header small { display: none; }
.document-outline-header .icon-button { width: 30px; height: 30px; color: var(--zy-muted); }
.document-outline-list {
    min-height: 0;
    flex: 1;
    padding: 6px 10px 28px;
    overflow: auto;
    scrollbar-color: var(--zy-border-strong) transparent;
}
.document-outline-empty { margin: 14px 6px; color: var(--zy-muted); font-size: 12px; line-height: 1.5; }
.document-outline-node { min-width: 0; }
.document-outline-row {
    display: grid;
    min-width: 0;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
}
.document-outline-toggle,
.document-outline-spacer {
    display: grid;
    width: 22px;
    height: 30px;
    place-items: center;
    color: var(--zy-muted);
}
.document-outline-toggle { border-radius: 4px; background: transparent; }
.document-outline-toggle:hover,
.document-outline-toggle:focus-visible { color: var(--zy-text); background: var(--zy-surface-soft); }
.document-outline-toggle svg { width: 14px; height: 14px; transition: transform .14s ease; }
.document-outline-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.document-outline-title {
    display: block;
    width: 100%;
    min-height: 32px;
    padding-right: 8px;
    padding-left: 3px;
    padding-top: 5px;
    padding-bottom: 5px;
    color: var(--zy-text-soft);
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
}
.document-outline-title:hover,
.document-outline-title:focus-visible {
    color: var(--zy-text);
    background: var(--zy-surface-soft);
}
.document-outline-children { margin-left: 14px; }
.document-zoom-controls {
    display: flex;
    height: 32px;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--zy-border);
    border-radius: 6px;
    background: var(--zy-surface);
}
.document-zoom-controls .icon-button {
    width: 30px;
    height: 30px;
    border-radius: 0;
}
.document-zoom-controls .icon-button:disabled { opacity: .4; cursor: not-allowed; }
.document-zoom-controls .icon-button svg { width: 15px; height: 15px; }
.document-zoom-reset {
    min-width: 52px;
    padding: 0 8px;
    color: var(--zy-text-soft);
    border-right: 1px solid var(--zy-border);
    border-left: 1px solid var(--zy-border);
    background: var(--zy-surface);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.document-zoom-reset:hover,
.document-zoom-reset:focus-visible { color: var(--zy-text); background: var(--zy-surface-soft); }
.document-font-control {
    display: flex;
    height: 32px;
    align-items: center;
    gap: 4px;
    padding-left: 8px;
    color: var(--zy-text-soft);
    border: 1px solid var(--zy-border);
    border-radius: 6px;
    background: var(--zy-surface);
}
.document-font-control svg { width: 14px; height: 14px; flex: 0 0 auto; }
.document-font-control select {
    width: 56px;
    height: 30px;
    padding: 0 6px 0 2px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 11px;
    cursor: pointer;
}

@media (max-width: 1180px) {
    .document-stage.outline-open { display: block; }
    .document-stage.outline-open .document-outline-resizer { display: none; }
    .document-outline-panel {
        position: absolute;
        top: 12px;
        right: 12px;
        bottom: 12px;
        z-index: 18;
        width: min(360px, calc(100% - 24px));
        max-height: none;
        border: 1px solid var(--zy-border-strong);
        border-radius: 8px;
        box-shadow: var(--zy-shadow-lg);
    }
}

@media (max-width: 640px) {
    .document-stage[data-mode="read"] .document-content-pane { padding: 0; }
    .document-stage[data-mode="read"] .markdown-reader {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    .document-outline-panel { top: 10px; right: 10px; bottom: 10px; width: calc(100% - 20px); }
    .document-font-control { display: none; }
    .document-zoom-controls { display: none; }
    .split-scroll-sync-button { display: none !important; }
    .document-header-actions #askDocumentButton:not([hidden]) { display: inline-flex; }
    .document-header-actions #askDocumentButton span { display: none; }
}

@media (max-width: 900px) {
    .document-stage.assistant-open,
    .document-stage.assistant-open.assistant-left { display: block; }
    .document-stage.assistant-open .document-content-pane { grid-column: 1; }
    .document-stage.assistant-open .document-assistant-resizer { display: none; }
    .document-assistant-panel,
    .document-stage.assistant-left .document-assistant-panel {
        position: absolute;
        inset: 0;
        z-index: 24;
        width: 100%;
        border: 0;
        background: var(--zy-surface);
    }
    .document-assistant-header { min-height: 52px; }
    .document-assistant-messages { padding-right: 14px; padding-left: 14px; }
    .document-append-heading-options { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .document-assistant-panel,
    .document-stage.assistant-left .document-assistant-panel { bottom: 64px; }
}

/* Keep the knowledge index layout authoritative after legacy responsive rules. */
.browser-view { padding: 48px clamp(24px, 5vw, 72px) 88px; }
.browser-view > * { width: min(100%, 1120px); }

@media (max-width: 900px) {
    .browser-view { padding: 38px 24px 72px; }
}

@media (max-width: 640px) {
    .browser-view { padding: 24px 14px 82px; }
    .base-overview { min-height: 92px; gap: 14px; padding: 0 2px 20px; }
    .base-overview-avatar { width: 58px; height: 58px; border-radius: 10px; box-shadow: inset 0 0 0 4px var(--zy-surface); }
    .base-overview-avatar svg { width: 26px; height: 26px; }
    .base-overview h1 { font-size: 21px; }
    .content-list-section { margin-top: 14px; }
    .content-list-section > .content-list-header { min-height: 42px; }
    .content-pathbar { min-height: 48px; gap: 1px; }
    .content-pathbar .breadcrumb { padding: 0 2px; font-size: 12px; }
    .content-pathbar .breadcrumb button { max-width: 118px; padding: 0 5px; }
    .content-pathbar .breadcrumb button:first-child svg { display: none; }
    .content-pathbar #browserForwardButton { display: none; }
    .content-pathbar .content-toolbar { gap: 0; }
    .content-collection .folder-card, .content-collection .document-card, .content-collection .document-collection.list .document-card {
        grid-template-columns: 32px minmax(0, 1fr) auto 34px;
        min-height: 54px;
        gap: 6px;
    }
    .content-collection .content-row-kind, .content-collection .content-row-size { display: none; }
    .content-collection .document-card time, .content-collection .folder-card time { grid-column: 3; font-size: 10px; }
    .content-collection .card-menu, .content-collection .document-collection.list .document-card .card-menu { width: 34px; height: 42px; grid-column: 4; opacity: 1; }
    .content-collection .welcome-card { min-height: 96px; }
}
