:root {
  color-scheme: light;
  --canvas: #f5f6f1;
  --paper: #fff;
  --ink: #19251f;
  --muted: #56635a;
  --line: #dde2da;
  --green: #294738;
  --accent: #d8f476;
  --accent-hover: #cbe768;
  --danger: #a32e2d;
  --radius: 18px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .62; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #397251;
  outline-offset: 3px;
}
h1, h2, p { margin: 0; }
code { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace; }

.topbar { background: var(--ink); color: #f1f5eb; }
.topbar-inner, .workspace { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.topbar-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 20px; font-weight: 750; letter-spacing: -.04em; }
.brand-mark { position: relative; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; background: var(--accent); }
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  transform: rotate(-42deg);
}
.brand-mark::before { top: 9px; left: 10px; }
.brand-mark::after { top: 14px; left: 6px; }
.brand-divider { height: 17px; width: 1px; background: #607065; }
.brand-label { color: #c5d0c5; font-size: 13px; font-weight: 550; letter-spacing: .025em; }
.topbar .button-quiet { color: #e3eae1; }
.topbar .button-quiet:hover:not(:disabled) { background: #303e35; color: #fff; }
.topbar .button-quiet:focus-visible { outline-color: var(--accent); }

.workspace { padding-block: 58px 72px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading h1, .login h1 { font-size: clamp(28px, 4vw, 43px); font-weight: 760; line-height: 1.22; letter-spacing: -.055em; }
.page-heading p { color: var(--muted); line-height: 1.65; margin-top: 10px; font-size: 15px; }
.page-heading .button { flex-shrink: 0; }
.plus { font: 500 21px/1 ui-monospace, monospace; margin-right: 4px; }
.button {
  min-height: 42px;
  padding: 8px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}
.button-primary { background: var(--accent); border-color: #c3d962; }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-secondary { background: var(--paper); border-color: #cfd8cd; }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: #edf1e9; }
.button-danger { background: var(--danger); color: white; }
.button-danger:hover:not(:disabled) { background: #8e2121; }
.button-small { min-height: 35px; padding: 5px 9px; font-size: 13px; }
.delete-button { color: var(--danger); }
.delete-button:hover:not(:disabled) { background: #faeeee; }

.mapping-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 7px 18px #19251f06; }
.panel-heading { min-height: 66px; padding: 14px 23px; display: flex; align-items: center; gap: 12px; }
.panel-heading h2 { font-size: 17px; line-height: 1.4; }
.mapping-count { padding: 2px 8px; border-radius: 7px; background: #edf2e9; color: var(--green); font-size: 12px; font-weight: 650; }
.mapping-columns, .mapping-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, .85fr) minmax(0, .9fr) auto;
  gap: 20px;
  align-items: center;
  padding: 13px 23px;
}
.mapping-columns { position: relative; border-block: 1px solid var(--line); background: #f7f8f4; color: var(--muted); font-size: 12px; font-weight: 650; }
.mapping-columns > :last-child { min-width: 165px; text-align: right; }
.mapping-row { min-height: 69px; }
.mapping-row + .mapping-row { border-top: 1px solid var(--line); }
.mapping-address { color: var(--green); font-size: 13px; font-weight: 620; overflow-wrap: anywhere; user-select: text; }
.mapping-source, .mapping-date { min-width: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.mapping-date { font-variant-numeric: tabular-nums; }
.mapping-actions { display: flex; min-width: 165px; justify-content: flex-end; gap: 3px; }
.mobile-label { display: none; }
.list-state, .state-panel { text-align: center; padding: 60px 24px; line-height: 1.65; }
.list-state { border-top: 1px solid var(--line); }
.list-state > p:first-child { font-size: 17px; font-weight: 700; }
.state-detail { margin-top: 7px; color: var(--muted); font-size: 14px; }
.list-state .button, .state-panel .button { margin-top: 18px; }

.login { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); max-width: 790px; margin: 24px auto 0; border-radius: 22px; overflow: hidden; box-shadow: 0 15px 40px #1d332218; }
.login-intro, .login-form { padding: clamp(30px, 5vw, 47px); }
.login-intro {
  background-color: #22392d;
  background-image: radial-gradient(ellipse at top left, #355642, transparent 74%);
  color: #fbfff5;
}
.login h1 { font-size: clamp(27px, 3.5vw, 36px); }
.login-intro > p { color: #d4e3d3; margin-top: 14px; font-size: 14px; line-height: 1.7; }
.address-example {
  margin-top: 37px;
  padding: 12px 15px;
  border: 1px solid #607567;
  border-radius: 10px;
  background: #1c3025b3;
  display: grid;
  gap: 5px;
  overflow-wrap: anywhere;
}
.address-example > span { color: #c4d5c4; font-size: 11px; letter-spacing: .06em; }
.address-example code { color: var(--accent); font-size: 15px; }
.login-form { display: grid; align-content: center; gap: 12px; background: var(--paper); }
.login-form > label, .form-field > label { display: block; font-weight: 680; font-size: 14px; }
.login-form .button-primary { margin-top: 8px; }
input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #cbd5cb;
  border-radius: 9px;
  color: var(--ink);
  background: white;
  font-size: 16px;
}
input::placeholder { color: #6d7970; }

.dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 14px 48px #19251f30;
}
.dialog::backdrop { background: #17251d80; }
.dialog h2 { margin-bottom: 24px; font-size: 23px; line-height: 1.3; letter-spacing: -.03em; }
.dialog form > p:not(.field-error) { margin-bottom: 17px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.dialog code { overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.form-field + .form-field { margin-top: 19px; }
.form-field > label { margin-bottom: 7px; }
.address-field, .target-field { display: flex; align-items: stretch; }
.address-prefix {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #cbd5cb;
  border-right: 0;
  border-radius: 9px 0 0 9px;
  background: #f0f3ee;
  color: var(--muted);
  font: 13px ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.address-field input { border-radius: 0 9px 9px 0; }
.address-field input:read-only { background: #f7f9f6; }
.target-field { gap: 6px; }
.target-field .button { border-color: #cbd5cb; }
.field-hint, .field-error { font-size: 13px; line-height: 1.55; }
.field-hint { margin-top: 7px; color: var(--muted); }
.field-error { color: var(--danger); }
.dialog .field-error { margin-top: 14px; }
.feedback {
  position: fixed;
  z-index: 1;
  inset: auto 24px max(24px, env(safe-area-inset-bottom)) auto;
  max-width: calc(100% - 48px);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 5px 19px #18251f27;
  opacity: 0;
  pointer-events: none;
}
.feedback.visible { opacity: 1; }

@media (max-width: 780px) {
  .topbar-inner, .workspace { width: calc(100% - 40px); }
  .workspace { padding-block: 40px 55px; }
  .page-heading { margin-bottom: 25px; }
  .mapping-columns { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mapping-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; border-top: 1px solid var(--line); padding-block: 15px; }
  .mapping-row + .mapping-row { border-top: 1px solid var(--line); }
  .mapping-address, .mapping-actions { grid-column: 1 / -1; }
  .mapping-actions { justify-content: flex-start; }
  .button-small { min-height: 40px; padding-inline: 11px; }
  .mobile-label { display: block; margin-bottom: 2px; color: var(--ink); font-weight: 650; font-size: 11px; }
}

@media (max-width: 560px) {
  .topbar-inner, .workspace { width: calc(100% - 32px); }
  .topbar-inner { min-height: 62px; }
  .brand { gap: 8px; }
  .topbar .button { padding-inline: 6px; font-size: 13px; }
  .workspace { padding-block: 30px 45px; }
  .login { grid-template-columns: 1fr; margin-top: 0; }
  .login-intro, .login-form { padding: 26px; }
  .address-example { margin-top: 22px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .panel-heading { min-height: 57px; padding-inline: 15px; }
  .mapping-row { padding-inline: 15px; }
  .list-state { padding: 42px 18px; }
  .dialog { padding: 20px; }
}
