/* White document-card structure and green/light theme adapted from pinned
   Paperless-ngx styles; native Bookify responsive forms. GPL-3.0. */
:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #212b23;
  background: #fff;
  --primary: #17541f;
  --light: #f4f6f5;
  --border: #d8dfda;
  --radius: 0.55rem;
  line-height: 1.5;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 1160px;
  margin: auto;
  padding: 20px;
}
header {
  margin: 12px 0 28px;
}
h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 8px 0;
}
h2 {
  font-size: 1.35rem;
  line-height: 1.3;
}
h3 {
  font-size: 1rem;
  margin: 8px 0;
}
p {
  margin: 10px 0;
}
h1,
h2,
h3,
p,
code,
li {
  overflow-wrap: anywhere;
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 700;
}
.meta,
footer {
  font-size: 0.875rem;
  color: #55645a;
}
.notice {
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  background: var(--light);
  border-radius: 4px;
}
.error {
  border-color: #a32d23;
  color: #81281f;
  background: #fff3f0;
}
.warning {
  background: #fff8e2;
  color: #654d12;
}
.actions,
nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
nav {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
button,
.file-button {
  border: 1px solid #aebbb2;
  border-radius: var(--radius);
  background: #fff;
  color: #243b2b;
  padding: 10px 14px;
  min-height: 42px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
}
button:hover,
.file-button:hover {
  background: #edf3ee;
}
button.primary,
nav button[aria-current] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #799e7f;
  outline-offset: 2px;
}
.toolbar {
  margin: 20px 0;
}
.file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  background: #fff;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 0;
  margin: 12px 0;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid #abb9ae;
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  margin-top: 6px;
  min-height: 44px;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
fieldset {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 18px 0;
}
legend {
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: var(--primary);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 18px;
  margin: 22px 0;
}
.document-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 0.125rem 0.25rem #00000013;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.doc-img-container {
  height: 200px;
  position: relative;
  background: #e9edeb;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.doc-img-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.paper-icon {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 5rem;
  color: #b1c0b4;
}
.card-check {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 68%;
  background: #ffffffed;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2px 7px;
}
.card-check label {
  font-size: 0.75rem;
  margin: 5px 0;
}
.tags {
  position: absolute;
  right: 6px;
  top: 6px;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 4px;
  max-width: 40%;
}
.badge {
  font-size: 0.75rem;
  display: inline-block;
  line-height: 1.3;
  border-radius: 4px;
  padding: 4px 7px;
  background: #dcecdf;
  color: #194820;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.badge.warning {
  background: #fff1ca;
  color: #684b03;
}
.card-body {
  padding: 12px;
  background: var(--light);
}
.sender {
  color: var(--primary);
  font-weight: 700;
}
.card-footer {
  padding: 8px 12px 14px;
  background: var(--light);
  flex: 1;
}
.card-footer p {
  font-size: 0.85rem;
  margin: 6px 0;
}
.card-footer .actions {
  margin-top: 12px;
}
.card-footer button {
  font-size: 0.8rem;
  padding: 8px 10px;
}
.cards .panel {
  margin: 0;
}
.cards code {
  display: block;
  margin: 12px 0;
}
.preview {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  border: 1px solid var(--border);
  background: white;
  margin: 16px 0;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 400px;
  overflow: auto;
  background: var(--light);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}
details {
  margin: 16px 0;
}
summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
}
code {
  font-size: 0.85rem;
}
footer {
  margin: 32px 0 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
a {
  color: var(--primary);
}
.empty {
  padding: 20px;
  background: var(--light);
}
@media (max-width: 600px) {
  main {
    padding: 16px;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 14px;
  }
  fieldset {
    padding: 12px;
  }
  nav button {
    flex: 1 1 40%;
  }
  .actions {
    align-items: stretch;
  }
  .toolbar > button,
  .toolbar > .file-button {
    flex: 1 1 45%;
  }
  .card-check {
    max-width: 65%;
  }
}
@media print {
  nav,
  .toolbar,
  footer,
  button,
  .file-button {
    display: none;
  }
  .panel,
  .document-card {
    break-inside: avoid;
    box-shadow: none;
  }
  main {
    max-width: none;
    padding: 0;
  }
}

/* Keep the accessible selection label from covering the document preview. */
.card-check {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
}
.card-check .check {
  font-size: 0;
  margin: 0;
  gap: 0;
}
