:root {
  --bg: #fbf6ee;
  --surface: #fffdf9;
  --border: #eadfcf;
  --text: #2b2420;
  --muted: #6b5e55;
  --primary: #c8643c;
  --primary-dark: #a8431f;
  --sage: #8aa98c;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
}

.topbar-user { display: flex; align-items: center; gap: 12px; margin: 0; }
.muted { color: var(--muted); }

.page {
  width: 100%;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 12px 40px rgba(90, 60, 30, 0.1);
}

.card-narrow {
  width: 100%;
  max-width: 440px;
  margin: 6vh auto 0;
}

h1 { margin: 0 0 16px; font-size: 1.9rem; font-weight: 800; }

.form { display: flex; flex-direction: column; gap: 8px; }
.form label { font-size: 0.95rem; color: var(--muted); margin-top: 8px; }

.form input {
  font: inherit;
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.form input:focus { outline: none; border-color: var(--primary); }

.btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
}

.btn-primary { margin-top: 20px; background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--primary-dark); border: 1px solid var(--border); padding: 8px 16px; }

.notice { border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; }
.notice-error { background: #fbe9e1; color: #8a2f12; border: 1px solid #efc3b0; }

a { color: var(--primary-dark); }

.notice-ok { background: #ddefe8; color: #1f5b4f; border: 1px solid #b7d9cc; }

.page > .card + .card { margin-top: 24px; }
.form select, .form input[type="file"] {
  font: inherit;
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  width: 100%;
}
.dropzone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 3px dashed #e0b49e;
  border-radius: 20px;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; }
.grid-2 > div { display: flex; flex-direction: column; gap: 8px; }
.upload-form .btn-primary { margin-top: 8px; }

.doc-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.doc-table th {
  text-align: left;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
}
.doc-table td { padding: 14px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.doc-table tbody tr:hover { background: #f7f0e4; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions input[type="text"] { max-width: 180px; }
.actions .btn { display: inline-block; text-decoration: none; }
.btn-danger { color: #8a2f12; }
.profile-data dt { font-size: 0.95rem; color: var(--muted); margin-top: 8px; }
.profile-data dd { margin: 0; }
.topbar-user a.muted { text-decoration: none; }
.error-text { margin-top: 6px; font-size: 0.9rem; color: #8a2f12; }

.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.pill-queued { background: #eadfcf; color: #6b5e55; }
.pill-running { background: #fbe3d6; color: #a8431f; }
.pill-ready { background: #ddefe8; color: #1f5b4f; }
.pill-confirmed { background: #c9e3d2; color: #1f5b4f; }
.pill-error { background: #fbe9e1; color: #8a2f12; }

.prompt-text { display: block; width: 100%; box-sizing: border-box; font-family: monospace; margin: 8px 0 12px; }
.doc-table td form { display: inline; }

.inline-form { margin-top: 16px; max-width: 420px; }
.delete-list { margin: 0 0 16px; padding-left: 20px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.num-input { width: 100%; max-width: 12rem; box-sizing: border-box; }
.quota { margin: 0 0 12px; }
