:root {
  color-scheme: light;
  --ink: #173b40;
  --ink-soft: #45666a;
  --teal: #17656a;
  --teal-deep: #104e53;
  --teal-pale: #e4f0ee;
  --paper: #f3f6f1;
  --surface: #fffefa;
  --line: #b9cbc7;
  --muted: #617579;
  --red: #b63232;
  --red-pale: #fff0ed;
  --amber: #985a14;
  --amber-pale: #fff4df;
  --focus: #a75815;
  --shadow: 0 18px 48px rgba(22, 61, 63, .09);
  --font: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-deep); text-underline-offset: 3px; }
a:hover { color: #0b4145; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.site-header {
  background: var(--teal-deep);
  color: #f6fbf8;
  border-bottom: 5px solid #c85143;
}
.header-inner {
  width: min(1120px, calc(100% - 36px));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -.025em;
}
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: #c85143;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}
.header-nav { display: flex; gap: 22px; }
.header-nav a { color: #e5f1ed; font-size: 15px; font-weight: 650; }

.page-wrap { width: min(1120px, calc(100% - 36px)); margin: 0 auto; }
.page-wrap.narrow { width: min(780px, calc(100% - 36px)); }
.page-top { padding: 42px 0 27px; }
.eyebrow {
  margin: 0 0 9px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(2.15rem, 5vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -.055em;
  font-weight: 760;
}
h2 { margin-bottom: 6px; font-size: 1.45rem; line-height: 1.22; letter-spacing: -.025em; }
h3 { font-size: 1.08rem; }
.lede { max-width: 690px; margin-bottom: 0; color: var(--ink-soft); font-size: 1.12rem; }

.layout-main { padding: 0 0 72px; }
.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 28px;
}
.form-panel, .side-panel, .content-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.form-panel { padding: clamp(22px, 4vw, 38px); }
.side-panel { position: sticky; top: 22px; padding: 23px; }
.side-panel h2 { font-size: 1.12rem; }
.side-panel p { color: var(--ink-soft); font-size: .94rem; }
.side-panel .aside-rule { margin: 19px 0; border: 0; border-top: 1px solid var(--line); }
.aside-number {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 15px;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--line);
}
.section-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.form-section + .form-section { margin-top: 34px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .label-text {
  display: block;
  margin: 0 0 7px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 720;
}
.required { color: var(--red); }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.field input, .field select, .field textarea, .login-input {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 1.5px solid #8fa9a6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}
.field textarea { min-height: 128px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #788b8d; opacity: 1; }
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.check-card {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  font-weight: 650;
  cursor: pointer;
}
.check-card input, .consent-row input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  accent-color: var(--teal);
}
.privacy-note, .warning-note, .success-note, .error-note {
  padding: 15px 17px;
  border-radius: 8px;
  font-size: .93rem;
}
.privacy-note { border-left: 4px solid var(--teal); background: var(--teal-pale); color: #214e50; }
.warning-note { border-left: 4px solid #d38a29; background: var(--amber-pale); color: #624312; }
.success-note { border-left: 4px solid var(--teal); background: var(--teal-pale); }
.error-note { border-left: 4px solid var(--red); background: var(--red-pale); color: #762222; }
.notice-list { margin: 8px 0 0; padding-left: 20px; }
.notice-list li + li { margin-top: 5px; }
.counter-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.counter { color: var(--teal-deep); font-size: .9rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.counter.is-warn { color: var(--amber); }
.counter.is-over { color: var(--red); }
.counter-caption { color: var(--muted); font-size: .82rem; }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8faf7;
}
.consent-row label { font-size: .95rem; font-weight: 630; line-height: 1.5; }
.button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 2px solid var(--teal-deep);
  border-radius: 8px;
  background: var(--teal-deep);
  color: #fff;
  font-weight: 760;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease, transform .16s ease;
}
.button:hover { background: #0b4145; color: #fff; transform: translateY(-1px); }
.button.secondary { background: transparent; color: var(--teal-deep); }
.button.secondary:hover { background: var(--teal-pale); color: var(--teal-deep); }
.button.danger { border-color: #812525; background: #812525; }
.button.danger:hover { border-color: #681d1d; background: #681d1d; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 23px; }
.form-footnote { margin: 13px 0 0; color: var(--muted); font-size: .85rem; }
.form-error-list { margin: 0 0 24px; }

.content-panel { padding: clamp(24px, 5vw, 42px); }
.danger-zone { margin-top: 24px; border: 1px solid #d9a8a8; border-radius: 12px; background: #fffafa; }
.danger-zone p { max-width: 70ch; }
.centered { text-align: center; }
.status-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-pale);
  color: var(--teal-deep);
  font-size: 27px;
  font-weight: 800;
}
.qr-image {
  display: block;
  width: min(290px, 78vw);
  height: auto;
  margin: 22px auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.record-id { color: var(--muted); font-size: .88rem; }
.record-id strong { color: var(--ink); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.action-stack { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 22px 0; }

.login-card { max-width: 520px; margin: 0 auto; }
.login-card .field { margin-top: 18px; }
.login-card .button { width: 100%; margin-top: 22px; }
.attempts { margin-top: 14px; color: var(--red); font-weight: 700; }

.record-hero {
  margin: -1px -1px 24px;
  padding: 26px clamp(22px, 4vw, 38px);
  border-radius: 14px 14px 0 0;
  background: var(--teal-deep);
  color: #f5fbf8;
}
.record-hero .eyebrow { color: #b9dcd6; }
.record-hero h1 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3rem); }
.record-section { padding: 0 clamp(22px, 4vw, 38px) 26px; }
.record-section h2 { padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.record-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 18px 0 0;
}
.record-values div { min-width: 0; }
.record-values dt { color: var(--muted); font-size: .83rem; font-weight: 720; text-transform: uppercase; letter-spacing: .06em; }
.record-values dd { margin: 3px 0 0; font-size: 1.12rem; font-weight: 650; overflow-wrap: anywhere; }
.record-critical {
  padding: 17px;
  border: 1px solid #e0aaa3;
  border-radius: 9px;
  background: #fff5f2;
}
.record-critical h2 { color: #812c2c; }
.flag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.flag {
  padding: 7px 10px;
  border-radius: 5px;
  background: #f6e7e3;
  color: #682d2d;
  font-size: .88rem;
  font-weight: 720;
}
.record-footer { padding: 0 clamp(22px, 4vw, 38px) 28px; color: var(--muted); font-size: .9rem; }

.attachments-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf7;
}
.attachments-section .section-heading { align-items: center; }
.attachments-section .section-heading p { margin-top: 5px; }
.attachment-count { flex: 0 0 auto; color: var(--muted); font-size: .85rem; font-weight: 700; }
.attachment-privacy { font-size: .88rem; }
.attachment-upload-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.attachment-upload-row .field-hint { margin: 0; }
.attachment-picker { min-height: 48px; }
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.attachment-upload-row:focus-within .attachment-picker { outline: 3px solid var(--focus); outline-offset: 3px; }
.attachment-status { min-height: 1.5em; margin: 15px 0 0; color: var(--muted); font-size: .9rem; }
.attachment-status.is-error { color: #812525; font-weight: 700; }
.attachment-list { display: grid; gap: 9px; margin: 10px 0 0; padding: 0; list-style: none; }
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.attachment-open {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 3px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.attachment-open:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.attachment-type-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-pale);
  color: var(--teal-deep);
  font-size: .73rem;
  font-weight: 850;
}
.attachment-file-copy { display: grid; min-width: 0; gap: 2px; }
.attachment-file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-file-copy small { color: var(--muted); font-size: .82rem; }
.attachment-remove { flex: 0 0 auto; padding: 9px 11px; border: 0; border-radius: 7px; background: transparent; color: #812525; font-size: .88rem; font-weight: 750; cursor: pointer; }
.attachment-remove:hover { background: var(--red-pale); }
.attachment-empty { padding: 14px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; font-size: .9rem; }

.attachment-viewer {
  width: min(1180px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101b1d;
  color: #fff;
  box-shadow: 0 22px 80px rgba(0, 0, 0, .36);
}
.attachment-viewer::backdrop { background: rgba(5, 20, 22, .78); backdrop-filter: blur(3px); }
.attachment-viewer-shell { display: flex; max-height: calc(100dvh - 26px); flex-direction: column; }
.attachment-viewer-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.attachment-viewer-header h2 { min-width: 0; margin: 0; overflow: hidden; color: #fff; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.attachment-viewer-header .button { min-height: 42px; flex: 0 0 auto; border-color: rgba(255, 255, 255, .45); color: #fff; }
.attachment-viewer-stage { display: grid; min-height: 260px; height: min(74vh, 850px); flex: 1 1 auto; place-items: center; overflow: hidden; background: #172326; }
.attachment-preview-image { max-width: 100%; max-height: 100%; object-fit: contain; touch-action: none; user-select: none; will-change: transform; }
.attachment-preview-pdf { width: 100%; height: 100%; border: 0; background: #fff; }
.attachment-viewer-error { margin: 24px; color: #fff; text-align: center; }
.attachment-viewer-controls { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 10px; padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .15); }
.attachment-viewer-controls .button { min-height: 42px; border-color: rgba(255, 255, 255, .4); color: #fff; }
.attachment-viewer-controls span { margin-left: 6px; color: #d4e0de; font-size: .8rem; }

.site-footer {
  padding: 22px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: .84rem;
}
.site-footer a { font-weight: 700; }

@media (max-width: 820px) {
  .create-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .side-panel .aside-rule { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .header-inner { width: calc(100% - 28px); min-height: 64px; }
  .header-nav { gap: 12px; }
  .header-nav a { font-size: 14px; }
  .page-wrap, .page-wrap.narrow { width: calc(100% - 26px); }
  .page-top { padding: 32px 0 22px; }
  .field-grid, .choice-grid, .record-values { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr; }
  .form-panel { padding: 22px 17px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 5px; }
  .button-row, .action-stack { flex-direction: column; }
  .button-row .button, .action-stack .button { width: 100%; }
  .record-section { padding-left: 20px; padding-right: 20px; }
  .attachments-section { padding: 16px; }
  .attachments-section .section-heading { display: flex; align-items: flex-start; }
  .attachment-upload-row { align-items: flex-start; flex-direction: column; }
  .attachment-item { align-items: flex-start; }
  .attachment-remove { align-self: center; }
  .attachment-viewer { width: 100vw; max-height: 100dvh; border-radius: 0; }
  .attachment-viewer-shell { max-height: 100dvh; }
  .attachment-viewer-stage { height: 74dvh; }
  .attachment-viewer-controls { flex-wrap: wrap; }
  .attachment-viewer-controls span { width: 100%; margin: 0; text-align: center; }
}

/* The label is intentionally sparse so the QR remains easy to scan after printing. */
.label-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e8eeeb; }
.print-label {
  width: 3.5in;
  height: 2in;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: .15in;
  border: 1px solid #d1d9d6;
  background: #fff;
  color: #171717;
  font-family: Arial, sans-serif;
}
.label-copy { width: 1.3in; text-align: center; }
.label-cross { width: 39px; height: 39px; margin-bottom: 5px; }
.label-title { display: block; color: #aa2525; font-size: 16px; line-height: 1; font-weight: 900; letter-spacing: .01em; white-space: nowrap; }
.label-phone { display: block; margin-top: 8px; font-size: 8px; line-height: 1.15; font-weight: 700; overflow-wrap: anywhere; }
.label-qr { width: 1.72in; height: 1.72in; object-fit: contain; }
@media print {
  @page { size: 3.5in 2in; margin: 0; }
  html, body, .label-page { width: 3.5in; height: 2in; min-height: 0; padding: 0; margin: 0; background: #fff; }
  .print-label { border: 0; }
}
