:root {
  --bg: #f6f1ea;
  --surface: #fffdf9;
  --surface-strong: #fff8ef;
  --ink: #2f261f;
  --muted: #7b6859;
  --accent: #7b3f22;
  --accent-dark: #5f2f19;
  --accent-soft: #ead7c7;
  --border: #e5d6c8;
  --danger: #9a2f22;
  --success: #276749;
  --warning: #9a6700;
  --shadow: 0 18px 40px rgba(74, 45, 25, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Times New Roman", Times, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff4e8 0, transparent 34rem), var(--bg);
  font-size: 18px;
  line-height: 1.55;
}

a { color: inherit; }
.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.hidden { display: none !important; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 76px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  letter-spacing: 0.04em;
}
.logo-text { font-size: 22px; }
.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.top-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  transition: 0.2s ease;
}
.top-nav a:hover,
.top-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.hero {
  padding: 54px 0 34px;
}
.hero--compact { padding: 40px 0 24px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 32px;
  align-items: center;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 14px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 16px;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
h2 { font-size: 30px; line-height: 1.15; }
.lead {
  max-width: 790px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 21px;
}
.hero-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card__title {
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.phone {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 28px;
  font-weight: 700;
  text-decoration: none;
}

.page-section { padding: 22px 0 70px; }
.page-section--narrow { width: min(860px, calc(100% - 32px)); }
.form-card,
.result-card,
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-card { padding: clamp(22px, 4vw, 40px); }
.form-card__head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.order-number-box {
  min-width: 250px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.order-number-box span {
  display: block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}
.order-number-box strong {
  display: block;
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 21px;
}
fieldset {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
}
legend {
  width: 100%;
  margin-bottom: 18px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  color: var(--accent-dark);
  font-size: 24px;
  font-weight: 700;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field--full { grid-column: 1 / -1; }
.field--small { min-width: 240px; }
label {
  font-weight: 700;
  color: var(--ink);
}
.required { color: var(--danger); }
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea { resize: vertical; min-height: 110px; }
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(123, 63, 34, 0.12);
}
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
}
.checkbox-line input { width: 18px; min-width: 18px; margin-top: 6px; }
.form-actions,
.admin-actions,
.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.form-actions {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(123, 63, 34, 0.22);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.btn-danger {
  background: #f3d5cf;
  color: var(--danger);
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateY(0); }

.result-card {
  margin-top: 22px;
  padding: 28px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
}
.status-accepted { background: #e9f2ff; color: #1d4e89; }
.status-processing { background: #fff2cc; color: var(--warning); }
.status-delivery { background: #e7f7ee; color: var(--success); }
.status-issued { background: #efe7ff; color: #56318d; }
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 20px 0 0;
}
.details-grid dt {
  color: var(--muted);
  font-weight: 700;
}
.details-grid dd { margin: 0 0 8px; }

.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.table-card { overflow: hidden; }
.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.orders-table th,
.orders-table td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.orders-table th {
  background: var(--surface-strong);
  color: var(--accent-dark);
  font-size: 16px;
}
.orders-table td { font-size: 16px; }
.orders-table select { min-width: 150px; padding: 9px 10px; }
.table-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.table-actions .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 15px;
}
.empty-state {
  padding: 50px 24px;
  text-align: center;
}
.empty-state p { color: var(--muted); }

.print-page { background: #fff; }
.print-wrap {
  width: min(900px, calc(100% - 32px));
  margin: 28px auto;
}
.print-blank {
  padding: 36px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
}
.print-head {
  text-align: center;
  border-bottom: 2px solid #000;
  margin-bottom: 22px;
  padding-bottom: 16px;
}
.print-head h1 { font-size: 30px; margin-bottom: 8px; }
.print-head p { margin-bottom: 4px; }
.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}
.print-table th,
.print-table td {
  border: 1px solid #000;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 16px;
}
.print-table th { width: 34%; background: #f2f2f2; }
.signature-grid {
  display: grid;
  grid-template-columns: 1fr 180px 180px;
  gap: 18px;
  margin-top: 34px;
}
.signature-grid span {
  display: inline-block;
  min-width: 100%;
  border-bottom: 1px solid #000;
}
.print-actions { margin-top: 18px; }

@media (max-width: 900px) {
  .header-inner,
  .admin-hero,
  .form-card__head {
    align-items: flex-start;
    flex-direction: column;
  }
  .top-nav { justify-content: flex-start; }
  .hero-grid,
  .form-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }
  .order-number-box { width: 100%; }
  .orders-table {
    min-width: 900px;
  }
  .table-card { overflow-x: auto; }
}

@media (max-width: 520px) {
  body { font-size: 17px; }
  .container { width: min(100% - 20px, 1180px); }
  .form-card { padding: 18px; }
  .top-nav a { padding: 8px 10px; }
  .signature-grid { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; font-size: 14px; }
  .no-print, .site-header, .toast { display: none !important; }
  .print-wrap { width: 100%; margin: 0; }
  .print-blank { border: 0; padding: 0; }
  .print-table th,
  .print-table td { font-size: 13px; }
  .print-head h1 { font-size: 22px; }
  .signature-grid { grid-template-columns: 1fr 160px 160px; }
}

.instruction-link,
.form-instruction-link,
.checkbox-line a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.instruction-link {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
}
.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}
.form-instruction-link {
  margin-left: auto;
}
.consent-field {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}
.checkbox-line input[aria-invalid="true"] {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}
.document-page h1 {
  font-size: clamp(34px, 5vw, 50px);
}
.document-card {
  padding: clamp(24px, 5vw, 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.document-card h2 {
  margin-top: 30px;
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 26px;
}
.document-list {
  margin: 0;
  padding-left: 24px;
}
.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .form-instruction-link { margin-left: 0; width: 100%; }
}

/* WordPress integration */
body.mba-site { margin: 0; }
body.mba-site .mba-hp {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}
body.mba-site button:disabled { opacity: 0.65; cursor: wait; transform: none; }
body.mba-site #wpadminbar { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
@media screen and (max-width: 782px) {
  body.admin-bar.mba-site .site-header { top: 46px; }
}
@media screen and (min-width: 783px) {
  body.admin-bar.mba-site .site-header { top: 32px; }
}
