:root {
  --ink: #17211d;
  --muted: #67736d;
  --paper: #f5f3ed;
  --white: #fffefb;
  --line: #d9ddd8;
  --green: #1e604c;
  --green-dark: #174b3c;
  --lime: #c7dc73;
  --danger: #a33f35;
  --shadow: 0 20px 60px rgba(28, 46, 38, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 10%, rgba(199, 220, 115, 0.28), transparent 27rem),
    var(--paper);
  font-family: "DM Sans", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px;
  padding: 0 max(5vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 33, 29, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--green);
  border-radius: 50% 50% 50% 12px;
  font-family: "DM Serif Display", serif;
  font-size: 21px;
}

main {
  width: min(1160px, 90vw);
  margin: 0 auto;
  padding: 72px 0 96px;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(540px, 1.28fr);
  gap: clamp(48px, 8vw, 120px);
  align-items: start;
}

.intro { position: sticky; top: 120px; padding-top: 28px; }
.eyebrow { margin: 0 0 14px; color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }

h1 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 400;
  line-height: 0.97;
  letter-spacing: -0.045em;
}

h1 em { color: var(--green); font-weight: 400; }
.intro-copy { max-width: 370px; margin-top: 30px; color: var(--muted); font-size: 17px; line-height: 1.65; }

.workspace { min-width: 0; }
.search-card, .record-card, .empty-state {
  background: var(--white);
  border: 1px solid rgba(23, 33, 29, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.search-card { padding: 28px; }
label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 9px; }

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #fafaf7;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}

input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30, 96, 76, 0.12); }
.helper { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.primary-button, .outline-button, .text-button {
  border: 0;
  border-radius: 9px;
  font-weight: 700;
}

.primary-button { min-height: 48px; padding: 0 22px; color: white; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { cursor: wait; opacity: 0.65; }
.outline-button { padding: 10px 16px; color: var(--green); background: transparent; border: 1px solid rgba(30, 96, 76, 0.35); }
.outline-button:hover { background: rgba(30, 96, 76, 0.06); }
.text-button { padding: 12px 8px; color: var(--muted); background: transparent; }

.empty-state { margin-top: 18px; padding: 72px 30px; text-align: center; box-shadow: none; border-style: dashed; }
.empty-icon { width: 60px; height: 60px; margin: 0 auto 20px; display: grid; place-items: center; color: var(--green); background: rgba(199, 220, 115, 0.25); border-radius: 50%; font-size: 30px; }
.empty-state h2 { margin: 0 0 8px; font-family: "DM Serif Display", serif; font-size: 27px; font-weight: 400; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; }

.record-card { margin-top: 18px; overflow: hidden; }
.record-heading { padding: 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.record-heading h2, dialog h2 { margin: 0; font-family: "DM Serif Display", serif; font-size: 30px; font-weight: 400; }
.record-id { padding: 8px 11px; color: var(--muted); background: var(--paper); border-radius: 7px; font-size: 12px; white-space: nowrap; }
.form-section { padding: 26px 28px; border-bottom: 1px solid var(--line); }
.form-section h3 { margin: 0 0 20px; font-size: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.consent-section { padding: 22px 28px; border-bottom: 1px solid var(--line); }
.consent-label { grid-template-columns: auto 1fr; align-items: start; gap: 12px; color: var(--muted); font-weight: 500; line-height: 1.5; }
.consent-label input { width: 18px; min-height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--green); cursor: pointer; }
.form-actions { padding: 20px 28px; display: flex; justify-content: flex-end; gap: 18px; }
.hidden { display: none; }

dialog {
  width: min(470px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(11, 28, 21, 0.28);
}

dialog::backdrop { background: rgba(14, 29, 23, 0.58); backdrop-filter: blur(3px); }
dialog form { position: relative; padding: 34px; }
.dialog-copy { margin: 12px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.close-button { position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; color: var(--muted); background: var(--paper); border: 0; border-radius: 50%; font-size: 22px; }
.file-drop { padding: 24px; display: flex; align-items: center; flex-direction: column; gap: 6px; border: 1px dashed #9eaaa4; border-radius: 12px; cursor: pointer; text-align: center; }
.file-drop:hover { border-color: var(--green); background: rgba(30, 96, 76, 0.03); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop small { color: var(--muted); font-weight: 400; }
.file-icon { margin-bottom: 5px; padding: 6px 8px; color: var(--green); background: rgba(199, 220, 115, 0.3); border-radius: 5px; font-size: 11px; font-weight: 700; }
.dialog-field { margin: 20px 0; }
.full-width { width: 100%; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 18px;
  color: white;
  background: var(--green-dark);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.visible { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }

@media (max-width: 860px) {
  main { padding-top: 42px; grid-template-columns: 1fr; gap: 30px; }
  .intro { position: static; padding: 0; }
  .intro-copy { margin-top: 18px; }
}

@media (max-width: 560px) {
  .topbar { height: 68px; }
  .brand span:last-child { display: none; }
  main { width: min(100% - 28px, 1160px); padding-bottom: 60px; }
  h1 { font-size: 47px; }
  .search-card, .record-heading, .form-section, .consent-section { padding: 21px; }
  .search-row, .field-grid { grid-template-columns: 1fr; }
  .search-row .primary-button { width: 100%; }
  .record-heading { align-items: flex-start; flex-direction: column; }
  .form-actions { padding: 18px 21px; }
  dialog form { padding: 28px 22px 22px; }
}
