:root {
  --bg: #eef5ef;
  --bg-2: #e2efe4;
  --panel: rgba(255, 255, 255, 0.94);
  --ink: #103425;
  --muted: #4f6f5f;
  --line: #c5d9c9;
  --accent: #0f6a3d;
  --accent-dark: #0a512f;
  --accent-soft: #dcefe1;
  --success: #dff3e3;
  --success-ink: #1d5a31;
  --error: #f8dfdb;
  --error-ink: #852c21;
  --shadow: 0 20px 45px rgba(18, 58, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(10, 81, 47, 0.08), rgba(10, 81, 47, 0) 22%),
    radial-gradient(circle at top left, rgba(15, 106, 61, 0.1), transparent 28%),
    radial-gradient(circle at bottom right, rgba(49, 112, 70, 0.08), transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.shell--auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.brand-bar {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  margin-bottom: 18px;
  border: 1px solid rgba(15, 106, 61, 0.18);
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(11, 76, 44, 0.98), rgba(19, 107, 60, 0.92));
  color: #f7fff8;
  box-shadow: var(--shadow);
}

.brand-mark {
  flex: 0 0 auto;
}

.brand-mark__logo {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
}

.brand-copy__kicker,
.brand-copy__sub {
  margin: 0;
  color: rgba(247, 255, 248, 0.88);
}

.brand-copy__kicker {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.brand-copy__title {
  margin: 6px 0 4px;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.brand-copy__sub {
  font-size: 1rem;
}

.hero {
  padding: 28px;
  border: 1px solid rgba(15, 106, 61, 0.15);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(220, 239, 225, 0.85), rgba(255, 255, 255, 0.9)),
    linear-gradient(140deg, rgba(15, 106, 61, 0.08), transparent 55%);
  box-shadow: var(--shadow);
}

.hero h1,
.panel h2,
.file-card h3 {
  margin: 0;
  line-height: 1.08;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  max-width: 13ch;
}

.hero__text,
.hint,
.section-head p,
.file-card p,
.qr-text,
.empty {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--accent);
  margin: 0 0 10px;
  font-weight: 700;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(15, 106, 61, 0.12);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.auth-panel {
  width: min(620px, 100%);
}

.topbar {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.topbar__links {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.form {
  display: grid;
  gap: 16px;
}

.form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.form span {
  font-size: 0.98rem;
}

input[type="text"],
input[type="password"],
textarea,
input[type="file"],
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(15, 106, 61, 0.2);
  border-color: rgba(15, 106, 61, 0.45);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #f6fff9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 24px rgba(15, 106, 61, 0.18);
}

.button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  border: 1px solid rgba(15, 106, 61, 0.16);
  box-shadow: none;
}

.button--danger {
  background: #b63527;
  color: #fffaf6;
  border: 0;
  padding: 10px 14px;
  box-shadow: none;
}

.button--danger:hover {
  background: #8f271d;
}

.notice {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 18px;
  font-weight: 700;
}

.notice--success {
  background: var(--success);
  color: var(--success-ink);
}

.notice--error {
  background: var(--error);
  color: var(--error-ink);
}

.results {
  display: grid;
  gap: 18px;
}

.file-card {
  border: 1px solid rgba(15, 106, 61, 0.14);
  border-radius: 20px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 251, 246, 0.95));
}

.file-card__top,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.file-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.qr-block {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.qr-block img {
  width: 140px;
  height: 140px;
  border-radius: 18px;
  border: 1px solid rgba(15, 106, 61, 0.12);
  background: #fff;
  padding: 8px;
}

code {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.96rem;
  word-break: break-word;
}

.qr-actions {
  margin-top: 14px;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.audit-details {
  min-width: 260px;
  max-width: 380px;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.status-badge--pending {
  background: #fff1cb;
  color: #7b5a00;
}

.status-badge--approved {
  background: #dff3e3;
  color: #1d5a31;
}

.status-badge--rejected {
  background: #f8dfdb;
  color: #852c21;
}

.status-badge--printed {
  background: #dce8fb;
  color: #214a85;
}

.table th {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card h2 {
  margin-top: 8px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.public-actions {
  margin-top: 18px;
}

.print-page {
  background: #f6fbf7;
  margin: 0;
}

.print-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  gap: 18px;
}

.print-card {
  width: 40mm;
  height: 30mm;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7mm;
  overflow: hidden;
}

.print-qr {
  display: block;
  width: 20mm;
  height: 20mm;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  image-rendering: pixelated;
}

.print-file-number {
  margin: 0;
  font-size: 7pt;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  color: #000;
}

.print-date-time {
  margin: 0;
  font-size: 4.9pt;
  line-height: 1.05;
  color: #000;
  text-align: center;
}

.print-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0;
}

@media print {
  @page {
    size: 40mm 30mm;
    margin: 0;
  }

  body.print-page {
    background: #fff;
    width: 40mm;
    height: 30mm;
    margin: 0;
    overflow: hidden;
  }

  .no-print {
    display: none !important;
  }

  .print-shell {
    padding: 0;
    min-height: auto;
    width: 40mm;
    height: 30mm;
    display: block;
    gap: 0;
  }

  .print-card {
    box-shadow: none;
    border: 0;
    width: 40mm;
    height: 30mm;
    border-radius: 0;
    padding: 0;
    margin: 0;
    page-break-after: avoid;
    break-after: avoid;
  }

  .print-qr {
    width: 20mm;
    height: 20mm;
    margin: 0 auto;
  }
}

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

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

  .file-card__top,
  .section-head,
  .topbar,
  .topbar__links,
  .brand-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-mark__logo {
    width: 72px;
    height: 72px;
  }
}

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

  .file-card__actions {
    justify-content: flex-start;
  }
}
