:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --ink: #17212b;
  --muted: #66717d;
  --line: #d9e1e7;
  --green: #1e6755;
  --gold: #8d6a16;
  --blue: #244f78;
  --bad: #b42318;
  --shadow: 0 10px 24px rgba(23, 33, 31, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

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

.operator-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.app-topbar,
.context-strip,
.record-panel,
.export-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark,
.brand-fallback {
  display: inline-grid;
  width: 78px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--green);
  font-weight: 900;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-links a,
button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  padding: 8px 12px;
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

button.ghost,
.app-links a {
  background: #ffffff;
  color: var(--green);
}

.context-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  box-shadow: none;
}

.context-strip div {
  padding: 13px 14px;
  background: #ffffff;
}

.context-strip span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.context-strip strong {
  overflow-wrap: anywhere;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.record-panel,
.export-card {
  padding: 16px;
}

.form-section {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.form-section:first-child {
  border-top: 0;
  padding-top: 0;
}

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

.section-title > span {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #edf6f2;
}

.section-title.compact {
  margin-bottom: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  padding: 9px 10px;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.unit-input input {
  border: 0;
  border-radius: 0;
}

.unit-input span {
  display: inline-flex;
  align-items: center;
  border-left: 1px solid var(--line);
  padding: 0 10px;
  color: var(--muted);
  font-weight: 900;
}

.unit-input.readonly {
  background: #eef4f1;
}

.inline-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mini-button {
  min-height: 39px;
  border-color: var(--blue);
  background: #ffffff;
  color: var(--blue);
  white-space: nowrap;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 14px 0;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.toggle-row input {
  width: auto;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.export-panel {
  position: sticky;
  top: 16px;
}

.export-summary {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.export-summary div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
}

.export-summary dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.export-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

pre {
  max-height: 540px;
  overflow: auto;
  border-radius: 6px;
  background: #111827;
  padding: 12px;
  color: #e5e7eb;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.copy-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 800;
}

@media (max-width: 980px) {
  .context-strip,
  .workspace-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .export-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .operator-shell {
    padding: 12px;
  }

  .app-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .export-summary div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
