:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --sidebar: #20243a;
  --sidebar-2: #2b304c;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --ink: #20242c;
  --muted: #66707d;
  --line: #dce2e8;
  --primary: #1688d8;
  --primary-dark: #0f69aa;
  --accent: #d89528;
  --success: #1f8a55;
  --danger: #c8463d;
  --warning: #b7791f;
  --shadow: 0 16px 36px rgba(20, 28, 44, 0.08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
}

a.link-button {
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  overflow: auto;
  padding: 18px 16px;
  background: var(--sidebar);
  color: #fff;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 56px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #fff;
  color: var(--sidebar);
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.sidebar-actions,
.nav-list,
.nav-group {
  display: grid;
  gap: 8px;
}

.nav-list {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item,
.nav-group button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  text-align: left;
}

.nav-item.active,
.nav-group button.active,
.nav-item:hover,
.nav-group button:hover {
  background: var(--sidebar-2);
  color: #fff;
}

.nav-item b {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
}

.nav-group {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.manager-registry {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(232, 241, 255, 0.1);
}

.manager-registry button {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  text-align: left;
}

.manager-registry .registry-root {
  display: flex;
  justify-content: space-between;
  font-weight: 900;
}

.manager-registry button:not(.registry-root) {
  padding-left: 28px;
}

.manager-registry button:hover,
.manager-registry button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-group > span {
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.plan-box {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.plan-box span,
.plan-box small {
  color: rgba(255, 255, 255, 0.68);
}

.workspace {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.crumbs,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.search {
  position: relative;
  display: block;
}

.search span {
  position: absolute;
  left: 12px;
  top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.search input {
  width: min(320px, 52vw);
  min-height: 48px;
  padding: 19px 12px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.search input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 136, 216, 0.14);
}

.org-switcher {
  position: relative;
}

.org-button {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--sidebar);
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.org-button strong,
.org-button em,
.org-button small,
.org-menu strong,
.org-menu small {
  display: block;
  overflow-wrap: anywhere;
}

.org-button em {
  margin-top: 4px;
  color: #fff;
  font-style: normal;
  font-weight: 900;
}

.org-button small,
.org-menu small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
}

.org-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0879d7;
  color: #fff;
  font-weight: 900;
}

.org-avatar b {
  position: absolute;
  top: -5px;
  right: -4px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #66707d;
  font-size: 11px;
}

.org-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  width: min(380px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 50px rgba(20, 28, 44, 0.22);
  overflow: hidden;
}

.account-menu-head,
.org-menu-current,
.org-menu button {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.account-menu-head,
.org-menu-current {
  grid-template-columns: 52px 1fr;
}

.account-menu-head {
  background: #f7f9fb;
}

.account-menu-head .org-avatar,
.org-menu-current .org-avatar,
.org-menu button .org-avatar {
  width: 52px;
  height: 52px;
}

.org-menu button {
  cursor: pointer;
}

.org-menu button:hover,
.org-menu button.active {
  background: #eef6fd;
}

.org-menu button small,
.org-menu-current small,
.account-menu-head small {
  color: var(--muted);
}

.org-menu em {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  background: #edf1f5;
  color: var(--muted);
  font-style: normal;
  font-weight: 900;
}

.org-menu-label {
  padding: 14px 16px 6px;
  color: var(--muted);
  font-size: 13px;
}

.org-menu .plain {
  display: block;
  min-height: 44px;
  color: var(--primary-dark);
  font-weight: 900;
  text-align: center;
}

.manager-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #b8d9f2;
  border-radius: 8px;
  background: #eef7ff;
}

.manager-strip strong,
.manager-strip span {
  display: block;
}

.manager-strip > span {
  max-width: 720px;
  color: var(--muted);
  font-weight: 700;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.document-list-panel,
.document-card,
.process-card,
.log-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-list-panel {
  overflow: hidden;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.segmented button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 28, 44, 0.08);
}

.drop-zone {
  display: grid;
  gap: 4px;
  margin: 16px;
  padding: 14px;
  border: 1px dashed #9ec8e9;
  border-radius: 8px;
  background: #f0f8fe;
}

.drop-zone.dragging {
  border-color: var(--primary);
  background: #e2f2fd;
}

.drop-zone span {
  color: var(--muted);
  font-size: 13px;
}

.folder-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  padding: 0 16px 14px;
}

.folder-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.folder-card:hover,
.folder-card.active {
  border-color: #8cc2ef;
  background: #f4faff;
}

.folder-card strong,
.folder-card small {
  overflow-wrap: anywhere;
}

.folder-card small {
  color: var(--muted);
  font-weight: 800;
}

.folder-card.manager-folder {
  grid-template-columns: 32px 1fr;
}

.folder-card.manager-folder small {
  grid-column: 2;
  font-weight: 700;
}

.folder-icon {
  position: relative;
  width: 30px;
  height: 22px;
  border-radius: 5px;
  background: #dff0fd;
}

.folder-icon::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 3px;
  width: 14px;
  height: 8px;
  border-radius: 5px 5px 0 0;
  background: #c8e4f8;
}

.table-head,
.document-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 1fr) 140px 120px;
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 0 16px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.document-table {
  display: grid;
  border-top: 1px solid var(--line);
}

.document-row {
  width: 100%;
  min-height: 76px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

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

.document-row.active,
.document-row:hover {
  background: #f8fbfe;
}

.doc-main {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e8f4fd;
  color: var(--primary-dark);
  font-weight: 900;
}

.doc-main strong,
.doc-main span,
.route-cell strong,
.route-cell span {
  display: block;
  overflow-wrap: anywhere;
}

.doc-main span,
.route-cell span,
.updated-cell {
  color: var(--muted);
  font-size: 13px;
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.agreed-document-card {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dossier-layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 520px;
}

.dossier-sidebar {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #f8fbfe;
}

.dossier-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dossier-sidebar-head h2,
.dossier-section h3,
.dossier-sidebar h3 {
  margin: 0;
  color: var(--ink);
}

.dossier-fields {
  display: grid;
  gap: 9px;
  margin: 0;
}

.dossier-fields div {
  display: grid;
  gap: 4px;
}

.dossier-fields dt,
.dossier-signer dt,
.dossier-counters dt,
.dossier-file-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dossier-fields dd,
.dossier-signer dd,
.dossier-counters dd {
  margin: 0;
  min-height: 28px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #26323d;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dossier-fields.compact {
  padding-top: 8px;
  border-top: 1px dashed #a9c5dc;
}

.dossier-signers {
  display: grid;
  gap: 10px;
}

.dossier-signer {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #c9d9e7;
  border-radius: 8px;
  background: #eaf5ff;
}

.dossier-signer.signed {
  border-color: rgba(31, 138, 85, 0.28);
  background: #eefaf3;
}

.dossier-signer.current {
  border-color: rgba(183, 121, 31, 0.28);
  background: #fff8eb;
}

.dossier-signer strong {
  font-size: 13px;
}

.dossier-signer dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.dossier-main {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px;
  background: #fff;
}

.dossier-alert {
  padding: 10px 14px;
  border: 1px solid #efcaa8;
  background: #fff1e3;
  color: #764313;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.dossier-alert.warning {
  background: #fff7eb;
}

.dossier-section {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.dossier-table-wrap {
  overflow-x: auto;
}

.dossier-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.dossier-table th:nth-child(1),
.dossier-table td:nth-child(1) {
  width: 78px;
}

.dossier-table th:nth-child(3),
.dossier-table td:nth-child(3) {
  width: 120px;
}

.dossier-table th:nth-child(4),
.dossier-table td:nth-child(4) {
  width: 118px;
}

.dossier-table th:nth-child(5),
.dossier-table td:nth-child(5) {
  width: 128px;
}

.dossier-table th {
  padding: 9px 8px;
  border-bottom: 2px solid #ccd8e3;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
}

.dossier-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.dossier-table td strong,
.dossier-table td span {
  display: block;
  overflow-wrap: anywhere;
}

.dossier-table td span {
  color: var(--muted);
  font-size: 11px;
}

.queue-cell {
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 42px;
  border-radius: 4px;
  background: #bfe8d3;
  color: #22533a;
  font-weight: 900;
}

.dossier-counters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dossier-counters div {
  display: grid;
  gap: 3px;
  min-height: 56px;
  padding: 10px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.dossier-counters div:last-child {
  border-right: 0;
}

.dossier-counters dd {
  min-height: 0;
  padding: 0;
  border: 0;
  font-weight: 900;
}

.dossier-file-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 72px;
  border-radius: 8px;
  background: #e2f2ff;
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 900;
}

/* Информация о документе — карточка как в референсе */
.dossier-section.docinfo {
  gap: 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.dossier-section.docinfo h3 {
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.docinfo-head {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.docinfo-file {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.docinfo-filename {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.docinfo-filename:hover {
  text-decoration: underline;
}

.docinfo-fields {
  display: grid;
  gap: 8px;
  margin: 0;
}

.docinfo-fields > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.docinfo-fields dt {
  color: var(--muted);
  font-size: 13px;
}

.docinfo-fields dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.docinfo-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.docinfo-path span {
  color: var(--primary-dark);
}

.docinfo-path i {
  color: var(--muted);
  font-style: normal;
}

.docinfo-downloads {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 22px 0;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.docinfo-downloads-label {
  color: var(--muted);
  font-size: 13px;
}

.docinfo-downloads-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.docinfo-download {
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 6px;
  color: var(--primary-dark);
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.docinfo-download:hover {
  text-decoration: underline;
}

.docinfo-download-icon {
  font-size: 28px;
  line-height: 1;
}

.dossier-info-note {
  padding: 12px;
  border: 1px solid #9ec8e9;
  background: #dceffd;
  color: #31536b;
  font-size: 12px;
  text-align: center;
}

.document-card,
.process-card,
.log-panel {
  padding: 16px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head.compact {
  align-items: center;
  margin-bottom: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid #bcd8ee;
  border-radius: 8px;
  background: #eff8ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.status-badge.muted {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.status-badge.ready {
  border-color: rgba(31, 138, 85, 0.28);
  background: #edf8f2;
  color: var(--success);
}

.status-badge.error {
  border-color: rgba(200, 70, 61, 0.3);
  background: #fff0ee;
  color: var(--danger);
}

.status-badge.warning {
  border-color: rgba(183, 121, 31, 0.32);
  background: #fff8e8;
  color: var(--warning);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.meta-grid div,
.qr-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

dd {
  margin: 5px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

select {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  min-height: 250px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

.compact-textarea {
  min-height: 86px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  min-height: 42px;
  padding: 8px 10px;
}

.public-link-field {
  margin-top: 12px;
}

.public-link-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.public-link-item {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.public-link-item span,
.public-link-item code {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.verify-qr-box {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.verify-qr-box svg {
  display: block;
  width: min(100%, 220px);
  height: auto;
}

.link-button.disabled {
  pointer-events: none;
  opacity: 0.55;
}

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

.button-grid {
  margin-top: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.approval-list,
.signature-list {
  display: grid;
  gap: 8px;
}

.approval-item,
.signature-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.approval-item {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.approval-item span,
.signature-item span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.approval-item.approved {
  border-color: rgba(31, 138, 85, 0.25);
  background: #edf8f2;
}

.approval-item.signed {
  border-color: rgba(31, 138, 85, 0.25);
  background: #edf8f2;
}

.approval-item.current {
  border-color: rgba(30, 117, 199, 0.28);
  background: #edf5ff;
}

.approval-item.waiting {
  opacity: 0.74;
}

.approval-item.approved span,
.approval-item.signed span {
  color: var(--success);
}

.approval-item.current span {
  color: var(--accent-strong);
}

.route-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

button.primary,
button.outline,
button.ghost,
.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  text-align: center;
}

button.primary {
  background: var(--primary);
  color: #fff;
}

button.primary:hover {
  background: var(--primary-dark);
}

button.outline,
.upload-button {
  border: 1px solid #8fc0e4;
  background: #fff;
  color: var(--primary-dark);
}

button.ghost {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
}

button.full,
.full {
  width: 100%;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.upload-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.qr-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.qr-code {
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  gap: 1px;
  width: min(220px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 10px solid #fff;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 28px rgba(20, 28, 44, 0.14);
}

.qr-cell {
  aspect-ratio: 1;
  background: #fff;
}

.qr-cell.dark {
  background: #121722;
}

.qr-code img {
  display: block;
  width: 100%;
  height: 100%;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  object-fit: contain;
}

.qr-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}

.hidden {
  display: none !important;
}

.log-panel pre {
  min-height: 150px;
  max-height: 260px;
  margin: 0;
  overflow: auto;
  color: #24303a;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-panel {
  display: grid;
  gap: 16px;
}

.admin-head,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.admin-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.admin-tabs button {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.admin-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 28, 44, 0.08);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.admin-card h3 {
  margin: 0;
  font-size: 16px;
}

.admin-wide {
  min-width: 0;
}

.admin-check-list {
  display: grid;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.admin-check-list label {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
}

.admin-check-list span {
  display: block;
}

.admin-check-list small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(120px, 0.6fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-row strong,
.admin-row span {
  display: block;
  overflow-wrap: anywhere;
}

.admin-row span,
.admin-row small {
  color: var(--muted);
  font-size: 12px;
}

.admin-row button {
  min-height: 34px;
}

.admin-test-result {
  display: grid;
  gap: 8px;
}

.admin-test-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.admin-test-item.ready {
  border-color: rgba(31, 138, 85, 0.28);
  background: #edf8f2;
}

.admin-test-item.error {
  border-color: rgba(200, 70, 61, 0.3);
  background: #fff0ee;
}

.admin-test-item code {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

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

@media (max-width: 1180px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

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

  .document-card {
    grid-column: 1 / -1;
  }

  .dossier-layout {
    grid-template-columns: 1fr;
  }

  .dossier-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .docinfo-downloads-list,
  .dossier-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .detail-panel {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions,
  .search input {
    width: 100%;
  }

  .table-head {
    display: none;
  }

  .document-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .dossier-table {
    min-width: 620px;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding: 12px;
  }

  .panel-toolbar,
  .topbar-actions,
  .settings-grid,
  .button-grid,
  .meta-grid,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .admin-tabs {
    display: grid;
    width: 100%;
  }

  button.primary,
  button.outline,
  .upload-button,
  .dossier-counters {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .docinfo-head,
  .docinfo-downloads {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .docinfo-fields > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .dossier-counters div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dossier-counters div:last-child {
    border-bottom: 0;
  }
}

.preview-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.preview-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

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

.preview-meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

#previewContent {
  min-height: 160px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #24323a;
  font-size: 13px;
}

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

.nca-actions .primary {
  grid-column: 1 / -1;
}

.signature-proof-list {
  display: grid;
  gap: 10px;
}

.signature-proof-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(31, 138, 85, 0.24);
  border-radius: 8px;
  background: #f3fbf6;
}

.proof-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.proof-row span,
.signature-proof-item p {
  color: var(--muted);
  font-size: 12px;
}

.signature-proof-item dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.signature-proof-item dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.signature-proof-item dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.signature-proof-item code {
  display: block;
  overflow-wrap: anywhere;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
  color: #34404a;
  font-size: 12px;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.audit-item span,
.audit-item code {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

a.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 800;
}

a.link-button.primary {
  background: var(--primary);
  color: #fff;
}

a.link-button.outline {
  border: 1px solid #8fc0e4;
  background: #fff;
  color: var(--primary-dark);
}

.public-sign-body {
  min-height: 100vh;
  background: var(--bg);
}

.public-sign-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.public-sign-main,
.public-sign-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.public-sign-main {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.public-sign-main h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.1;
}

.public-route-card {
  margin-top: 4px;
}

#publicEventLog {
  min-height: 220px;
  max-height: 420px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #24323a;
  font-size: 12px;
}

@media (max-width: 900px) {
  .public-sign-shell {
    grid-template-columns: 1fr;
  }
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(32, 36, 58, 0.96), rgba(22, 66, 92, 0.92)),
    #20243a;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(280px, 420px);
  gap: 28px;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: min(1000px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.login-panel {
  display: grid;
  gap: 24px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(8, 14, 28, 0.28);
}

.login-brand {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.login-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--sidebar);
  color: #fff;
  font-weight: 900;
}

.login-brand strong,
.login-brand span,
.login-heading span {
  display: block;
}

.login-brand strong {
  font-size: 18px;
}

.login-brand span,
.login-heading span {
  color: var(--muted);
}

.login-heading {
  display: grid;
  gap: 5px;
}

.login-heading span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-heading h1 {
  margin: 0;
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 136, 216, 0.14);
}

.login-check {
  margin-top: 0;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(200, 70, 61, 0.3);
  border-radius: 8px;
  background: #fff0ee;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.login-aside {
  display: grid;
  gap: 24px;
  color: #fff;
}

.login-aside > div {
  display: grid;
  gap: 8px;
}

.login-aside span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-aside strong {
  max-width: 360px;
  font-size: 32px;
  line-height: 1.12;
}

.login-aside dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.login-aside dl div {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.login-aside dt {
  color: rgba(255, 255, 255, 0.62);
}

.login-aside dd {
  color: #fff;
}

@media (max-width: 820px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-aside {
    order: -1;
  }

  .login-aside strong {
    max-width: none;
    font-size: 26px;
  }
}

/* Impersonation banner + admin row actions */
.impersonation-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: #b45309;
  color: #fff;
  font-size: 14px;
}
.impersonation-bar strong { font-weight: 700; }
.impersonation-bar button {
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.impersonation-bar button:hover { background: rgba(255, 255, 255, 0.24); }
.admin-row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ===== Documents explorer (folder tree) ===== */
.document-list-panel.explorer {
  background: #ffffff;
  border: 1px solid #e6e9f0;
  border-radius: 14px;
  padding: 16px 20px 8px;
}
.explorer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.explorer-toolbar .upload-button,
.ghost-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid #c9d4e8;
  border-radius: 10px;
  background: #ffffff;
  color: #2563eb;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.explorer-toolbar .upload-button:hover,
.ghost-add:hover { background: #f3f6fc; }
.explorer-toolbar .upload-button input { display: none; }
.document-list-panel.explorer .drop-zone {
  margin-bottom: 12px;
  border: 1px dashed #cdd6e6;
  background: #fafbfe;
  border-radius: 10px;
}

.folder-tree { display: flex; flex-direction: column; }
.tree-folder { border-top: 1px solid #eef1f6; }
.tree-folder:first-child { border-top: none; }
.tree-folder-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: #1f2733;
  border-radius: 8px;
}
.tree-folder-head:hover { background: #f7f9fd; }
.tree-caret {
  width: 12px;
  color: #98a2b3;
  font-size: 10px;
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
.tree-caret::before { content: "\25B6"; }
.tree-folder.open > .tree-folder-head .tree-caret { transform: rotate(90deg); }
.tree-folder-icon {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex: 0 0 auto;
}
.tree-folder-icon::before { content: "\1F4C1"; }
.tree-folder.open > .tree-folder-head .tree-folder-icon::before { content: "\1F4C2"; }
.tree-section .tree-folder-icon::before { content: "\1F5C2"; }
.tree-folder-name { font-weight: 600; }
.tree-folder-meta { color: #98a2b3; font-size: 13px; margin-left: auto; white-space: nowrap; }
.tree-folder-body { display: none; padding: 2px 0 10px 34px; }
.tree-folder.open > .tree-folder-body { display: block; }
.tree-document { margin: 4px 0; }

/* explorer search box */
.explorer-toolbar { justify-content: space-between; }
.explorer-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.explorer-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 360px;
  min-width: 220px;
  padding: 8px 16px;
  border: 1px solid #d8dfea;
  border-radius: 999px;
  background: #ffffff;
}
.explorer-search:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.explorer-search-icon { flex: 0 0 auto; color: #98a2b3; line-height: 1; }
.explorer-search-icon::before { content: "\1F50D"; font-size: 14px; }
.explorer-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: #1f2733;
}
.explorer-search input::placeholder { color: #9aa6b8; }

/* keep search on the same row as the actions */
.explorer-toolbar { flex-wrap: nowrap; gap: 16px; }
.explorer-actions { flex: 0 0 auto; }
.explorer-search { flex: 1 1 200px; min-width: 170px; max-width: 460px; margin-left: auto; }
@media (max-width: 1100px) {
  .explorer-toolbar { flex-wrap: wrap; }
  .explorer-search { flex: 1 1 100%; margin-left: 0; }
}

/* ===== Detail panel as admin slide-in drawer ===== */
body.detail-drawer-mode .dashboard { grid-template-columns: minmax(0, 1fr); }
body.detail-drawer-mode .detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(460px, 94vw);
  margin: 0;
  padding: 54px 20px 28px;
  overflow-y: auto;
  background: var(--bg, #f3f5f8);
  box-shadow: -18px 0 48px rgba(20, 28, 44, 0.20);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 80;
}
body.detail-drawer-mode .detail-panel.open { transform: translateX(0); }
.detail-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line, #dce2e8);
  color: var(--muted, #66707d);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
body.detail-drawer-mode .detail-close { display: inline-flex; }
.detail-close:hover { background: #f3f6fc; }
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 70;
}
.detail-backdrop.open { opacity: 1; visibility: visible; }
#toggleDetailButton.active {
  background: var(--primary, #1688d8);
  color: #fff;
  border-color: var(--primary, #1688d8);
}

/* ===== Folder create modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 20, 35, 0.45);
}
.modal-overlay.hidden { display: none; }
.modal-card {
  width: min(400px, 92vw);
  background: #ffffff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(20, 28, 44, 0.28);
}
.modal-card h3 { margin: 0 0 14px; font-size: 18px; }
.modal-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 10px;
  outline: none;
  font-size: 15px;
}
.modal-card input:focus {
  border-color: var(--primary, #1688d8);
  box-shadow: 0 0 0 3px rgba(22, 136, 216, 0.14);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.modal-actions button { padding: 9px 18px; border-radius: 10px; cursor: pointer; }

/* ===== Document page (dossier on click) ===== */
.back-button {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 16px;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary, #1688d8);
  font-weight: 600;
  cursor: pointer;
}
.back-button:hover { background: #f3f6fc; }
body.viewing-document .back-button { display: inline-flex; }
body.viewing-document .document-list-panel { display: none; }
body.viewing-document .manager-strip { display: none; }
.dossier-basic {
  background: #ffffff;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 14px;
  padding: 22px;
}
.dossier-basic h2 { margin: 0 0 14px; }

body.viewing-document .dashboard { display: block; }
body.viewing-document #agreedDocumentCard { margin-top: 0; }

/* document page: loader + lazy PDF preview */
.dossier-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 20px;
  color: var(--muted, #66707d);
  font-size: 15px;
  background: #ffffff;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 14px;
}
.dossier-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d8dfea;
  border-top-color: var(--primary, #1688d8);
  border-radius: 50%;
  animation: dossier-spin 0.8s linear infinite;
}
@keyframes dossier-spin { to { transform: rotate(360deg); } }

/* full-page loader while a document opens */
.document-loader {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #f3f5f8;
  color: var(--muted, #66707d);
  font-size: 15px;
}
body.document-loading .document-loader { display: flex; }

/* ===== Document page: collapsible rail (reference layout) ===== */
.dossier-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: auto;
}
.doc-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  width: 96px;
  position: sticky;
  top: 16px;
}
.doc-rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 12px;
  background: #ffffff;
  color: var(--muted, #66707d);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.doc-rail-btn:hover { background: #f3f6fc; }
.doc-rail-btn.active {
  border-color: var(--primary, #1688d8);
  color: var(--primary, #1688d8);
  background: #eef6fd;
}
.doc-rail-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.doc-rail-icon.card::before { content: "\1F4C4"; }
.doc-rail-icon.comments::before { content: "\1F4AC"; }
.doc-panel {
  display: none;
  flex: 0 0 320px;
  align-self: stretch;
  background: #ffffff;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 14px;
  overflow: hidden;
}
.doc-panel.open { display: block; }
.dossier-sidebar.doc-panel.open { display: grid; }
.doc-comments { padding: 16px; }
.dossier-main { flex: 1 1 auto; min-width: 0; }

/* ===== Document page: top action bar ===== */
.docpage-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 14px;
  background: #ffffff;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 14px;
}
.docpage-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.docpage-title { margin: 0; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.docpage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.docpage-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line, #dce2e8);
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary, #1688d8);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.docpage-action:hover { background: #f3f6fc; }
.docpage-action-icon { font-size: 14px; line-height: 1; }
