:root {
  --bg: #f4f0e8;
  --surface: #fffdf8;
  --surface-2: #f8f4ec;
  --text: #201a1c;
  --muted: #6d6664;
  --primary: #4b2e47;
  --primary-2: #3a2238;
  --accent: #c9a052;
  --border: rgba(32, 26, 28, .07);
  --shadow: 0 16px 40px rgba(32, 26, 28, .08);
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
code { border-radius: 5px; padding: 2px 6px; background: rgba(75, 46, 71, .09); color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(circle at 18% 18%, rgba(201, 160, 82, .18), transparent 28%), radial-gradient(circle at 86% 28%, rgba(126, 74, 116, .3), transparent 30%), linear-gradient(135deg, #160f17, #2b1b2a 56%, #4b2e47); }
.login-panel { width: min(100%, 520px); border: 1px solid rgba(255, 255, 255, .22); border-radius: 5px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: 0 22px 70px rgba(0, 0, 0, .28); padding: clamp(22px, 4vw, 38px); }
.admin-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.admin-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 5px; background: var(--primary); color: #fffdf8; font-weight: 600; letter-spacing: .04em; box-shadow: 0 10px 24px rgba(75, 46, 71, .25); flex: 0 0 auto; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.85rem, 4vw, 2.65rem); line-height: 1.05; }
h2 { margin-bottom: 8px; font-size: 1.1rem; }
p { margin-bottom: 0; color: var(--muted); }

.admin-alert { display: grid; gap: 6px; border: 1px solid var(--border); border-radius: 5px; background: rgba(255, 253, 248, .72); padding: 16px; color: var(--muted); }
.alert-title { color: var(--text); font-weight: 500; }
.admin-alert-error { margin-bottom: 14px; border-color: rgba(164, 60, 52, .12); background: rgba(164, 60, 52, .09); color: #7a2f2a; }
.admin-login { display: grid; gap: 14px; }
.admin-login label { display: grid; gap: 7px; color: var(--muted); font-size: .92rem; }
.admin-login input { width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--text); padding: 10px 12px; outline: 0; }
.admin-login input:focus { border-color: rgba(75, 46, 71, .42); box-shadow: 0 0 0 3px rgba(75, 46, 71, .12); }
.admin-login button { min-height: 42px; border: 0; border-radius: 5px; background: var(--primary); color: #fffdf8; font-weight: 600; cursor: pointer; }
.admin-login button:hover { background: var(--primary-2); }

.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }

.admin-main { min-width: 0; padding: 18px 22px 24px; }
.page-title { margin: 0 0 14px; font-size: clamp(1.65rem, 2.4vw, 2.2rem); line-height: 1.1; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { display: grid; gap: 8px; min-height: 118px; align-content: center; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); padding: 18px; }
.stat-card span { color: var(--muted); font-size: .9rem; }

.work-panel { display: grid; gap: 18px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); padding: 20px; }
.module-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.module-list a { display: grid; gap: 5px; min-height: 96px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); padding: 14px; }
.module-list a:hover { border-color: rgba(75, 46, 71, .18); }
.module-list span { color: var(--muted); font-size: .92rem; }
.plan-list { display: grid; gap: 9px; margin: 0; padding-left: 20px; color: var(--muted); }
.plan-list li::marker { color: var(--primary); }

@media (max-width: 640px) {
  .admin-brand { align-items: flex-start; }
  .stat-grid, .module-list { grid-template-columns: 1fr; }
}


.table-panel { display: grid; gap: 14px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); padding: 16px; }
.admin-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.admin-filters label { display: grid; gap: 6px; min-width: min(100%, 260px); color: var(--muted); font-size: .88rem; }
.admin-filters input, .admin-filters select { min-height: 40px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--text); padding: 9px 11px; outline: 0; }
.admin-filters input:focus, .admin-filters select:focus { border-color: rgba(75, 46, 71, .42); box-shadow: 0 0 0 3px rgba(75, 46, 71, .12); }
.admin-filters button { min-height: 40px; border: 0; border-radius: 5px; background: var(--primary); color: #fffdf8; padding: 9px 14px; font-weight: 600; cursor: pointer; }
.quiet-link { min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 5px; padding: 8px 12px; color: var(--muted); }
.table-meta { color: var(--muted); font-size: .92rem; }
.table-meta .meta-value { color: var(--text); font-weight: 500; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 5px; }
.admin-table { width: 100%; min-width: 980px; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
.admin-table th, .admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.admin-table th { background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .name-link span { color: inherit; }
.subtext { display: block; margin-top: 2px; color: var(--muted); font-size: .82rem; }
.quote-cell { max-width: 520px; color: var(--text); line-height: 1.45; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; border-radius: 5px; padding: 3px 8px; background: rgba(109, 102, 100, .12); color: var(--muted); font-size: .78rem; font-weight: 500; white-space: nowrap; }
.status-pill.is-on { background: rgba(70, 130, 92, .14); color: #346c4b; }
.status-pill.is-off { background: rgba(164, 60, 52, .12); color: #8a3731; }
.row-action { display: inline-flex; min-height: 30px; align-items: center; border: 1px solid var(--border); border-radius: 5px; padding: 5px 10px; color: var(--primary); font-weight: 500; }
.row-action[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.empty-cell { padding: 24px !important; color: var(--muted); text-align: center !important; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; color: var(--muted); }
.pager a { min-height: 36px; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 5px; padding: 7px 11px; color: var(--primary); font-weight: 500; }
.pager a[aria-disabled="true"] { color: var(--muted); opacity: .45; pointer-events: none; }

@media (max-width: 640px) {
  .admin-filters { display: grid; }
  .admin-filters label, .admin-filters button, .quiet-link { width: 100%; }
  .pager { justify-content: stretch; }
  .pager a, .pager span { flex: 1; justify-content: center; text-align: center; }
}


.admin-alert-success { margin-bottom: 14px; border-color: rgba(70, 130, 92, .18); background: rgba(70, 130, 92, .1); color: #346c4b; }
.edit-panel { display: grid; gap: 14px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); padding: 16px; }
.edit-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.edit-form { display: grid; gap: 18px; }
.portrait-preview { display: flex; align-items: center; gap: 14px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); padding: 14px; }
.portrait-preview-media, .portrait-preview-media img { width: 84px; height: 84px; border-radius: 5px; object-fit: cover; }
.portrait-preview-media { display: grid; place-items: center; color: var(--muted); font-size: .82rem; text-align: center; }
.portrait-preview .preview-title { display: block; font-size: 1.1rem; }
.portrait-preview small { display: block; color: var(--muted); margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: .88rem; }
.field-wide { grid-column: 1 / -1; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--text); padding: 10px 12px; outline: 0; }
.field input, .field select { min-height: 42px; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(75, 46, 71, .42); box-shadow: 0 0 0 3px rgba(75, 46, 71, .12); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.edit-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); padding-top: 14px; }
.edit-actions button { min-height: 42px; border: 0; border-radius: 5px; background: var(--primary); color: #fffdf8; padding: 9px 15px; font-weight: 600; cursor: pointer; }
.edit-actions button:hover { background: var(--primary-2); }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .portrait-preview { align-items: flex-start; }
}

.filter-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid rgba(75, 46, 71, .10); border-radius: 5px; background: rgba(75, 46, 71, .07); padding: 12px 14px; color: var(--muted); }
.filter-banner .inline-emphasis { color: var(--text); }
.filter-banner a { color: var(--primary); font-weight: 500; }
.filter-banner.is-warning { border-color: rgba(164, 60, 52, .14); background: rgba(164, 60, 52, .08); }

.count-link { color: var(--primary); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.count-link:hover { color: var(--primary-2); }

.name-link { color: var(--text); }
.name-link span { display: inline; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.name-link:hover { color: var(--primary); }

.quote-edit-link { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.quote-edit-link:hover { color: var(--primary); }
.quote-preview { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); padding: 14px; }
.quote-preview blockquote { margin: 0; color: var(--text); font-size: 1.05rem; line-height: 1.55; }
.quote-preview .preview-title { display: block; }
.quote-preview small { display: block; color: var(--muted); margin-top: 3px; }
.relation-toolbar { margin-bottom: 10px; }
.relation-source-quote { margin-bottom: 14px; }
.relation-source-quote .preview-title { width: fit-content; color: var(--text); }
.relation-table { min-width: 860px; }
.relation-table th:first-child,
.relation-table td:first-child { width: 72px; text-align: center; }
.relation-order {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 26px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .76rem;
}
.relation-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 3px 7px;
  font-size: .74rem;
}
.relation-type-agreement { background: var(--success-bg); color: #3e7456; }
.relation-type-alternative { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); color: var(--primary); }
.relation-score { color: var(--text); font-variant-numeric: tabular-nums; }
.stat-value { color: var(--primary); font-size: clamp(1.75rem, 3vw, 2.45rem); line-height: 1; font-weight: 500; }
.module-title { color: var(--text); font-weight: 500; }
.meta-value, .inline-emphasis, .preview-title { color: var(--text); font-weight: 500; }

/* Investor-ready admin grid refinement */
:root {
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #f8f8f7;
  --text: #242326;
  --muted: #737178;
  --primary: #514253;
  --primary-2: #3f3341;
  --accent: #b9964b;
  --border: rgba(36, 35, 38, .07);
  --shadow: 0 1px 2px rgba(36, 35, 38, .05), 0 12px 28px rgba(36, 35, 38, .06);
}

body { background: var(--bg); }
.admin-main { padding: 20px 24px 28px; }
.page-title { margin: 0 0 12px; font-size: 1.72rem; line-height: 1.16; letter-spacing: 0; font-weight: 500; }

.table-panel { border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); }
.authors-panel { gap: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.authors-panel .admin-filters { display: grid; grid-template-columns: minmax(280px, 1fr) 180px auto auto; gap: 10px; align-items: end; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: #fbfbfa; padding: 14px; }
.authors-panel .admin-filters label { min-width: 0; gap: 5px; color: var(--muted); font-size: .75rem; font-weight: 400; letter-spacing: .02em; }
.authors-panel .admin-filters label:first-child { flex: initial; }
.authors-panel .admin-filters input, .authors-panel .admin-filters select { min-height: 38px; border-color: rgba(36, 35, 38, .09); border-radius: 5px; background: #fff; box-shadow: none; color: var(--text); }
.authors-panel .admin-filters input::placeholder { color: #9b99a0; }
.authors-panel .admin-filters button { min-height: 38px; border-radius: 5px; background: var(--primary); box-shadow: none; font-weight: 500; }
.authors-panel .quiet-link { min-height: 38px; border-radius: 5px; background: transparent; color: var(--muted); }
.authors-meta { min-height: 0; justify-self: stretch; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: #fff; padding: 9px 14px; color: var(--muted); font-size: .84rem; }
.authors-meta span { color: var(--text); font-weight: 500; }
.authors-panel .table-scroll { border: 0; border-radius: 0; background: #fff; box-shadow: none; }
.authors-panel .admin-table { min-width: 1040px; font-size: .9rem; }
.authors-panel .admin-table th { height: 38px; background: #fbfbfa; color: #76737b; font-size: .72rem; font-weight: 500; letter-spacing: .04em; border-bottom: 1px solid rgba(36, 35, 38, .06); }
.authors-panel .admin-table td { height: 62px; padding: 9px 12px; border-bottom: 1px solid rgba(36, 35, 38, .05); vertical-align: middle; }
.authors-panel .admin-table tbody tr:hover { background: #faf9f7; }
.authors-panel .admin-table tbody tr:last-child td { border-bottom: 0; }

.author-cell { min-width: 310px; gap: 10px; }
.author-avatar { width: 38px; height: 38px; flex-basis: 38px; border-radius: 5px; border-color: rgba(36, 35, 38, .07); background: #f0efed; color: #6f6470; font-size: .88rem; font-weight: 500; }
.author-name-link { color: #242326; font-size: .94rem; font-weight: 500; line-height: 1.2; }
.author-name-link:hover { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.author-id, .subtext { color: #8a878e; font-size: .76rem; font-weight: 400; }

.metric-link, .metric-muted { display: inline; min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 0; color: var(--primary); }
.metric-link span:not(.metric-value), .metric-muted span:not(.metric-value) { display: none; }
.metric-link .metric-value, .metric-muted .metric-value { display: inline; color: var(--primary); font-size: .92rem; font-weight: 500; }
.metric-link:hover .metric-value { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rank-badge { min-height: 0; border-radius: 0; background: transparent; color: #6f6c73; padding: 0; font-weight: 400; }
.text-pill { display: inline; min-height: 0; max-width: 180px; border: 0; border-radius: 0; background: transparent; padding: 0; color: #454348; font-weight: 400; }
.occupation-text { max-width: 340px; color: #6f6c73; line-height: 1.35; }
.status-pill { min-height: 24px; border: 1px solid rgba(36, 35, 38, .06); border-radius: 5px; background: #f7f7f6; color: #6d6971; padding: 2px 8px; font-size: .74rem; font-weight: 400; }
.status-pill.is-on { border-color: rgba(55, 128, 91, .12); background: #f1f7f3; color: #3e7456; }
.status-pill.is-off { border-color: rgba(164, 60, 52, .12); background: #fbf2f1; color: #95433c; }

.pager { padding: 12px 14px; border-top: 1px solid var(--border); background: #fbfbfa; }
.pager a { min-height: 34px; border-radius: 5px; background: #fff; color: var(--primary); font-weight: 400; }
.pager span { color: var(--muted); }

@media (max-width: 900px) {
  .authors-panel .admin-filters { grid-template-columns: 1fr 160px; }
}
@media (max-width: 640px) {
  .admin-main { padding: 16px 14px 24px; }
  .authors-panel .admin-filters { grid-template-columns: 1fr; }
  .author-cell { min-width: 260px; }
}
/* Sidebar refinement */
.admin-layout { grid-template-columns: 220px minmax(0, 1fr); }
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  box-shadow: none;
}
.sidebar-brand {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 6px 12px;
  border-bottom: 1px solid rgba(36, 35, 38, .05);
  color: var(--text);
  font-weight: 400;
}
.sidebar-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid rgba(36, 35, 38, .07);
  border-radius: 5px;
  background: #f7f7f6;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .02em;
}
.sidebar-brand-copy { display: grid; gap: 0; min-width: 0; }
.sidebar-brand-name { color: var(--text); font-size: .9rem; font-weight: 500; line-height: 1.15; letter-spacing: 0; }
.sidebar-brand-sub { color: var(--muted); font-size: .7rem; font-weight: 400; line-height: 1.2; }
.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 1px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}
.sidebar-nav a {
  position: relative;
  min-height: 34px;
  display: flex;
  align-items: center;
  border-radius: 5px;
  padding: 7px 9px 7px 13px;
  color: #69666d;
  font-size: .86rem;
  font-weight: 400;
}
.sidebar-nav a::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}
.sidebar-nav a:hover { background: #f7f7f5; color: var(--text); }
.sidebar-nav a[aria-current="page"] { background: #f4f2f0; color: var(--text); }
.sidebar-nav a[aria-current="page"]::before { background: var(--primary); }
.sidebar-link-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 12px 6px 0;
  border-top: 1px solid rgba(36, 35, 38, .05);
  color: var(--muted);
  font-size: .78rem;
}
.sidebar-account {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.sidebar-account-label { color: #9a979e; font-size: .68rem; line-height: 1.2; }
.sidebar-user {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 400;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-foot form { margin: 0; }
.sidebar-foot button {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(36, 35, 38, .07);
  border-radius: 5px;
  background: #fff;
  color: #69666d;
  padding: 6px 9px;
  font-weight: 400;
  text-align: left;
}
.sidebar-foot button:hover { background: #f7f7f5; color: var(--text); }

@media (max-width: 640px) {
  .admin-layout { grid-template-columns: 204px minmax(0, 1fr); }
  .admin-sidebar { padding: 12px 8px; }
  .sidebar-brand-name { font-size: .86rem; }
  .sidebar-nav a { font-size: .82rem; min-height: 32px; }
}


.quote-taxonomy { display: flex; flex-wrap: wrap; gap: 5px; align-items: baseline; margin-top: 4px; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.quote-mood-label { color: var(--text); font-weight: 600; }
.quote-mood-label::after { content: "·"; margin-left: 5px; color: #aaa6ad; font-weight: 400; }
.quote-taxonomy .quote-mood-label:last-child::after { content: ""; margin: 0; }
.quote-flags { display: grid; gap: 4px; margin-top: 7px; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.quote-flags > span { display: block; overflow-wrap: anywhere; }
.quote-flag-label { display: inline-block; margin-right: 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--text); padding: 1px 5px; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.quote-status-cell { min-width: 112px; }
.quote-status-cell > span { display: block; margin-bottom: 8px; }
.quote-status-cell form { margin: 0; }
.quote-status-cell .row-action { min-height: 30px; padding: 5px 9px; font-size: .78rem; }
.quote-status-cell .row-action.is-danger { color: #95433c; }
.quotes-panel .admin-filters label:first-of-type { flex: 1 1 300px; }
.quotes-panel .admin-filters label:not(:first-of-type) { min-width: 140px; }


.author-list-cell { min-width: 150px; }
.author-list-cell .subtext { display: block; margin-top: 3px; }
.missing-author {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(177, 92, 48, .14);
  border-radius: 5px;
  background: #fff7f1;
  color: #8a4a28;
  padding: 3px 9px;
  font-size: .76rem;
  font-weight: 500;
}


.legacy-author-name {
  display: inline-block;
  color: var(--text);
  font-size: .88rem;
  font-weight: 500;
  line-height: 1.3;
}

/* Admin system polish */
:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f3f2ef;
  --surface-3: #ebe9e5;
  --text: #242326;
  --muted: #737078;
  --soft: #918d95;
  --primary: #59455a;
  --primary-2: #453647;
  --accent: #b68b39;
  --border: rgba(36, 35, 38, .07);
  --border-strong: rgba(36, 35, 38, .07);
  --focus: rgba(89, 69, 90, .18);
  --danger-bg: #fff4f0;
  --success-bg: #eff8f2;
  --shadow: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171519;
  --surface: #211e24;
  --surface-2: #2a262d;
  --surface-3: #35313a;
  --text: #f3f0f2;
  --muted: #b4adb8;
  --soft: #928a97;
  --primary: #d9bddc;
  --primary-2: #ead7ec;
  --accent: #d6af5b;
  --border: rgba(243, 240, 242, .08);
  --border-strong: rgba(243, 240, 242, .12);
  --focus: rgba(217, 189, 220, .24);
  --danger-bg: rgba(180, 86, 67, .16);
  --success-bg: rgba(72, 148, 101, .16);
}

body { background: var(--bg); color: var(--text); }
.icon { width: 17px; height: 17px; flex: 0 0 17px; }

.admin-main { padding: 18px 22px 28px; }
.page-title { color: var(--text); font-size: 1.58rem; font-weight: 500; margin-bottom: 12px; }

.table-panel,
.authors-panel,
.edit-panel,
.work-panel,
.stat-card,
.quote-preview,
.portrait-preview,
.login-panel {
  box-shadow: none !important;
  border: 1px solid var(--border);
  background: var(--surface);
}

.authors-panel .admin-filters,
.authors-meta,
.pager,
.admin-table th,
.authors-panel .admin-table th,
.filter-banner,
.quote-preview,
.portrait-preview,
.module-list a {
  background: var(--surface-2);
}

.table-scroll,
.authors-panel .table-scroll,
.admin-table,
.authors-panel .table-scroll,
.authors-panel .admin-table,
.admin-table td,
.authors-panel .admin-table td {
  background: var(--surface);
  border-color: var(--border);
}

.admin-table tbody tr:hover,
.authors-panel .admin-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 72%, transparent); }

button,
.quiet-link,
.pager a,
.row-action,
.admin-filters button,
.edit-actions button,
.admin-login button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  box-shadow: none;
  font-weight: 500;
  line-height: 1.1;
  cursor: pointer;
}

.admin-filters button,
.edit-actions button,
.admin-login button {
  background: var(--primary);
  color: var(--surface);
  border-color: var(--primary);
  padding: 8px 13px;
}

.admin-filters button:hover,
.edit-actions button:hover,
.admin-login button:hover { background: var(--primary-2); border-color: var(--primary-2); }

.quiet-link,
.pager a,
.row-action {
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
}

.quiet-link:hover,
.pager a:hover,
.row-action:hover { background: var(--surface-2); color: var(--text); }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus) !important;
  border-color: var(--primary) !important;
}

.admin-sidebar {
  width: 220px;
  background: var(--surface);
  border-right-color: var(--border);
  padding: 14px 10px;
}
.sidebar-brand { border-bottom-color: var(--border); padding-bottom: 13px; }
.sidebar-logo { background: var(--surface-2); border-color: var(--border-strong); color: var(--primary); }
.sidebar-brand-name,
.sidebar-user { color: var(--text); }
.sidebar-brand-sub,
.sidebar-account-label,
.sidebar-nav a { color: var(--muted); }
.sidebar-nav { gap: 3px; }
.sidebar-nav a {
  min-height: 36px;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid transparent;
}
.sidebar-nav a::before { content: none; }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--text);
}
.sidebar-nav a[aria-current="page"] .icon { color: var(--primary); }
.sidebar-foot { border-top-color: var(--border); }
.sidebar-foot button {
  justify-content: flex-start;
  width: 100%;
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
}
.sidebar-foot button:hover { background: var(--surface-2); color: var(--text); }

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
}
.theme-switch button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
  font-size: .76rem;
}
.theme-switch button[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.admin-filters input,
.admin-filters select,
.field input,
.field textarea,
.field select,
.admin-login input {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}
.admin-filters input::placeholder,
.field input::placeholder { color: var(--soft); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }

.edit-panel { padding: 14px; }
.edit-toolbar { justify-content: flex-start; gap: 8px; }
.edit-form { gap: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.field,
.field-wide {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  grid-column: auto;
  min-height: 40px;
  color: var(--muted);
  font-size: .85rem;
}
.field > span {
  min-height: 38px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: .8rem;
}
.field input,
.field select,
.field textarea {
  width: min(100%, var(--control-width, 420px));
  min-height: 38px;
  border-radius: 5px;
  padding: 8px 10px;
}
.field textarea {
  width: min(100%, var(--control-width, 760px));
  line-height: 1.45;
}
.field-kind-id,
.field-kind-rank,
.field-kind-rank2,
.field-kind-count,
.field-kind-flag,
.field-kind-number { --control-width: 138px; }
.field-kind-date { --control-width: 170px; }
.field-kind-short { --control-width: 260px; }
.field-kind-medium { --control-width: 420px; }
.field-kind-url { --control-width: 620px; }
.field-kind-long { --control-width: 820px; }
.field-kind-code { --control-width: 900px; }

.edit-actions {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top-color: var(--border);
  padding-top: 12px;
}

.stat-card { background: var(--surface); }
.stat-value { color: var(--primary); }
.status-pill { border-color: var(--border); background: var(--surface-2); color: var(--muted); }
.status-pill.is-on { background: var(--success-bg); color: color-mix(in srgb, #3e7456 80%, var(--text)); }
.status-pill.is-off,
.missing-author { background: var(--danger-bg); }

html[data-theme="dark"] .admin-filters button,
html[data-theme="dark"] .edit-actions button,
html[data-theme="dark"] .admin-login button { color: #171519; }
html[data-theme="dark"] code { background: rgba(217, 189, 220, .12); color: var(--primary); }
html[data-theme="dark"] .login-shell { background: linear-gradient(135deg, #121014, #211b24 58%, #35283a); }
html[data-theme="dark"] .admin-mark { color: #171519; background: var(--primary); }
html[data-theme="dark"] .authors-panel .admin-filters input,
html[data-theme="dark"] .authors-panel .admin-filters select,
html[data-theme="dark"] .authors-panel .admin-filters,
html[data-theme="dark"] .authors-meta,
html[data-theme="dark"] .pager,
html[data-theme="dark"] .authors-panel .admin-table th { background: var(--surface-2); }
html[data-theme="dark"] .author-name-link,
html[data-theme="dark"] .name-link,
html[data-theme="dark"] .quote-edit-link,
html[data-theme="dark"] .legacy-author-name,
html[data-theme="dark"] .text-pill { color: var(--text); }
html[data-theme="dark"] .author-avatar { background: var(--surface-3); color: var(--muted); border-color: var(--border-strong); }
html[data-theme="dark"] .occupation-text,
html[data-theme="dark"] .rank-badge { color: var(--muted); }

@media (max-width: 720px) {
  .field,
  .field-wide { grid-template-columns: 1fr; gap: 5px; }
  .field > span { min-height: 0; }
  .field input,
  .field select,
  .field textarea { width: 100%; }
}

/* Authors top repair and button typography */
button,
.quiet-link,
.pager a,
.row-action,
.admin-filters button,
.edit-actions button,
.admin-login button,
.sidebar-foot button,
.theme-switch button {
  font-size: .84rem;
  font-weight: 400;
  letter-spacing: 0;
}

.page-title {
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1.18;
  margin-bottom: 14px;
}

.authors-panel {
  border-color: var(--border);
}

.authors-panel .admin-filters {
  grid-template-columns: minmax(320px, 1fr) 170px max-content max-content;
  gap: 8px;
  align-items: end;
  padding: 12px;
  background: var(--surface);
}

.authors-panel .admin-filters label {
  gap: 5px;
  font-size: .74rem;
  font-weight: 400;
  letter-spacing: 0;
}

.authors-panel .admin-filters label > span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 400;
}

.authors-panel .admin-filters input,
.authors-panel .admin-filters select {
  min-height: 34px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 10px;
  font-size: .84rem;
  font-weight: 400;
}

.authors-panel .admin-filters input::placeholder {
  color: var(--soft);
  font-weight: 400;
}

.authors-panel .admin-filters button,
.authors-panel .quiet-link {
  min-height: 34px;
  padding: 7px 12px;
  font-size: .84rem;
  font-weight: 400;
}

.authors-panel .admin-filters button {
  background: color-mix(in srgb, var(--primary) 86%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 72%, transparent);
  color: var(--surface);
}

.authors-panel .admin-filters button:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.authors-panel .quiet-link {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.authors-panel .quiet-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.authors-meta {
  padding: 8px 12px;
  background: var(--surface);
  font-size: .82rem;
}

.authors-meta span,
.table-meta .meta-value,
.metric-link .metric-value,
.metric-muted .metric-value,
.author-name-link,
.name-link span,
.legacy-author-name {
  font-weight: 400;
}

.authors-panel .admin-table th {
  height: 34px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .035em;
}

.authors-panel .admin-table td {
  height: 58px;
}

.author-avatar {
  font-weight: 400;
}

@media (max-width: 900px) {
  .authors-panel .admin-filters {
    grid-template-columns: 1fr 150px;
  }
}

@media (max-width: 640px) {
  .authors-panel .admin-filters {
    grid-template-columns: 1fr;
  }
}

.taxonomy-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 24%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.taxonomy-link:hover {
  color: var(--primary);
  text-decoration-color: currentColor;
}

.occupation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 7px;
  max-width: 340px;
  line-height: 1.35;
}
.occupation-list .occupation-text:not(:last-child)::after {
  content: ",";
  color: var(--muted);
  text-decoration: none;
}

/* Author identity cell refinement */
.authors-panel .admin-table td {
  height: 68px;
}
.author-cell {
  display: flex;
  align-items: center;
  min-width: 340px;
  gap: 12px;
}
.author-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 400;
}
.author-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.author-avatar img + span,
.author-avatar:has(img) > span {
  display: none;
}
.author-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.author-name-link {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  font-size: .92rem;
  line-height: 1.22;
}
.author-id {
  display: block;
  margin-top: 1px;
  color: var(--soft);
  font-size: .74rem;
  line-height: 1.2;
}

@media (max-width: 640px) {
  .author-cell { min-width: 300px; }
  .author-avatar { width: 46px; height: 46px; flex-basis: 46px; }
}

/* Author management controls */
.authors-panel .admin-filters {
  grid-template-columns: minmax(280px, 1fr) 130px 160px max-content max-content;
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.active-filters a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 4px 8px;
  font-size: .76rem;
  font-weight: 400;
}
.active-filters a:hover { color: var(--text); border-color: var(--border-strong); }
.active-filters span { color: var(--soft); font-size: .82rem; }
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font-weight: inherit;
}
.sort-link:hover { color: var(--text); }
.sort-link.is-active { color: var(--text); }
.sort-marker {
  display: inline-block;
  min-width: 8px;
  color: var(--soft);
  font-size: .72rem;
  line-height: 1;
}
.quality-signals {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.quality-dot {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--soft);
  font-size: .66rem;
  font-weight: 400;
  line-height: 1;
}
.quality-dot.is-ok {
  background: color-mix(in srgb, #4b8f63 9%, var(--surface));
  border-color: color-mix(in srgb, #4b8f63 18%, transparent);
  color: #4b7b5c;
}
.quality-dot.is-missing {
  background: color-mix(in srgb, #b15c48 8%, var(--surface));
  border-color: color-mix(in srgb, #b15c48 16%, transparent);
  color: #9a5a49;
}

@media (max-width: 900px) {
  .authors-panel .admin-filters {
    grid-template-columns: 1fr 140px;
  }
}
@media (max-width: 640px) {
  .authors-panel .admin-filters {
    grid-template-columns: 1fr;
  }
}

/* Author image process */
.process-image-button,
.localize-image-button,
.ideogram-image-button,
.sculpture-image-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
}
.process-image-button:hover,
.localize-image-button:hover,
.ideogram-image-button:hover,
.sculpture-image-button:hover {
  background: var(--surface-2);
  color: var(--primary);
  border-color: var(--border-strong);
}
.process-image-button.is-loading,
.localize-image-button.is-loading,
.ideogram-image-button.is-loading,
.sculpture-image-button.is-loading {
  color: var(--soft);
  cursor: wait;
}
.process-image-button.is-loading .icon,
.localize-image-button.is-loading .icon,
.ideogram-image-button.is-loading .icon,
.sculpture-image-button.is-loading .icon {
  animation: admin-spin .9s linear infinite;
}
@keyframes admin-spin {
  to { transform: rotate(360deg); }
}
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}
.admin-toast {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  font-size: .84rem;
  box-shadow: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .18s ease, transform .18s ease;
}
.admin-toast.is-success {
  background: color-mix(in srgb, #4b8f63 10%, var(--surface));
  border-color: color-mix(in srgb, #4b8f63 18%, transparent);
}
.admin-toast.is-error {
  background: color-mix(in srgb, #b15c48 10%, var(--surface));
  border-color: color-mix(in srgb, #b15c48 18%, transparent);
}
.admin-toast.is-hiding {
  opacity: 0;
  transform: translateY(4px);
}

.authors-panel .admin-table {
  min-width: 1140px;
}
.authors-panel .admin-table th:nth-child(2),
.authors-panel .admin-table td:nth-child(2) {
  width: 126px;
  text-align: center;
}
.authors-panel .admin-table td:nth-child(2) {
  vertical-align: middle;
}

/* Jobs */
.jobs-panel {
  gap: 12px;
}
.job-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  padding: 12px;
}
.job-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.job-title {
  color: var(--text);
  font-size: .92rem;
  font-weight: 400;
}
.job-subtext {
  color: var(--muted);
  font-size: .8rem;
}
.job-run-button {
  min-height: 34px;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--surface);
  padding: 7px 12px;
}
.job-progress {
  display: grid;
  gap: 5px;
  flex: 0 0 240px;
  color: var(--muted);
  font-size: .76rem;
}
.job-progress[hidden] {
  display: none;
}
.job-progress progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: var(--surface-2);
  accent-color: var(--primary);
}
.job-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
}
.job-summary span {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  padding: 5px 8px;
}
.jobs-table {
  min-width: 760px;
}
.job-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: .74rem;
  color: var(--muted);
  background: var(--surface-2);
}
.job-status.is-ok {
  background: color-mix(in srgb, #4b8f63 10%, var(--surface));
  border-color: color-mix(in srgb, #4b8f63 18%, transparent);
  color: #4b7b5c;
}
.job-status.is-failed {
  background: color-mix(in srgb, #b15c48 10%, var(--surface));
  border-color: color-mix(in srgb, #b15c48 18%, transparent);
  color: #9a5a49;
}
@media (max-width: 640px) {
  .job-card { align-items: stretch; flex-direction: column; }
  .job-run-button { width: 100%; }
  .job-progress { flex-basis: auto; }
}

.job-author-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}
.job-author-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
}
.job-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.job-author-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.jobs-table {
  min-width: 680px;
}

.quality-dot.is-skipped {
  background: color-mix(in srgb, #b9964b 10%, var(--surface));
  border-color: color-mix(in srgb, #b9964b 18%, transparent);
  color: #80642b;
}

/* Import */
.import-panel {
  gap: 0;
}
.import-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) max-content;
  gap: 10px;
  align-items: end;
  padding: 14px;
}
.import-file-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .76rem;
}
.import-file-field input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 7px;
}
.import-form button {
  min-height: 38px;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--surface);
  padding: 8px 13px;
}
.import-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.import-progress {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 14px;
}
.import-progress[hidden] {
  display: none;
}
.import-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: .84rem;
}
.import-progress progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 5px;
  background: var(--surface-2);
  accent-color: var(--primary);
}
.import-stat-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: 8px;
}
.import-stat-grid span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  padding: 8px;
}
.import-stat-grid small {
  color: var(--muted);
  font-size: .68rem;
}
.import-stat-grid b {
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
}
.import-result-message,
.import-missing-ids {
  color: var(--muted);
  font-size: .78rem;
}
.import-result-message.is-error {
  color: var(--danger);
}
.import-missing-ids {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--danger-bg);
  padding: 8px;
}
@media (max-width: 760px) {
  .import-form { grid-template-columns: 1fr; }
  .import-stat-grid { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .import-meta { align-items: flex-start; flex-direction: column; }
}

/* Quote of the Day */
.qotd-page-heading { margin-bottom: 14px; }
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: .88rem;
}
.calendar-nav .icon-link {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
}
.qotd-upcoming-panel,
.qotd-calendar-panel,
.qotd-editor-panel {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: none;
}
.qotd-upcoming-panel { margin-bottom: 14px; padding: 12px; }
.qotd-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qotd-section-heading h2,
.qotd-editor-panel h2 { margin: 0; font-size: .9rem; font-weight: 500; }
.qotd-section-heading > span { color: var(--muted); font-size: .72rem; }
.qotd-upcoming-strip {
  display: grid;
  grid-template-columns: repeat(14, minmax(72px, 1fr));
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.qotd-upcoming-day {
  display: grid;
  gap: 3px;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px;
  text-align: left;
  cursor: pointer;
}
.qotd-upcoming-day.is-missing { border-color: rgba(166, 68, 58, .22); background: rgba(166, 68, 58, .08); }
.qotd-upcoming-day.is-filled { border-color: rgba(62, 125, 91, .22); background: rgba(62, 125, 91, .08); }
.qotd-upcoming-weekday { color: var(--muted); font-size: .68rem; }
.qotd-upcoming-date { font-size: .8rem; }
.qotd-upcoming-state { color: var(--muted); font-size: .68rem; }
.qotd-upcoming-day.is-missing .qotd-upcoming-state { color: #a64b43; }
.qotd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  gap: 14px;
}
.qotd-calendar-panel { overflow: hidden; }
.qotd-weekdays,
.qotd-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.qotd-weekdays { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.qotd-weekdays span { padding: 9px; color: var(--muted); font-size: .68rem; text-align: center; }
.qotd-calendar-grid { gap: 1px; background: var(--border); }
.qotd-calendar-blank { min-height: 114px; background: var(--surface-2); }
.qotd-calendar-day {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 114px;
  align-content: start;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}
.qotd-calendar-day.is-missing { background: rgba(166, 68, 58, .075); }
.qotd-calendar-day.is-filled { background: rgba(62, 125, 91, .07); }
.qotd-calendar-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.qotd-calendar-day:hover { filter: brightness(.98); }
.qotd-day-number { color: var(--muted); font-size: .7rem; }
.qotd-day-author { overflow: hidden; color: var(--text); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.qotd-day-quote {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.qotd-day-state { align-self: end; color: #a64b43; font-size: .7rem; }
.qotd-editor-panel { position: sticky; top: 14px; padding: 14px; }
.qotd-editor-panel.is-selected { border-color: var(--border-strong); }
.qotd-editor-panel form { display: grid; gap: 12px; margin-top: 14px; }
.qotd-editor-panel label {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .76rem;
}
.qotd-editor-panel input,
.qotd-editor-panel select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 9px;
}
.qotd-editor-panel .field-date { max-width: 160px; }
.qotd-editor-panel .field-status { max-width: 130px; }
.qotd-search-control { position: relative; display: block; min-width: 0; }
.qotd-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  overflow-y: auto;
  max-height: 360px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.qotd-search-result {
  display: grid;
  width: 100%;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 9px;
  text-align: left;
  cursor: pointer;
}
.qotd-search-result:last-child { border-bottom: 0; }
.qotd-search-result:hover { background: var(--surface-2); }
.qotd-search-result:disabled { cursor: not-allowed; opacity: .48; }
.qotd-result-author { font-size: .75rem; }
.qotd-result-quote {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.qotd-search-empty { display: block; padding: 12px; color: var(--muted); font-size: .75rem; }
.qotd-selected-quote {
  display: grid;
  gap: 4px;
  min-height: 58px;
  margin-left: 80px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 9px;
  font-size: .72rem;
}
.qotd-selected-author { color: var(--text); }
.qotd-selected-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
a.qotd-selected-text {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a.qotd-selected-text:hover { color: var(--primary); }
.qotd-editor-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.qotd-editor-actions button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  padding: 7px 11px;
  font-size: .78rem;
  font-weight: 400;
  cursor: pointer;
}
.qotd-editor-actions .row-action { background: transparent; color: #a64b43; }
html[data-theme="dark"] .qotd-calendar-day.is-missing,
html[data-theme="dark"] .qotd-upcoming-day.is-missing { background: rgba(190, 85, 74, .12); }
html[data-theme="dark"] .qotd-calendar-day.is-filled,
html[data-theme="dark"] .qotd-upcoming-day.is-filled { background: rgba(67, 143, 103, .12); }
@media (max-width: 1180px) {
  .qotd-layout { grid-template-columns: 1fr; }
  .qotd-editor-panel { position: static; }
}
@media (max-width: 720px) {
  .qotd-page-heading { display: grid; }
  .calendar-nav { justify-content: space-between; }
  .qotd-calendar-panel { overflow-x: auto; }
  .qotd-weekdays,
  .qotd-calendar-grid { min-width: 700px; }
  .qotd-editor-panel label { grid-template-columns: 1fr; gap: 5px; }
  .qotd-selected-quote { margin-left: 0; }
}

/* FAQ */
.faq-table {
  min-width: 980px;
}
.faq-copy-cell {
  max-width: 680px;
  line-height: 1.42;
}
.faq-answer {
  max-width: 760px;
  margin-top: 5px;
  color: var(--muted);
}
.faq-panel .admin-filters {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.faq-panel .pager {
  font-size: .8rem;
  padding: 9px 12px;
}
.faq-panel .pager a {
  min-height: 30px;
  padding: 5px 9px;
  font-size: .8rem;
}
.faq-panel .pager span {
  font-size: .8rem;
}



.portrait-preview-media {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}
.portrait-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portrait-preview-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.portrait-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* Ideogram author portraits */
.author-portrait-pair,
.portrait-preview-pair,
.portrait-preview-item {
  display: flex;
  align-items: center;
}
.author-portrait-pair { gap: 5px; flex: 0 0 auto; }
.author-ideogram-avatar,
.portrait-ideogram-preview-media {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: 5px;
  color: var(--soft);
  font-size: .65rem;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.author-ideogram-avatar { width: 42px; height: 52px; flex: 0 0 42px; }
.author-ideogram-avatar img,
.portrait-ideogram-preview-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.author-ideogram-avatar.has-image,
.sculpture-image-button { color: #8a6a48; }
.sculpture-image-button:hover { color: #6f5135; }
.sculpture-image-button.is-ready { color: #4b8f63; }
.sculpture-image-button.is-failed { color: #b15c48; border-color: color-mix(in srgb, #b15c48 45%, var(--border)); }
.portrait-ideogram-preview-media.has-image { border-style: solid; }
.author-process-actions { display: inline-flex; align-items: center; gap: 6px; }
.ideogram-image-button.is-ready { color: #4b8f63; }
.ideogram-image-button.is-failed { color: #b15c48; border-color: color-mix(in srgb, #b15c48 45%, var(--border)); }
.ideogram-process-message {
  display: block;
  overflow: hidden;
  max-width: 126px;
  margin: 4px auto 0;
  color: var(--muted);
  font-size: .65rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ideogram-process-message:empty { display: none; }
.ideogram-process-message.is-error { color: #b15c48; }
.portrait-preview { flex-wrap: wrap; }
.portrait-preview-pair { align-items: flex-end; gap: 8px; }
.portrait-preview-item { display: grid; gap: 4px; color: var(--muted); font-size: .72rem; }
.portrait-preview-item > small { line-height: 1; }
.portrait-ideogram-preview-media { width: 67px; height: 84px; flex: 0 0 67px; }
.edit-ideogram-message {
  flex: 1 0 100%;
  max-width: none;
  margin: 0;
  white-space: normal;
}
.portrait-process-button {
  flex: 0 0 auto;
}
@media (max-width: 640px) {
  .portrait-preview-actions { margin-left: 0; }
}


/* Taxonomy lists */
.taxonomy-panel .admin-filters {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.topics-panel .admin-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 130px 90px 122px max-content max-content;
  align-items: end;
  gap: 8px;
}
.topics-panel .admin-filters label {
  width: auto;
  min-width: 0;
}
.topics-panel .admin-filters input,
.topics-panel .admin-filters select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
.topics-panel .quote-count-operator {
  min-width: 0;
}
.topics-panel .quote-count-value {
  width: auto;
  min-width: 0;
}
.curated-toggle input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--primary);
}
.curated-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
}
.curated-toggle:has(input:checked) {
  color: var(--text);
}
.curated-toggle:has(input:disabled) {
  cursor: wait;
  opacity: .6;
}
@media (max-width: 1000px) {
  .topics-panel .admin-filters {
    grid-template-columns: minmax(200px, 1fr) repeat(3, minmax(100px, 140px));
  }
}
@media (max-width: 640px) {
  .topics-panel .admin-filters {
    grid-template-columns: 1fr;
  }
  .topics-panel .admin-filters button,
  .topics-panel .admin-filters .quiet-link {
    width: 100%;
  }
}
.taxonomy-table {
  min-width: 1040px;
}
.topics-panel .taxonomy-table {
  min-width: 1120px;
}
.taxonomy-title-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
}
.taxonomy-thumb {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
}
.taxonomy-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.taxonomy-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.taxonomy-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.taxonomy-flags span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 6px;
  font-size: .74rem;
}
.mood-thumb .icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

/* Pagination standard */
.pager,
.faq-panel .pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.2;
}
.pager a,
.faq-panel .pager a {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  font-weight: 400;
}
.pager span,
.faq-panel .pager span {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 400;
}


/* BG Images */
.bg-images-panel .admin-filters {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.bg-image-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
}
.bg-image-stats > span {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  padding: 5px 8px;
}
.bg-image-stats span span {
  color: var(--text);
  font-weight: 500;
}
.manual-bg-form {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  padding: 10px 12px;
}
.manual-bg-form summary {
  cursor: pointer;
  color: var(--text);
  font-size: .9rem;
  font-weight: 400;
}
.manual-bg-form form {
  display: grid;
  grid-template-columns: 140px 120px minmax(260px, 1fr) repeat(3, minmax(140px, 1fr)) 90px auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}
.manual-bg-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .78rem;
}
.manual-bg-form input,
.manual-bg-form select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}
.manual-bg-form button {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: var(--primary);
  color: var(--surface);
  padding: 8px 12px;
  font-weight: 500;
}
.bg-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.bg-image-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  overflow: hidden;
}
.bg-image-card.is-removing {
  opacity: 0;
  transform: scale(.985);
  transition: opacity .16s ease, transform .16s ease;
}
.bg-image-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  color: var(--muted);
  overflow: hidden;
}
.bg-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bg-image-copy {
  display: grid;
  gap: 2px;
  padding: 0 10px;
}
.bg-image-title {
  color: var(--text);
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.3;
}
.bg-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 9px 10px;
}
.bg-image-actions form {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.row-action,
button.row-action {
  cursor: pointer;
  background: var(--surface);
  font: inherit;
}
button.row-action {
  color: var(--primary);
}
button.row-action.is-loading {
  color: var(--soft);
  cursor: wait;
}
@media (max-width: 1200px) {
  .manual-bg-form form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manual-bg-form .field-wide { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .manual-bg-form form { grid-template-columns: 1fr; }
  .bg-image-grid { grid-template-columns: 1fr; }
}

.bg-target-form {
  display: grid;
  grid-template-columns: 150px minmax(260px, 1fr) 160px auto auto auto;
  gap: 10px;
  align-items: end;
}
.bg-target-form .bg-target-search {
  min-width: 0;
}
.bg-target-form button[name="action"] {
  background: color-mix(in srgb, var(--primary) 88%, #000 0%);
}
@media (max-width: 1100px) {
  .bg-target-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .bg-target-form { grid-template-columns: 1fr; }
}

/* MuseQuotes brand palette */
:root {
  --bg: #faf7f0;
  --surface: #ffffff;
  --surface-2: #f4f0e6;
  --surface-3: #ede7db;
  --text: #2e2a26;
  --muted: #5a6b8c;
  --soft: #6c685e;
  --primary: #1b2a4a;
  --primary-2: #243559;
  --accent: #c9a227;
  --on-primary: #faf7f0;
  --brand-ink: #1b2a4a;
  --brand-gold: #e0b840;
  --border: rgba(27, 42, 74, .10);
  --border-strong: rgba(27, 42, 74, .16);
  --focus: rgba(201, 162, 39, .24);
  --danger-bg: #fff4f0;
  --success-bg: #eff8f2;
  --shadow: none;
}

html[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1a1d25;
  --surface-2: #181b22;
  --surface-3: #1c1f27;
  --text: #e9e4d8;
  --muted: #8e9bb5;
  --soft: #88857c;
  --primary: #e0b840;
  --primary-2: #f2d06b;
  --accent: #e0b840;
  --on-primary: #2e2410;
  --brand-ink: #10151f;
  --brand-gold: #e0b840;
  --border: rgba(227, 220, 203, .09);
  --border-strong: rgba(227, 220, 203, .15);
  --focus: rgba(224, 184, 64, .25);
}

.admin-filters button,
.edit-actions button,
.admin-login button,
.manual-bg-form button {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.admin-filters button:hover,
.edit-actions button:hover,
.admin-login button:hover,
.manual-bg-form button:hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
  color: var(--on-primary);
}

.admin-sidebar { background: var(--surface); }
.sidebar-logo {
  background: var(--brand-ink);
  border-color: color-mix(in srgb, var(--brand-gold) 58%, transparent);
  color: var(--brand-gold);
}
.sidebar-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}
.sidebar-nav a[aria-current="page"] .icon { color: var(--accent); }
.login-shell { background: var(--brand-ink); }
html[data-theme="dark"] .login-shell { background: var(--brand-ink); }
.admin-mark { background: var(--brand-ink); color: var(--brand-gold); }

.authors-panel .admin-filters,
.authors-meta,
.authors-panel .table-scroll,
.authors-panel .admin-table,
.authors-panel .admin-table td,
.pager,
.sidebar-foot button {
  background: var(--surface);
}
.authors-panel .admin-table th { background: var(--surface-2); color: var(--muted); }
.authors-panel .admin-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.author-avatar { background: var(--surface-2); border-color: var(--border); color: var(--muted); }
.author-name-link,
.text-pill { color: var(--text); }
.author-id,
.subtext,
.occupation-text,
.rank-badge { color: var(--muted); }
.metric-link,
.metric-link .metric-value,
.metric-muted .metric-value,
.count-link { color: var(--primary); }

html[data-theme="dark"] .admin-filters button,
html[data-theme="dark"] .edit-actions button,
html[data-theme="dark"] .admin-login button,
html[data-theme="dark"] .manual-bg-form button,
html[data-theme="dark"] .admin-mark {
  color: var(--on-primary);
}

/* Compact admin login */
.login-shell { padding: 20px 14px; }
.login-panel {
  width: min(100%, 420px);
  padding: 24px;
}
.login-panel .admin-brand {
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.login-panel .admin-mark {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}
.login-panel #admin-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}
.login-panel .admin-brand p {
  margin-top: 3px;
  font-size: .78rem;
  line-height: 1.4;
}
.login-panel .admin-login { gap: 11px; }
.login-panel .admin-login label {
  gap: 5px;
  font-size: .78rem;
}
.login-panel .admin-login input {
  min-height: 36px;
  padding: 8px 10px;
}
.login-panel .admin-login button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: .82rem;
}
.login-panel .admin-alert {
  padding: 12px;
  font-size: .8rem;
}

@media (max-width: 420px) {
  .login-panel { padding: 20px; }
  .login-panel #admin-title { font-size: 1.18rem; }
  .login-panel .admin-brand p { font-size: .75rem; }
}

.topic-actions-cell { width: 106px; white-space: nowrap; }
.topic-actions-cell form { margin: 0; }
.topic-actions-cell .row-action { min-height: 30px; padding: 5px 9px; font-size: .78rem; }
.topic-actions-cell .row-action.is-danger { color: #95433c; }

/* Quote Analysis */
.quote-analyses-panel .admin-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 150px max-content max-content;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.quote-analyses-panel .admin-filters label { min-width: 0; }
.quote-analyses-panel .admin-filters input,
.quote-analyses-panel .admin-filters select { width: 100%; }
.quote-analyses-table { min-width: 980px; table-layout: fixed; }
.quote-analyses-table th:nth-child(1) { width: 34%; }
.quote-analyses-table th:nth-child(2) { width: 38%; }
.quote-analyses-table th:nth-child(3) { width: 18%; }
.quote-analyses-table th:nth-child(4) { width: 10%; }
.analysis-cell-stack {
  display: grid;
  gap: 5px;
}
.analysis-view-link {
  display: block;
  color: var(--text);
  text-decoration: none;
}
.analysis-preview {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.analysis-view-label {
  display: inline-block;
  margin-top: 7px;
  color: var(--primary);
  font-size: .78rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.analysis-view-link:hover .analysis-view-label { color: var(--text); }
.analysis-public-link {
  width: max-content;
  color: var(--primary);
  font-size: .76rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.analysis-public-link:hover { color: var(--text); }
.quote-analyses-table time {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}
.analysis-status-stack { display: grid; justify-items: start; gap: 9px; }
.analysis-status-stack form { margin: 0; }
.analysis-status-stack .row-action { min-height: 30px; padding: 5px 9px; font-size: .78rem; }
.analysis-status-stack .row-action.is-danger,
.analysis-detail-status .row-action.is-danger { color: #95433c; }
.page-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-heading-row .edit-toolbar { margin: 0; }
.analysis-detail-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.analysis-detail-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.analysis-detail-header blockquote {
  max-width: 920px;
  margin: 0;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.55;
}
.analysis-detail-author { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.analysis-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.analysis-detail-meta > span {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.meta-label {
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
}
.analysis-detail-status { display: flex !important; align-items: center; justify-content: space-between; gap: 10px !important; }
.analysis-detail-status form { margin: 0; }
.analysis-document {
  max-width: 920px;
  padding: 24px;
  color: var(--text);
}
.analysis-document h2 {
  margin: 26px 0 8px;
  font-size: 1rem;
  font-weight: 500;
}
.analysis-document h2:first-child { margin-top: 0; }
.analysis-document p { margin: 0 0 14px; color: var(--text); line-height: 1.7; }
.analysis-response { padding: 18px 24px; border-top: 1px solid var(--border); }
.analysis-response p { margin: 5px 0 0; }
@media (max-width: 760px) {
  .quote-analyses-panel .admin-filters { grid-template-columns: 1fr; }
  .quote-analyses-panel .admin-filters button,
  .quote-analyses-panel .admin-filters .quiet-link { width: 100%; }
  .page-heading-row { display: grid; }
  .analysis-detail-meta { grid-template-columns: 1fr; }
}
