:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1f0eb;
  --border: #e2e0d8;
  --text: #1c1b18;
  --text-muted: #75736a;
  --accent: #2d6a4f;
  --accent-hover: #1f5138;
  --accent-soft: #e8f2ec;
  --danger-bg: #fdecea;
  --danger-text: #a12;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 15, 0.04), 0 4px 16px rgba(20, 20, 15, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #16160f;
  --surface: #1e1e17;
  --surface-2: #262619;
  --border: #34331f;
  --text: #ede9d8;
  --text-muted: #a3a08c;
  --accent: #6fcf9c;
  --accent-hover: #8adeb0;
  --accent-soft: #1e3529;
  --danger-bg: #3a1f1c;
  --danger-text: #f2938a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.6;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}

.topbar .session {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.topbar .session a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 8px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}

.subtitle {
  color: var(--text-muted);
  margin: 0 0 32px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

form p { margin: 0 0 16px; }

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg);
}

textarea { resize: vertical; min-height: 80px; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

button, .btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

button:hover, .btn:hover { background: var(--accent-hover); }

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.doc-list li:last-child { border-bottom: none; }

.doc-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.doc-list a:hover { color: var(--accent); }

.status-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--accent);
  font-weight: 600;
}

.status-badge.processing { background: #fdf3e3; color: #a56b0a; }
.status-badge.failed { background: var(--danger-bg); color: var(--danger-text); }

.answer-box {
  background: #f3f7f5;
  border: 1px solid #d9e8e1;
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
  white-space: pre-wrap;
}

.answer-box h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--accent);
}

.error-box {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-switch a { color: var(--accent); font-weight: 600; text-decoration: none; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-flex; align-items: center; gap: 8px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.doc-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  margin-bottom: 12px;
}

.doc-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  word-break: break-word;
}

.doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* DocuMind refresh */
:root {
  --bg: #f6f4ee; --surface: #fffefa; --surface-2: #efede4;
  --border: #e6e2d7; --text: #20251f; --text-muted: #797d72;
  --accent: #356b57; --accent-hover: #285540; --accent-soft: #e8f0e9;
  --danger-bg: #fff0ed; --danger-text: #aa4336; --radius: 18px;
  --shadow: 0 14px 38px rgba(43, 51, 42, .07);
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Manrope", "DM Sans", sans-serif;
}
[data-theme="dark"] {
  --bg:#151a17; --surface:#202723; --surface-2:#29332d; --border:#37433b;
  --text:#f0f0e7; --text-muted:#a6afa4; --accent:#82c7a2; --accent-hover:#9bdbb7;
  --accent-soft:#273c31; --danger-bg:#412a28; --danger-text:#ffaaa0;
  --shadow:0 14px 38px rgba(0,0,0,.22);
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { font-family:var(--font); background:var(--bg); color:var(--text); margin:0; line-height:1.65; min-height:100vh; transition:background .25s,color .25s; }
a { color:var(--accent); transition:color .2s; }
button,input,textarea { font:inherit; }
.page { max-width:1120px; margin:0 auto; padding:30px 38px 26px; }
.topbar { align-items:center; padding:0 0 20px; border-bottom:1px solid var(--border); margin-bottom:44px; }
.brand { display:inline-flex; gap:10px; align-items:center; text-decoration:none; color:var(--text); font-family:var(--display); font-size:1.2rem; font-weight:800; letter-spacing:-.06em; }
.brand-mark { display:grid; place-items:center; width:34px; height:34px; border-radius:11px; background:var(--accent); color:white; font:800 1rem var(--display); box-shadow:0 5px 14px rgba(53,107,87,.23); }
.brand-period { color:#c8854e; }
.topbar-actions { display:flex; align-items:center; gap:20px; }
.session-user { display:flex; align-items:center; gap:8px; color:var(--text-muted); font-size:.9rem; }
.user-dot { width:8px; height:8px; border-radius:50%; background:#65a77e; }
.logout-form { display:inline; }
.text-button { background:none; border:0; color:var(--text-muted); padding:0; cursor:pointer; }
.text-button:hover { color:var(--accent); }
.theme-toggle { width:38px; height:38px; display:grid; place-items:center; border:1px solid var(--border); background:var(--surface); border-radius:50%; color:var(--text); cursor:pointer; transition:transform .2s,border-color .2s; padding:0; }
.theme-toggle:hover { transform:rotate(-18deg); border-color:var(--accent); }
.main-content { min-height:62vh; }
h1,h2,h3 { font-family:var(--display); letter-spacing:-.045em; line-height:1.2; }
h1 { font-size:clamp(1.8rem,4vw,2.7rem); margin:0 0 10px; }
h2 { font-size:1.35rem; }
.subtitle { color:var(--text-muted); margin:0 0 30px; }
.subtitle a { text-decoration:none; }
.subtitle a:hover { text-decoration:underline; }
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:clamp(20px,3vw,30px); margin-bottom:24px; box-shadow:var(--shadow); animation:rise .5s both; }
.card:nth-of-type(2) { animation-delay:.08s; }
.card h2 { margin-top:0; font-size:1.1rem; }
form p { margin:0 0 17px; }
label { display:block; font-size:.88rem; font-weight:700; margin-bottom:7px; color:var(--text); }
input[type="text"],input[type="password"],input[type="file"],input[type="email"],textarea { width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:11px; font-family:inherit; font-size:1rem; background:var(--bg); color:var(--text); transition:border-color .2s,box-shadow .2s; }
input[type="file"] { padding:9px; }
textarea { resize:vertical; min-height:110px; }
input:focus,textarea:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 14%,transparent); }
button,.btn { background:var(--accent); color:#fff; border:0; padding:12px 19px; border-radius:11px; font-size:.95rem; font-weight:700; cursor:pointer; transition:transform .2s,background .2s,box-shadow .2s; }
button:hover,.btn:hover { background:var(--accent-hover); transform:translateY(-1px); box-shadow:0 7px 18px rgba(37,83,62,.18); }
.doc-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr)); gap:16px; list-style:none; padding:0; margin:0; }
.doc-card { display:block; min-height:176px; background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; text-decoration:none; color:var(--text); transition:transform .24s,border-color .24s,box-shadow .24s; }
.doc-card:hover { transform:translateY(-5px); border-color:var(--accent); box-shadow:0 16px 30px rgba(36,66,48,.1); }
.doc-icon { width:44px; height:44px; border-radius:13px; background:var(--accent-soft); color:var(--accent); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:.75rem; margin-bottom:15px; }
.doc-name { font-weight:700; font-size:.97rem; margin-bottom:12px; word-break:break-word; }
.doc-meta { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.doc-date { font-size:.8rem; color:var(--text-muted); }
.status-badge { font-size:.72rem; padding:4px 10px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-weight:700; }
.status-badge.processing { background:#fff3df; color:#a56b0a; }
.status-badge.failed { background:var(--danger-bg); color:var(--danger-text); }
.answer-box { background:var(--accent-soft); border:1px solid color-mix(in srgb,var(--accent) 20%,var(--border)); border-radius:var(--radius); padding:22px; margin-top:20px; white-space:pre-wrap; }
.answer-box h3 { margin:0 0 10px; font-size:1rem; color:var(--accent); }
.error-box { background:var(--danger-bg); color:var(--danger-text); border-radius:var(--radius); padding:16px 20px; margin-top:20px; }
.empty-state { color:var(--text-muted); text-align:center; padding:30px 0; }
.auth-switch { text-align:center; margin-top:20px; font-size:.9rem; color:var(--text-muted); }
.auth-switch a { color:var(--accent); font-weight:700; text-decoration:none; }
.auth-switch a:hover { text-decoration:underline; }
.htmx-indicator { display:none; }
.htmx-request .htmx-indicator,.htmx-request.htmx-indicator { display:inline-flex; align-items:center; gap:8px; }
.spinner { width:16px; height:16px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin .6s linear infinite; }
.site-footer { display:flex; justify-content:space-between; gap:14px; padding-top:24px; margin-top:34px; border-top:1px solid var(--border); color:var(--text-muted); font-size:.76rem; }
.site-footer span+span { font-size:.65rem; letter-spacing:.11em; }
.site-footer i { font-style:normal; color:#c8854e; padding:0 4px; }
.auth-page { background:#f7f5ef; }
.auth-layout { min-height:100vh; display:grid; grid-template-columns:minmax(0,1.08fr) minmax(440px,.92fr); }
.auth-visual { position:relative; overflow:hidden; display:flex; flex-direction:column; justify-content:space-between; min-height:100vh; padding:42px clamp(34px,6vw,92px); color:#f7f5ed; background:linear-gradient(90deg,rgba(8,20,19,.84),rgba(8,20,19,.38)),url("login-atmosphere.15749e6ff192.svg") center/cover no-repeat; }
.auth-visual:after { content:""; position:absolute; inset:0; background:linear-gradient(0deg,rgba(8,17,17,.32),transparent 28%,rgba(8,17,17,.2)); pointer-events:none; }
.auth-visual>* { position:relative; z-index:1; }
.auth-brand { align-self:flex-start; color:#f7f5ed; }
.auth-brand .brand-mark { background:#e4a66e; color:#18342b; }
.visual-copy { max-width:540px; margin:auto 0; padding:72px 0 64px; animation:rise .65s both; }
.eyebrow { display:flex; align-items:center; gap:10px; font-size:.68rem; font-weight:700; letter-spacing:.16em; color:#d6c7aa; }
.eyebrow-line { width:28px; height:1px; background:#d6a174; }
.visual-copy h1 { font-size:clamp(2.6rem,5.3vw,5rem); letter-spacing:-.065em; line-height:1.08; margin:24px 0 20px; }
.visual-copy h1 em { font-family:Georgia,serif; font-weight:400; color:#e7b47e; }
.visual-copy p { max-width:390px; color:rgba(250,248,238,.74); font-size:1.05rem; }
.visual-bottom { display:flex; align-items:center; gap:12px; color:rgba(250,248,238,.76); font-size:.8rem; }
.visual-orbit { display:grid; place-items:center; color:#efb77f; font-size:1.25rem; }
.visual-index { margin-left:auto; font-size:.65rem; letter-spacing:.16em; color:rgba(250,248,238,.5); }
.auth-main { position:relative; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:80px clamp(28px,6vw,92px); background:var(--bg); }
.auth-theme { position:absolute; right:32px; top:30px; }
.auth-form-wrap { width:min(100%,420px); animation:rise .55s both; }
.auth-eyebrow { color:var(--accent); margin-bottom:18px; }
.auth-eyebrow:before { content:""; width:20px; height:1px; background:#c8854e; }
.auth-form-wrap h2 { font-size:clamp(1.8rem,3vw,2.35rem); margin:0 0 8px; }
.auth-intro { color:var(--text-muted); margin:0 0 28px; }
.auth-card { background:var(--surface); border:1px solid var(--border); padding:25px; border-radius:17px; box-shadow:0 16px 45px rgba(31,44,33,.06); }
.auth-card form p:last-of-type { margin-bottom:20px; }
.auth-card ul { margin:7px 0 0; padding-left:19px; color:var(--danger-text); font-size:.82rem; }
.auth-card .helptext,.auth-card .helptext ul { font-size:.78rem; color:var(--text-muted); }
.primary-button { width:100%; display:flex; justify-content:center; align-items:center; gap:10px; padding:13px 18px; border-radius:11px; }
.primary-button span { transition:transform .2s; }
.primary-button:hover span { transform:translateX(4px); }
.auth-legal { margin:40px 0 0; color:var(--text-muted); font-size:.76rem; }
.forgot-password { text-align:right; margin:-7px 0 18px!important; font-size:.84rem; }
.forgot-password a { color:var(--accent); font-weight:700; text-decoration:none; }
.forgot-password a:hover { text-decoration:underline; }
.auth-standard { max-width:620px; margin:20px auto; animation:rise .45s both; }
.auth-standard h1 { margin:8px 0 12px; }
.auth-standard .auth-eyebrow { margin-bottom:10px; }
.auth-standard .card p:first-child { margin-top:0; }
.auth-standard .card p:last-child { margin-bottom:0; }
@keyframes rise { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@media(max-width:850px) {
 .auth-layout { grid-template-columns:1fr; }
 .auth-visual { min-height:36vh; padding:25px 28px 20px; background-position:center 55%; }
 .visual-copy { padding:48px 0 38px; }
 .visual-copy h1 { font-size:clamp(2.2rem,8vw,3.5rem); margin:15px 0 10px; }
 .visual-copy p { margin-bottom:0; }
 .visual-bottom { display:none; }
 .auth-main { min-height:64vh; padding:50px 24px 35px; }
 .auth-theme { top:20px; right:20px; }
 .auth-legal { margin-top:28px; }
}
@media(max-width:560px) {
 .page { padding:20px 16px 24px; }
 .topbar { margin-bottom:30px; padding-bottom:16px; }
 .topbar-actions { gap:12px; }
 .session-user { font-size:.78rem; }
 .brand { font-size:1.08rem; }
 .brand-mark { width:31px; height:31px; }
 .site-footer { flex-direction:column; }
 .site-footer span+span { font-size:.6rem; }
 .doc-grid { grid-template-columns:1fr; }
 .doc-card { min-height:150px; }
 .auth-visual { min-height:33vh; padding:20px 22px; }
 .visual-copy { padding:32px 0 25px; }
 .visual-copy h1 { font-size:2.25rem; }
 .visual-copy p { font-size:.94rem; }
 .auth-main { padding:45px 20px 30px; }
 .auth-form-wrap h2 { font-size:1.8rem; }
 .auth-card { padding:20px; }
 .auth-legal { margin-top:22px; }
 .auth-switch { font-size:.84rem; }
}
@media(prefers-reduced-motion:reduce) {
 *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }
}

/* Library, collection, history, profile, and moderation tools */
.topbar-nav { display:flex; align-items:center; gap:18px; }
.topbar-nav a,.text-link { color:var(--muted); text-decoration:none; font-size:.88rem; font-weight:700; }
.topbar-nav a:hover,.text-link:hover { color:var(--accent); }
.profile-link { text-decoration:none; }
.library-heading,.document-page-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:24px; margin-bottom:26px; }
.library-heading h1,.document-page-heading h1 { margin:5px 0 8px; }
.library-heading .subtitle,.document-page-heading .subtitle { margin-bottom:0; }
.library-count { white-space:nowrap; color:var(--muted); font-size:.86rem; padding-bottom:7px; }
.dashboard-tools { display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:start; }
.dashboard-tools .card { height:100%; }
.dashboard-tools h2 { margin:0 0 8px; }
.muted-copy { color:var(--muted); font-size:.9rem; margin:0 0 18px; }
.auth-eyebrow { font-size:.65rem; }
.stacked-form button { margin-top:2px; }
.inline-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:start; }
.inline-form input { min-width:0; }
.field-errors,.processing-error { color:var(--danger-text); font-size:.84rem; }
.field-errors { grid-column:1/-1; }
.collection-list { margin-top:18px; border-top:1px solid var(--border); }
.collection-row { display:flex; align-items:center; gap:12px; padding:13px 0; border-bottom:1px solid var(--border); text-decoration:none; color:var(--text); }
.collection-row:hover .collection-label strong { color:var(--accent); }
.collection-glyph { display:grid; place-items:center; width:36px; height:36px; border-radius:11px; color:var(--accent); background:var(--accent-soft); }
.collection-label { display:grid; flex:1; }
.collection-label strong { font-size:.9rem; }
.collection-label small { color:var(--muted); font-size:.75rem; }
.empty-hint { color:var(--muted); font-size:.82rem; margin:14px 0 0; }
.message-stack { margin:-8px 0 20px; }
.message { padding:10px 14px; border-radius:10px; font-size:.88rem; }
.message.success { background:var(--accent-soft); color:var(--accent); }
.message.error { background:var(--danger-bg); color:var(--danger-text); }
.library-section { margin-top:24px; }
.section-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:15px; margin-bottom:16px; }
.section-heading h2 { margin:4px 0 0; }
.filter-bar { display:grid; grid-template-columns:minmax(170px,1.5fr) repeat(3,minmax(125px,.8fr)) auto auto; gap:9px; margin-bottom:18px; }
.filter-bar input,.filter-bar select { min-width:0; padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); }
.filter-button { padding:9px 14px; }
.clear-filters { display:flex; align-items:center; color:var(--muted); font-size:.82rem; }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.document-item { min-width:0; }
.document-card { height:100%; }
.document-card .doc-name { overflow-wrap:anywhere; min-height:2.6em; }
.document-collection { display:inline-block; margin-top:11px; padding:3px 9px; border-radius:99px; color:var(--muted); background:var(--surface-2); font-size:.72rem; }
.document-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin-top:16px; }
.document-actions form { margin:0; }
.small-action { display:inline-flex; align-items:center; justify-content:center; min-height:34px; padding:7px 11px; border:1px solid var(--border); border-radius:9px; background:var(--surface); color:var(--text); text-decoration:none; font-size:.78rem; font-weight:700; cursor:pointer; transition:transform .2s,border-color .2s,color .2s,background .2s; }
.small-action:hover { transform:translateY(-1px); border-color:var(--accent); color:var(--accent); background:var(--accent-soft); box-shadow:none; }
.primary-action { color:var(--accent); border-color:color-mix(in srgb,var(--accent) 35%,var(--border)); }
.retry-action { color:#94600d; }
.delete-action,.danger-button { color:var(--danger-text); }
.processing-error { margin:10px 0 0; }
.empty-library { text-align:center; padding:42px 22px; }
.empty-library h3 { margin:8px 0; }
.empty-orbit { color:#c8854e; font-size:1.7rem; }
.breadcrumb { display:flex; gap:10px; align-items:center; margin:0 0 20px; color:var(--muted); font-size:.86rem; }
.breadcrumb a { text-decoration:none; }
.document-page-heading { align-items:center; }
.document-page-heading .eyebrow { margin-bottom:8px; }
.ask-card { padding:clamp(20px,3vw,30px); }
.answer-copy { white-space:pre-wrap; margin:8px 0; }
.answer-box h3 { margin:2px 0 12px; }
.sources-list { margin-top:22px; border-top:1px solid color-mix(in srgb,var(--accent) 20%,var(--border)); padding-top:15px; }
.sources-list h4 { margin:0 0 10px; font-size:.85rem; color:var(--text); }
.source-item { padding:10px 12px; border:1px solid var(--border); border-radius:11px; margin:8px 0; background:var(--surface); }
.source-item summary { cursor:pointer; font-size:.82rem; font-weight:700; }
.source-item p { margin:10px 0 0; color:var(--muted); font-size:.82rem; }
.source-tag { color:var(--accent); font-weight:800; }
.feedback-form { display:flex; align-items:center; flex-wrap:wrap; gap:8px; border-top:1px solid var(--border); margin-top:16px; padding-top:14px; color:var(--muted); font-size:.8rem; }
.feedback-button { padding:6px 10px; border:1px solid var(--border); background:var(--surface); border-radius:9px; color:var(--text); font-size:.76rem; }
.feedback-button:hover { color:var(--accent); background:var(--accent-soft); box-shadow:none; }
.history-panel { margin:30px 0; }
.history-item { padding:13px 15px; border:1px solid var(--border); border-radius:12px; margin:9px 0; background:var(--surface); }
.history-item summary { display:flex; justify-content:space-between; gap:15px; cursor:pointer; font-size:.88rem; font-weight:700; }
.history-item time,.history-context time { color:var(--muted); font-size:.75rem; white-space:nowrap; }
.history-item p { white-space:pre-wrap; }
.history-source-line { color:var(--muted); font-size:.78rem; }
.collection-documents { margin-bottom:20px; }
.collection-documents h2 { margin-top:0; }
.collection-document-list { margin:0; padding:0; list-style:none; }
.collection-document-list li { display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--border); }
.collection-document-name { flex:1; min-width:0; overflow-wrap:anywhere; font-weight:600; font-size:.88rem; }
.collection-document-list a { font-size:.78rem; text-decoration:none; }
.status-dot { width:8px; height:8px; border-radius:50%; background:#d19b42; }
.status-dot.ready { background:#65a77e; }
.status-dot.failed { background:#d86b5d; }
.history-list { display:grid; gap:12px; }
.history-card { margin:0; }
.history-context { display:flex; justify-content:space-between; gap:15px; align-items:center; margin-bottom:14px; font-size:.8rem; }
.history-context a { font-weight:700; text-decoration:none; }
.history-card h2 { margin:0 0 10px; font-size:1.15rem; }
.profile-page .card { margin-bottom:16px; }
.profile-card { display:grid; grid-template-columns:auto 1fr; gap:18px 22px; align-items:center; }
.profile-avatar { grid-row:span 3; display:grid; place-items:center; width:64px; height:64px; border-radius:22px; background:var(--accent-soft); color:var(--accent); font:800 1.8rem var(--display); }
.profile-value { margin:3px 0 0; font-weight:700; }
.stats-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:18px 0; }
.stats-grid div { display:grid; justify-items:center; gap:3px; padding:13px 8px; border-radius:12px; background:var(--surface-2); }
.stats-grid strong { font:800 1.35rem var(--display); }
.stats-grid span { color:var(--muted); font-size:.74rem; }
.profile-security h2 { margin-top:0; }
.danger-zone { padding:18px 0; }
.danger-zone h2 { margin-bottom:5px; }
.danger-zone p { color:var(--muted); font-size:.86rem; }
.danger-button { background:var(--danger-bg); border:1px solid color-mix(in srgb,var(--danger-text) 25%,var(--border)); }
.danger-button:hover { background:var(--danger-bg); }
.manage-status .section-heading h2 { margin:0; }
.failed-card { border-color:color-mix(in srgb,var(--danger-text) 28%,var(--border)); }
@media(max-width:850px) {
 .dashboard-tools { grid-template-columns:1fr; }
 .filter-bar { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .filter-bar input { grid-column:1/-1; }
 .topbar-nav { gap:11px; }
}
@media(max-width:560px) {
 .topbar { align-items:flex-start; }
 .topbar-actions { gap:9px; flex-wrap:wrap; justify-content:flex-end; }
 .topbar-nav { order:3; width:100%; justify-content:flex-end; }
 .session-user { gap:5px; }
 .library-heading,.document-page-heading { align-items:flex-start; flex-direction:column; gap:10px; }
 .library-count { padding:0; }
 .section-heading { align-items:flex-start; }
 .filter-bar { grid-template-columns:1fr 1fr; }
 .filter-bar select { width:100%; }
 .collection-document-list li { flex-wrap:wrap; }
 .collection-document-name { flex-basis:calc(100% - 30px); }
 .collection-document-list .status-badge { margin-left:18px; }
 .history-item summary { flex-direction:column; gap:3px; }
 .history-context { align-items:flex-start; flex-direction:column; gap:3px; }
 .profile-card { grid-template-columns:1fr; }
 .profile-avatar { grid-row:auto; }
 .stats-grid { grid-template-columns:repeat(2,1fr); }
}
