* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f6f7f9; color: #1f2933; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 20px; background: #ffffff; border-bottom: 1px solid #d9dee7; }
nav { display: flex; gap: 12px; flex-wrap: wrap; }
a { color: #0b5cad; text-decoration: none; }
main { width: min(1100px, 94vw); margin: 24px auto; }
h1 { font-size: 26px; margin: 0 0 18px; }
.form { display: grid; gap: 14px; max-width: 520px; padding: 18px; background: #ffffff; border: 1px solid #d9dee7; border-radius: 8px; }
.form.inline { max-width: none; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
label { display: grid; gap: 6px; font-weight: 700; }
label.checkbox { display: flex; align-items: center; gap: 8px; }
label.checkbox input { width: auto; }
input, select, button { width: 100%; padding: 11px 12px; border: 1px solid #b8c2cc; border-radius: 6px; font: inherit; }
button, .button, .action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: #0b5cad;
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
.button.secondary, button.secondary, .action-button.secondary { background: #52616f; color: #ffffff; }
button.danger, .action-button.danger { background: #b42318; color: #ffffff; }
.action-button, .actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 14px;
}
.action-button.print { background: #1f7a4d; }
.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input, .search select { max-width: 420px; }
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
}
.filter-actions { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.filter-actions button, .filter-actions .button { min-height: 40px; height: 40px; }
.error { padding: 10px 12px; background: #fde8e8; color: #8a1f1f; border-radius: 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #ffffff; border: 1px solid #d9dee7; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #e5e9f0; vertical-align: top; }
th { background: #eef2f7; }
small { display: block; color: #667085; margin-top: 3px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 156px; }
.document-actions { min-width: 250px; }
.actions form { margin: 0; }
h2 { font-size: 20px; margin: 24px 0 12px; }
.viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
}
.document-viewer {
  min-height: 70vh;
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  overflow: hidden;
}
.document-side {
  padding: 14px;
  border-bottom: 1px solid #d9dee7;
}
.document-side:last-child { border-bottom: 0; }
.document-side img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
.document-side iframe {
  display: block;
  width: 100%;
  min-height: 78vh;
  border: 0;
}
.print-side-title { font-size: 16px; margin: 0 0 12px; }
@media (max-width: 640px) {
  header { align-items: flex-start; flex-direction: column; }
  .search { flex-direction: column; }
  .viewer-toolbar { align-items: flex-start; flex-direction: column; }
  .document-actions { min-width: 0; }
}
@media print {
  @page { size: A4; margin: 10mm; }
  header, .filters, .no-print, .button, .actions, p { display: none !important; }
  body { background: #ffffff; }
  main { width: 100%; margin: 0; }
  h1 { font-size: 18px; }
  .table-wrap, table { overflow: visible; border: 0; }
  th, td { border: 1px solid #cccccc; font-size: 12px; }
  body.printing-document h1, body:has(.print-document) h1, .print-side-title { display: none !important; }
  body.printing-document main, body:has(.print-document) main { display: block; width: 100%; height: auto; }
  .print-document {
    width: 190mm;
    border: 0;
    overflow: visible;
    min-height: auto;
  }
  .document-side {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 190mm;
    min-height: 277mm;
    padding: 0;
    border: 0;
    page-break-after: always;
    page-break-inside: avoid;
  }
  .document-side:last-child { page-break-after: auto; }
  .document-side img {
    max-width: 190mm;
    max-height: 277mm;
    width: auto;
    height: auto;
    object-fit: contain;
  }
  .document-side iframe {
    width: 190mm;
    height: 277mm;
    min-height: 277mm;
    border: 0;
  }
}
