:root {
  color: #1d2522;
  background: #eef1ef;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #eef1ef;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
  padding: 64px 0 72px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #64706b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  color: #17201c;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: 0;
}

.local-status {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  color: #58635f;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2e9d67;
  box-shadow: 0 0 0 4px #d7eadf;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 24px;
  border: 1px solid #d7dcda;
  border-radius: 6px;
  background: #ffffff;
}

.stat-item {
  display: flex;
  min-width: 0;
  min-height: 116px;
  flex-direction: column;
  justify-content: center;
  padding: 22px 28px;
}

.stat-item + .stat-item {
  border-left: 1px solid #e1e5e3;
}

.stat-label {
  margin-bottom: 10px;
  color: #68736e;
  font-size: 14px;
}

.stat-value {
  overflow: hidden;
  color: #1b2520;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: ellipsis;
}

.stat-value-pending {
  color: #1a7450;
}

.search-panel {
  margin-top: 20px;
  padding: 24px 28px;
  border: 1px solid #d7dcda;
  border-radius: 6px;
  background: #ffffff;
}

.search-heading {
  margin-bottom: 18px;
}

.search-heading h2 {
  margin-bottom: 3px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: 0;
}

.search-heading p {
  margin-bottom: 0;
  color: #737d79;
  font-size: 13px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: end;
  gap: 12px;
}

.search-field label {
  display: block;
  margin-bottom: 8px;
  color: #56615c;
  font-size: 13px;
  font-weight: 700;
}

.search-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #bbc3bf;
  border-radius: 6px;
  outline: 0;
  color: #202925;
  background: #ffffff;
  font-size: 15px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-field input:focus {
  border-color: #397cae;
  box-shadow: 0 0 0 3px #dfeef8;
}

.search-button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: #253d34;
  font-weight: 750;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.search-button:hover {
  background: #182b24;
}

.search-button:active {
  transform: translateY(1px);
}

.search-button:focus-visible {
  outline: 3px solid #a8c3b8;
  outline-offset: 2px;
}

.search-result {
  min-height: 57px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e1e5e3;
}

.search-result > p {
  margin: 8px 0 0;
  color: #6e7974;
  font-size: 13px;
}

.search-summary {
  margin: 0 0 12px;
  color: #58635f;
  font-size: 13px;
  font-weight: 700;
}

.search-table-wrap {
  overflow-x: auto;
}

.search-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.search-table th {
  padding: 0 14px 10px;
  color: #737d79;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.search-table td {
  padding: 14px;
  border-top: 1px solid #e1e5e3;
  overflow-wrap: anywhere;
  color: #26302b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.search-table th:first-child,
.search-table td:first-child {
  width: 42%;
  padding-left: 0;
}

.search-table th:nth-child(2),
.search-table td:nth-child(2) {
  width: 36%;
}

.search-table th:last-child,
.search-table td:last-child {
  width: 22%;
  padding-right: 0;
}

.search-state {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12px;
}

.search-state.exported {
  color: #285f91;
  background: #e0edf7;
}

.search-state.pending {
  color: #176442;
  background: #dff0e7;
}

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

.tool-panel {
  min-width: 0;
  padding: 28px;
  border: 1px solid #d7dcda;
  border-radius: 6px;
  background: #ffffff;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.panel-heading h2 {
  margin-bottom: 3px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: 0;
}

.panel-heading p {
  margin-bottom: 0;
  color: #737d79;
  font-size: 13px;
}

.step-number {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 6px;
  color: #176442;
  background: #dff0e7;
  font-size: 12px;
  font-weight: 800;
}

.step-number-blue {
  color: #285f91;
  background: #e0edf7;
}

.file-picker {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px dashed #aeb8b3;
  border-radius: 6px;
  background: #f8faf9;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.file-picker:hover,
.file-picker:focus-within {
  border-color: #31825d;
  background: #f3f8f5;
}

.file-icon {
  display: grid;
  width: 46px;
  height: 52px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid #c8d1cd;
  border-radius: 4px;
  color: #356c53;
  background: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.file-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.file-copy strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy small,
.export-controls small {
  color: #77817d;
  font-size: 12px;
}

.browse-label {
  flex: 0 0 auto;
  color: #1f6e4b;
  font-size: 13px;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.export-controls {
  min-height: 92px;
}

.export-controls > label {
  display: block;
  margin-bottom: 8px;
  color: #56615c;
  font-size: 13px;
  font-weight: 700;
}

.number-field {
  display: flex;
  height: 48px;
  align-items: center;
  margin-bottom: 7px;
  border: 1px solid #bbc3bf;
  border-radius: 6px;
  background: #ffffff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.number-field:focus-within {
  border-color: #397cae;
  box-shadow: 0 0 0 3px #dfeef8;
}

.number-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  border: 0;
  outline: 0;
  color: #202925;
  background: transparent;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.number-field span {
  padding-right: 14px;
  color: #747e7a;
  font-size: 13px;
}

.export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.export-button {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: #286f9e;
  font-weight: 750;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.export-button:hover:not(:disabled) {
  background: #205f89;
}

.quick-export-button {
  background: #29734f;
}

.quick-export-button:hover:not(:disabled) {
  background: #205e40;
}

.export-button:active:not(:disabled) {
  transform: translateY(1px);
}

.export-button:focus-visible,
.file-picker:has(+ input:focus-visible) {
  outline: 3px solid #9fc9e3;
  outline-offset: 2px;
}

.export-button:disabled {
  color: #8d9692;
  background: #e2e6e4;
  cursor: not-allowed;
}

.message {
  min-height: 21px;
  margin-top: 16px;
  color: #6e7974;
  font-size: 13px;
  line-height: 1.6;
}

.message.success {
  color: #19704b;
}

.message.error {
  color: #b34035;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 560px);
    padding: 32px 0 44px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
  }

  h1 {
    font-size: 30px;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-item {
    min-height: 94px;
    padding: 16px 14px;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-value {
    font-size: 27px;
  }

  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-panel {
    padding: 22px;
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-table,
  .search-table tbody,
  .search-table tr,
  .search-table td {
    display: block;
    width: 100%;
  }

  .search-table thead {
    display: none;
  }

  .search-table tr {
    padding: 10px 0;
    border-top: 1px solid #e1e5e3;
  }

  .search-table td,
  .search-table td:first-child,
  .search-table td:nth-child(2),
  .search-table td:last-child {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border: 0;
  }

  .search-table td::before {
    content: attr(data-label);
    color: #737d79;
    font-size: 12px;
    font-weight: 500;
  }

  .tool-panel {
    padding: 22px;
  }
}

@media (max-width: 400px) {
  .stat-item {
    min-height: 86px;
    padding: 13px 10px;
  }

  .stat-label {
    min-height: 34px;
    margin-bottom: 5px;
  }

  .stat-value {
    font-size: 24px;
  }

  .file-picker {
    gap: 10px;
    padding: 13px;
  }

  .browse-label {
    display: none;
  }
}
