:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-muted: rgba(255, 255, 255, 0.56);
  --line: rgba(29, 29, 31, 0.08);
  --line-strong: rgba(29, 29, 31, 0.14);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-strong: #515154;
  --primary: #0071e3;
  --primary-soft: rgba(0, 113, 227, 0.12);
  --success: #18864b;
  --success-soft: rgba(24, 134, 75, 0.12);
  --warning: #c67c10;
  --warning-soft: rgba(198, 124, 16, 0.12);
  --danger: #c9343a;
  --danger-soft: rgba(201, 52, 58, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.04);
  --font-display: clamp(24px, 2.4vw, 30px);
  --font-title-lg: clamp(20px, 1.9vw, 24px);
  --font-title-md: 18px;
  --font-title-sm: 16px;
  --font-body-lg: 14px;
  --font-body: 13px;
  --font-caption: 12px;
  --font-meta: 11px;
  --lh-tight: 1.2;
  --lh-body: 1.6;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", sans-serif;
  font-size: var(--font-body);
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(0, 113, 227, 0.08), transparent 28%),
    linear-gradient(180deg, #fafafa 0%, var(--bg) 100%);
  color: var(--text);
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  background: none;
}

a {
  color: inherit;
}

.dashboard-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 18px 16px;
  transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .dashboard-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar,
.library-pane,
.inspector-pane,
.overview-stats,
.section-block,
.review-shell,
.review-table-pane,
.review-editor-pane,
.book-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: var(--shadow-md);
}

.sidebar {
  min-width: 0;
  border-radius: var(--radius-xl);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  transition: opacity 160ms ease, padding 160ms ease;
}

body.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  padding-inline: 0;
}

.sidebar-top {
  display: grid;
  gap: 20px;
  align-content: start;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0a84ff 0%, #64a8ff 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  flex: 0 0 auto;
}

.brand-copy h1,
.brand-copy p {
  margin: 0;
}

.brand-copy h1 {
  font-size: var(--font-title-sm);
  line-height: var(--lh-tight);
}

.brand-copy p {
  margin-top: 4px;
  font-size: var(--font-meta);
  color: var(--muted);
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.system-nav {
  display: grid;
  gap: 6px;
}

.system-nav-item {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 16px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.system-nav-item:hover {
  background: rgba(255, 255, 255, 0.56);
  transform: translateY(-1px);
}

.system-nav-item.is-active {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(0, 113, 227, 0.12), var(--shadow-sm);
}

.system-nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(29, 29, 31, 0.06);
  color: var(--muted-strong);
  flex: 0 0 auto;
}

.system-nav-item.is-active .system-nav-icon {
  background: rgba(0, 113, 227, 0.12);
  color: var(--primary);
}

.system-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.system-nav-label {
  min-width: 0;
  font-size: var(--font-body);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-section-label {
  font-size: var(--font-meta);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sidebar-status {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.sidebar-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.sidebar-status-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(29, 29, 31, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-status-card span,
.sidebar-status-card strong {
  display: inline-block;
}

.sidebar-status-card span {
  font-size: var(--font-meta);
  color: var(--muted);
}

.sidebar-status-card strong {
  font-size: var(--font-title-sm);
}

.dropzone,
.review-dropzone {
  border: 1px dashed rgba(0, 113, 227, 0.2);
  background: rgba(250, 252, 255, 0.9);
  border-radius: 18px;
  padding: 22px 16px;
  display: grid;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.dropzone:hover,
.review-dropzone:hover,
.dropzone.is-dragover,
.review-dropzone.is-dragover {
  border-color: rgba(0, 113, 227, 0.4);
  background: rgba(244, 248, 255, 0.96);
  transform: translateY(-1px);
}

.review-dropzone.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.dropzone-title,
.review-dropzone-title {
  font-size: var(--font-body-lg);
  font-weight: 600;
}

.dropzone-subtitle,
.selected-file,
.review-file-name {
  font-size: var(--font-caption);
  color: var(--muted);
}

.main-shell {
  min-width: 0;
  height: calc(100vh - 34px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  overflow: hidden;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 10px 4px 0;
}

.page-title-block {
  position: relative;
  min-width: 0;
}

body.sidebar-collapsed .page-title-block {
  padding-left: 52px;
}

.page-toggle {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .page-toggle {
  opacity: 1;
  pointer-events: auto;
}

.breadcrumbs {
  font-size: var(--font-meta);
  color: var(--muted);
}

.page-header h2,
.page-header p {
  margin: 0;
}

.page-header h2 {
  margin-top: 10px;
  font-size: var(--font-display);
  line-height: 1.12;
}

.page-header p {
  margin-top: 12px;
  max-width: 720px;
  color: var(--muted);
  font-size: var(--font-body);
  line-height: var(--lh-body);
}

.header-tools {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  height: 46px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding: 0 16px;
  outline: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.search-box input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(0, 113, 227, 0.26);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.profile-chip {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1d1d1f;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.profile-chip strong,
.profile-chip span {
  display: block;
}

.profile-chip strong {
  font-size: 13px;
}

.profile-chip span {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.overview-strip {
  min-width: 0;
}

.overview-stats {
  min-width: 0;
  border-radius: var(--radius-xl);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-tile {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.summary-label {
  display: block;
  font-size: var(--font-caption);
  color: var(--muted);
}

.stat-tile strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1;
}

.workspace-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 18px;
  overflow: hidden;
}

.library-pane,
.inspector-pane {
  min-height: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.library-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.inspector-pane {
  padding: 18px;
  display: grid;
  min-height: 0;
}

.pane-header {
  display: grid;
  gap: 14px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.pane-kicker {
  font-size: var(--font-meta);
  line-height: 1;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pane-header h3,
.pane-header p {
  margin: 0;
}

.pane-header h3 {
  font-size: var(--font-title-md);
}

.pane-header p {
  margin-top: 6px;
  color: var(--muted);
  line-height: var(--lh-body);
  font-size: var(--font-body);
}

.module-panel {
  margin: 0 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 14px;
}

.module-panel.is-compact {
  padding: 14px;
  gap: 10px;
}

.module-panel h4,
.module-panel p {
  margin: 0;
}

.module-panel h4 {
  margin-top: 8px;
  font-size: var(--font-title-sm);
}

.module-panel p {
  margin-top: 6px;
  font-size: var(--font-caption);
  line-height: var(--lh-body);
  color: var(--muted);
}

.module-panel.is-compact h4 {
  font-size: 16px;
}

.module-panel.is-compact p {
  font-size: 12px;
}

.module-upload-form {
  display: grid;
  gap: 12px;
}

body[data-section="review"] .overview-strip,
body[data-section="review"] #page-breadcrumbs,
body[data-section="review"] #page-copy,
body[data-section="review"] #list-kicker,
body[data-section="review"] #list-caption,
body[data-section="review"] .detail-mode-tabs,
body[data-section="review"] .book-hero,
body[data-section="review"] .book-hero .detail-kicker,
body[data-section="review"] #detail-meta,
body[data-section="review"] .detail-message,
body[data-section="review"] .hero-metrics,
body[data-section="review"] #retry-button {
  display: none !important;
}

body[data-section="review"] .main-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section="review"] .page-header {
  padding-top: 0;
}

body[data-section="review"] .page-header h2 {
  margin-top: 0;
}

body[data-section="review"] .workspace-grid {
  grid-template-columns: 1fr;
}

body[data-section="review"] #library-pane {
  display: none;
}

body[data-section="review"] .inspector-pane {
  padding: 0;
}

body[data-section="review"] .pane-header {
  padding-bottom: 10px;
}

body[data-section="review"] .detail-view {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

body[data-section="review"] .detail-pane-view {
  overflow: hidden;
}

body[data-section="review"] .review-shell {
  height: 100%;
  padding: 14px;
  gap: 12px;
}

.module-panel.is-compact .dropzone {
  padding: 16px 14px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.05);
  border: 1px solid rgba(29, 29, 31, 0.06);
}

.segment {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: var(--font-body);
  color: var(--muted-strong);
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.segment:hover {
  transform: translateY(-1px);
}

.segment.is-active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.segment:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.task-list {
  min-height: 0;
  padding: 14px;
  display: grid;
  gap: 12px;
  overflow: auto;
  align-content: start;
}

.task-list.is-table-mode {
  padding: 0;
  display: block;
  overflow: hidden;
}

.task-table-scroll {
  height: 100%;
  overflow: auto;
}

.task-review-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.task-review-table th:nth-child(1),
.task-review-table td:nth-child(1) {
  width: 38%;
}

.task-review-table th:nth-child(2),
.task-review-table td:nth-child(2) {
  width: 20%;
}

.task-review-table th:nth-child(3),
.task-review-table td:nth-child(3) {
  width: 26%;
}

.task-review-table th:nth-child(4),
.task-review-table td:nth-child(4) {
  width: 16%;
}

.task-review-table th,
.task-review-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.task-review-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.96);
  font-size: var(--font-caption);
  color: var(--muted);
  white-space: nowrap;
}

.task-review-table tbody td {
  font-size: var(--font-body);
  line-height: 1.5;
}

.task-review-row {
  cursor: pointer;
  transition: background 120ms ease;
}

.task-review-row:hover {
  background: rgba(0, 113, 227, 0.04);
}

.task-review-row.is-selected {
  background: rgba(0, 113, 227, 0.08);
}

.task-review-title {
  font-weight: 600;
  font-size: var(--font-body);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-structure-cell {
  display: grid;
  gap: 4px;
}

.task-structure-cell strong,
.task-structure-cell span {
  display: block;
}

.task-structure-cell strong {
  font-size: var(--font-body);
  font-weight: 600;
}

.task-structure-cell span {
  font-size: var(--font-caption);
  color: var(--muted);
}

.task-item {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(29, 29, 31, 0.08);
  background: rgba(255, 255, 255, 0.84);
  display: grid;
  gap: 12px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.task-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.task-item.is-selected {
  border-color: rgba(0, 113, 227, 0.26);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.08);
}

.task-item-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.task-title,
.book-hero h3,
.review-editor-head h4 {
  margin: 0;
}

.task-title {
  font-size: var(--font-title-sm);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta,
.task-message {
  margin: 0;
  color: var(--muted);
}

.task-meta {
  font-size: var(--font-caption);
  line-height: 1.5;
}

.task-message {
  font-size: var(--font-body);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-metrics,
.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-pill {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: var(--font-caption);
  color: var(--muted-strong);
  background: rgba(29, 29, 31, 0.05);
  border: 1px solid rgba(29, 29, 31, 0.06);
}

.empty-state,
.review-editor-empty {
  border: 1px dashed rgba(29, 29, 31, 0.12);
  border-radius: 20px;
  padding: 28px 20px;
  color: var(--muted);
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.46);
}

.detail-empty,
.detail-view {
  min-height: 0;
  height: 100%;
}

.system-view {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.system-shell {
  min-height: 100%;
  display: grid;
  gap: 18px;
}

.system-view-head {
  border-radius: var(--radius-xl);
  padding: 22px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.system-view-head h3,
.system-view-head p {
  margin: 0;
}

.system-view-head h3 {
  margin-top: 10px;
  font-size: var(--font-title-lg);
  line-height: 1.15;
}

.system-view-head p {
  margin-top: 10px;
  max-width: 720px;
  font-size: var(--font-body);
  line-height: var(--lh-body);
  color: var(--muted);
}

.system-head-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 112px));
  gap: 10px;
}

.system-head-stat {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.system-head-stat span,
.system-head-stat strong {
  display: block;
}

.system-head-stat span {
  font-size: var(--font-meta);
  color: var(--muted);
}

.system-head-stat strong {
  margin-top: 10px;
  font-size: 24px;
  line-height: 1;
}

.detail-empty {
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.detail-empty h3,
.detail-empty p {
  margin: 0;
}

.detail-empty h3 {
  font-size: var(--font-title-lg);
}

.detail-empty p {
  margin-top: 10px;
  max-width: 560px;
  font-size: var(--font-body);
  line-height: var(--lh-body);
  color: var(--muted);
}

.detail-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.book-hero {
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.book-hero-main {
  min-width: 0;
}

.detail-kicker {
  font-size: var(--font-meta);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.book-hero h3 {
  margin-top: 10px;
  font-size: var(--font-title-lg);
  line-height: 1.18;
}

.book-hero p {
  margin: 0;
}

#detail-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--font-body);
  line-height: 1.5;
}

.detail-message {
  margin-top: 12px;
  max-width: 800px;
  font-size: var(--font-body);
  color: var(--muted-strong);
  line-height: var(--lh-body);
}

.book-hero-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.hero-metrics {
  grid-column: 1 / -1;
}

.status-badge {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-caption);
  font-weight: 700;
  white-space: nowrap;
}

.status-queued,
.status-processing,
.status-exporting {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-ready_for_review {
  background: var(--success-soft);
  color: var(--success);
}

.status-exported {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.detail-mode-tabs {
  width: fit-content;
}

.detail-pane-view {
  min-height: 0;
  overflow: auto;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.system-card-wide {
  grid-column: 1 / -1;
}

.system-list {
  display: grid;
  gap: 12px;
}

.system-list-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
}

.system-list-item strong,
.system-list-item span {
  display: block;
}

.system-list-item strong {
  font-size: var(--font-body-lg);
}

.system-list-item span {
  margin-top: 6px;
  color: var(--muted);
  line-height: var(--lh-body);
  font-size: var(--font-body);
}

.system-flow {
  margin-top: 4px;
}

.overview-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
}

.overview-main,
.overview-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.section-block {
  border-radius: var(--radius-xl);
  padding: 20px;
}

.section-header {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.section-header h4,
.section-header p,
.next-step-callout h5,
.next-step-callout p {
  margin: 0;
}

.section-header h4 {
  font-size: var(--font-title-sm);
}

.section-header p,
.next-step-callout p {
  color: var(--muted);
  line-height: var(--lh-body);
  font-size: var(--font-body);
}

.edit-grid,
.timeline-grid,
.review-editor-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: var(--font-caption);
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 11px 14px;
  font-size: var(--font-body);
  color: var(--text);
  outline: none;
  resize: vertical;
}

.compact-field span {
  font-size: var(--font-meta);
}

.field-full {
  grid-column: 1 / -1;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.save-feedback {
  font-size: 12px;
  color: var(--muted);
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.flow-step {
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
}

.flow-step.is-done {
  background: rgba(24, 134, 75, 0.08);
  border-color: rgba(24, 134, 75, 0.14);
}

.flow-step.is-current {
  background: rgba(0, 113, 227, 0.08);
  border-color: rgba(0, 113, 227, 0.14);
}

.flow-step-index {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.flow-step-copy strong,
.flow-step-copy span {
  display: block;
}

.flow-step-copy strong {
  font-size: var(--font-body);
}

.flow-step-copy span {
  margin-top: 6px;
  font-size: var(--font-caption);
  color: var(--muted);
}

.next-step-callout {
  margin-top: 16px;
  padding: 18px;
  border-radius: 22px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(247, 250, 255, 0.92));
  border: 1px solid rgba(0, 113, 227, 0.1);
}

.next-step-callout h5 {
  margin-top: 8px;
  font-size: var(--font-title-sm);
}

.timeline-grid {
  grid-template-columns: 1fr;
}

.timeline-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item strong {
  font-size: var(--font-caption);
  color: var(--muted);
}

.timeline-item span {
  margin-top: 8px;
  font-size: var(--font-body);
  color: var(--text);
  line-height: 1.5;
}

.download-list {
  display: grid;
  gap: 12px;
}

body[data-section="review"] #detail-section-settings,
body[data-section="delivery"] #detail-section-settings,
body[data-section="delivery"] #detail-section-upload {
  display: none;
}

body[data-section="settings"] #library-pane {
  display: none;
}

body[data-section="settings"] .workspace-grid {
  grid-template-columns: 1fr;
}

.download-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.download-copy strong,
.download-copy span {
  display: block;
}

.download-copy strong {
  font-size: var(--font-body);
}

.download-copy span {
  margin-top: 6px;
  font-size: var(--font-caption);
  color: var(--muted);
  line-height: 1.5;
}

.review-form {
  display: grid;
  gap: 12px;
}

.log-panel {
  border-radius: var(--radius-xl);
  padding: 16px 18px;
}

.log-panel summary {
  cursor: pointer;
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--muted-strong);
}

.log-text {
  margin: 14px 0 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--font-caption);
  line-height: 1.5;
  color: #4c5666;
}

.review-shell {
  min-height: 100%;
  border-radius: var(--radius-xl);
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
}

.review-context-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.review-context-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.review-context-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-context-title-row h3 {
  margin: 0;
  font-size: var(--font-title-lg);
  line-height: 1.2;
}

.review-context-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-context-meta {
  max-width: 320px;
  font-size: var(--font-caption);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-context-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-context-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.review-book-switcher {
  width: min(320px, 100%);
}

.review-book-switcher select {
  height: 40px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-topbar {
  display: block;
}

.review-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.review-toolbar-meta {
  font-size: var(--font-caption);
  color: var(--muted);
  min-height: 18px;
}

.annotation-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.annotation-summary-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  display: grid;
  gap: 6px;
}

.annotation-summary-card span {
  font-size: var(--font-caption);
  color: var(--muted);
}

.annotation-summary-card strong {
  font-size: 22px;
  line-height: 1.1;
  color: var(--text-strong);
}

.review-workbench {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(320px, 1.15fr) minmax(340px, 0.85fr);
  gap: 14px;
}

.review-table-pane,
.review-editor-pane {
  min-height: 0;
  border-radius: 22px;
  padding: 16px;
}

.review-table-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.review-table-scroll {
  min-height: 0;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.review-table th,
.review-table td {
  text-align: left;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.review-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.96);
  font-size: var(--font-caption);
  color: var(--muted);
}

.review-table tbody td {
  font-size: var(--font-body);
  line-height: 1.55;
  word-break: break-word;
}

.review-table tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

.review-table tbody tr:hover {
  background: rgba(0, 113, 227, 0.04);
}

.review-table tbody tr.is-selected {
  background: rgba(0, 113, 227, 0.08);
}

.review-table-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.review-col-object {
  width: 20%;
}

.review-col-page,
.review-col-risk,
.review-col-status {
  width: 11%;
  white-space: nowrap;
}

.review-col-preview {
  width: 47%;
}

.review-cell-title {
  font-weight: 600;
}

.review-cell-sub {
  margin-top: 4px;
  font-size: var(--font-caption);
  color: var(--muted);
}

.review-preview-text {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted-strong);
}

.review-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-editor-pane {
  overflow: auto;
  display: grid;
}

.review-editor-form {
  display: grid;
  gap: 16px;
}

.review-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.review-editor-head h4 {
  margin-top: 8px;
  font-size: var(--font-title-sm);
  line-height: 1.35;
}

.review-editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-editor-copy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.review-editor-pane textarea {
  min-height: 0;
  font-size: var(--font-body);
  line-height: var(--lh-body);
}

#review-editor-original-text {
  background: rgba(248, 249, 252, 0.92);
}

.risk-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.risk-medium {
  background: var(--warning-soft);
  color: var(--warning);
}

.risk-low,
.risk-none {
  background: rgba(29, 29, 31, 0.06);
  color: var(--muted-strong);
}

.button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: linear-gradient(180deg, #0a84ff 0%, #0071e3 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0, 113, 227, 0.2);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border: 1px solid var(--line);
}

.button.ghost.danger {
  background: rgba(255, 255, 255, 0.92);
  color: var(--danger);
  border: 1px solid rgba(201, 52, 58, 0.18);
}

@media (max-width: 1440px) {
  .overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  body[data-section="review"] .workspace-grid {
    grid-template-columns: 1fr;
  }

  .overview-layout,
  .system-grid {
    grid-template-columns: 1fr;
  }

  .overview-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 1200px) {
  body {
    overflow: auto;
  }

  .dashboard-shell {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .main-shell {
    height: auto;
    min-height: calc(100vh - 34px);
    overflow: visible;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .library-pane,
  .inspector-pane,
  .detail-pane-view,
  .system-view,
  .review-shell {
    overflow: visible;
  }

  .detail-view {
    height: auto;
  }

  .system-head-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .review-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  body.sidebar-collapsed .dashboard-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .sidebar {
    opacity: 1;
    pointer-events: auto;
    padding: 18px 14px;
  }

  body.sidebar-collapsed .page-title-block {
    padding-left: 0;
  }

  .page-toggle {
    display: none;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-radius: 24px;
  }

  .sidebar-top {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 14px 18px;
  }

  .brand-block {
    grid-column: 1 / -1;
  }

  .system-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .system-nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    min-height: 74px;
    padding: 10px 8px;
  }

  .system-nav-label {
    font-size: 12px;
  }

  .sidebar-status {
    margin-top: 0;
  }

  .sidebar-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .header-tools {
    grid-template-columns: 1fr;
  }

  .book-hero,
  .system-view-head {
    grid-template-columns: 1fr;
  }

  .book-hero-side {
    justify-items: start;
  }
}

@media (max-width: 768px) {
  .dashboard-shell {
    padding: 12px;
    gap: 12px;
  }

  .sidebar,
  .library-pane,
  .inspector-pane,
  .book-hero,
  .section-block,
  .review-shell,
  .system-view-head {
    border-radius: 22px;
  }

  .overview-stats,
  .sidebar-status-grid,
  .system-head-stats,
  .overview-side {
    grid-template-columns: 1fr;
  }

  .system-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pane-header,
  .page-header,
  .review-topbar,
  .review-context-bar,
  .section-header,
  .review-editor-head,
  .next-step-callout,
  .system-view-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segment {
    min-height: 40px;
    justify-content: center;
    text-align: center;
  }

  .module-panel,
  .book-hero,
  .section-block,
  .review-shell,
  .pane-header {
    padding: 16px;
  }

  .flow-steps,
  .review-filter-grid,
  .review-editor-grid {
    grid-template-columns: 1fr;
  }

  .review-context-meta {
    max-width: 100%;
  }

  .review-context-actions {
    width: 100%;
    justify-content: stretch;
  }

  .review-book-switcher {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .brand-identity {
    width: 100%;
  }

  .system-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-card {
    grid-template-columns: 1fr;
  }

  .review-pagination {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Shared two-row controls for the library and review workbenches. */
.review-control-panel {
  gap: 8px;
}

.review-control-main {
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
}

.review-control-bottom {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}

.review-filter-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  align-items: end;
}

.review-control-panel .field input,
.review-control-panel .field select,
.review-control-panel .button,
.review-control-panel .read-aloud-workbook-actions select,
.library-current-book {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
}

.review-control-panel .review-entity-tabs {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
  align-self: center;
}

.review-control-panel .review-entity-tabs .segment {
  min-height: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.review-control-bottom .review-action-stack {
  grid-column: auto;
  align-self: end;
  justify-items: end;
}

.review-control-bottom .review-action-group {
  min-height: 36px;
  align-items: center;
}

.review-action-stack .save-feedback:empty {
  display: none;
}

body[data-section="library"] .review-control-main {
  grid-template-columns: minmax(220px, 1fr) auto;
}

body[data-section="library"] .review-control-bottom .review-action-stack {
  grid-column: auto;
}

@media (max-width: 1280px) {
  .review-control-bottom {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-control-bottom .review-action-stack,
  body[data-section="library"] .review-control-bottom .review-action-stack {
    grid-column: 1;
    justify-items: start;
  }
}

@media (max-width: 760px) {
  .review-control-main,
  body[data-section="library"] .review-control-main,
  .review-control-bottom,
  .review-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-control-panel .review-entity-tabs {
    height: auto;
    min-height: 36px;
  }
}

/* Account entry remains available in every module and matches the search control. */
body[data-section="review"] .header-tools {
  display: grid;
}

.header-tools .search-box input,
.header-tools .profile-chip.account-menu-button {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
}

body[data-auth-role="viewer"] .sidebar-import {
  display: none;
}

@media (max-width: 640px) {
  body[data-section] .header-tools {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 148px;
  }

  body[data-section] .profile-chip.account-menu-button {
    display: flex !important;
    width: 148px;
  }
}

@media (max-width: 460px) {
  body[data-section] .header-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-section] .profile-chip.account-menu-button {
    width: 100%;
  }
}

/* Account drawer final precedence: profile, members and logs remain readable. */
.account-drawer {
  width: min(620px, 100vw);
  grid-template-rows: auto auto auto auto;
  align-content: start;
}

.account-list {
  max-height: 240px;
  overflow-y: auto;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.audit-search-field {
  grid-column: 1 / -1;
}

.audit-summary {
  color: var(--muted);
  font-size: 12px;
}

.audit-log-list {
  display: grid;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.audit-log-row {
  min-width: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.audit-log-row:last-child {
  border-bottom: 0;
}

.audit-log-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.audit-log-heading,
.audit-pagination {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audit-log-main p,
.audit-log-main span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.audit-action-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.audit-action-badge.is-failed {
  color: var(--danger);
  background: var(--danger-soft);
}

.audit-pagination span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .audit-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .audit-search-field {
    grid-column: 1;
  }
}

/* Super-admin activity log. */
.account-drawer {
  width: min(620px, 100vw);
  grid-template-rows: auto;
  align-content: start;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.audit-search-field {
  grid-column: 1 / -1;
}

.audit-summary {
  color: var(--muted);
  font-size: 12px;
}

.audit-log-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.audit-log-row {
  min-width: 0;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.audit-log-row:last-child {
  border-bottom: 0;
}

.audit-log-main,
.audit-log-heading {
  min-width: 0;
}

.audit-log-main {
  display: grid;
  gap: 4px;
}

.audit-log-heading,
.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audit-log-main p,
.audit-log-main span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.audit-action-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.audit-action-badge.is-failed {
  color: var(--danger);
  background: var(--danger-soft);
}

.audit-pagination span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .audit-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .audit-search-field {
    grid-column: 1;
  }
}

/* Authentication and account management. */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f5f7fa;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.auth-brand,
.account-current-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1,
.auth-brand p,
.auth-intro strong,
.auth-intro span,
.account-current-user strong,
.account-current-user span {
  margin: 0;
  display: block;
}

.auth-brand h1 {
  font-size: 20px;
}

.auth-brand p,
.auth-intro span,
.account-current-user span {
  color: var(--muted);
  font-size: 12px;
}

.auth-form,
.account-form,
.auth-intro {
  display: grid;
  gap: 14px;
}

.auth-form-grid,
.account-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-submit {
  width: 100%;
  min-height: 40px;
}

.form-feedback {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.header-tools {
  align-items: center;
}

.profile-chip.account-menu-button {
  box-sizing: border-box;
  width: 184px;
  min-height: 36px;
  height: 36px;
  padding: 4px 10px;
  display: flex !important;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.profile-chip.account-menu-button:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.account-menu-button .profile-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}

.account-menu-button > div {
  min-width: 0;
  display: block;
}

.account-menu-button strong,
.account-menu-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-button strong {
  display: block;
  font-size: 13px;
  line-height: 1;
}

.account-menu-button span[hidden] {
  display: none !important;
}

.account-layer,
.account-editor-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.account-editor-layer {
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
}

.account-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.36);
  cursor: default;
}

.account-drawer {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(560px, 100vw);
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.14);
}

.account-editor-card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.account-drawer-header,
.account-section-heading,
.account-form-actions,
.account-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-drawer-header h2,
.account-section-heading h3,
.account-section-heading p {
  margin: 0;
}

.account-drawer-header h2 {
  font-size: 18px;
}

.account-profile-block,
.account-admin-section {
  display: grid;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.account-section-heading h3 {
  font-size: 15px;
}

.account-section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.account-list {
  display: grid;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.account-list-row {
  min-width: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.account-list-row:last-child {
  border-bottom: 0;
}

.account-list-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.account-list-main strong,
.account-list-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-list-main span {
  color: var(--muted);
  font-size: 12px;
}

.account-list-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.account-role-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border-radius: 4px;
  background: #f3f4f6;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 600;
}

.account-role-badge.is-inactive {
  color: var(--danger);
  background: var(--danger-soft);
}

.account-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 13px;
}

.account-toggle input {
  width: 16px;
  height: 16px;
}

@media (max-width: 640px) {
  .auth-form-grid,
  .account-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-chip.account-menu-button {
    width: 100%;
  }

  .account-drawer {
    width: 100vw;
    padding: 16px;
  }

  .account-list-row,
  .account-section-heading,
  .account-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-list-actions,
  .account-list-actions .button,
  .account-form-actions .button {
    width: 100%;
  }
}

/* Enterprise admin reset: keep the workflow, remove the decorative dashboard feel. */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-muted: #f8fafc;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --muted-strong: #374151;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --shadow-lg: none;
  --shadow-md: none;
  --shadow-sm: none;
  --font-display: 22px;
  --font-title-lg: 18px;
  --font-title-md: 16px;
  --font-title-sm: 14px;
}

body {
  background: var(--bg);
}

.dashboard-shell {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.sidebar,
.library-pane,
.inspector-pane,
.overview-stats,
.section-block,
.review-shell,
.review-table-pane,
.review-editor-pane,
.book-hero,
.system-view-head,
.system-head-stat,
.system-list-item,
.task-item,
.module-panel,
.download-card,
.timeline-item,
.flow-step,
.next-step-callout,
.log-panel {
  background: #fff;
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar {
  border-radius: 0;
  border-width: 0 1px 0 0;
  padding: 16px 12px;
  gap: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary);
  font-size: 14px;
}

.brand-copy h1 {
  font-size: 15px;
}

.icon-button,
.system-nav-icon {
  border-radius: 6px;
  box-shadow: none;
}

.system-nav {
  gap: 2px;
}

.system-nav-item {
  min-height: 40px;
  border-radius: 6px;
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 0 8px;
}

.system-nav-item:hover,
.system-nav-item.is-active {
  transform: none;
  background: var(--primary-soft);
  box-shadow: none;
}

.system-nav-icon {
  width: 28px;
  height: 28px;
  background: transparent;
}

.sidebar-status-card {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff;
}

.main-shell {
  height: 100vh;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 0 20px 20px;
}

.page-header {
  min-height: 72px;
  align-items: center;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--line);
}

.page-header h2 {
  margin-top: 0;
  font-size: 22px;
  line-height: 1.25;
}

.header-tools {
  grid-template-columns: minmax(220px, 320px) auto;
}

.search-box input,
.field input,
.field textarea,
.field select {
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}

.search-box input {
  height: 36px;
}

.profile-chip {
  min-height: 36px;
  border-radius: 6px;
  box-shadow: none;
}

.profile-avatar {
  width: 26px;
  height: 26px;
}

.overview-strip {
  display: none;
}

.workspace-grid {
  gap: 12px;
}

.library-pane,
.inspector-pane {
  border-radius: 8px;
}

.inspector-pane {
  padding: 0;
}

body[data-section="review"] .main-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section="review"] .workspace-grid {
  height: 100%;
}

body[data-section="review"] .review-shell {
  border-radius: 8px;
  padding: 12px;
}

.review-shell {
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
}

.review-context-bar {
  min-height: 42px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.review-context-main {
  display: none;
}

.review-context-actions {
  width: 100%;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.review-book-switcher {
  width: min(560px, calc(100% - 150px));
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.review-book-switcher span {
  font-size: 12px;
  color: var(--muted-strong);
}

.review-book-switcher select {
  height: 34px;
}

.button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  transform: none !important;
}

.button.primary {
  background: var(--primary);
  box-shadow: none;
}

.button.ghost {
  background: #fff;
  border-color: var(--line-strong);
}

.segmented {
  border-radius: 6px;
  background: #f3f4f6;
  padding: 2px;
}

.segment {
  min-height: 30px;
  border-radius: 4px;
  padding: 0 12px;
}

.segment:hover {
  transform: none;
}

.segment.is-active {
  box-shadow: none;
  background: #fff;
}

.review-filter-grid {
  grid-template-columns: 1.25fr 0.8fr 0.9fr 1.1fr;
  gap: 10px;
}

.compact-field {
  gap: 4px;
}

.review-workbench {
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
}

.review-table-pane,
.review-editor-pane {
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
}

.review-table-scroll {
  border: 0;
  border-radius: 0;
  background: #fff;
}

.review-table th,
.review-table td {
  padding: 10px 12px;
  border-color: var(--line);
}

.review-table thead th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
}

.review-table tbody tr:hover {
  background: #f9fafb;
}

.review-table tbody tr.is-selected {
  background: #eff6ff;
}

.review-table tbody tr.is-approved {
  background: #f7fdf9;
}

.review-table tbody tr.is-saving {
  opacity: 0.72;
}

.review-preview-text {
  -webkit-line-clamp: 4;
  color: var(--text);
}

.review-pagination {
  min-height: 42px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.review-editor-pane {
  padding: 12px;
}

.review-editor-head {
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.review-editor-head h4 {
  margin-top: 4px;
  font-size: 14px;
}

.review-editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.review-editor-copy-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.review-editor-pane textarea {
  line-height: 1.65;
}

#review-editor-original-text,
#review-editor-revised-text {
  min-height: 128px;
}

#review-editor-comment {
  min-height: 74px;
}

.status-badge,
.metric-pill {
  min-height: 24px;
  border-radius: 4px;
  padding: 0 8px;
}

@media (max-width: 980px) {
  .dashboard-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .main-shell {
    padding: 0 14px 14px;
  }

  .review-editor-grid,
  .review-editor-copy-grid {
    grid-template-columns: 1fr;
  }

  .review-workbench {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 0.9fr) minmax(320px, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-shell {
    padding: 0;
  }

  .main-shell {
    padding: 0 10px 10px;
  }

  .review-context-actions,
  .review-book-switcher {
    width: 100%;
  }

  .review-book-switcher {
    grid-template-columns: 1fr;
  }
}

/* Review production mode: compact toolbar, row actions, modal editing. */
.sidebar-top {
  min-height: 100%;
  grid-template-rows: auto auto 1fr auto;
}

.sidebar-status {
  display: none;
}

.sidebar-import {
  display: grid;
  gap: 8px;
  align-self: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-upload-form {
  display: grid;
  gap: 8px;
}

.sidebar-dropzone {
  min-height: 58px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #f9fafb;
  padding: 8px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.sidebar-dropzone:hover,
.sidebar-dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

body[data-section="review"] .page-header {
  min-height: 48px;
  padding: 8px 0;
}

body[data-section="review"] .page-header h2 {
  font-size: 20px;
}

body[data-section="review"] .header-tools {
  display: none;
}

body[data-section="review"] .review-shell {
  padding: 8px 10px 10px;
  gap: 6px;
}

body[data-section="review"] .field {
  gap: 4px;
}

body[data-section="review"] .field input,
body[data-section="review"] .field select {
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}

.review-workbench {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
}

.table-pass-button {
  background: var(--success-soft);
  border: 1px solid rgba(21, 128, 61, 0.22);
  color: var(--success);
}

.review-table th,
.review-table td {
  padding: 9px 10px;
}

.review-table tbody td {
  line-height: 1.48;
}

.review-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.32);
}

.review-editor-pane {
  position: fixed;
  z-index: 41;
  top: 56px;
  right: 24px;
  bottom: 24px;
  width: min(760px, calc(100vw - 48px));
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  overflow: auto;
}

.review-editor-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-editor-head-actions .icon-button {
  width: 30px;
  height: 30px;
  font-size: 18px;
}

.review-editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.review-editor-copy-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#review-editor-original-text,
#review-editor-revised-text {
  min-height: 260px;
}

@media (max-width: 980px) {
  .review-editor-pane {
    inset: 48px 12px 12px;
    width: auto;
  }

  .review-editor-copy-grid {
    grid-template-columns: 1fr;
  }
}

/* Compact review controls and content-first table widths. */
.review-control-panel {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding-bottom: 6px;
}

.review-shell {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.review-control-row {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-items: end;
}

.review-control-main {
  grid-template-columns: minmax(280px, 520px) auto minmax(124px, max-content);
}

.review-action-stack {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 0;
}

.review-action-group,
.read-aloud-workbook-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.read-aloud-workbook-actions[hidden],
.read-aloud-workbook-feedback[hidden] {
  display: none;
}

.read-aloud-workbook-actions select {
  width: 96px;
  min-height: 34px;
  padding: 0 28px 0 10px;
}

.read-aloud-import-button {
  cursor: pointer;
  margin: 0;
}

.review-action-stack .save-feedback {
  min-height: 16px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-book-switcher {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.review-book-switcher select {
  min-width: 0;
}

.review-filter-grid {
  grid-template-columns: minmax(180px, 0.95fr) 120px 150px minmax(220px, 0.9fr);
  gap: 8px;
}

.review-toolbar-meta {
  min-height: 0;
  padding: 0 0 2px;
  line-height: 1.35;
}

.review-table {
  table-layout: fixed;
}

.review-col-object-col {
  width: 112px;
}

.review-col-page-col {
  width: 72px;
}

.review-col-risk-col {
  width: 72px;
}

.review-col-status-col {
  width: 82px;
}

.review-col-actions-col {
  width: 112px;
}

.review-col-preview-col {
  width: auto;
}

.review-col-actions {
  white-space: nowrap;
}

.review-col-actions .button {
  min-height: 28px;
  padding: 0 8px;
}

body[data-section="annotation"] .review-filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

body[data-section="annotation"] .review-col-risk-col {
  width: 120px;
}

body[data-section="annotation"] .review-col-preview-col {
  width: 120px;
}

body[data-section="annotation"] .review-col-status-col {
  width: 96px;
}

body[data-section="annotation"] .review-col-actions-col {
  width: auto;
}

body[data-section="annotation"] .review-col-actions {
  white-space: normal;
}

.review-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  padding: 0 7px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.is-approved .review-status-pill {
  background: var(--success-soft);
  color: var(--success);
}

.row-save-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 12px;
  white-space: normal;
}

.review-preview-text {
  display: block;
  color: var(--text);
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}

.review-table th,
.review-table td {
  padding: 8px 10px;
}

.review-table tbody td {
  vertical-align: top;
}

@media (max-width: 1200px) {
  .review-control-main {
    grid-template-columns: minmax(280px, 1fr) auto max-content;
  }

  .review-filter-grid {
    grid-template-columns: minmax(180px, 1fr) 120px 150px minmax(200px, 0.9fr);
  }
}

@media (max-width: 900px) {
  .review-control-main,
  .review-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .review-action-stack {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .review-action-group {
    flex-wrap: wrap;
    white-space: normal;
  }
}

/* Temporary isolated UI: multi-book read-aloud final workbook export. */
.read-aloud-batch-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
}

.read-aloud-batch-dialog {
  position: relative;
  width: min(760px, 100%);
  height: min(720px, calc(100vh - 40px));
  min-height: 480px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.18);
}

.read-aloud-batch-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.read-aloud-batch-search {
  min-width: 0;
}

.read-aloud-batch-select-actions,
.read-aloud-batch-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.read-aloud-batch-summary,
.read-aloud-batch-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.read-aloud-batch-summary {
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
}

.read-aloud-batch-summary strong {
  color: var(--text);
  font-size: 13px;
}

.read-aloud-batch-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.read-aloud-batch-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.read-aloud-batch-row:last-child {
  border-bottom: 0;
}

.read-aloud-batch-row:hover,
.read-aloud-batch-row.is-selected {
  background: #f5f8ff;
}

.read-aloud-batch-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.read-aloud-batch-row-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.read-aloud-batch-row-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.read-aloud-batch-row-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.read-aloud-batch-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.read-aloud-batch-footer {
  min-height: 38px;
  padding-top: 2px;
}

.read-aloud-batch-footer .save-feedback {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .read-aloud-batch-layer {
    padding: 10px;
  }

  .read-aloud-batch-dialog {
    height: calc(100vh - 20px);
    min-height: 0;
    padding: 16px;
  }

  .read-aloud-batch-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .read-aloud-batch-select-actions .button,
  .read-aloud-batch-footer-actions .button {
    flex: 1 1 auto;
  }

  .read-aloud-batch-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .read-aloud-batch-footer .save-feedback {
    white-space: normal;
  }
}

/* Unified responsive actions for review exports and imports. */
.button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.button.secondary:hover {
  background: #f8fafc;
  border-color: #98a2b3;
}

.review-action-group {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.review-action-group > .button,
.read-aloud-workbook-actions .button,
.read-aloud-workbook-actions select {
  box-sizing: border-box;
  height: 34px;
  min-height: 34px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.read-aloud-workbook-actions select {
  border: 1px solid var(--line-strong);
  background-color: #fff;
  color: var(--text);
}

@media (max-width: 1450px) {
  .review-control-main {
    grid-template-columns: minmax(280px, 1fr) auto;
  }

  .review-action-stack {
    grid-column: 1 / -1;
    width: 100%;
    justify-items: start;
  }

  .review-action-group {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .review-control-main,
  .review-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-entity-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .review-action-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .read-aloud-workbook-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .read-aloud-workbook-actions select {
    grid-column: 1 / -1;
    width: 100%;
  }

  .review-action-group > .button,
  .read-aloud-workbook-actions .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .review-action-group,
  .read-aloud-workbook-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .read-aloud-workbook-actions,
  .read-aloud-workbook-actions select {
    grid-column: 1;
  }
}

@media (max-width: 1100px) {
  .dashboard-shell,
  body.sidebar-collapsed .dashboard-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  body.sidebar-collapsed .sidebar {
    min-height: 0;
    height: auto;
    opacity: 1;
    pointer-events: auto;
    padding: 8px 12px;
    border-width: 0 0 1px;
  }

  .sidebar-top {
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(300px, 1fr) auto;
    grid-template-rows: auto;
    gap: 10px;
    align-items: center;
  }

  .brand-block {
    grid-column: auto;
  }

  .brand-copy p,
  .sidebar-section-label,
  .sidebar-dropzone .selected-file,
  #sidebar-toggle {
    display: none;
  }

  .brand-identity {
    gap: 8px;
  }

  .system-nav {
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 4px;
  }

  .system-nav-item {
    min-height: 40px;
    grid-template-columns: 28px auto;
    justify-content: center;
    justify-items: start;
    gap: 6px;
    padding: 0 8px;
  }

  .system-nav-icon {
    width: 28px;
    height: 28px;
  }

  .sidebar-import {
    align-self: center;
    padding: 0;
    border: 0;
  }

  .sidebar-upload-form {
    grid-template-columns: 104px 104px;
    gap: 6px;
  }

  .sidebar-dropzone,
  .sidebar-upload-form .button {
    width: 104px;
    min-height: 36px;
    height: 36px;
  }

  .sidebar-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
  }

  .sidebar-dropzone .dropzone-title {
    font-size: 12px;
    white-space: nowrap;
  }

  .sidebar-upload-form .button {
    padding: 0 8px;
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  .sidebar-top {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand-block {
    grid-column: 1;
  }

  .sidebar-import {
    grid-column: 2;
  }

  .sidebar-upload-form {
    grid-template-columns: repeat(2, 96px);
  }

  .sidebar-dropzone {
    width: 96px;
  }

  .system-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 480px) {
  .brand-copy {
    display: none;
  }

  .brand-copy h1 {
    font-size: 13px;
  }

  .system-nav-label {
    font-size: 11px;
  }

  .system-nav-item {
    grid-template-columns: 24px minmax(0, auto);
    padding: 0 4px;
  }

  .system-nav-icon {
    width: 24px;
    height: 24px;
  }
}

/* Library workbench: compact book list on the left, structure table on the right. */
body[data-section="library"] .main-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section="library"] .overview-strip,
body[data-section="library"] #page-breadcrumbs,
body[data-section="library"] #page-copy,
body[data-section="library"] #module-panel {
  display: none !important;
}

body[data-section="library"] .workspace-grid {
  height: 100%;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
}

body[data-section="library"] .library-pane {
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section="library"] .pane-header {
  gap: 10px;
  padding: 14px 12px 12px;
}

body[data-section="library"] .pane-header h3 {
  font-size: 15px;
}

body[data-section="library"] #quick-filters {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 6px;
}

body[data-section="library"] #quick-filters .segment {
  min-width: 0;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
}

.task-list.is-library-list {
  padding: 0;
  display: block;
  overflow: auto;
}

.library-book-list {
  display: grid;
  align-content: start;
}

.library-book-row {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.library-book-row:hover {
  background: #f8fafc;
}

.library-book-row.is-selected {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.library-book-row-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.library-book-row-main strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  line-height: 1.45;
}

.library-book-row-main small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.library-book-row .status-badge {
  margin-top: 1px;
  padding: 3px 6px;
  font-size: 10px;
}

body[data-section="library"] .inspector-pane {
  min-width: 0;
  padding: 0;
}

body[data-section="library"][data-detail-mode="review"] .book-hero {
  display: none;
}

body[data-section="library"][data-detail-mode="review"] .detail-view {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

body[data-section="library"][data-detail-mode="review"] .detail-pane-view {
  overflow: hidden;
}

body[data-section="library"] .review-shell {
  height: 100%;
  padding: 12px;
  border-radius: 8px;
}

body[data-section="library"] .review-book-switcher {
  display: none;
}

body[data-section="library"] .review-control-main {
  grid-template-columns: minmax(180px, 1fr) auto minmax(124px, max-content);
}

.library-current-book {
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.library-current-book[hidden] {
  display: none;
}

.library-current-book span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.library-current-book strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.button.secondary.danger {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff;
}

.button.secondary.danger:hover {
  background: var(--danger-soft);
}

@media (max-width: 1450px) and (min-width: 901px) {
  body[data-section="library"] .workspace-grid {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  body[data-section="library"] .review-control-main {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  body[data-section="library"] .review-action-stack {
    grid-column: 1 / -1;
    justify-items: start;
  }
}

@media (max-width: 900px) {
  body[data-section="library"] .main-shell {
    height: auto;
    min-height: 100vh;
  }

  body[data-section="library"] .workspace-grid {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  body[data-section="library"] .library-pane {
    max-height: 300px;
  }

  body[data-section="library"] .inspector-pane,
  body[data-section="library"] .detail-view,
  body[data-section="library"] .detail-pane-view,
  body[data-section="library"] .review-shell {
    min-height: 680px;
  }
}

@media (max-width: 640px) {
  body[data-section="library"] .header-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-section="library"] .profile-chip {
    display: none;
  }

  body[data-section="library"] .review-control-main {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-section="library"] .library-current-book,
  body[data-section="library"] .review-entity-tabs,
  body[data-section="library"] .review-action-stack {
    grid-column: 1;
    width: 100%;
  }
}

/* Final control-layout precedence after all legacy responsive rules. */
.review-control-main {
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
}

.review-control-bottom {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.review-filter-grid,
body[data-section="annotation"] .review-filter-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  align-items: end;
}

body[data-section="library"] .review-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
}

.review-control-panel .field input,
.review-control-panel .field select,
.review-control-panel .button,
.review-control-panel .read-aloud-workbook-actions select,
.library-current-book {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
}

.review-control-panel .review-entity-tabs {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
  align-self: center;
}

.review-control-bottom .review-action-stack,
body[data-section="library"] .review-control-bottom .review-action-stack {
  grid-column: auto;
  align-self: end;
  justify-items: end;
}

@media (max-width: 1280px) {
  .review-control-bottom {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-control-bottom .review-action-stack,
  body[data-section="library"] .review-control-bottom .review-action-stack {
    grid-column: 1;
    justify-items: start;
  }
}

@media (max-width: 760px) {
  .review-control-main,
  body[data-section="library"] .review-control-main,
  .review-filter-grid,
  body[data-section="annotation"] .review-filter-grid,
  body[data-section="library"] .review-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-control-panel .review-entity-tabs {
    height: auto;
  }
}

/* Final account-control precedence. */
body[data-section="review"] .header-tools {
  display: grid;
}

.header-tools .search-box input,
.header-tools .profile-chip.account-menu-button {
  box-sizing: border-box;
  min-height: 36px;
  height: 36px;
}

body[data-auth-role="viewer"] .sidebar-import,
body[data-auth-role="reviewer"] .sidebar-import {
  display: none;
}

@media (max-width: 640px) {
  body[data-section] .header-tools {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 168px;
  }

  body[data-section] .profile-chip.account-menu-button {
    display: flex !important;
    width: 168px;
  }
}

@media (max-width: 460px) {
  body[data-section] .header-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-section] .profile-chip.account-menu-button {
    width: 100%;
  }
}

/* Final account drawer layout. */
.account-drawer {
  width: min(620px, 100vw);
  grid-template-rows: auto auto auto auto;
  align-content: start;
}

.account-list {
  max-height: 240px;
  overflow-y: auto;
}

.audit-log-list {
  max-height: 360px;
  overflow-y: auto;
}

/* Surname avatar: one character, optically centered. */
.account-menu-button .profile-avatar,
.account-current-user .profile-avatar {
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  line-height: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

/* Split knowledge-base navigation and final enterprise layout. */
body {
  background: #f4f6f8;
}

.system-nav {
  gap: 8px;
}

.system-nav-group {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.system-nav-group-toggle {
  width: 100%;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: center;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.system-nav-group-toggle:hover {
  background: #f5f7fa;
}

.system-nav-group-toggle .system-nav-icon {
  width: 28px;
  height: 28px;
}

.system-nav-chevron {
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  text-align: center;
  transition: transform 160ms ease;
}

.system-nav-group.is-open .system-nav-chevron {
  transform: rotate(180deg);
}

.system-nav-submenu {
  display: none;
  gap: 2px;
}

.system-nav-group.is-open .system-nav-submenu {
  display: grid;
}

.system-nav-submenu .system-nav-item {
  min-height: 36px;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  padding: 0 8px 0 38px;
  color: #475467;
}

.system-nav-submenu .system-nav-item:hover {
  background: #f5f7fa;
}

.system-nav-submenu .system-nav-item.is-active {
  color: #175cd3;
  background: #eff4ff;
  font-weight: 600;
}

.system-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c5ccd6;
  justify-self: center;
}

.system-nav-item.is-active .system-nav-dot {
  background: #2e6fe8;
}

.review-col-actions-col {
  width: 150px;
}

.review-col-actions {
  white-space: normal;
  vertical-align: middle !important;
}

.review-col-status {
  vertical-align: middle !important;
}

.review-row-actions {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.review-row-actions .button {
  flex: 0 0 auto;
}

.review-row-actions .row-save-error {
  flex-basis: 100%;
}

.review-table tbody tr > td {
  transition: background-color 160ms ease, opacity 160ms ease;
}

.review-table tbody tr {
  transition: background-color 160ms ease, opacity 160ms ease;
}

.review-table tbody tr.is-saved > td {
  background: #ecfdf3;
}

.review-table tbody tr.is-leaving {
  opacity: 0;
}

.review-quiet-toast {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #abefc6;
  border-radius: 6px;
  background: #ecfdf3;
  color: #067647;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.1);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.review-quiet-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.review-col-actions .table-return-button {
  color: #b54708;
  border-color: #f2c94c;
  background: #fffaeb;
}

.review-col-actions .table-return-button:hover {
  background: #fef0c7;
}

body[data-section="book_review"] .review-shell,
body[data-section="book_final"] .review-shell,
body[data-section="read_aloud_review"] .review-shell,
body[data-section="read_aloud_final"] .review-shell {
  min-height: 0;
}

body[data-section="book_final"] .review-filter-grid,
body[data-section="read_aloud_final"] .review-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 1100px) {
  .system-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .system-nav-group {
    grid-template-columns: 86px minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px;
  }

  .system-nav-group-toggle {
    min-height: 34px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 4px;
    padding: 0 4px;
  }

  .system-nav-group-toggle .system-nav-icon {
    width: 24px;
    height: 24px;
  }

  .system-nav-chevron {
    display: none;
  }

  .system-nav-submenu,
  .system-nav-group.is-open .system-nav-submenu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
  }

  .system-nav-submenu .system-nav-item {
    min-height: 34px;
    grid-template-columns: 6px minmax(0, 1fr);
    padding: 0 6px;
  }
}

@media (max-width: 760px) {
  .system-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .system-nav-group {
    grid-template-columns: 80px minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .system-nav-group {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .system-nav-group-toggle .system-nav-label,
  .system-nav-submenu .system-nav-label {
    font-size: 11px;
  }

  .system-nav-submenu .system-nav-item {
    min-width: 0;
  }
}

/* All four modules use the same book-list + data-table workbench. */
body[data-section] .main-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section] .overview-strip,
body[data-section] #page-breadcrumbs,
body[data-section] #page-copy,
body[data-section] #module-panel,
body[data-section] .detail-mode-tabs,
body[data-section][data-detail-mode="review"] .book-hero {
  display: none !important;
}

body[data-section] .page-header {
  min-height: 52px;
  padding: 8px 0;
}

body[data-section] .page-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

body[data-section] .workspace-grid {
  height: 100%;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
}

body[data-section] .library-pane {
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-section] .pane-header {
  padding: 12px;
  gap: 4px;
}

body[data-section] .pane-header h3 {
  margin: 0;
  font-size: 15px;
}

body[data-section] #quick-filters,
body[data-section] #list-kicker,
body[data-section] #list-caption {
  display: none !important;
}

body[data-section] .inspector-pane {
  min-width: 0;
  padding: 0;
}

body[data-section][data-detail-mode="review"] .detail-view {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

body[data-section][data-detail-mode="review"] .detail-pane-view {
  overflow: hidden;
}

body[data-section] .review-shell {
  height: 100%;
  min-height: 0;
  padding: 10px;
  border-radius: 8px;
  gap: 6px;
}

body[data-section] .review-book-switcher,
body[data-section] .library-current-book {
  display: none !important;
}

body[data-section] .review-control-main {
  grid-template-columns: minmax(0, 1fr);
}

body[data-section] .review-entity-tabs {
  justify-self: start;
  max-width: 100%;
  overflow-x: auto;
}

body[data-section] .review-toolbar-meta {
  color: #667085;
  font-size: 12px;
}

@media (max-width: 1450px) and (min-width: 901px) {
  body[data-section] .workspace-grid {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  body,
  html {
    height: auto;
    min-height: 100%;
  }

  body {
    overflow: auto;
  }

  body[data-section] .main-shell {
    height: auto;
    min-height: 100vh;
  }

  body[data-section] .workspace-grid {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  body[data-section] .library-pane {
    max-height: 240px;
  }

  body[data-section] .inspector-pane,
  body[data-section] .detail-view,
  body[data-section] .detail-pane-view,
  body[data-section] .review-shell {
    min-height: 680px;
  }
}

/* Review editor readability pass: larger proofreading canvas and visible diff highlights. */
.review-editor-pane {
  top: 48px;
  right: 18px;
  bottom: 18px;
  width: min(1280px, calc(100vw - 32px));
  border-radius: 16px;
}

.review-editor-form {
  gap: 18px;
  padding: 4px;
}

.review-editor-head h4 {
  font-size: 20px;
  line-height: 1.3;
  margin-top: 6px;
}

.review-editor-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 16px;
}

.review-editor-pane .field > span,
.review-editor-write-field > span,
.review-copy-panel-head span {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
  letter-spacing: 0;
}

.review-editor-pane .field input,
.review-editor-pane .field select,
.review-editor-pane .field textarea {
  font-size: 14px;
}

.review-editor-pane .field input,
.review-editor-pane .field select,
.review-text-editor,
#review-editor-comment {
  min-height: 44px;
  border-radius: 8px;
  padding: 11px 13px;
}

.review-editor-pane .field input,
.review-editor-pane .field select {
  height: 44px;
}

.review-editor-pane .field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.review-editor-pane .field input[type="number"]::-webkit-outer-spin-button,
.review-editor-pane .field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.review-editor-copy-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.review-copy-panel {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.review-copy-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 32px;
}

.review-copy-panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-copy-panel-head small {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.review-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.review-zoom-button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.review-text-preview {
  height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdfd;
  padding: 16px;
  font-size: 17px;
  line-height: 1.78;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.review-text-preview-revised {
  background: #fbfef9;
}

.review-text-editor {
  height: 420px;
  resize: vertical;
  font-size: 17px;
  line-height: 1.78;
  border: 1px solid var(--line);
  background: #ffffff;
}

.review-diff-panel {
  display: grid;
  gap: 8px;
}

#review-editor-comment {
  min-height: 140px;
  font-size: 14px;
  line-height: 1.7;
}

.review-editor-grid > .field:nth-child(1),
.review-editor-grid > .field:nth-child(2),
.review-editor-grid > .field:nth-child(3),
.review-editor-grid > .field:nth-child(4) {
  grid-column: span 1;
}

.review-editor-grid > .field:nth-child(5),
.review-editor-grid > .field:nth-child(6) {
  grid-column: span 2;
}

.review-editor-form > .field,
.review-diff-panel,
.detail-actions {
  margin-top: 0;
}

.review-diff-mark {
  border-radius: 6px;
  padding: 0.02em 0.08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.review-diff-mark-left {
  background: rgba(245, 158, 11, 0.2);
  color: #8a4b00;
}

.review-diff-mark-right {
  background: rgba(34, 197, 94, 0.22);
  color: #166534;
}

.review-text-placeholder {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .review-editor-pane {
    width: calc(100vw - 24px);
    right: 12px;
    left: 12px;
    top: 20px;
    bottom: 12px;
  }

  .review-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-editor-grid > .field:nth-child(5),
  .review-editor-grid > .field:nth-child(6) {
    grid-column: span 1;
  }

  .review-text-preview {
    font-size: 17px;
    height: 360px;
  }

  .review-text-editor {
    font-size: 17px;
    height: 360px;
  }
}

@media (max-width: 900px) {
  .review-editor-copy-grid,
  .review-editor-grid {
    grid-template-columns: 1fr;
  }

  .review-editor-grid > .field:nth-child(5),
  .review-editor-grid > .field:nth-child(6) {
    grid-column: span 1;
  }

  .review-text-preview {
    height: 300px;
    font-size: 16px;
    line-height: 1.72;
    padding: 16px;
  }

  .review-text-editor {
    height: 300px;
    font-size: 16px;
    padding: 16px;
  }
}
