:root {
  color-scheme: light;
  --navy: #071a2f;
  --ink: #142033;
  --line: #d7dde6;
  --muted: #667085;
  --paper: #f7f3eb;
  --surface: #ffffff;
  --bronze: #9f7a45;
  --focus: #315f8f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  color: #fff;
  background: var(--navy);
  border-bottom: 3px solid var(--bronze);
}

.topbar img {
  width: 110px;
  height: auto;
}

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

.topbar span {
  color: #d8e1ea;
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(360px, 1.05fr);
  gap: 20px;
  padding: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  min-width: 0;
}

.section-title p {
  margin: 0 0 6px;
  color: var(--bronze);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 18px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
}

form,
label {
  display: grid;
  gap: 8px;
}

[hidden] {
  display: none !important;
}

form {
  gap: 14px;
}

label {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.hint {
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d0dc;
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--focus), transparent 75%);
  border-color: var(--focus);
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

.preview,
#status,
.status {
  min-height: 48px;
  padding: 12px;
  border: 1px solid #d9c7a8;
  border-radius: 6px;
  color: #604716;
  background: #fff8eb;
  overflow-wrap: anywhere;
}

#status:empty {
  display: none;
}

.status:empty {
  display: none;
}

button,
.doc a,
.preview-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  background: var(--navy);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.search {
  margin-bottom: 16px;
}

.documents {
  display: grid;
  gap: 10px;
}

.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.doc strong,
.doc span,
.doc small {
  display: block;
  overflow-wrap: anywhere;
}

.doc strong {
  margin-bottom: 5px;
}

.doc span,
.doc small,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.doc small {
  margin-top: 5px;
}

.doc-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.doc-actions button,
.doc-actions a {
  white-space: nowrap;
}

.doc-actions a,
.preview-actions a:first-child {
  color: var(--navy);
  background: #eef2f6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 26, 47, .62);
}

.preview-modal {
  width: min(1120px, 100%);
  height: min(86vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(7, 26, 47, .28);
}

.preview-head,
.preview-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.preview-head p,
.preview-head h2 {
  margin: 0;
}

.preview-head p {
  color: var(--bronze);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.preview-head h2 {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 18px;
}

.document-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #f8fafc;
}

.preview-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

@media (max-width: 900px) {
  .layout,
  .two,
  .three {
    grid-template-columns: 1fr;
  }

  .layout {
    padding: 14px;
  }

  .topbar {
    padding: 0 16px;
  }

  .doc,
  .doc-actions {
    grid-template-columns: 1fr;
  }

  .doc-actions {
    display: grid;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .preview-modal {
    height: 92vh;
  }

  .preview-head,
  .preview-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
