:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --text: #18202b;
  --muted: #657181;
  --line: #d8e0e7;
  --soft: #eef3f6;
  --blue: #145ecb;
  --blue-soft: #eaf2ff;
  --green: #168454;
  --green-soft: #e9f7ef;
  --amber: #9a5b08;
  --amber-soft: #fff5df;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(920px, calc(100% - 32px));
  min-height: 92px;
  margin: 0 auto;
}

.header-inner img {
  flex: 0 0 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

h1, h2, p { margin: 0; }
h1 { font-size: 22px; letter-spacing: 0; }
.header-inner p { margin-top: 2px; color: var(--muted); font-size: 12px; }

.secure-state {
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid #b9e2cb;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.customer-link {
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.secure-state.insecure {
  border-color: #f0cf94;
  background: var(--amber-soft);
  color: var(--amber);
}

main {
  display: grid;
  gap: 16px;
  width: min(920px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.security-alert {
  padding: 12px 14px;
  border: 1px solid #f0cf94;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #754204;
  font-size: 14px;
}

.order-form,
.lookup-section,
.receipt {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-section { padding: 24px; border-bottom: 1px solid var(--line); }

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.section-heading > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.section-heading h2 { font-size: 16px; letter-spacing: 0; }
.section-heading p { margin-top: 1px; color: var(--muted); font-size: 11px; }
.section-heading.compact { margin-bottom: 12px; }

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

label { display: grid; gap: 6px; min-width: 0; }
label > span { color: #455164; font-size: 12px; font-weight: 700; }
.full { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input, select { height: 42px; padding: 9px 11px; }
textarea { min-height: 84px; padding: 10px 11px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(20, 94, 203, 0.12);
}

.schedule-rows { display: grid; gap: 10px; }

.schedule-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.7fr) 42px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcfd;
}

.schedule-hint {
  grid-column: 1 / 3;
  min-height: 17px;
  color: var(--muted);
  font-size: 12px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

button.primary { border-color: var(--blue); background: var(--blue); color: #fff; font-weight: 700; }
button.secondary { background: #fff; color: var(--text); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
.add-row { margin-top: 10px; }
.icon-button { width: 42px; padding: 0; background: #fff; color: #8b3440; font-size: 20px; }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 18px 24px 0;
}

.consent input { width: 18px; height: 18px; margin: 0; }
.consent span { padding-top: 1px; font-weight: 500; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; }

.submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 16px 24px;
}

.submit-row button { min-width: 130px; }
.submit-row span { color: var(--muted); font-size: 13px; }
.submit-row span.error { color: #a12634; }

.receipt {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 22px 24px;
  border-color: #b9e2cb;
  background: #fbfffd;
}

.receipt-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.receipt h2 { font-size: 17px; }
.receipt p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.receipt-orders { display: grid; gap: 6px; margin-top: 12px; }
.receipt-order { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; }
.receipt-order code { color: var(--blue); font-weight: 700; }

.lookup-section { padding: 20px 24px; }
.lookup-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; max-width: 620px; }
.lookup-result { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.lookup-result strong { color: var(--text); }

@media (max-width: 680px) {
  .header-inner, main { width: min(100% - 20px, 920px); }
  main { margin-top: 10px; }
  .form-section, .lookup-section { padding: 18px 14px; }
  .field-grid, .schedule-row, .lookup-form { grid-template-columns: 1fr; }
  .schedule-row { position: relative; padding-right: 58px; }
  .schedule-row .icon-button { position: absolute; right: 10px; top: 10px; }
  .schedule-hint { grid-column: 1 / -1; }
  .full { grid-column: auto; }
  .consent { padding: 16px 14px 0; }
  .submit-row { align-items: stretch; flex-direction: column; padding: 14px; }
  .receipt { grid-template-columns: 1fr; padding: 18px; }
}
