/* =============================================================================
   DEVA METADATA PUBLISHER
   Palette follows Section 3.2 of the DEVA GIS publishing standard so the tool
   looks like the artifacts it produces.
   ============================================================================= */

:root {
  --green: rgb(44, 95, 45);
  --green-dark: rgb(30, 68, 31);
  --lime: rgb(151, 188, 98);
  --sand: #f6f5f1;
  --ink: #1f2320;
  --muted: #5f6b61;
  --line: #d9ded8;
  --white: #ffffff;
  --warn-bg: #fff3cd;
  --warn-line: #ffc107;
  --error-bg: #fdecea;
  --error-line: #c0392b;
  --ok-bg: #d4edda;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(20, 30, 20, 0.08), 0 6px 18px rgba(20, 30, 20, 0.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--sand);
}

h1, h2, h3 { color: var(--green); font-weight: 600; line-height: 1.25; }

a { color: var(--green); }

/* --- Masthead ------------------------------------------------------------ */

.masthead {
  background: var(--green);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--lime);
}

.masthead h1 {
  color: var(--white);
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.2px;
}

.masthead p { margin: 2px 0 0; font-size: 13px; color: #dbe8d3; }

.masthead-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Layout -------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
}

/* --- Step navigation ----------------------------------------------------- */

.stepnav {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  position: sticky;
  top: 16px;
}

@media (max-width: 900px) { .stepnav { position: static; } }

.stepnav ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }

.stepnav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius);
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.stepnav button:hover { background: #eef2ec; }
.stepnav button[aria-current="step"] { background: var(--green); color: var(--white); font-weight: 600; }
.stepnav button[disabled] { opacity: 0.45; cursor: not-allowed; }

.stepnav .marker {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: #e7ece5;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.stepnav button[aria-current="step"] .marker { background: var(--lime); color: var(--green-dark); }
.stepnav .marker.has-errors { background: var(--error-line); color: var(--white); }
.stepnav .marker.is-done { background: var(--lime); color: var(--green-dark); }

/* --- Panels -------------------------------------------------------------- */

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel > h2 { margin-top: 0; font-size: 22px; }
.panel-intro { color: var(--muted); margin-top: -6px; max-width: 70ch; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 18px;
}

legend { font-weight: 600; color: var(--green); padding: 0 6px; font-size: 15px; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field > label, .field-label {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

input[type="text"], input[type="date"], input[type="number"], input[type="url"], input[type="email"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 1px;
  border-color: var(--green);
}

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

@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.checkbox input { margin-top: 3px; }

/* --- Buttons ------------------------------------------------------------- */

button, .button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  background: var(--green);
  color: var(--white);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button:hover, .button:hover { background: var(--green-dark); }

button.secondary, .button.secondary {
  background: var(--white);
  color: var(--green);
  border-color: var(--green);
}

button.secondary:hover { background: #eef2ec; }

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  font-weight: 500;
  padding: 5px 10px;
}

button.ghost:hover { background: #f0f2ee; color: var(--ink); }

button.danger { background: transparent; color: var(--error-line); border-color: #e6c3bf; font-weight: 500; padding: 5px 10px; }
button.danger:hover { background: var(--error-bg); }

button[disabled] { opacity: 0.5; cursor: not-allowed; }

.masthead .button.secondary, .masthead button.secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.6);
}

.masthead button.secondary:hover { background: rgba(255, 255, 255, 0.14); }

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* --- Upload -------------------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--lime);
  border-radius: var(--radius);
  background: #fbfcfa;
  padding: 34px 24px;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dropzone.is-over { background: var(--ok-bg); border-color: var(--green); }
.dropzone h3 { margin: 0 0 6px; }
.dropzone p { margin: 0 0 14px; color: var(--muted); }

/* --- Callouts ------------------------------------------------------------ */

.callout { border-left: 4px solid var(--muted); background: #eef1ec; padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin: 14px 0; }
.callout.warn { background: var(--warn-bg); border-left-color: var(--warn-line); }
.callout.error { background: var(--error-bg); border-left-color: var(--error-line); }
.callout.ok { background: var(--ok-bg); border-left-color: var(--green); }
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* --- Lists of repeatable records ---------------------------------------- */

.record {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: #fcfdfb;
}

.record-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.record-head h4 { margin: 0; font-size: 14.5px; color: var(--green); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ec;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 6px 3px 11px;
  font-size: 13px;
}

.tag button { background: none; color: var(--muted); border: 0; padding: 0 4px; font-size: 15px; line-height: 1; }
.tag button:hover { background: none; color: var(--error-line); }

/* --- Field editor -------------------------------------------------------- */

.field-card { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--white); }

.field-card > summary {
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  list-style: none;
}

.field-card > summary::-webkit-details-marker { display: none; }
.field-card > summary::before { content: "\25B8"; color: var(--muted); font-size: 12px; }
.field-card[open] > summary::before { content: "\25BE"; }
.field-card[open] > summary { border-bottom: 1px solid var(--line); background: #fbfcfa; }
.field-card .body { padding: 14px; }

.field-name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }

.pill {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ec;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}

.pill.user { background: var(--ok-bg); color: var(--green-dark); border-color: #b9d9be; }
.pill.system { background: #e9ecef; }
.pill.editor { background: var(--warn-bg); color: #7a5c00; border-color: #f0d68a; }
.pill.todo { background: var(--error-bg); color: var(--error-line); border-color: #eec4bf; }

/* --- Review -------------------------------------------------------------- */

.output-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 0; flex-wrap: wrap; }

.output-tabs button {
  background: none;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: -1px;
}

.output-tabs button[aria-selected="true"] {
  background: var(--white);
  color: var(--green);
  border-color: var(--line);
}

pre.code {
  background: #1f2320;
  color: #e8efe6;
  padding: 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: auto;
  max-height: 460px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0;
  white-space: pre;
  tab-size: 2;
}

iframe.preview {
  width: 100%;
  height: 520px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--white);
}

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 5px 0 5px 26px; position: relative; font-size: 14px; border-bottom: 1px solid #eef0ec; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { position: absolute; left: 0; top: 4px; font-weight: 700; }
.checklist li.pass::before { content: "\2713"; color: var(--green); }
.checklist li.fail::before { content: "\2715"; color: var(--error-line); }

.issue-list { list-style: none; margin: 10px 0 0; padding: 0; }

.issue-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 13.5px;
  background: var(--warn-bg);
}

.issue-list li.error { background: var(--error-bg); }
.issue-list li .detail { display: block; color: var(--muted); font-size: 12.5px; }
.issue-list li button { margin-left: auto; flex: 0 0 auto; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }

.summary-card { background: #fbfcfa; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.summary-card .value { font-size: 20px; font-weight: 700; color: var(--green); display: block; }
.summary-card .label { font-size: 12.5px; color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 10px 0; }
table.data th, table.data td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
table.data th { background: #eef2ec; color: var(--green-dark); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--green-dark);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.toast.show { opacity: 1; }

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 20px 24px 40px;
}
