:root {
  --bg: #f3efe6;
  --ink: #1c1a16;
  --muted: #6b6458;
  --card: #fffdf8;
  --line: #ddd4c4;
  --accent: #1f5c4a;
  --accent-2: #c45c26;
  --warn: #8a5a00;
  --ok: #1f5c4a;
  --shadow: 0 10px 30px rgba(40, 30, 10, 0.08);
  --radius: 14px;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #fff8e8, transparent 40%),
    radial-gradient(circle at 90% 10%, #e8f2ee, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 32px 8px;
}
.top h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.sub { margin: 0; color: var(--muted); }

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
}
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }

.layout {
  padding: 16px 32px 48px;
  display: grid;
  gap: 16px;
  max-width: 1200px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.hidden { display: none !important; }

h2 { margin: 0 0 12px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 16px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

.uploads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.file {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #faf7f0;
  cursor: pointer;
}
.file input { width: 100%; }

.primary, .linkbtn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.primary:hover, .linkbtn:hover { filter: brightness(1.05); }
.primary:disabled { opacity: 0.5; cursor: wait; }

.status { min-height: 1.2em; color: var(--muted); font-size: 14px; }
.status.error { color: #9b1c1c; }
.status.ok { color: var(--ok); }

.form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
.secondary:hover { background: #f7f2e8; }

.section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}
.section h3 { margin-top: 0; color: var(--accent-2); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
.field textarea { min-height: 64px; resize: vertical; }
.field.wide { grid-column: 1 / -1; }

.docs {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.doc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.doc-row button {
  border: 1px solid var(--line);
  background: #f7f3ea;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.preview-wrap iframe {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 800px) {
  .top, .layout { padding-left: 16px; padding-right: 16px; }
  .uploads, .grid { grid-template-columns: 1fr; }
  .form-head { flex-direction: column; align-items: stretch; }
}
