* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-medium);
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--text-h1); font-weight: var(--weight-semibold); }
h2 { font-size: var(--text-h2); font-weight: var(--weight-semibold); }
h3 { font-size: var(--text-h3); font-weight: var(--weight-semibold); }
h4 { font-size: var(--text-h4); }
h5 { font-size: var(--text-h5); }
h6 { font-size: var(--text-h6); }

p { margin: 0; }

a { color: inherit; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: #f5f6f8;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: transparent;
  border-right: none;
  display: flex;
  flex-direction: column;
  padding: var(--space-8);
  gap: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6);
  border-radius: var(--radius-md);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--btn-primary-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-h6);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.brand-name {
  font-size: var(--text-h6);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}
.brand-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.2;
}

.nav-group { display: flex; flex-direction: column; gap: var(--space-2); }

.nav-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
  padding: var(--space-8) var(--space-6) var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  text-decoration: none;
  font-size: var(--text-base);
  position: relative;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-item:hover { background: var(--nav-active-bg); }

.nav-item[aria-current="page"] {
  background: #ffffff;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
}

.nav-badge {
  margin-left: auto;
  background: var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-medium);
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.nav-item[aria-current="page"] .nav-badge { background: rgba(0,0,0,0.06); }

.sidebar-footer { margin-top: auto; }

.role-switcher {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.role-switcher label { font-size: var(--text-sm); color: var(--text-muted); padding: 0 var(--space-2); }

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: var(--space-12);
  margin: 8px 8px 8px 0;
  border-radius: 20px;
  border: 0.8px solid rgba(232, 234, 237, 0.20);
  background: var(--Colors-Neutral-colorBgBase, #FFF);
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 4px 8px 0 rgba(15, 23, 42, 0.02);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.breadcrumbs {
  list-style: none;
  display: flex;
  gap: var(--space-2);
  padding: 0;
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.breadcrumbs li::before {
  content: "/";
  margin-right: var(--space-2);
  color: var(--text-muted);
}

.breadcrumbs li:first-child::before { content: none; }

.header-actions { display: flex; gap: var(--space-4); align-items: center; }
.header-actions .btn { height: var(--control-height-md); padding: 0 var(--space-10); font-size: var(--text-base); }

.divider-full {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-8) calc(-1 * var(--space-12)) var(--space-6);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  height: var(--control-height-md);
  padding: 0 var(--space-10);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  cursor: pointer;
  line-height: 1.2;
  transition: box-shadow .15s ease, background .15s ease, transform .05s ease;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--btn-primary-gradient);
  color: var(--btn-primary-fg);
  border-radius: 12px;
  box-shadow: var(--btn-primary-shadow);
}
.btn-primary:hover { filter: brightness(1.15); }
.btn-primary:active { transform: translateY(1px); filter: brightness(0.95); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-interactive);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover { background: var(--bg-sidebar); }

.btn-pill { border-radius: var(--radius-pill); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--border-subtle); }

.btn-danger {
  border-radius: 10px;
  border: 0.8px solid rgba(0, 0, 0, 0.00);
  background: linear-gradient(180deg, #E56363 0%, #C81D1D 100%);
  box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.20) inset;
  color: #fff;
}
.btn-danger:hover { background: linear-gradient(180deg, #D85050 0%, #B01010 100%); }

.btn-sm { height: var(--control-height-sm); padding: 0 var(--space-6); font-size: var(--text-sm); }
.btn-lg { height: var(--control-height-lg); padding: 0 var(--space-12); font-size: var(--text-md); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-interactive);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-btn:hover { background: var(--border-subtle); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  height: var(--control-height-md);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-control);
  padding: 0 var(--space-8);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: inset 0 1px 2px rgba(15,23,42,0.05);
}

/* Select styled as secondary button */
.select {
  width: 100%;
  height: var(--control-height-md);
  border: 1px solid var(--border-interactive);
  border-radius: 12px;
  padding: 0 var(--space-8) 0 var(--space-8);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: var(--space-16);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-6) center;
  cursor: pointer;
  font-weight: var(--weight-medium);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.select:hover {
  background-color: var(--bg-sidebar);
}
.select:focus-visible {
  outline: none;
  border-color: #334155;
  box-shadow: 0 0 0 3px #f1f5f9;
}

textarea.input {
  height: auto;
  min-height: var(--control-height-lg);
  padding: var(--space-6) var(--space-8);
  resize: vertical;
}

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field label { font-size: var(--text-sm); color: var(--text-secondary); font-weight: var(--weight-medium); }

.search-box {
  position: relative;
  max-width: 320px;
}
.search-box input {
  width: 100%;
  height: var(--control-height-md);
  padding: 0 var(--space-8) 0 var(--space-24);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-sidebar);
  box-shadow: none;
}
.search-box svg {
  position: absolute;
  left: var(--space-8);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-12);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-12);
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-12);
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-icon svg { width: 20px; height: 20px; }

.doc-title { font-size: var(--text-h6); font-weight: var(--weight-medium); }
.doc-meta { font-size: var(--text-sm); color: var(--text-muted); }

.doc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
}
.badge-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.badge-approved { background: var(--color-success-bg); color: var(--color-success); border: 0.8px solid rgba(21, 128, 61, 0.12); }
.badge-pending { background: var(--color-warning-bg); color: var(--color-warning); border: 0.8px solid rgba(180, 83, 9, 0.12); }
.badge-declined { background: var(--color-danger-bg); color: var(--color-danger); border: 0.8px solid rgba(201, 42, 42, 0.12); }
.badge-archived { background: var(--neutral-20); color: var(--neutral-70); border: 0.8px solid rgba(203, 213, 225, 0.20); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.tag-violet { background: var(--tag-violet-bg); color: var(--tag-violet-text); }
.tag-orange { background: var(--tag-orange-bg); color: var(--tag-orange-text); }
.tag-blue { background: var(--tag-blue-bg); color: var(--tag-blue-text); }
.tag-green { background: var(--tag-green-bg); color: var(--tag-green-text); }
.tag-teal { background: var(--tag-teal-bg); color: var(--tag-teal-text); }
.tag-pink { background: var(--tag-pink-bg); color: var(--tag-pink-text); }
.tag-neutral {
  background: var(--tag-neutral-bg);
  color: var(--tag-neutral-text);
  font-size: 11px;
  letter-spacing: 0.03em;
}

/* Team chip — white bill, soft grey shadow, tighter radius, people icon */
.team-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-6);
  border-radius: 100px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border: 0.8px solid #EEF2F6;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, rgba(238, 242, 246, 0.30) 100%);
  white-space: nowrap;
}
.team-chip svg { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }

.role-tag {
  display: inline-flex;
  padding: var(--space-2) var(--space-8);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  background: var(--tag-blue-bg);
  color: var(--tag-blue-text);
}

/* ---------- Avatars ---------- */
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--neutral-30);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: var(--weight-semibold);
  border: 2px solid var(--avatar-ring);
  flex-shrink: 0;
}
/* Hard solid profile colors — deterministic per person (see avatarColor in script.js) */
.avatar--violet { background: #6d28d9; color: #fff; }
.avatar--blue   { background: #2563eb; color: #fff; }
.avatar--orange { background: #c2410c; color: #fff; }
.avatar--green  { background: #15803d; color: #fff; }
.avatar--teal   { background: #334155; color: #fff; }
.avatar--pink   { background: #be185d; color: #fff; }

.avatar-name { display: inline-flex; align-items: center; gap: var(--space-6); white-space: nowrap; }

/* Person cell — avatar left, name over date */
.person { display: flex; align-items: center; gap: var(--space-6); }
.person-text { min-width: 0; }
.person-name { font-weight: var(--weight-medium); line-height: 1.3; }
.person .cell-sub { margin-top: 0; }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Table (sheet) ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }

thead th {
  text-align: left;
  padding: var(--space-6) var(--space-8);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-4) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

td[contenteditable="true"], .cell-input {
  outline: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-width: 120px;
}
td[contenteditable="true"]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -1px;
  background: #f1f5f9;
}

.cell-dirty { background: var(--color-warning-bg); border-radius: var(--radius-sm); }
.cell-added-col { background: var(--color-success-bg); }

.row-actions, .col-actions { display: flex; gap: var(--space-2); }

/* ---------- Users table ---------- */
.user-row-avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: #111827;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  box-shadow: var(--sheen);
}

/* ---------- Banner ---------- */
.banner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-10);
  border-radius: var(--radius-lg);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  margin-bottom: var(--space-12);
  font-size: var(--text-base);
}
.banner svg { width: 18px; height: 18px; flex-shrink: 0; }
.banner-actions { margin-left: auto; display: flex; gap: var(--space-4); }

.banner-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.banner-info { background: #f1f5f9; color: #334155; }

/* ---------- Review queue ---------- */
.review-list { display: flex; flex-direction: column; gap: var(--space-8); }

.review-item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-10);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.review-item:hover { border-color: var(--border-interactive); }
.review-item.active { border-color: #475569; box-shadow: 0 0 0 1px #475569; }

.review-item-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: #f1f5f9; color: #334155;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.review-item-icon svg { width: 18px; height: 18px; }

.review-item-body { min-width: 0; flex: 1; }
.review-item-title { font-weight: var(--weight-medium); font-size: var(--text-base); }
.review-item-meta { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-1); }

.split-panel {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-12);
  align-items: start;
}

.diff-table td, .diff-table th { font-size: var(--text-sm); }
.diff-old { background: var(--color-danger-bg); color: var(--color-danger); text-decoration: line-through; }
.diff-new { background: var(--color-success-bg); color: var(--color-success); }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
}
.compare-col-label { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-4); font-weight: var(--weight-medium); }

/* ---------- Version history ---------- */
.timeline { display: flex; flex-direction: column; }

.timeline-item {
  display: flex;
  gap: var(--space-8);
  padding-bottom: var(--space-16);
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}
.timeline-item:last-child::before { content: none; }

.timeline-dot {
  width: 11px; height: 11px; border-radius: 999px;
  background: #111827;
  margin-top: 5px;
  flex-shrink: 0;
  box-shadow: var(--sheen);
}
.timeline-item.current .timeline-dot { background: var(--color-success); box-shadow: none; }

.timeline-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-10);
  box-shadow: var(--shadow-sm);
}

.timeline-meta { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-1); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-12);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.modal.modal-wide { max-width: 760px; }

.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-4); margin-top: var(--space-4); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-12); }
.tab {
  padding: var(--space-6) var(--space-8);
  font-size: var(--text-base);
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab { display: inline-flex; align-items: center; gap: var(--space-2); }
.tab svg { width: 15px; height: 15px; }
.tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--text-primary); font-weight: var(--weight-medium); }

.tab-count {
  background: var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-medium);
  min-width: 18px; height: 18px;
  border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.tab[aria-selected="true"] .tab-count { background: var(--text-primary); color: var(--surface); }

/* Archived drill-down bar (replaces the status tabs in-place) */
.tabs.archived-bar { align-items: center; gap: var(--space-8); padding-bottom: var(--space-8); }
.arch-heading { display: inline-flex; align-items: center; gap: var(--space-4); font-weight: var(--weight-medium); }

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--text-sm); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.empty-state { text-align: center; padding: var(--space-32) var(--space-12); color: var(--text-muted); }

/* ---------- Page icon (colored square badge next to page title) ---------- */
.page-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--tag-violet-text);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-h4); font-weight: var(--weight-semibold);
  flex-shrink: 0;
}

.page-icon-img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.page-icon-colorful {
  filter: none;
}

.page-icon-gray {
}

.title-row { display: flex; align-items: flex-start; gap: var(--space-8); }
.title-row p { margin-top: 0; }

/* ---------- Grouped / collapsible sections ---------- */
.section-group { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); margin-bottom: var(--space-8); overflow: hidden; }
.section-header {
  display: flex; align-items: center; gap: var(--space-6);
  padding: var(--space-6) var(--space-8);
  background: var(--bg-sidebar);
  cursor: pointer;
  user-select: none;
}
.section-header .chevron { width: 14px; height: 14px; color: var(--text-muted); transition: transform .15s ease; flex-shrink: 0; }
.section-header.collapsed .chevron { transform: rotate(-90deg); }
.section-title { font-weight: var(--weight-medium); font-size: var(--text-base); }
.section-count {
  background: var(--border-subtle); color: var(--text-secondary);
  font-size: 11px; font-weight: var(--weight-medium);
  min-width: 18px; height: 18px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.section-add {
  margin-left: auto;
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; border: none; background: transparent;
}
.section-add:hover { background: var(--border-subtle); }
.section-add svg { width: 14px; height: 14px; }
.section-body.collapsed { display: none; }

.list-row {
  display: flex; align-items: center; gap: var(--space-8);
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--border-subtle);
}
.list-row:hover { background: var(--bg-sidebar); }
.list-row .row-check { width: 16px; height: 16px; accent-color: var(--btn-primary-bg); flex-shrink: 0; }
.list-row .row-title { font-weight: var(--weight-medium); min-width: 200px; }
.list-row .row-meta { color: var(--text-muted); font-size: var(--text-sm); flex: 1; }
.list-row .row-menu { margin-left: auto; opacity: 0; }
.list-row:hover .row-menu { opacity: 1; }

/* ---------- Documents / Archived table ---------- */
/* Horizontal scroll stays inside the table only (see .table-wrap overflow-x: auto).
   In-table tooltips use the native title attribute so they aren't clipped by that scroll. */
.doc-table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
.doc-table thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }

.doc-table td { vertical-align: middle; }
.doc-table .col-actions-cell { text-align: right; white-space: nowrap; }

.doc-name-cell { display: flex; align-items: center; gap: var(--space-8); }
.doc-name-cell > div { min-width: 0; }
.doc-icon-sm {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid #EEF2F6;
  background: #F8FAFC; color: #64748b;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  object-fit: cover;
}
.doc-icon-sm svg { width: 17px; height: 17px; }
.doc-icon-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.doc-name-main {
  font-weight: var(--weight-medium);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-sub { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-1); }

.row-actions-end { display: inline-flex; align-items: center; gap: var(--space-4); justify-content: flex-end; }
.await-text { font-size: var(--text-sm); color: var(--text-muted); }

/* Comment chip — reviewer's decline note, revealed on hover */
.comment-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-2);
  padding: 0; border: none; background: none; cursor: help;
  font-size: var(--text-sm); color: var(--text-muted);
}
.comment-chip svg { width: 14px; height: 14px; }
.comment-chip:hover { color: var(--text-secondary); }

/* Admin comment — filled black icon */
.comment-chip--admin { color: var(--text-primary); font-weight: var(--weight-medium); }
.comment-chip--admin:hover { color: var(--text-primary); opacity: 0.75; }

/* ---------- File uploader (with simulated progress) ---------- */
.uploader {
  position: relative;
  border: 1.5px dashed var(--border-interactive);
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
  padding: var(--space-16);
  transition: border-color .15s ease, background .15s ease;
}
.uploader.dragover { border-color: #475569; background: #f1f5f9; }
.uploader-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.uploader-idle {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-4); text-align: center;
  color: var(--text-secondary); pointer-events: none;
}
.uploader-idle svg { width: 26px; height: 26px; color: var(--text-muted); }
.uploader-file { display: flex; flex-direction: column; gap: var(--space-6); position: relative; }
.uploader-file-head { display: flex; align-items: center; gap: var(--space-6); min-width: 0; }
.uploader-file-name {
  font-weight: var(--weight-medium);
  flex: 1;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-progress {
  height: 6px; border-radius: var(--radius-pill);
  background: var(--border-subtle); overflow: hidden;
}
.upload-bar {
  height: 100%; width: 0;
  background: var(--btn-primary-bg);
  border-radius: var(--radius-pill);
  transition: width .12s linear;
}
.upload-status { font-size: var(--text-sm); color: var(--text-muted); display: inline-flex; align-items: center; gap: var(--space-2); }
.upload-status.done { color: var(--color-success); }
.upload-status svg { width: 14px; height: 14px; }

.team-inherit { display: flex; align-items: center; gap: var(--space-4); font-size: var(--text-base); color: var(--text-secondary); }

/* ---------- Tooltip ----------
   Single body-level tooltip (see initGlobalTooltips in script.js). Elements just need
   a [data-tip] (or [title], auto-converted) attribute — no per-element CSS needed,
   and it can never be clipped by an ancestor's overflow:auto (e.g. table-wrap). */
.df-tooltip {
  display: none;
  position: absolute;
  z-index: 9999;
  background: var(--btn-primary-bg);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: 1.4;
  text-align: left;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.df-tooltip--wide { white-space: normal; width: 220px; }

/* ---------- Pagination (static — states only) ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-top: var(--space-12);
}
.pagination-info { font-size: var(--text-sm); color: var(--text-muted); }
.pagination-controls { display: flex; align-items: center; gap: var(--space-2); }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 var(--space-4);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-interactive);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
}
.page-btn svg { width: 15px; height: 15px; }
.page-btn:hover:not(:disabled):not(.active) { background: var(--bg-sidebar); }
.page-btn.active {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary-bg);
}
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 900px) {
  .split-panel { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   CLIENT SHEET REDESIGN — New styles
   ============================================================ */

/* --- Version badge pill --- */
.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-6);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background: #f1f5f9;
  color: #334155;
  letter-spacing: 0.02em;
}

/* --- Sheet toolbar (search + col selector) --- */
.sheet-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: 12px;
}
.sheet-toolbar .search-box { flex: 1; max-width: 320px; }

/* --- Column selector dropdown --- */
.col-selector-wrap { position: relative; }
.col-selector-btn {
  gap: var(--space-4);
  height: var(--control-height-md);
  padding: 0 var(--space-8);
}

.col-selector-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: var(--space-4) 0;
}
.col-selector-dropdown.open { display: block; }

.col-selector-item {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-primary);
  user-select: none;
}
.col-selector-item:hover { background: var(--bg-sidebar); }
.col-selector-item input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--btn-primary-bg);
  flex-shrink: 0;
  cursor: pointer;
}

/* --- Role select (custom dropdown, styled like the column selector) --- */
.role-select { position: relative; display: inline-block; }
.role-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-width: 112px;
  height: var(--control-height-sm);
  padding: 0 var(--space-6) 0 var(--space-8);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.role-select-btn:hover { background: var(--bg-sidebar); }
.role-select-btn svg {
  width: 14px; height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.role-select.open .role-select-btn svg:not(.role-select-updown) { transform: rotate(180deg); }
.role-select.open .role-select-btn {
  border-color: #334155;
  box-shadow: 0 0 0 3px #f1f5f9;
}

.role-select-menu {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 100%;
  padding: var(--space-4) 0;
}
.role-select.open .role-select-menu { display: block; }

.role-select-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  user-select: none;
}
.role-select-item:hover { background: var(--bg-sidebar); }
.role-select-item svg {
  width: 14px; height: 14px;
  color: var(--text-primary);
  flex-shrink: 0;
  visibility: hidden;
}
.role-select-item[data-selected="true"] svg { visibility: visible; }

.role-select-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* --- Role switcher variant: larger pill with icon + up/down chevron --- */
.role-select--switcher { width: 100%; }
.role-select-btn--switcher {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-8) 0 var(--space-8);
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  justify-content: flex-start;
  min-width: 0;
}
.role-select-btn--switcher .role-select-value {
  flex: 1;
  text-align: left;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.role-select-updown { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.role-select-menu--switcher {
  width: 100%;
  min-width: 100%;
  top: auto;
  bottom: calc(100% + var(--space-2));
}

.role-select-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.role-select-icon-wrap .role-select-icon { width: 32px; height: 32px; }

/* --- Sheet table overhaul --- */
/* Header cells */
.sheet-th {
  text-align: left;
  padding: var(--space-6) var(--space-8);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: middle;
}
.th-inner {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}
.th-label { flex: 1; }

/* Add column header cell */
.sheet-th-add {
  padding: var(--space-4);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  vertical-align: middle;
}

/* Cells */
.sheet-cell {
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
  min-width: 140px;
  line-height: 1.5;
  transition: background 0.1s ease;
}

/* Row separator — tbody rows */
#sheetTable tbody tr:last-child .sheet-cell { border-bottom: none; }

/* View mode hover — subtle, scannable */
#sheetTable tbody tr:hover .sheet-cell:not([contenteditable="true"]) {
  background: var(--bg-sidebar);
  cursor: default;
}

/* Edit mode cell styling */
.sheet-cell[contenteditable="true"] {
  outline: none;
  cursor: text;
}
.sheet-cell[contenteditable="true"]:hover {
  background: #f1f5f9;
}
.sheet-cell[contenteditable="true"]:focus {
  background: #f1f5f9;
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

/* Diff highlight — yellow for changed cells in review */
.cell-diff-yellow {
  background: #fef9c3 !important;
  cursor: pointer !important;
  position: relative;
}
.cell-diff-yellow:hover {
  background: #fef08a !important;
  outline: 2px solid #ca8a04;
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}
.cell-diff-yellow.selected {
  background: #fde68a !important;
  outline: 2px solid #d97706;
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

/* Delete column button — hover-only on th */
.del-col-btn {
  opacity: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-interactive);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease, color 0.1s ease, background 0.1s ease;
}
.del-col-btn svg { width: 14px; height: 14px; }
.sheet-th:hover .del-col-btn {
  opacity: 1;
  pointer-events: auto;
}
.del-col-btn:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* Add column + button */
.add-col-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-interactive);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.add-col-btn svg { width: 14px; height: 14px; }
.add-col-btn:hover {
  border-color: #475569;
  background: #f1f5f9;
  color: #334155;
  border-style: solid;
}

/* Delete row button — hover-only trailing cell */
.row-del-cell {
  width: 40px;
  padding: var(--space-4) var(--space-4) var(--space-4) 0;
  vertical-align: middle;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}
#sheetTable tbody tr:last-child .row-del-cell { border-bottom: none; }

.del-row-btn {
  opacity: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-interactive);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: opacity 0.15s ease, color 0.1s ease, background 0.1s ease;
}
.del-row-btn svg { width: 14px; height: 14px; }

#sheetTable tbody tr:hover .del-row-btn {
  opacity: 1;
  pointer-events: auto;
}
.del-row-btn:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* Add row affordance */
.add-row-tr { border-top: 1px dashed var(--border-interactive); }
.add-row-cell {
  padding: var(--space-4) var(--space-8);
  vertical-align: middle;
}
.add-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-interactive);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.add-row-btn svg { width: 14px; height: 14px; }
.add-row-btn:hover {
  border-color: #475569;
  background: #f1f5f9;
  color: #334155;
  border-style: solid;
}

/* New row highlight */
.row-new .sheet-cell { background: var(--color-success-bg); }

/* ============================================================
   SIDE DRAWERS (VH + cell detail)
   ============================================================ */
.drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.3);
  z-index: 200;
}
.drawer-backdrop.open { display: block; }

/* Version History as an inline panel (right of main, pushes main width) */
.vh-panel {
  display: none;
  flex-direction: column;
  width: 360px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 8px;
  height: calc(100vh - 16px);
  margin: 8px 8px 8px 0;
  border-radius: 20px;
  border: 0.8px solid rgba(232, 234, 237, 0.20);
  background: var(--Colors-Neutral-colorBgBase, #FFF);
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 4px 8px 0 rgba(15, 23, 42, 0.02);
  overflow: hidden;
}
.vh-panel.open { display: flex; }
.vh-item--selected { background: var(--nav-active-bg); box-shadow: inset 3px 0 0 #475569; }
.vh-item--current.vh-item--selected { background: #f1f5f9; }
.version-badge--preview { background: var(--color-warning-bg); color: var(--color-warning); }

.side-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 480px;
  max-width: 95vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -4px 0 32px rgba(15,23,42,0.12);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.side-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-12) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.drawer-search {
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.drawer-search .search-box { max-width: 100%; }
.drawer-search .search-box input { width: 100%; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8) 0;
}

/* ============================================================
   VERSION HISTORY DRAWER ITEMS
   ============================================================ */
.vh-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-10);
  padding: var(--space-10) var(--space-12);
  cursor: pointer;
  transition: background 0.12s ease;
  border-bottom: 1px solid var(--border-subtle);
}
.vh-item:last-child { border-bottom: none; }
.vh-item:hover { background: var(--bg-sidebar); }

.vh-item--current { background: #f1f5f9; }
.vh-item--current:hover { background: #d1faf3; }

.vh-item-dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: #475569;
  margin-top: 5px;
  flex-shrink: 0;
}
.vh-item--current .vh-item-dot { background: var(--color-success); }

.vh-item-body { flex: 1; min-width: 0; }
.vh-item-title {
  display: flex; align-items: center; gap: var(--space-6);
  font-weight: var(--weight-medium);
  font-size: var(--text-base);
}
.vh-item-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vh-item-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
.vh-item-chevron { width: 16px; height: 16px; color: var(--text-muted); margin-top: 2px; flex-shrink: 0; }

/* Version preview pane (within drawer) */
.vh-preview {
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.vh-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.vh-preview-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8) var(--space-12);
}
.vh-preview-meta {
  margin-bottom: var(--space-8);
}

/* ============================================================
   CELL DETAIL DRAWER
   ============================================================ */
.cell-diff-block { display: flex; flex-direction: column; gap: var(--space-4); padding: 0 var(--space-12); }
.cell-diff-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Neutral value boxes — no color coding, just clean separation */
.cell-diff-value {
  border-radius: var(--radius-md);
  padding: var(--space-10);
  font-size: var(--text-base);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
  border: 1px solid var(--border-interactive);
  background: var(--bg-sidebar);
  color: var(--text-primary);
}
/* Neutral variant used in the review panel */
.cell-diff-value--neutral {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  border-color: var(--border-interactive);
}
/* Legacy colored variants kept for backwards compat but unused in review */
.cell-diff-value--before {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: #fca5a5;
}
.cell-diff-value--after {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: #86efac;
}

/* Deleted rows — grey text + subtle bg, no strikethrough */
.row-deleted {
  color: var(--text-muted) !important;
  background: var(--neutral-20) !important;
}

/* ============================================================
   REVIEW SCREEN SPLIT PANEL
   ============================================================ */
/* review-screen is now a flex row: left = all content, right = detail panel */
.review-screen {
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: stretch;
  min-height: 0;
}
.review-screen-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Before/After panel content lives inside a .vh-panel (inline, pushes main narrower) */
.rsd-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-10) var(--space-10) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.rsd-title {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  color: var(--text-primary);
}
.rsd-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-12) 0;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   REVIEW SCREEN
   ============================================================ */
.review-section { }
.review-section.mt-16 { margin-top: var(--space-16); }
.review-section-title {
  font-size: var(--text-h5);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

/* ---------- Review Changes: inline row actions ---------- */
.review-actions { display: inline-flex; align-items: center; gap: var(--space-8); justify-content: flex-end; }
.act {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium);
  border-radius: var(--radius-sm);
}
.act svg { width: 15px; height: 15px; }
.act:hover { text-decoration: underline; }
.act-review  { color: #334155; }
.act-decline { color: var(--color-danger); }
.act-approve { color: var(--color-success); }

/* ---------- Review Changes: faux document preview ---------- */
.doc-preview-wrap { display: flex; flex-direction: column; gap: var(--space-8); align-items: center; }
.doc-preview-toolbar {
  display: flex; align-items: center; gap: var(--space-8);
  align-self: stretch; padding-bottom: var(--space-4);
}
.doc-preview-page {
  width: 100%; max-width: 720px;
  background: #fff; color: #0f172a;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: var(--space-24);
}
.dp-doc-title { height: 16px; width: 45%; margin: 0 auto var(--space-16); border-radius: 3px; background: #cbd5e1; }
.dp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-24); }
.dp-heading { height: 9px; width: 60%; margin-bottom: 10px; border-radius: 3px; background: #cbd5e1; }
.dp-line { height: 7px; margin-bottom: 7px; border-radius: 3px; background: #e2e8f0; }
.dp-gap { height: var(--space-12); }

/* ============================================================
   TOAST
   ============================================================ */
.df-toast {
  position: fixed;
  bottom: var(--space-20, 20px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  background: var(--neutral-100, #1a1a2e);
  color: #fff;
  padding: var(--space-8, 8px) var(--space-16, 16px);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  pointer-events: none;
  z-index: 10000;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.df-toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: #4ade80;
}
.df-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   MY SUBMISSIONS PAGE
   ============================================================ */
.sub-section { }
.sub-section.mt-24 { margin-top: var(--space-20, 20px); }

.sub-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}
.sub-section-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sub-section-icon svg { width: 15px; height: 15px; }
.sub-section-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

/* submission card */
.sub-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-12) var(--space-16);
}
.sub-card--pending { border-left: 3px solid var(--color-warning, #f59e0b); }
.sub-card--declined { border-left: 3px solid var(--color-danger, #ef4444); }

.sub-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-12);
}
.sub-card-main { flex: 1; min-width: 0; }
.sub-card-title {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  color: var(--text-primary);
}
.sub-card-meta {
  font-size: var(--text-sm);
  margin-top: 2px;
}
.sub-card-chips {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-4);
}
.sub-card-reason {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-top: var(--space-8);
  font-size: var(--text-sm);
  color: var(--color-danger, #ef4444);
  background: var(--color-danger-bg, #fef2f2);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-8);
}
.sub-card-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
}

/* doc name cell in submissions table */
.submissions-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin: 0 0 12px;
}
.submissions-toolbar .search-box { flex: 1; max-width: 320px; }
.submissions-toolbar .select { width: 148px; flex: 0 0 148px; }
.submissions-toolbar .role-select-btn { width: 148px; height: var(--control-height-md); }
@media (max-width: 600px) {
  .submissions-toolbar { align-items: stretch; flex-direction: column; }
  .submissions-toolbar .search-box { max-width: none; }
}
.doc-name-cell {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}
#submissionsContent .doc-name-cell--document .doc-icon-sm,
#submissionsContent .doc-name-cell--sheet .doc-icon-sm {
  background: #f1f5f9;
  border-color: #f1f5f9;
}
#submissionsContent .doc-name-cell--document .doc-icon-sm svg,
#submissionsContent .doc-name-cell--sheet .doc-icon-sm svg { color: #334155; }
#submissionsContent.submission-preview {
  min-height: calc(100dvh - 220px);
}
#submissionsContent.submission-preview .review-screen {
  min-height: calc(100dvh - 220px);
}
.doc-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.doc-icon-sm svg { width: 14px; height: 14px; color: var(--text-muted); }
.doc-name-main {
  font-weight: var(--weight-medium);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 1px;
}
