:root {
  --ink: #312a23;
  --muted: #786f64;
  --line: #ded3c4;
  --line-strong: #cdbda8;
  --paper: #fffdf8;
  --paper-soft: #faf5ec;
  --canvas: #f4efe6;
  --cream: #eee4d5;
  --cream-deep: #ddcdb7;
  --brown: #8a5f3d;
  --brown-dark: #70482d;
  --brown-deep: #4a382b;
  --soft-brown: #efe2d2;
  --amber: #9a671d;
  --red: #a84a42;
  --shadow: 0 18px 45px rgba(74, 56, 43, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Calibri, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #e9dfd0; color: var(--brown-deep); padding: 26px 18px 20px; border-right: 1px solid var(--line-strong); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(74,56,43,.18); background: var(--brown); color: #fffaf2; font-weight: 900; font-size: 20px; border-radius: 10px 3px 10px 3px; box-shadow: 0 8px 18px rgba(112,72,45,.15); }
.brand-mark.large { width: 54px; height: 54px; font-size: 28px; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; font-size: 17px; }
.brand small { margin-top: 3px; color: #857665; font-size: 12px; }
.nav { display: grid; gap: 5px; }
.nav a { color: #675c50; padding: 12px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.nav a:hover { color: var(--brown-deep); background: rgba(255,253,248,.55); }
.nav a.active { color: var(--brown-deep); background: #fffaf2; box-shadow: inset 3px 0 var(--brown), 0 5px 16px rgba(74,56,43,.05); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(74,56,43,.14); padding-top: 18px; }
.user-card { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.user-card strong, .user-card small { display: block; }
.user-card strong { font-size: 13px; }
.user-card small { color: #857665; margin-top: 3px; font-size: 11px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: rgba(255,253,248,.75); border: 1px solid rgba(74,56,43,.12); border-radius: 50%; font-weight: 700; }
.main { min-width: 0; }
.topbar { height: 96px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; background: rgba(255,253,248,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.topbar h1 { margin: 3px 0 0; font-size: 23px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--brown); font-size: 10px; letter-spacing: .18em; font-weight: 800; }
.eyebrow.light { color: var(--brown); }
.content { max-width: 1500px; margin: 0 auto; padding: 28px 34px 52px; }
.menu-toggle { display: none; }

.button { border: 1px solid transparent; display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 7px; background: var(--brown); color: #fffaf2; font-weight: 700; font-size: 14px; box-shadow: 0 7px 16px rgba(112,72,45,.12); transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { background: var(--brown-dark); }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .65; }
.button.compact { min-height: 36px; padding: 0 14px; font-size: 12px; }
.button.full, .ghost.full { width: 100%; }
.button.light { background: var(--brown-deep); color: #fffaf2; }
.button.light:hover { background: #382a20; }
.button.outline-light { background: rgba(255,253,248,.45); color: var(--brown-deep); border: 1px solid rgba(74,56,43,.38); box-shadow: none; }
.button.outline-light:hover { background: rgba(255,253,248,.8); }
.button.ghost, .ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); box-shadow: none; }
.button.ghost:hover, .ghost:hover { color: var(--brown-deep); background: var(--paper-soft); border-color: #bca88e; }
.button.danger { background: #fff2ef; color: var(--red); border: 1px solid #e9c9c4; box-shadow: none; }
.button.danger:hover { background: #fbe7e3; }
.sidebar .ghost { color: #675c50; border-color: rgba(74,56,43,.22); padding: 9px 12px; border-radius: 7px; }
.sidebar .ghost:hover { color: var(--brown-deep); background: rgba(255,253,248,.55); }
.text-link { border: 0; background: none; padding: 0; color: var(--brown); font-weight: 700; white-space: nowrap; }
.text-link:hover { color: var(--brown-dark); }
.title-link { color: var(--ink); }
.title-link:hover { color: var(--brown); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.hero-panel { position: relative; overflow: hidden; min-height: 210px; display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 34px; background: linear-gradient(120deg, #eee2d1, #dfcbb0); color: var(--brown-deep); border: 1px solid #d4c1a7; border-radius: 14px; box-shadow: var(--shadow); }
.hero-panel::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--brown); }
.hero-panel::after { content: ""; position: absolute; width: 360px; height: 360px; right: -110px; top: -190px; border: 70px solid rgba(255,253,248,.28); border-radius: 50%; }
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel h2 { margin: 30px 0 8px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.035em; }
.hero-panel p { max-width: 680px; margin: 0; color: #675849; line-height: 1.7; }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; }
.status-dot.online { background: #a97228; box-shadow: 0 0 0 5px rgba(169,114,40,.13); }
.status-dot.offline { background: #c75d54; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stat-card, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(74,56,43,.035); }
.stat-card { padding: 20px 22px; }
.stat-card span, .stat-card small, .muted { color: var(--muted); }
.stat-card span { font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; margin: 10px 0 5px; color: var(--brown-deep); font-size: 30px; letter-spacing: -.04em; }
.stat-card small { font-size: 11px; }
.panel { padding: 22px; }
.two-column { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.section-head h3 { margin: 4px 0 0; font-size: 18px; }
.section-head a { color: var(--brown); font-size: 12px; font-weight: 700; }
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid #eee6da; }
.list-row:first-child { border-top: 0; }
.list-row:hover .grow strong { color: var(--brown); }
.grow { min-width: 0; flex: 1; }
.grow strong, .grow small, .block { display: block; }
.grow strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.grow small, .block { color: var(--muted); margin-top: 4px; font-size: 11px; }
.file-type { width: 42px; height: 42px; display: grid; place-items: center; flex-shrink: 0; border-radius: 7px; background: var(--soft-brown); color: var(--brown); font-size: 10px; font-weight: 900; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.published { color: #76502f; background: #eee0cf; }
.badge.pending_review { color: #8a5b16; background: #f8ead0; }
.badge.rejected { color: #9e413b; background: #f9e5e2; }
.badge.draft, .badge.archived { color: #6f665d; background: #eee9e1; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps li > span { color: var(--brown); font-size: 12px; font-weight: 900; padding-top: 2px; }
.steps strong, .steps small { display: block; }
.steps strong { font-size: 14px; }
.steps small { margin-top: 5px; color: var(--muted); line-height: 1.5; }

.filters { display: grid; grid-template-columns: minmax(260px, 1fr) 170px 170px auto; align-items: end; gap: 12px; }
label { display: grid; gap: 7px; color: #554b41; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--ink); background: #fffefa; border: 1px solid #d3c6b5; border-radius: 7px; padding: 11px 12px; outline: none; }
input, select { height: 43px; }
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #a49a8f; }
input:focus, select:focus, textarea:focus { border-color: var(--brown); box-shadow: 0 0 0 3px rgba(138,95,61,.11); }
label small { color: var(--muted); font-weight: 400; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
th, td { padding: 13px 12px; border-bottom: 1px solid #eee6da; vertical-align: middle; }
tbody tr:hover { background: #fbf6ee; }
code { color: var(--brown-deep); background: #f0e7da; padding: 5px 8px; border-radius: 5px; font-weight: 700; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.form-card { display: grid; gap: 16px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.file-drop { padding: 18px; border: 1px dashed #bda98e; border-radius: 9px; background: #fbf6ee; }
.file-drop span { color: var(--muted); font-weight: 400; }
.file-drop input { height: auto; padding: 9px; background: #fffefa; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.aside-help h3 { margin: 5px 0 18px; }
.aside-help ul { margin: 0; padding-left: 19px; color: var(--muted); line-height: 1.8; font-size: 12px; }
.review-list { display: grid; gap: 12px; }
.review-card { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fcf8f1; }
.review-main { display: flex; gap: 12px; }
.review-main h4 { margin: 1px 0 6px; }
.review-main p { margin: 0 0 7px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.review-main .extraction-state { margin-top: 8px; }
.review-warning { display: block; margin-top: 7px; color: #8a5b16 !important; line-height: 1.5; }
.review-form { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; margin-top: 14px; }
.users-layout { grid-template-columns: 1.25fr .75fr; }
.stack { display: grid; gap: 18px; }
.narrow { max-width: 560px; }
.detail-grid { max-width: 920px; }
.detail-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.detail-list > div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:nth-child(odd) { padding-right: 22px; }
.detail-list dt { color: var(--muted); font-size: 11px; font-weight: 700; }
.detail-list dd { margin: 6px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.summary-box { margin-top: 18px; padding: 16px; border-radius: 9px; background: #f8f1e8; border: 1px solid #eadfce; }
.summary-box span { color: var(--brown); font-size: 11px; font-weight: 800; }
.summary-box p { margin: 8px 0 0; color: #554b41; line-height: 1.7; font-size: 13px; }
.checksum { display: block; max-width: 100%; overflow-wrap: anywhere; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.detail-actions form { margin-left: auto; }
.empty { padding: 46px 24px; text-align: center; }
.empty strong { font-size: 17px; }
.empty p { color: var(--muted); font-size: 12px; margin: 8px 0 18px; }
.alert { margin-bottom: 16px; padding: 12px 14px; border-radius: 7px; font-size: 12px; line-height: 1.5; }
.alert.success { background: #f0e6d8; color: #735032; border: 1px solid #ddc9af; }
.alert.error { background: #fff0ed; color: #9d3e38; border: 1px solid #ebc9c4; }
.alert.warning { background: #fbefd8; color: #825716; border: 1px solid #e9d19f; }

.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; }
.upload-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.upload-intro h3 { margin: 5px 0 8px; }
.upload-intro p { margin: 0; line-height: 1.7; }
.upload-actions, .queue-actions { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.smart-drop { margin: 18px 0; min-height: 120px; display: grid; place-content: center; text-align: center; gap: 8px; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.smart-drop strong { color: var(--brown-deep); font-size: 15px; }
.smart-drop.dragging, .smart-drop:focus { border-color: var(--brown); background: #f5eadb; outline: none; }
.queue-panel { min-height: 260px; }
.upload-queue { display: grid; gap: 14px; }
.upload-card { padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: #fdf9f2; }
.upload-card-head { display: flex; align-items: center; gap: 12px; }
.status-pill { padding: 5px 9px; border-radius: 999px; color: #6f665d; background: #eee9e1; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pill.analyzing, .status-pill.importing { color: #76502f; background: #eee0cf; }
.status-pill.ready { color: #815b1c; background: #f6e7c9; }
.status-pill.done { color: #5d563a; background: #e7e6d1; }
.status-pill.error { color: #9e413b; background: #f9e5e2; }
.progress-track { height: 5px; margin: 13px 0 9px; overflow: hidden; border-radius: 999px; background: #ece4d8; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brown); transition: width .18s ease; }
.processing-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.duplicate-warning { margin-top: 12px; padding: 10px 12px; border: 1px solid #e4c88f; border-radius: 7px; background: #fbefd8; color: #75501a; font-size: 12px; line-height: 1.55; }
.compact-fields { margin-top: 16px; }
.compact-fields .full-field { grid-column: 1 / -1; }
.needs-confirmation { padding: 9px; margin: -9px; border-radius: 8px; background: #fff2ce; }
.needs-confirmation::before { content: "请确认"; justify-self: start; padding: 3px 7px; border-radius: 999px; color: #7d561a; background: #f5db9e; font-size: 9px; font-weight: 900; }
.upload-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.text-button { padding: 0; border: 0; color: var(--brown); background: transparent; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.danger-text { color: #a34a43; margin-right: auto; }

.knowledge-filters { grid-template-columns: minmax(260px, 1fr) 150px 150px 140px auto; }
.knowledge-title-cell { min-width: 300px; }
.knowledge-summary { display: -webkit-box; max-width: 540px; margin-top: 7px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.search-hit { margin-top: 8px; padding: 9px 11px; border-left: 3px solid #b9926f; border-radius: 0 7px 7px 0; background: #faf2e7; }
.search-hit span { color: var(--brown); font-size: 10px; font-weight: 800; }
.search-hit p { max-width: 680px; margin: 5px 0 0; color: #5f554b; font-size: 11px; line-height: 1.6; }
mark { padding: 0 2px; border-radius: 2px; color: inherit; background: #f3d99a; }
.extraction-state { display: inline-block; padding: 4px 8px; border-radius: 999px; color: #6f665d; background: #eee9e1; font-size: 10px; font-weight: 800; white-space: nowrap; }
.extraction-state.ready { color: #625c3f; background: #e9e8d6; }
.extraction-state.needs_review { color: #815b1c; background: #f6e7c9; }
.extraction-state.failed { color: #9e413b; background: #f9e5e2; }
.knowledge-card-list { display: none; }

.ask-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.ask-main { display: grid; gap: 18px; }
.ask-form { display: grid; gap: 14px; }
.ask-options { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px; }
.ask-rule h3 { margin: 5px 0 18px; }
.ask-rule ul { margin: 0; padding-left: 19px; color: var(--muted); line-height: 1.8; font-size: 12px; }
.answer-box { padding: 18px; border: 1px solid #ddc9af; border-radius: 10px; background: #f8f1e8; }
.answer-box.no-basis { border-color: #e4c88f; background: #fbefd8; }
.answer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--brown); font-size: 11px; font-weight: 900; }
.answer-box > p { margin: 12px 0 0; color: #4f463d; font-size: 13px; line-height: 1.8; white-space: pre-line; }
.citation-panel { margin-top: 18px; }
.citation-list { display: grid; gap: 12px; }
.citation-card { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fdf9f2; }
.citation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.citation-head small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.citation-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.citation-meta span { padding: 4px 7px; border-radius: 5px; color: #6a5c50; background: #eee5da; font-size: 10px; font-weight: 700; }
.citation-card blockquote { margin: 12px 0; padding: 12px 14px; border-left: 3px solid #b9926f; background: #faf2e7; color: #554b41; font-size: 12px; line-height: 1.75; }
.follow-up { margin-top: 16px; padding: 14px; border-radius: 8px; background: #f5eee4; }
.follow-up strong { font-size: 12px; }
.follow-up p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.content-preview { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.segment-list { display: grid; gap: 9px; }
.segment-card { border: 1px solid var(--line); border-radius: 8px; background: #fdf9f2; }
.segment-card summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; cursor: pointer; }
.segment-card summary strong { color: var(--brown-deep); font-size: 12px; }
.segment-card summary span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.segment-card > p { max-height: 360px; margin: 0; padding: 0 14px 14px; overflow: auto; color: #554b41; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-empty { margin-top: 18px; padding: 26px 20px; border: 1px dashed var(--line); border-radius: 9px; background: #fbf6ee; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-brand { position: relative; overflow: hidden; display: flex; align-items: center; padding: 8vw; background: linear-gradient(135deg, #efe5d6 0%, #e1cfb7 100%); color: var(--brown-deep); border-right: 1px solid #d2bea3; }
.login-brand::before { content: ""; position: absolute; width: 520px; height: 520px; left: -250px; bottom: -330px; border: 95px solid rgba(255,253,248,.32); border-radius: 50%; }
.login-brand::after { content: ""; position: absolute; width: 370px; height: 370px; right: -170px; top: -210px; border: 70px solid rgba(138,95,61,.08); border-radius: 50%; }
.login-copy { position: relative; z-index: 1; max-width: 620px; }
.login-copy .eyebrow { margin-top: 26px; }
.login-copy h1 { margin: 18px 0; font-size: clamp(38px, 5vw, 64px); line-height: 1.12; letter-spacing: -.05em; }
.login-copy > p:not(.eyebrow) { color: #68594a; line-height: 1.8; max-width: 560px; }
.login-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 34px; }
.login-points span { padding: 8px 11px; border: 1px solid rgba(74,56,43,.22); border-radius: 999px; color: #5f5144; background: rgba(255,253,248,.3); font-size: 11px; }
.login-panel { display: grid; place-items: center; padding: 32px; background: #fffdf8; }
.login-card { width: min(420px, 100%); display: grid; gap: 17px; }
.login-card h2 { margin: 2px 0 0; color: var(--brown-deep); font-size: 30px; letter-spacing: -.04em; }
.login-card .muted { margin: -8px 0 8px; font-size: 13px; }
.security-note { text-align: center; color: var(--muted); margin-top: 4px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; width: 236px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 18px 0 40px rgba(74,56,43,.15); }
  .menu-open .sidebar { transform: translateX(0); }
  .topbar { height: 82px; padding: 0 20px; }
  .menu-toggle { display: block; border: 1px solid var(--line); background: #f0e7da; color: var(--brown-deep); padding: 8px 10px; border-radius: 6px; }
  .content { padding: 20px; }
  .hero-panel { align-items: flex-start; flex-direction: column; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .two-column, .users-layout { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
  .form-layout { grid-template-columns: 1fr; }
  .knowledge-filters { grid-template-columns: 1fr 1fr; }
  .ask-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar .button { display: none; }
  .topbar h1 { font-size: 19px; }
  .hero-panel { padding: 24px; }
  .hero-actions { width: 100%; flex-direction: column; }
  .stat-grid, .field-grid, .filters { grid-template-columns: 1fr; }
  .filters .search { grid-column: auto; }
  .stat-card strong { font-size: 25px; }
  .review-form { grid-template-columns: 1fr 1fr; }
  .review-form input { grid-column: 1 / -1; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 42vh; padding: 42px 26px; border-right: 0; border-bottom: 1px solid #d2bea3; }
  .login-copy h1 { font-size: 38px; }
  .login-points { display: none; }
  .login-panel { padding: 42px 26px; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list > div:nth-child(odd) { padding-right: 0; }
  .detail-actions { align-items: stretch; flex-direction: column; }
  .detail-actions form { margin-left: 0; }
  .detail-actions .button { width: 100%; }
  .upload-intro { align-items: stretch; flex-direction: column; }
  .upload-actions, .queue-actions { width: 100%; flex-wrap: wrap; }
  .upload-actions .button, .queue-actions .button { flex: 1; text-align: center; }
  .smart-drop { min-height: 105px; padding: 18px; }
  .queue-panel { padding: 16px; }
  .queue-panel > .section-head { align-items: stretch; flex-direction: column; }
  .upload-card { padding: 14px; }
  .upload-card-head { align-items: flex-start; }
  .status-pill { flex-shrink: 0; }
  .upload-card-actions { flex-wrap: wrap; }
  .upload-card-actions .button { flex: 1; }
  .knowledge-filters, .ask-options { grid-template-columns: 1fr; }
  .desktop-knowledge-table { display: none; }
  .knowledge-card-list { display: grid; gap: 12px; }
  .knowledge-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fdf9f2; }
  .knowledge-card-head { display: flex; align-items: flex-start; gap: 10px; }
  .knowledge-card-head .grow strong, .knowledge-card-head .grow small { white-space: normal; overflow-wrap: anywhere; }
  .knowledge-card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
  .knowledge-card-meta span { padding: 4px 7px; border-radius: 5px; color: var(--muted); background: #eee7dc; font-size: 10px; }
  .citation-head, .segment-card summary { align-items: flex-start; flex-direction: column; }
  .segment-card summary span { max-width: 100%; white-space: normal; }
  .answer-heading { align-items: flex-start; }
}

/* v2.3 workspace shell and dashboard */
:root {
  --canvas: #f5f1e9;
  --paper: #fbf9f4;
  --paper-soft: #f7f2e9;
  --line: #ddd4c7;
  --line-strong: #cec2b2;
  --brick: #af4d3e;
  --brick-dark: #8f3d32;
  --sage-soft: #dfe4df;
  --sand-soft: #eee4d2;
  --rose-soft: #edddd8;
}
body { background: var(--canvas); }
.app-shell { grid-template-columns: 224px minmax(0, 1fr); }
.sidebar {
  width: 224px;
  padding: 26px 13px 18px;
  background: #f7f2ea;
  border-right-color: var(--line);
}
.brand { gap: 11px; padding: 0 11px 31px; }
.brand-mark {
  width: 39px; height: 39px; border: 0; border-radius: 50%;
  background: var(--brick); font-family: Georgia, serif; font-size: 16px;
}
.brand strong { font-family: Georgia, "Songti SC", serif; font-size: 18px; letter-spacing: .04em; }
.brand small { font-size: 11px; }
.nav { gap: 4px; }
.nav a {
  position: relative; display: grid; grid-template-columns: 24px 1fr auto;
  align-items: center; gap: 9px; min-height: 49px; padding: 0 13px;
  border-radius: 7px; color: #625e57; font-size: 14px; font-weight: 500;
}
.nav a.active { color: var(--brick); background: #eadbd5; box-shadow: none; font-weight: 700; }
.nav a.active::before {
  content: ""; position: absolute; left: -13px; top: 10px; bottom: 10px;
  width: 4px; border-radius: 0 3px 3px 0; background: var(--brick);
}
.nav-icon { font-size: 20px; line-height: 1; text-align: center; }
.nav-count {
  min-width: 22px; height: 22px; display: grid; place-items: center;
  padding: 0 6px; border-radius: 999px; background: #ecd6d0;
  color: var(--brick); font-size: 10px;
}
.sidebar-foot { border-top: 0; padding: 0 0 0; }
.local-first {
  display: flex; align-items: flex-start; gap: 9px; padding: 13px;
  border: 1px solid var(--line); border-radius: 7px; background: #fbf8f2;
}
.local-first > span { color: #62716c; font-size: 18px; }
.local-first strong, .local-first small { display: block; }
.local-first strong { font-size: 12px; }
.local-first small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.topbar {
  height: 76px; justify-content: flex-start; gap: 22px; padding: 0 34px;
  background: rgba(248,245,239,.95);
}
.global-search {
  width: min(540px, 53vw); height: 45px; display: flex; align-items: center;
  gap: 10px; padding: 0 14px; border: 1px solid #cfc4b4;
  border-radius: 8px; background: #fbf9f4;
}
.global-search > span { color: #6e726e; font-size: 25px; line-height: 1; }
.global-search input {
  height: auto; padding: 0; border: 0; box-shadow: none; background: transparent;
}
.global-search input:focus { border: 0; box-shadow: none; }
.topbar-account { margin-left: auto; display: flex; align-items: center; gap: 11px; }
.notification-link { position: relative; margin-right: 12px; color: #5c605b; font-size: 23px; }
.notification-link i {
  position: absolute; right: -1px; top: 1px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--brick);
}
.avatar.warm { width: 37px; height: 37px; color: white; background: var(--brick); border: 0; }
.account-copy strong, .account-copy small { display: block; }
.account-copy strong { font-size: 13px; }
.account-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.account-menu { position: relative; }
.account-menu summary { padding: 8px; cursor: pointer; list-style: none; }
.account-menu > div {
  position: absolute; z-index: 20; right: 0; top: 36px; width: 120px;
  padding: 7px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); box-shadow: var(--shadow);
}
.account-menu a, .account-menu button {
  width: 100%; display: block; padding: 9px; border: 0; border-radius: 5px;
  color: var(--ink); background: transparent; text-align: left; font-size: 11px;
}
.account-menu a:hover, .account-menu button:hover { background: var(--paper-soft); }
.mobile-page-title { display: none; }
.content { max-width: 1280px; padding: 30px 42px 52px; }
.dashboard-intro {
  display: flex; justify-content: space-between; align-items: end;
  gap: 30px; padding: 4px 0 20px;
}
.dashboard-date {
  margin: 0 0 13px; color: var(--brick); font-size: 11px;
  font-weight: 800; letter-spacing: .08em;
}
.dashboard-intro h1 {
  margin: 0; color: #272a26; font-family: Georgia, "Songti SC", serif;
  font-size: clamp(34px, 4.2vw, 48px); line-height: 1.08; letter-spacing: -.035em;
}
.dashboard-intro p:last-child { margin: 12px 0 0; color: #7b7871; font-size: 13px; }
.import-button {
  min-height: 41px; padding: 0 17px; border-color: #c8bbaa;
  color: #343530; background: #fbf9f4; box-shadow: none;
}
.import-button:hover { color: var(--brick); background: #fffdf8; border-color: var(--brick); }
.dashboard-stats { margin: 0 0 18px; gap: 12px; }
.dashboard-stats .stat-card {
  position: relative; min-height: 101px; display: grid;
  grid-template-columns: 49px 1fr auto; grid-template-rows: 1fr 1fr;
  align-items: center; column-gap: 12px; padding: 16px;
  border-radius: 8px; box-shadow: none;
}
.dashboard-stats .stat-card:hover { border-color: #c5b7a5; background: #fffdf8; }
.dashboard-stats .stat-symbol {
  grid-row: 1 / 3; width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 50%; color: #65706b; font-size: 23px;
}
.stat-symbol.sand { background: var(--sand-soft); }
.stat-symbol.sage { background: var(--sage-soft); }
.stat-symbol.rose { color: var(--brick); background: var(--rose-soft); }
.dashboard-stats .stat-card > span:nth-child(2) { align-self: end; color: var(--muted); font-size: 11px; }
.dashboard-stats .stat-card strong {
  align-self: start; margin: 3px 0 0; color: #252825;
  font-family: Georgia, serif; font-size: 28px;
}
.dashboard-stats .stat-card > b { grid-column: 3; grid-row: 1 / 3; color: #aaa295; font-size: 23px; font-weight: 400; }
.dashboard-stats .stat-card.conflict > span:nth-child(2),
.dashboard-stats .stat-card.conflict strong { color: var(--brick); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .9fr); gap: 16px; }
.dashboard-grid .panel { padding: 0; border-radius: 8px; box-shadow: none; overflow: hidden; }
.dashboard-grid .section-head { min-height: 77px; margin: 0; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.dashboard-grid .section-head h3 {
  margin: 4px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 20px;
}
.dashboard-grid .section-head a { color: #575a54; font-weight: 500; }
.category-list { display: grid; }
.category-row {
  min-height: 89px; display: grid; grid-template-columns: 48px 112px minmax(170px, 1fr) 92px 15px;
  align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line);
}
.category-row:first-child { border-top: 0; }
.category-row:hover { background: #f8f4ec; }
.category-symbol { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; font-size: 21px; }
.category-symbol.sand { background: var(--sand-soft); }
.category-symbol.sage { background: var(--sage-soft); }
.category-name { padding-right: 12px; border-right: 1px solid var(--line); }
.category-name strong, .category-name small, .category-examples small, .category-meta small { display: block; }
.category-name strong { font-size: 13px; }
.category-name small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.category-examples small { overflow: hidden; color: #62645f; font-size: 10px; line-height: 2; text-overflow: ellipsis; white-space: nowrap; }
.category-meta small { color: #73746f; font-size: 9px; line-height: 2.2; white-space: nowrap; }
.category-row > b { color: #373a36; font-size: 22px; font-weight: 400; }
.dashboard-side { display: grid; align-content: start; gap: 16px; }
.dashboard-ask { min-height: 274px; }
.dashboard-ask form {
  position: relative; margin: 15px; padding: 0; border: 1px solid #cfc4b5;
  border-radius: 7px; background: #fffdf8;
}
.dashboard-ask textarea { min-height: 73px; padding: 14px 48px 14px 13px; border: 0; background: transparent; }
.dashboard-ask textarea:focus { box-shadow: none; }
.dashboard-ask form button {
  position: absolute; right: 9px; bottom: 9px; width: 35px; height: 35px;
  border: 0; border-radius: 7px; color: white; background: var(--brick); font-size: 16px;
}
.example-question { display: flex; align-items: center; gap: 8px; padding: 0 15px; color: var(--muted); font-size: 9px; }
.example-question a { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; color: #5d5e59; }
.trust-note { margin: 15px; color: #747770; font-size: 9px; }
.pending-panel .section-head { min-height: 72px; }
.pending-row {
  display: grid; grid-template-columns: 25px 1fr auto; align-items: center;
  gap: 9px; padding: 12px 16px; border-top: 1px solid var(--line);
}
.pending-row > span:first-child { color: var(--brick); }
.pending-row strong, .pending-row small { display: block; }
.pending-row strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pending-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.quiet-state { margin: 0; padding: 24px 18px; color: var(--muted); font-size: 11px; }

@media (max-width: 1080px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .sidebar { width: 224px; }
  .topbar { height: 70px; padding: 0 20px; }
  .global-search { width: min(520px, 65vw); }
  .content { padding: 24px 20px 44px; }
  .mobile-page-title { display: none; }
}
@media (max-width: 700px) {
  .global-search { flex: 1; width: auto; }
  .account-copy, .notification-link { display: none; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; }
  .import-button { width: 100%; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .dashboard-side { grid-template-columns: 1fr; }
  .category-row { grid-template-columns: 45px minmax(0, 1fr) 15px; min-height: 76px; }
  .category-name { border-right: 0; }
  .category-examples, .category-meta { display: none; }
}
@media (max-width: 440px) {
  .topbar { gap: 10px; padding: 0 13px; }
  .global-search { padding: 0 10px; }
  .global-search input::placeholder { color: transparent; }
  .dashboard-stats { grid-template-columns: 1fr; }
  .dashboard-intro h1 { font-size: 34px; }
}
.edit-box { margin-top: 18px; }
.edit-box summary { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.form-grid label { display: grid; gap: 6px; }
.form-grid .full { grid-column: 1 / -1; }
.notification-card { display: block; color: inherit; text-decoration: none; }
.notification-card:hover { background: #f8f4ec; }
.preview-workspace {
  overflow: hidden; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); box-shadow: var(--shadow);
}
.preview-workspace > .section-head { min-height: 82px; margin: 0; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.preview-workspace .section-head h3 { margin: 4px 0 5px; }
.preview-actions { display: flex; gap: 8px; }
.preview-layout { min-height: calc(100vh - 230px); display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.preview-outline { padding: 19px 14px; border-right: 1px solid var(--line); background: #f7f2e9; }
.preview-outline > strong { color: var(--brown-deep); font-size: 12px; }
.preview-outline > p { margin: 5px 0 14px; color: var(--muted); font-size: 10px; }
.preview-outline nav { max-height: calc(100vh - 300px); display: grid; align-content: start; gap: 3px; overflow: auto; }
.preview-outline nav a, .preview-outline nav span {
  padding: 8px 9px; border-radius: 6px; color: #5f5e58; font-size: 10px;
  text-decoration: none; overflow-wrap: anywhere;
}
.preview-outline nav a:hover { color: var(--brick); background: #eadbd5; }
.preview-stage { min-width: 0; padding: 14px; background: #e8e3da; }
.document-frame { width: 100%; min-height: calc(100vh - 270px); border: 1px solid #cbc2b5; border-radius: 7px; background: white; }
.structured-fallback { margin-top: 12px; padding: 12px; border-radius: 7px; background: var(--paper); }
.structured-fallback summary { cursor: pointer; color: var(--brick); font-size: 11px; font-weight: 700; }
.preview-segments { display: grid; gap: 9px; margin-top: 12px; }
.preview-segments .segment-card { padding: 13px; }
.preview-segments .segment-card > p { margin-top: 8px; padding: 0; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .preview-workspace > .section-head { align-items: stretch; flex-direction: column; }
  .preview-actions { width: 100%; }
  .preview-actions .button { flex: 1; text-align: center; }
  .preview-layout { grid-template-columns: 1fr; }
  .preview-outline { padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-outline nav { max-height: 92px; display: flex; overflow-x: auto; }
  .preview-outline nav a { flex: 0 0 auto; white-space: nowrap; }
  .preview-stage { padding: 8px; }
  .document-frame { min-height: 68vh; }
}

/* v2.6 direct publishing, folder packages, and batch management */
.auto-import-toggle {
  display: flex; grid-auto-flow: column; align-items: center; gap: 7px;
  color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap;
}
.auto-import-toggle input, .row-checkbox, .bulk-select-all input {
  width: 18px; height: 18px; margin: 0; accent-color: var(--brick);
}
.bulk-toolbar {
  display: grid; grid-template-columns: auto 180px 180px minmax(190px, 1fr) auto;
  align-items: end; gap: 10px; margin: 0 0 18px; padding: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper-soft);
}
.bulk-select-all { display: flex; align-items: center; gap: 7px; min-height: 43px; white-space: nowrap; }
.knowledge-card-head > .row-checkbox { flex: 0 0 auto; margin-top: 11px; }
.folder-preview-layout { grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); }
.folder-tree nav { gap: 5px; }
.folder-tree nav a {
  display: grid; gap: 4px; border: 1px solid transparent;
}
.folder-tree nav a span { overflow-wrap: anywhere; }
.folder-tree nav a small { color: var(--muted); font-size: 9px; }
.folder-tree nav a.active { color: var(--brick); border-color: #d7bcb5; background: #eadbd5; }

@media (max-width: 1080px) {
  .bulk-toolbar { grid-template-columns: 1fr 1fr; }
  .bulk-toolbar .bulk-select-all, .bulk-toolbar button { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .bulk-toolbar { grid-template-columns: 1fr; }
  .bulk-toolbar .bulk-select-all, .bulk-toolbar button { grid-column: auto; }
  .queue-actions .auto-import-toggle { width: 100%; }
  .folder-preview-layout { grid-template-columns: 1fr; }
  .folder-tree nav { max-height: 180px; display: grid; overflow-y: auto; }
  .folder-tree nav a { white-space: normal; }
}

/* v2.7 Feishu-style document workspace and instant preview */
.content.content-library { max-width: none; padding: 16px 18px 24px; }
.library-workspace {
  height: calc(100vh - 116px); min-height: 650px; display: grid;
  grid-template-columns: minmax(310px, 360px) minmax(0, 1fr); overflow: hidden;
  border: 1px solid #dfe2e6; border-radius: 9px; background: #fff;
  box-shadow: 0 9px 28px rgba(39, 43, 49, .045);
}
.library-navigation {
  min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  border-right: 1px solid #e1e3e6; background: #f7f8fa;
}
.library-navigation-head {
  min-height: 72px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px 11px;
}
.library-navigation-head h2 { margin: 3px 0 0; color: #303338; font-size: 18px; }
.library-add {
  width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #d7dbe0;
  border-radius: 7px; color: #535861; background: #fff; font-size: 21px;
}
.library-add:hover { color: var(--brick); border-color: #d6aaa2; background: #fff7f5; }
.library-search {
  position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center; gap: 4px; margin: 0 12px 10px; padding: 0 8px;
  border: 1px solid #d9dde2; border-radius: 7px; background: #fff;
}
.library-search > span { color: #777c84; font-size: 20px; }
.library-search > input { height: 38px; padding: 0 4px; border: 0; background: transparent; box-shadow: none; }
.library-search > input:focus { border: 0; box-shadow: none; }
.library-search > button { padding: 6px 7px; border: 0; color: #5e6570; background: transparent; font-size: 10px; }
.library-search > button:hover { color: var(--brick); }
.library-search-filters {
  grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 0 0 8px;
}
.library-search-filters select { height: 32px; padding: 0 8px; border-color: #e0e3e7; font-size: 10px; }
.library-bulk { margin: 0 12px 9px; }
.library-bulk details { border: 1px solid #dfe2e6; border-radius: 7px; background: #fff; }
.library-bulk summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; cursor: pointer; color: #555b64; font-size: 11px; font-weight: 700;
}
.library-bulk summary span { color: #8b9098; font-size: 9px; font-weight: 500; }
.library-bulk details[open] { padding-bottom: 10px; }
.library-bulk details[open] summary { margin-bottom: 8px; border-bottom: 1px solid #eceef1; }
.library-bulk label { margin: 7px 10px; gap: 5px; font-size: 10px; }
.library-bulk input, .library-bulk select { height: 34px; padding: 7px 8px; font-size: 10px; }
.library-bulk .bulk-select-all { min-height: 28px; display: flex; }
.library-bulk .bulk-select-all input { width: 17px; height: 17px; }
.library-bulk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 3px 10px 0; }
.document-tree { min-height: 0; flex: 1; overflow: auto; padding: 0 8px 14px; }
.document-group { margin-top: 2px; }
.document-group > summary {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center;
  gap: 5px; min-height: 37px; padding: 0 8px; cursor: pointer; list-style: none;
  color: #545962; font-size: 11px;
}
.document-group > summary::-webkit-details-marker { display: none; }
.document-group > summary > span { transition: transform .15s ease; }
.document-group:not([open]) > summary > span { transform: rotate(-90deg); }
.document-group > summary small {
  min-width: 21px; padding: 2px 6px; border-radius: 999px; color: #858a92;
  background: #eceef1; text-align: center; font-size: 9px;
}
.file-tree-row {
  position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center; gap: 5px; min-height: 56px; margin: 2px 0; padding: 4px 5px;
  border: 1px solid transparent; border-radius: 6px;
}
.file-tree-row:hover { background: #eef1f5; }
.file-tree-row.active { border-color: #cdd9f5; background: #e6edff; }
.file-tree-row > .row-checkbox { width: 16px; height: 16px; }
.file-tree-link { min-width: 0; display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 8px; }
.file-tree-icon {
  width: 29px; height: 32px; display: grid; place-items: center; border: 1px solid #d7dce2;
  border-radius: 5px; color: #4b67a6; background: #fff; font-size: 9px; font-weight: 800;
}
.file-tree-row.active .file-tree-icon { border-color: #b9c9ed; color: #2858bd; }
.file-tree-copy { min-width: 0; }
.file-tree-copy strong, .file-tree-copy small, .file-tree-copy em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tree-copy strong { color: #3c4046; font-size: 11px; }
.file-tree-copy small { margin-top: 4px; color: #8a8f97; font-size: 9px; }
.file-tree-copy em { margin-top: 3px; color: #a06b26; font-size: 8px; font-style: normal; }
.tree-delete-form { align-self: center; }
.tree-delete-form button {
  min-height: 28px; padding: 0 7px; border: 1px solid #e5c0bb; border-radius: 5px;
  color: #a8463e; background: #fff4f2; font-size: 9px; font-weight: 700;
}
.tree-delete-form button:hover { color: #8e302a; background: #ffe9e6; }
.library-empty-tree { padding: 45px 18px; color: #777c84; text-align: center; }
.library-empty-tree strong, .library-empty-tree p { display: block; }
.library-empty-tree p { margin: 7px 0 13px; font-size: 10px; }
.library-empty-tree a { color: #315ebf; font-size: 11px; font-weight: 700; }
.library-document { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.library-document-top {
  min-height: 57px; display: flex; align-items: center; justify-content: space-between;
  gap: 15px; padding: 10px 20px; border-bottom: 1px solid #e5e7ea;
}
.document-breadcrumb {
  min-width: 0; display: flex; align-items: center; gap: 8px; margin: 0;
  overflow: hidden; color: #717780; font-size: 10px; white-space: nowrap;
}
.document-breadcrumb span { overflow: hidden; text-overflow: ellipsis; }
.document-breadcrumb b { color: #b1b5bb; font-size: 15px; font-weight: 400; }
.library-document-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.library-document-actions > a, .library-document-actions button {
  min-height: 31px; display: inline-flex; align-items: center; padding: 0 10px;
  border: 1px solid #d8dce1; border-radius: 6px; color: #555b64; background: #fff;
  font-size: 9px; font-weight: 700;
}
.library-document-actions > a:hover { color: #245ac7; border-color: #afc2ec; }
.library-document-actions button { color: #a8463e; border-color: #e3bcb7; background: #fff5f3; }
.library-document-actions button:hover { background: #ffeae7; }
.library-document-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 20px 25px 16px; border-bottom: 1px solid #eceef1;
}
.library-document-heading h1 {
  max-width: 850px; margin: 0; overflow: hidden; color: #25282c;
  font-family: Georgia, "Songti SC", serif; font-size: clamp(24px, 2.4vw, 34px);
  text-overflow: ellipsis; white-space: nowrap;
}
.library-document-heading p { display: flex; align-items: center; gap: 8px; margin: 9px 0 0; color: #8a8f97; font-size: 10px; }
.library-document-heading p i { width: 1px; height: 11px; background: #d8dbe0; }
.instant-preview-badge {
  flex-shrink: 0; padding: 6px 9px; border-radius: 999px; color: #477064;
  background: #e9f1ee; font-size: 9px; font-weight: 700;
}
.library-viewer { position: relative; min-height: 0; flex: 1; overflow: hidden; background: #eef0f3; }
.library-viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-loading {
  position: absolute; z-index: 2; inset: 0; display: none; place-content: center;
  justify-items: center; gap: 7px; color: #565c64; background: rgba(247, 248, 250, .96);
}
.library-viewer.loading .viewer-loading { display: grid; }
.preview-frame-shell { position: relative; min-height: calc(100vh - 270px); }
.preview-frame-shell.loading .viewer-loading { display: grid; }
.preview-frame-shell .viewer-loading { border-radius: 7px; }
.preview-frame-shell .document-frame { display: block; }
.preview-actions form { display: flex; }
.viewer-loading > span {
  width: 28px; height: 28px; margin-bottom: 4px; border: 3px solid #d7dce4;
  border-top-color: #4d6fbd; border-radius: 50%; animation: viewer-spin .8s linear infinite;
}
.viewer-loading strong { font-size: 12px; }
.viewer-loading small { color: #91969e; font-size: 9px; }
@keyframes viewer-spin { to { transform: rotate(360deg); } }
.library-document-empty { margin: auto; padding: 30px; color: #7b8088; text-align: center; }
.library-document-empty > span { display: block; margin-bottom: 12px; font-size: 42px; }
.library-document-empty strong { color: #4b5058; font-size: 16px; }
.library-document-empty p { margin: 8px 0 0; font-size: 11px; }

@media (max-width: 1120px) {
  .library-workspace { grid-template-columns: minmax(285px, 320px) minmax(0, 1fr); }
  .instant-preview-badge { display: none; }
}
@media (max-width: 820px) {
  .content.content-library { padding: 12px; }
  .library-workspace { height: auto; min-height: calc(100vh - 110px); grid-template-columns: 1fr; }
  .library-navigation { min-height: calc(100vh - 110px); border-right: 0; }
  .library-document { display: none; }
  .document-tree { overflow: visible; }
  .file-tree-row { min-height: 62px; }
  .file-tree-copy strong, .file-tree-copy small { white-space: normal; overflow-wrap: anywhere; }
}

/* v2.9 typography, direct editing, concise AI sources and controlled sharing */
body { font-size: 16px; line-height: 1.55; }
.sidebar { overflow: hidden; }
.nav { min-height: 0; overflow-y: auto; padding-right: 3px; }
.brand strong { font-size: 20px; }
.brand small { font-size: 13px; }
.nav a { min-height: 52px; font-size: 16px; }
.nav-icon { font-size: 17px; }
.topbar input, .global-search input { font-size: 16px; }
.account-copy strong { font-size: 14px; }
.account-copy small { font-size: 12px; }
.eyebrow { font-size: 12px; }
.button { min-height: 46px; font-size: 15px; }
.button.compact { min-height: 38px; font-size: 14px; }
label { font-size: 14px; }
input, select, textarea { font-size: 15px; }
.muted, label small { font-size: 13px; }
.section-head h3 { font-size: 21px; }
.section-head a { font-size: 14px; }
.alert { font-size: 14px; }
.detail-list dt { font-size: 13px; }
.detail-list dd, .summary-box p { font-size: 15px; }
.summary-box span { font-size: 13px; }
.segment-card summary strong { font-size: 15px; }
.segment-card summary span { font-size: 13px; }
.segment-card > p { font-size: 15px; }
.answer-box > p { font-size: 16px; }
.ask-rule ul { font-size: 14px; }
.citation-card blockquote { font-size: 15px; }
.citation-head small { font-size: 13px; }

.dashboard-date { font-size: 13px; }
.dashboard-intro p:last-child { font-size: 15px; }
.dashboard-stats .stat-card > span:nth-child(2) { font-size: 14px; }
.dashboard-stats .stat-card strong { font-size: 32px; }
.dashboard-grid .section-head h3 { font-size: 23px; }
.category-name strong { font-size: 16px; }
.category-name small { font-size: 13px; }
.category-examples small { font-size: 13px; line-height: 1.7; }
.category-meta small { font-size: 12px; line-height: 1.8; }
.example-question, .trust-note { font-size: 12px; }
.pending-row strong { font-size: 14px; }
.pending-row small, .quiet-state { font-size: 12px; }

.project-experience-entry {
  min-height: 104px; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center; gap: 18px; margin: 0 0 18px; padding: 18px 22px;
  border: 1px solid #d6c7b5; border-radius: 10px;
  color: #3b3833; background: linear-gradient(105deg, #fffaf1, #f2e7d6);
}
.project-experience-entry:hover { border-color: var(--brick); background: #fffaf2; }
.project-entry-icon {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 11px;
  color: white; background: var(--brick); font-family: Georgia, serif; font-size: 25px;
}
.project-experience-entry small, .project-experience-entry strong, .project-experience-entry em { display: block; }
.project-experience-entry small { color: #8a655b; font-size: 12px; font-weight: 800; }
.project-experience-entry strong { margin-top: 3px; font-family: Georgia, "Songti SC", serif; font-size: 22px; }
.project-experience-entry em { margin-top: 4px; color: #79736b; font-size: 13px; font-style: normal; }
.project-experience-entry > b { color: var(--brick); font-size: 14px; }

.library-workspace { grid-template-columns: minmax(380px, 430px) minmax(0, 1fr); }
.library-navigation-head h2 { font-size: 22px; }
.library-head-actions { display: flex; gap: 7px; }
.library-head-actions > a {
  width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #d7dbe0;
  border-radius: 7px; color: #535861; background: white; font-size: 17px; font-weight: 800;
}
.library-add { font-size: 23px !important; }
.library-search > input { font-size: 15px; }
.library-search > button { font-size: 13px; }
.library-search-filters select { height: 38px; font-size: 13px; }
.library-bulk summary { font-size: 14px; }
.library-bulk summary span { font-size: 12px; }
.library-bulk label { font-size: 13px; }
.library-bulk input, .library-bulk select { height: 39px; font-size: 13px; }
.document-group > summary { min-height: 43px; font-size: 15px; }
.document-group > summary small { font-size: 12px; }
.directory-tree-children { display: grid; }
.directory-group { --directory-depth: 0; }
.directory-group > summary {
  display: grid; grid-template-columns: 17px 25px minmax(0, 1fr) auto;
  align-items: center; gap: 4px; min-height: 40px;
  padding: 0 8px 0 calc(12px + var(--directory-depth) * 15px);
  color: #646a72; cursor: pointer; list-style: none; font-size: 14px;
}
.directory-group > summary::-webkit-details-marker { display: none; }
.directory-group > summary > span { transition: transform .15s ease; }
.directory-group:not([open]) > summary > span { transform: rotate(-90deg); }
.directory-group > summary > b {
  width: 23px; height: 22px; display: grid; place-items: center; border-radius: 5px;
  color: #8a672e; background: #f0e4c9; font-size: 11px;
}
.directory-group > summary > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.directory-group > summary > small { color: #8a9098; font-size: 12px; }
.directory-group > div > .file-tree-row { margin-left: calc(10px + var(--directory-depth) * 15px); }
.unassigned-directory > summary > b { color: #737983; background: #e8eaed; }
.file-tree-row { min-height: 68px; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 7px; }
.file-tree-row > .row-checkbox { width: 18px; height: 18px; }
.file-tree-link { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; }
.file-tree-icon { width: 34px; height: 38px; font-size: 11px; }
.file-tree-copy strong { font-size: 15px; }
.file-tree-copy small { font-size: 12px; }
.file-tree-copy em { font-size: 11px; }
.tree-delete-form button { min-height: 32px; font-size: 12px; }
.library-document-actions > a, .library-document-actions button { min-height: 36px; font-size: 13px; }
.document-breadcrumb { font-size: 13px; }
.library-document-heading p { font-size: 13px; }
.instant-preview-badge { font-size: 12px; }
.viewer-loading strong { font-size: 16px; }
.viewer-loading small { font-size: 13px; }
.library-document-empty p { font-size: 14px; }

.preview-outline { grid-column: auto; }
.preview-outline > strong { font-size: 15px; }
.preview-outline > p { font-size: 13px; }
.preview-outline nav a, .preview-outline nav span { font-size: 14px; }
.folder-tree nav a small { font-size: 12px; }
.structured-fallback summary { font-size: 14px; }

.upload-diagnosis {
  display: grid; grid-template-columns: auto 1fr; gap: 13px; margin: -2px 0 18px;
  padding: 15px 18px; border-color: #cbdad5; background: #f1f7f4;
}
.upload-diagnosis strong { color: #3f685c; font-size: 14px; }
.upload-diagnosis span { color: #53665f; font-size: 14px; }
.processing-note { font-size: 14px; }
.status-pill { font-size: 13px; }
.status-pill.uploading { color: #76502f; background: #eee0cf; }
.import-result {
  margin-top: 12px; padding: 10px 12px; border-radius: 7px;
  color: #315f52; background: #e9f3ef; font-size: 14px; font-weight: 700;
}

.directory-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.directory-hero h2 { margin: 5px 0 8px; font-size: 30px; }
.directory-hero p { max-width: 760px; margin: 0; color: var(--muted); font-size: 15px; }
.directory-layout { display: grid; grid-template-columns: minmax(270px, .7fr) minmax(0, 1.5fr); gap: 18px; align-items: start; }
.directory-create { position: sticky; top: 18px; }
.directory-help { margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.managed-directory-tree { display: grid; gap: 10px; }
.managed-category { border: 1px solid var(--line); border-radius: 9px; background: #fdfbf7; }
.managed-category > summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 52px;
  padding: 0 15px; cursor: pointer; font-size: 16px;
}
.managed-category > summary span { color: var(--muted); font-size: 13px; }
.managed-category > div { border-top: 1px solid var(--line); }
.managed-directory-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 10px 12px 10px calc(12px + var(--directory-depth) * 20px);
  border-top: 1px solid #eee8df;
}
.managed-directory-row:first-child { border-top: 0; }
.managed-folder-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 6px; color: #84652e; background: #f0e4c9; font-size: 12px; }
.directory-rename-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 9px; }
.directory-rename-form input { height: 40px; }
.directory-rename-form small { color: var(--muted); font-size: 13px; white-space: nowrap; }

.content.content-editor { max-width: none; padding: 16px 22px 32px; }
.editor-shell {
  min-height: calc(100vh - 132px); overflow: hidden; border: 1px solid #dfe2e6;
  border-radius: 10px; background: #fff; box-shadow: 0 10px 35px rgba(35, 40, 48, .05);
}
.editor-topbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
  gap: 20px; padding: 15px 22px; border-bottom: 1px solid #e5e8ec; background: #fbfcfd;
}
.editor-title p { margin: 0 0 3px; color: #7a8089; font-size: 13px; }
.editor-title h1 { margin: 0; overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.editor-state { min-width: 150px; text-align: right; }
.editor-state span, .editor-state small { display: block; }
.editor-state small { margin-top: 3px; color: #7c828b; font-size: 12px; }
.saving-state { font-size: 14px; font-weight: 800; }
.saving-state.saved { color: #3f7565; }
.saving-state.saving, .saving-state.dirty { color: #926724; }
.saving-state.conflict { color: #a8463e; }
.editor-actions { display: flex; gap: 7px; }
.editor-toolbar {
  position: sticky; z-index: 2; top: 0; display: flex; flex-wrap: wrap; gap: 5px;
  padding: 10px max(18px, calc((100% - 900px) / 2)); border-bottom: 1px solid #e4e7eb;
  background: rgba(255, 255, 255, .97);
}
.editor-toolbar button { min-height: 35px; padding: 0 11px; border: 1px solid transparent; border-radius: 6px; color: #51565e; background: transparent; font-size: 14px; }
.editor-toolbar button:hover { border-color: #d7dce3; background: #f1f3f6; }
.editor-notice { max-width: 900px; margin: 18px auto 0; padding: 11px 14px; border-radius: 7px; color: #596b65; background: #eef5f2; font-size: 13px; }
.rich-editor {
  width: min(900px, calc(100% - 36px)); min-height: 640px; margin: 0 auto; padding: 42px 58px 90px;
  color: #292d32; background: white; outline: none; font-size: 17px; line-height: 1.85;
}
.rich-editor:focus { box-shadow: inset 0 0 0 2px #e7ecf7; }
.rich-editor h1 { font-size: 31px; }
.rich-editor h2 { font-size: 25px; }
.rich-editor h3 { font-size: 20px; }
.rich-editor blockquote { margin: 18px 0; padding: 10px 18px; border-left: 4px solid #bdc9e5; color: #5e6570; background: #f6f8fc; }
.rich-editor table { width: 100%; border-collapse: collapse; }
.rich-editor th, .rich-editor td { padding: 9px; border: 1px solid #dfe3e8; }

.project-experience-hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.project-experience-hero h1 { margin: 5px 0 8px; font-size: 36px; }
.project-experience-hero p { max-width: 760px; margin: 0; color: var(--muted); font-size: 15px; }
.experience-group { margin-top: 18px; }
.experience-group .section-head h2 { margin: 4px 0 0; font-size: 24px; }
.experience-list { display: grid; gap: 14px; }
.experience-card { padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: #fdfbf7; }
.experience-card h3 { margin: 0; font-size: 20px; }
.experience-meta { color: var(--muted) !important; font-size: 13px !important; }
.experience-card > p { max-height: 220px; overflow: auto; color: #4c4a46; font-size: 15px; line-height: 1.8; white-space: pre-wrap; }
.experience-actions { display: flex; gap: 8px; }

.external-source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.external-source-card { display: grid; gap: 7px; padding: 17px; border: 1px solid #d8dde6; border-radius: 9px; background: #fbfcfe; }
.external-source-card:hover { border-color: #9eb3df; background: #f4f7fd; }
.external-source-card span { color: #315ebf; font-size: 12px; font-weight: 800; }
.external-source-card strong { font-size: 15px; line-height: 1.5; }
.external-source-card b { color: #6d7480; font-size: 13px; }
.standards-warning { font-size: 15px; line-height: 1.7; }

@media (max-width: 1120px) {
  .library-workspace { grid-template-columns: minmax(340px, 380px) minmax(0, 1fr); }
  .directory-layout { grid-template-columns: 1fr; }
  .directory-create { position: static; }
  .editor-topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .editor-state { display: none; }
  .editor-actions { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .library-workspace { grid-template-columns: 1fr; }
  .project-experience-entry { grid-template-columns: 50px minmax(0, 1fr); }
  .project-experience-entry > b { grid-column: 2; }
  .directory-hero, .project-experience-hero { align-items: stretch; flex-direction: column; }
  .managed-directory-row { grid-template-columns: 30px minmax(0, 1fr); }
  .managed-directory-row > form:last-child { grid-column: 2; }
  .directory-rename-form { grid-template-columns: 1fr auto; }
  .directory-rename-form small { grid-column: 1 / -1; }
  .editor-topbar { grid-template-columns: 1fr; }
  .editor-actions { grid-column: auto; flex-wrap: wrap; }
  .rich-editor { width: 100%; min-height: 70vh; padding: 30px 22px 70px; }
  .external-source-list { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .upload-diagnosis { grid-template-columns: 1fr; }
  .project-experience-entry { padding: 15px; }
  .directory-rename-form { grid-template-columns: 1fr; }
  .directory-rename-form small { grid-column: auto; }
  .editor-toolbar { padding: 8px; }
  .editor-actions .button { flex: 1; }
  .experience-actions { flex-direction: column; }
}

/* v2.9 direct-edit workflow, Calibri-first typography and concise AI answer */
:root {
  --font-ui: Calibri, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Noto Sans SC", Arial, sans-serif;
}
body, body * {
  font-family: var(--font-ui) !important;
}
body { font-variant-ligatures: common-ligatures; }

.direct-editor .editor-topbar { background: #fbf9f4; border-bottom-color: var(--line); }
.direct-editor .editor-title h1 { color: var(--ink); font-size: 24px; }
.direct-editor .editor-title p { color: var(--muted); }
.compact-editor-toolbar { align-items: center; background: rgba(255,253,248,.97); border-bottom-color: var(--line); }
.editor-hint { margin-right: auto; padding: 0 10px; color: var(--muted); font-size: 13px; }
.editor-share-status {
  width: min(900px, calc(100% - 36px)); margin: 14px auto 0; padding: 10px 13px;
  border: 1px solid #d8c8b3; border-radius: 7px; color: #62513f; background: #faf1e5;
  font-size: 13px;
}
.direct-editor .rich-editor {
  min-height: 68vh; margin-top: 16px; border: 1px solid #e5ded4; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(74,56,43,.035);
}
.direct-editor .rich-editor:focus { border-color: #cbb9a3; box-shadow: 0 0 0 3px rgba(138,95,61,.08); }

.ask-simple { max-width: 980px; margin: 0 auto; }
.ask-simple-head { margin-bottom: 12px; }
.ask-simple-head h3 { margin-bottom: 7px; }
.ask-simple-head p { margin: 0; }
.ask-simple .ask-form > textarea { min-height: 96px; font-size: 16px; }
.simple-options { grid-template-columns: minmax(220px, 300px) auto; justify-content: space-between; }
.ask-simple .answer-box { margin-top: 18px; }
.ask-simple .answer-box > p { font-size: 16px; line-height: 1.75; }
.compact-sources { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.compact-citation-list { gap: 10px; }
.compact-citation { background: #fffdf8; }
.compact-citation blockquote { max-height: 150px; overflow: auto; }
.source-preview-link { display: inline-block; margin-left: 12px; font-size: 12px; }

@media (max-width: 820px) {
  .content.content-editor { padding: 10px 10px 24px; }
  .editor-shell { border-radius: 7px; }
  .editor-hint { width: 100%; margin: 0 0 4px; }
  .direct-editor .rich-editor { width: calc(100% - 18px); margin: 9px; padding: 24px 18px 60px; border-radius: 6px; }
  .editor-share-status { width: calc(100% - 18px); margin: 9px; }
  .simple-options { grid-template-columns: 1fr; }
  .simple-options .button { width: 100%; }
}

/* v3.0 unified editor, media preview and navigation */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px;
  color: #75695d; font-size: 13px; font-weight: 700; text-decoration: none;
}
.back-link:hover { color: var(--brick); }
.media-preview-shell {
  min-height: calc(100vh - 300px); display: grid; place-items: center;
  padding: 18px; border: 1px solid #d8cec0; border-radius: 8px; background: #e9e4db;
}
.media-preview-shell img {
  display: block; max-width: 100%; max-height: calc(100vh - 340px); object-fit: contain;
  border-radius: 7px; background: white; box-shadow: 0 8px 30px rgba(49,42,35,.08);
}
.media-preview-shell video {
  display: block; width: min(100%, 1280px); max-height: calc(100vh - 340px);
  border-radius: 7px; background: #111; box-shadow: 0 8px 30px rgba(49,42,35,.16);
}
.editor-media-card {
  width: min(1080px, calc(100% - 40px)); margin: 18px auto 0;
  overflow: hidden; border: 1px solid #d7ccbc; border-radius: 9px; background: #f7f3ec;
}
.editor-media-head {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 10px 14px; border-bottom: 1px solid #ddd3c5; background: #fbf8f2;
}
.editor-media-head strong, .editor-media-head small { display: block; }
.editor-media-head small { margin-top: 2px; color: var(--muted); }
.editor-media-head a { color: var(--brick); font-size: 13px; font-weight: 700; }
.editor-image-stage, .editor-video-stage { display: grid; place-items: center; min-height: 280px; padding: 16px; background: #e9e4db; }
.editor-image-stage img { max-width: 100%; max-height: 68vh; object-fit: contain; border-radius: 6px; background: white; }
.editor-video-stage video { width: min(100%, 1180px); max-height: 68vh; border-radius: 6px; background: #111; }
.embedded-editor-page { margin: 0; min-height: 100vh; overflow-x: hidden; background: #fff; }
.embedded-editor-page .editor-shell { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
.embedded-editor .editor-topbar { position: sticky; top: 0; z-index: 6; }
.embedded-editor .rich-editor { min-height: 58vh; }
.rich-editor table { margin: 16px 0 24px; background: #fff; }
.rich-editor td, .rich-editor th { min-width: 80px; vertical-align: top; }

@media (max-width: 820px) {
  .media-preview-shell { min-height: 64vh; padding: 8px; }
  .media-preview-shell img, .media-preview-shell video { max-height: 60vh; }
  .editor-media-card { width: calc(100% - 18px); margin-top: 9px; }
  .editor-media-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .editor-image-stage, .editor-video-stage { min-height: 220px; padding: 8px; }
}


/* v3.1 CAD viewer */
.editor-cad-stage { min-height: 620px; background: #e9e5df; border-radius: 10px; overflow: hidden; }
.editor-cad-stage iframe { display: block; width: 100%; height: 70vh; min-height: 620px; border: 0; background: white; }
.cad-preview-frame .document-frame { min-height: 72vh; }
@media (max-width: 820px) {
  .editor-cad-stage, .editor-cad-stage iframe { min-height: 480px; height: 62vh; }
}

/* v3.2 member classification correction inside the direct editor */
.editor-classification-panel {
  margin: 0 18px 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf7ef;
}
.classification-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.classification-heading strong,
.classification-heading small { display: block; }
.classification-heading small { margin-top: 4px; color: var(--muted); }
.classification-grid {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(220px, 1fr) minmax(260px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
}
.classification-grid label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.classification-grid select,
.classification-grid input {
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fffdf9; color: var(--ink);
  font: inherit;
}
.classification-save-wrap { min-height: 40px; display: flex; align-items: center; gap: 8px; }
.classification-save-wrap .muted { max-width: 180px; font-size: 12px; }
@media (max-width: 980px) {
  .classification-grid { grid-template-columns: 1fr 1fr; }
  .classification-tags { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .editor-classification-panel { margin: 0 10px 12px; padding: 12px; }
  .classification-grid { grid-template-columns: 1fr; }
  .classification-tags { grid-column: auto; }
  .classification-save-wrap { align-items: flex-start; flex-direction: column; }
}

/* v3.3 answer extraction, source localisation and one-click AI organisation */
.source-answer-line {
  display: grid; gap: 5px; margin: 12px 0 6px; padding: 10px 12px;
  border: 1px solid #dfcfb9; border-radius: 8px; background: #fff8e8;
}
.source-answer-line span { color: #8b6547; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.source-answer-line strong { color: #332b25; font-size: 14px; line-height: 1.55; }
.ai-source-locator {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 0 12px; padding: 12px 14px; border: 1px solid #dfc690; border-radius: 9px;
  background: #fff7d9; box-shadow: 0 4px 14px rgba(98,71,42,.05);
}
.ai-source-locator div { min-width: 0; }
.ai-source-locator span, .ai-source-locator strong, .ai-source-locator small { display: block; }
.ai-source-locator span { color: #8b6547; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.ai-source-locator strong { margin-top: 3px; color: #2f2923; font-size: 15px; line-height: 1.55; }
.ai-source-locator small { margin-top: 3px; color: var(--muted); }
.ai-source-locator a { flex: 0 0 auto; color: #825b39; font-size: 12px; font-weight: 800; }
.preview-segments .segment-card.ai-match { border-color: #d8b96f; background: #fff9df; box-shadow: 0 0 0 2px rgba(219,184,101,.12); }
.preview-segments mark, .citation-card mark { padding: 0 2px; border-radius: 2px; background: #ffe47a; color: inherit; }
.library-ai-organise {
  min-width: 66px; height: 36px; padding: 0 10px; border: 1px solid #cbb9a3; border-radius: 7px;
  color: #704b31; background: #fffaf1; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.library-ai-organise:hover { border-color: #9f714d; background: #f7ebda; }
.classification-grid { grid-template-columns: minmax(220px, .8fr) minmax(230px, 1fr) auto; align-items: start; }
.classification-auto {
  min-height: 40px; display: flex !important; grid-template-columns: auto 1fr !important;
  align-items: center; gap: 8px !important; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fffdf9; color: #514940 !important;
}
.classification-auto input { width: auto !important; min-height: 0 !important; margin: 0; }
.classification-advanced { grid-column: 1 / -1; padding: 8px 10px; border: 1px dashed #d9cbbb; border-radius: 8px; background: #fffdf9; }
.classification-advanced summary { cursor: pointer; color: #78695a; font-size: 12px; font-weight: 700; }
.classification-advanced[open] { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(260px, 1.2fr); gap: 10px; }
.classification-advanced[open] summary { grid-column: 1 / -1; }
@media (max-width: 820px) {
  .ai-source-locator { align-items: flex-start; flex-direction: column; }
  .classification-grid { grid-template-columns: 1fr; }
  .classification-advanced, .classification-advanced[open] { grid-template-columns: 1fr; }
  .library-ai-organise { min-width: 56px; padding: 0 7px; }
}

/* v3.4 administrator page settings and clean launch */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 18px; align-items: start; }
.settings-main { display: grid; gap: 18px; }
.settings-section { padding-top: 16px; border-top: 1px solid var(--line); }
.settings-section h4 { margin: 0 0 12px; font-size: 15px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.toggle-row { display: flex !important; align-items: center; gap: 9px !important; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf9; color: var(--ink) !important; }
.toggle-row input { width: auto !important; margin: 0; }
.settings-status-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.settings-status-row span { color: var(--muted); }
.settings-status-row strong { text-align: right; }
.danger-panel { border-color: #e7c9c2; background: #fffaf7; }
.danger-panel .button.danger { background: #a44e42; color: #fff; border-color: #a44e42; }
.danger-panel .button.danger:hover { background: #8f4339; }
@media (max-width: 980px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .form-grid.two, .toggle-grid { grid-template-columns: 1fr; }
}
