:root {
  --bg: #f7f5f1;
  --panel: #ffffff;
  --text: #171615;
  --muted: #625e57;
  --brand-red: #ef4e33;
  --brand-orange: #f58d2f;
  --brand-black: #161616;
  --brand-yellow: #ffc928;
  --line: #ddd5ca;
  --ok: #2f8f5b;
  --warn: #c46a00;
  --err: #b62626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top right, #fff4e6 0%, var(--bg) 44%);
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  line-height: 1.35;
}

a {
  color: #b83c2a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: 'Lora', serif;
  margin: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #fff, #fff7ec);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 175px;
  max-width: 42vw;
  height: auto;
}

.brand-text h1 {
  font-size: 30px;
  color: var(--brand-black);
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--muted);
}

.main-nav {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.main-nav a {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  color: #2a2622;
  font-weight: 600;
}

.main-nav a.active {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
  color: #fff;
  border-color: transparent;
}

.page-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
}

.card + .card {
  margin-top: 14px;
}

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

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

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

label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfc6ba;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

textarea {
  min-height: 120px;
}

button,
.btn {
  border: 0;
  border-radius: 11px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
  color: #fff;
}

.btn-secondary {
  background: #f0e8dc;
  color: #3b3226;
  border: 1px solid #d2c7b7;
}

.btn-danger {
  background: #b62929;
  color: #fff;
}

.flash-stack {
  max-width: 1240px;
  margin: 10px auto 0;
  padding: 0 20px;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 8px;
  border: 1px solid transparent;
}

.flash-success {
  background: #e6f6ee;
  border-color: #99d4b3;
  color: #0d6e3f;
}

.flash-warning {
  background: #fff4df;
  border-color: #f4c57a;
  color: #8f4d00;
}

.flash-error {
  background: #fde8e8;
  border-color: #eaa2a2;
  color: #9d1d1d;
}

.flash-info {
  background: #edf3ff;
  border-color: #b9cbf5;
  color: #244e9a;
}

.dropzone {
  border: 2px dashed #dc8c63;
  border-radius: 14px;
  padding: 30px;
  text-align: center;
  background: linear-gradient(140deg, #fff7ee, #fff);
}

.dropzone.dragover {
  border-color: var(--brand-red);
  background: #ffece8;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  vertical-align: top;
}

th {
  font-family: 'Lora', serif;
  font-size: 18px;
}

.status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 16px;
  display: inline-block;
}

.status-ok {
  background: #dff3e8;
  color: #155f3a;
}

.status-warn {
  background: #ffeace;
  color: #8a4a00;
}

.status-err {
  background: #f8d8d8;
  color: #8d1b1b;
}

.status-neutral {
  background: #ece8e2;
  color: #50483e;
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small {
  font-size: 16px;
  color: var(--muted);
}

.upload-progress {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf4;
  padding: 10px 12px;
}

.upload-progress p {
  margin: 0 0 6px;
}

.upload-progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.upload-progress-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-bottom: 1px dashed #d8cdbd;
  padding: 6px 0;
}

.upload-progress-item:last-child {
  border-bottom: 0;
}

.upload-progress-name {
  color: #2d281f;
  word-break: break-word;
}

.upload-progress-state {
  font-size: 16px;
  color: #6a6257;
  text-align: right;
}

.upload-progress-item.is-pending .upload-progress-state {
  color: #8a4a00;
}

.upload-progress-item.is-ok .upload-progress-state {
  color: #155f3a;
}

.upload-progress-item.is-warn .upload-progress-state {
  color: #8a4a00;
}

.upload-progress-item.is-error .upload-progress-state {
  color: #8d1b1b;
}

.tag {
  border: 1px solid #d3bda8;
  border-radius: 999px;
  display: inline-block;
  padding: 1px 8px;
  margin-right: 4px;
  font-size: 15px;
  background: #fff6ea;
}

@media (max-width: 880px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  body {
    font-size: 19px;
  }

  .brand-text h1 {
    font-size: 24px;
  }

  .page-content {
    padding: 14px;
  }
}

.pdf-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  z-index: 60;
}

.pdf-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdf-modal-inner {
  width: min(1200px, 96vw);
  height: min(92vh, 980px);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pdf-modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

#pdf-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
}
