:root {
  color-scheme: light;
  --paper: #f6f4ef;
  --ink: #1d252c;
  --muted: #66717a;
  --line: rgba(29, 37, 44, 0.14);
  --panel: #ffffff;
  --accent: #2f6f73;
  --accent-strong: #214f52;
  --danger: #a33a31;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.ground-truth-page {
  width: min(1360px, calc(100vw - 32px));
  margin: 24px auto;
}

.ground-truth-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.1;
}

.ground-truth-header p {
  margin-top: 6px;
  color: var(--muted);
}

.version-badge {
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.toolbar-menu-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.top-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.top-menu-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.top-menu-link:hover,
.top-menu-link.active {
  background: var(--ink);
  color: #fff;
}

.top-menu-link.disabled {
  color: rgba(29, 37, 44, 0.45);
}

.top-menu-icon {
  width: 28px;
  justify-content: center;
  padding: 0;
}

.top-menu-link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notice,
.error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #edf7f4;
  color: #173d3e;
  font-weight: 700;
}

.error {
  background: #f8e9e7;
  color: var(--danger);
}

.document-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.document-context div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.document-context span {
  color: var(--muted);
}

.document-context a {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.document-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.lock-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.lock-toggle input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
}

.ground-truth-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.entry-list,
.editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.entry-list {
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.list-header h2 {
  font-size: 1rem;
}

.list-header a,
.entry-row {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.entry-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.entry-row.active {
  background: #e8f2f1;
}

.entry-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.empty-list {
  padding: 14px 12px;
  color: var(--muted);
}

.editor-panel {
  padding: 14px;
}

.pdf-picker {
  margin-bottom: 14px;
}

.editor-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 12px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 700;
}

.span-2 {
  grid-column: 1 / -1;
}

.address-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.address-fieldset legend {
  padding: 0 6px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.address-notes {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.operation-steps-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.operation-step-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
}

.operation-step-display {
  background: #f2f4f5;
  color: var(--ink);
}

.operation-step-toggle {
  position: relative;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.operation-step-toggle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(-50%, -65%) rotate(45deg);
}

.operation-step-toggle[aria-expanded="true"]::before {
  transform: translate(-50%, -35%) rotate(225deg);
}

.operation-step-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.operation-step-menu {
  display: grid;
  gap: 2px;
  max-height: 280px;
  overflow: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.operation-step-menu[hidden] {
  display: none;
}

.operation-step-menu.is-open {
  display: grid;
}

.operation-step-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 4px;
  font-weight: 400;
}

.operation-step-option:hover {
  background: #edf7f4;
}

.operation-step-main {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.operation-step-label {
  min-width: 0;
}

.operation-step-main input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
}

.operation-step-note-input {
  min-width: 0;
  width: 100%;
}

textarea {
  resize: vertical;
  line-height: 1.35;
}

input[readonly] {
  background: #f2f4f5;
  color: var(--muted);
}

.analysis-preset {
  color: #c98282;
}

.analysis-preset:focus,
.analysis-preset-released {
  color: var(--ink);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.danger {
  background: var(--danger);
}

@media (max-width: 840px) {
  .ground-truth-layout,
  .editor-form,
  .address-fieldset {
    grid-template-columns: 1fr;
  }

  .span-2,
  .address-notes {
    grid-column: auto;
  }
}
