/* In-app PDF viewer (public/pdf-viewer.js) and the document identity settings. */
body.pdfv-open {
  overflow: hidden;
}
.pdfv {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #2a2a30;
  color: #f4f4f5;
}
.pdfv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 16px;
  background: #18181b;
  border-block-end: 1px solid #3f3f46;
}
.pdfv-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pdfv-title > div {
  display: grid;
  min-width: 0;
}
.pdfv-title strong {
  overflow: hidden;
  font-size: 0.98rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pdfv-title small {
  color: #a1a1aa;
}
.pdfv-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pdfv-tools .icon-button {
  color: #f4f4f5;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  min-width: 36px;
  min-height: 36px;
  font-size: 1.15rem;
}
.pdfv-tools .icon-button:hover,
.pdfv-tools .icon-button:focus-visible {
  background: #27272a;
  border-color: #3f3f46;
}
.pdfv-tools .btn {
  min-height: 36px;
}
.pdfv-tools .btn:not(.primary) {
  color: #f4f4f5;
  background: #27272a;
  border-color: #3f3f46;
}
.pdfv-tools select,
.pdfv-page input {
  height: 34px;
  color: #f4f4f5;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  padding-inline: 8px;
}
.pdfv-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a1a1aa;
}
.pdfv-page input {
  width: 56px;
  text-align: center;
}
.pdfv-sep {
  width: 1px;
  height: 22px;
  margin-inline: 4px;
  background: #3f3f46;
}
.pdfv-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: 0;
}
.pdfv.no-thumbs .pdfv-body {
  grid-template-columns: 1fr;
}
.pdfv.no-thumbs .pdfv-thumbs {
  display: none;
}
.pdfv-thumbs {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px 18px;
  overflow: auto;
  background: #1f1f23;
  border-inline-end: 1px solid #3f3f46;
}
.pdfv-thumb {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 6px;
  color: #a1a1aa;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}
.pdfv-thumb canvas {
  width: 100%;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 35%);
}
.pdfv-thumb.is-active {
  color: #fff;
  border-color: var(--accent, #ed6a24);
}
.pdfv-pages {
  display: grid;
  justify-content: center;
  align-content: start;
  gap: 22px;
  padding: 24px;
  overflow: auto;
  outline: none;
}
.pdfv-page-slot {
  max-width: none;
  background: #fff;
  border-radius: 3px;
  box-shadow:
    0 10px 30px rgb(0 0 0 / 40%),
    0 1px 3px rgb(0 0 0 / 30%);
}
.pdfv-page-slot canvas {
  display: block;
}
.pdfv-print {
  display: none;
}
.pdfv::backdrop {
  background: rgb(0 0 0 / 60%);
}
.pdfv:not([open]) {
  display: none;
}
@media (max-width: 760px) {
  .pdfv-bar {
    padding: 8px 10px;
  }
  .pdfv-tools .btn span {
    display: none;
  }
  .pdfv-pages {
    padding: 12px;
  }
}
@media print {
  body.pdfv-printing > *:not(.pdfv-print) {
    display: none !important;
  }
  body.pdfv-printing .pdfv-print {
    display: block;
  }
  body.pdfv-printing .pdfv-print img {
    display: block;
    width: 100%;
    page-break-after: always;
    break-after: page;
  }
  @page {
    size: A4;
    margin: 0;
  }
}

/* Document identity settings */
.db-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-block: 12px 18px;
}
.db-image {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.db-image small {
  display: block;
  margin-block: 4px 8px;
  color: var(--muted);
}
.db-image-preview {
  display: grid;
  place-items: center;
  width: 110px;
  height: 110px;
  overflow: hidden;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.db-image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.db-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.db-check {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px;
  align-items: center;
}
.db-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 14px;
}

/* AI workforce (public/ai-app.js) */
.ai-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(
    135deg,
    var(--ai-color, #334155),
    color-mix(in srgb, var(--ai-color, #334155) 60%, #000)
  );
  border-radius: 14px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ai-color, #334155) 30%, transparent);
}
.ai-avatar.is-small {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
  border-radius: 10px;
}
.ai-avatar.is-large {
  width: 72px;
  height: 72px;
  font-size: 1.4rem;
  border-radius: 20px;
}
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-block: 18px;
}
.ai-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-block-start: 4px solid var(--ai-color, var(--accent));
  border-radius: 16px;
}
.ai-card.is-off {
  opacity: 0.65;
}
.ai-card header {
  display: flex;
  gap: 12px;
  align-items: center;
}
.ai-card header > div {
  flex: 1;
  min-width: 0;
}
.ai-card h2 {
  margin: 0;
  font-size: 1.05rem;
}
.ai-card h2 span {
  color: var(--muted);
  font-weight: 600;
}
.ai-card header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.ai-card dl {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
}
.ai-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.ai-card dt {
  color: var(--muted);
}
.ai-card dd {
  margin: 0;
  font-weight: 600;
}
.ai-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ai-switch {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-inline-start: auto;
  font-size: 0.85rem;
}
.ai-count {
  padding: 0 7px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
}
.ai-warnings p {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 4px 0;
  color: var(--muted);
}
.ai-agent-head {
  display: flex;
  gap: 18px;
  align-items: center;
  border-inline-start: 4px solid var(--ai-color, var(--accent));
}
.ai-tab-body {
  padding-block-start: 14px;
}
.ai-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.ai-tool {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ai-tool small {
  display: block;
  margin-block-start: 4px;
  color: var(--muted);
}
.ai-tool.is-off {
  opacity: 0.7;
}
.ai-chat {
  display: grid;
  gap: 10px;
  margin-block-end: 18px;
}
.ai-chat-log {
  display: grid;
  gap: 12px;
  max-height: 420px;
  padding: 14px;
  overflow: auto;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 85%;
}
.ai-msg > div,
.ai-msg.is-user {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.ai-msg.is-user {
  display: block;
  margin-inline-start: auto;
  background: var(--accent-soft);
}
.ai-msg p {
  margin: 0 0 6px;
}
.ai-msg small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}
.ai-msg .chip {
  margin: 4px 4px 4px 0;
}
.ai-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ai-chat-form textarea {
  flex: 1;
  resize: vertical;
}
.ai-result {
  display: grid;
  gap: 12px;
}
.ai-summary {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}
.ai-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.ai-metrics div {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ai-metrics small {
  color: var(--muted);
}
.ai-metrics strong {
  font-size: 1.15rem;
}
.ai-findings {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-draft pre {
  padding: 12px;
  white-space: pre-wrap;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ai-meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.ai-perm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.ai-perm ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-timeline {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-timeline small {
  display: block;
  color: var(--muted);
}
@media (max-width: 760px) {
  .ai-msg {
    max-width: 100%;
  }
  .ai-chat-form {
    flex-direction: column;
    align-items: stretch;
  }
}
