:root {
  color-scheme: light;
  --ink: #18231e;
  --muted: #66736b;
  --line: #dfe6df;
  --surface: #ffffff;
  --canvas: #f5f7f4;
  --green: #1d684d;
  --green-dark: #16533d;
  --green-pale: #e8f3ed;
  --warning: #9a4427;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

button, input, select { font: inherit; }

.page-shell {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: 26px 0 38px;
}

.page-header,
.site-mark,
.local-badge,
.file-actions,
.editor-card__header,
.editor-card__footer,
.status-line,
.field-row {
  display: flex;
  align-items: center;
}

.page-header {
  justify-content: space-between;
  gap: 16px;
}

.site-mark {
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.site-mark__icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--green);
  font-size: 15px;
}

.local-badge {
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #d5e7dc;
  border-radius: 999px;
  color: var(--green-dark);
  background: #f5fbf7;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.local-badge span,
.status-line__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2d9a68;
}

.intro { padding: 55px 0 28px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(31px, 7vw, 42px);
  letter-spacing: -.045em;
  line-height: 1.1;
}

.intro__copy {
  max-width: 540px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.workspace { display: grid; gap: 14px; }

.file-card,
.editor-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgb(29 49 37 / 3%);
}

.file-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 17px;
  padding: 23px;
  transition: border-color .15s ease, background-color .15s ease;
}

.file-card.is-dragging {
  border-color: var(--green);
  background: #f5fbf7;
}

.file-card__icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 12px;
  color: var(--green);
  background: var(--green-pale);
}

.file-card__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.file-card__body { min-width: 0; flex: 1; }

.file-card h2,
.editor-card h2 {
  margin: 1px 0 5px;
  font-size: 17px;
  letter-spacing: -.02em;
}

.file-card__body > p:not(.file-help) {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.file-actions { gap: 8px; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.button--primary { color: #fff; background: var(--green); }
.button--primary:hover:not(:disabled) { background: var(--green-dark); }
.button--primary:disabled { cursor: not-allowed; opacity: .48; }
.button--quiet { border-color: var(--line); color: var(--ink); background: #fff; }
.button--quiet:hover { background: #f7f9f7; }
.file-picker { position: relative; overflow: hidden; }
.file-picker__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-picker:focus-within { outline: 3px solid #a4d9bb; outline-offset: 2px; }

.button:focus-visible,
.field-input:focus-visible,
.site-mark:focus-visible {
  outline: 3px solid #a4d9bb;
  outline-offset: 2px;
}

.file-help {
  margin: 9px 0 0;
  color: #87928b;
  font-size: 12px;
}

.file-card__selected {
  min-width: 100%;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.file-card__selected-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card__selected-size { display: block; margin-top: 3px; }

.status-line {
  min-height: 20px;
  gap: 8px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-line__dot { width: 6px; height: 6px; background: #99a59d; }
.status-line[data-state="busy"] .status-line__dot { background: #d28b24; }
.status-line[data-state="error"] .status-line__dot { background: #c15b41; }
.status-line[data-state="ready"] .status-line__dot { background: #2d9a68; }

.editor-card { padding: 22px 23px 17px; }

.editor-card__header {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid #edf0ed;
}

.editor-card__header .eyebrow { margin-bottom: 5px; }
.editor-card__header h2 { margin-bottom: 0; }

.field-count {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-pale);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 126px;
  align-content: center;
  justify-items: center;
  padding: 20px 12px;
  color: #7c8981;
  text-align: center;
}

.empty-state__mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #86928a;
  font-size: 17px;
}

.empty-state p { max-width: 340px; margin: 0; font-size: 13px; line-height: 1.5; }

.field-list { display: grid; }

.edit-section {
  padding: 18px 0 10px;
  border-bottom: 1px solid #edf0ed;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -.01em;
}

.section-count {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.section-help {
  margin: 9px 0 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.filter-row {
  display: grid;
  align-items: end;
  gap: 10px;
}

.growth-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.resource-controls { grid-template-columns: minmax(0, 1.5fr) minmax(140px, 1fr) auto; }

.filter-control {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.filter-control input,
.filter-control select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #d5ded7;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 450;
}

.filter-control input:focus-visible,
.filter-control select:focus-visible,
.owned-filter input:focus-visible {
  outline: 3px solid #a4d9bb;
  outline-offset: 2px;
}

.owned-filter {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
}

.owned-filter input { width: 16px; height: 16px; accent-color: var(--green); }

.field-category {
  color: var(--green-dark);
  font-size: 10px;
  line-height: 1.3;
}

.resource-list {
  max-height: 390px;
  margin-top: 11px;
  overflow: auto;
  border-top: 1px solid #edf0ed;
  scrollbar-color: #c5d2c9 transparent;
  scrollbar-width: thin;
}

.resource-list .field-row { padding: 10px 5px 10px 0; }
.resource-list .field-label { font-size: 12px; }
.resource-list .field-input { height: 35px; }

.empty-filter {
  margin: 14px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.changes-panel {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfb;
  font-size: 12px;
}

.changes-panel summary { color: var(--green-dark); cursor: pointer; font-weight: 700; }
.changes-panel ul { display: grid; gap: 6px; margin: 10px 0 0; padding-left: 20px; color: var(--ink); }
.changes-panel li { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.field-row {
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid #edf0ed;
}

.field-label-group { display: grid; min-width: 0; gap: 3px; }
.field-label { min-width: 0; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.field-range { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.field-input-wrap {
  display: flex;
  width: min(190px, 43%);
  flex: 0 0 min(190px, 43%);
  align-items: center;
  gap: 8px;
}

.field-input {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 0 10px;
  border: 1px solid #d5ded7;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.field-input[aria-invalid="true"] { border-color: #c15b41; }

.inline-error {
  margin: 11px 0 0;
  color: var(--warning);
  font-size: 12px;
}

.editor-card__footer {
  justify-content: space-between;
  gap: 15px;
  padding-top: 17px;
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.privacy-note span { padding-right: 5px; color: var(--green); font-size: 8px; vertical-align: 1px; }
.page-footer { padding: 18px 2px 0; }
.page-footer p { margin: 0; color: #818c85; font-size: 11px; line-height: 1.5; }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  .page-shell { width: min(100% - 28px, 760px); padding-top: 17px; }
  .site-mark { font-size: 12px; }
  .local-badge { padding: 6px 8px; font-size: 10px; }
  .intro { padding: 42px 0 21px; }
  .intro__copy { font-size: 14px; }
  .file-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 17px; }
  .file-card__selected { grid-column: 1 / -1; }
  .editor-card { padding: 18px 16px 15px; }
  .field-row { gap: 12px; }
  .field-input-wrap { width: min(160px, 45%); flex-basis: min(160px, 45%); }
  .resource-controls { grid-template-columns: minmax(0, 1fr) minmax(115px, .8fr); }
  .filter-control--search { grid-column: 1 / -1; }
  .owned-filter { grid-column: 1 / -1; min-height: 24px; }
  .resource-list { max-height: 330px; }
  .editor-card__footer { align-items: flex-start; flex-direction: column; }
  .editor-card__footer .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
