@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --bg: #f1f3f6;
  --ink: #1b2433;
  --ink-soft: #3c4654;
  --muted: #69727f;
  --faint: #97a0ad;
  --line: #e6e9ee;
  --line-strong: #d7dce3;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --primary: #17695f;
  --primary-dark: #0f5249;
  --primary-soft: #e7f3f0;
  --primary-tint: #f1f8f6;
  --accent: #a64835;
  --amber-bg: #fdf6e3;
  --amber-line: #ecdcab;
  --amber-ink: #6b5418;
  --shadow-sm: 0 1px 2px rgba(20, 28, 40, 0.05), 0 2px 5px rgba(20, 28, 40, 0.05);
  --shadow: 0 1px 3px rgba(20, 28, 40, 0.05), 0 14px 30px -12px rgba(20, 28, 40, 0.16);
  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(1100px 460px at 78% -8%, rgba(23, 105, 95, 0.07), transparent 70%);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

/* ---------- Header ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 30px;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(150deg, #1f7a6f, var(--primary-dark));
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(15, 82, 73, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  color: var(--ink);
  font-size: 1.72rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
}

h2 {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.subtitle {
  margin-top: 8px;
  max-width: 540px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.topbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.button.ghost {
  min-height: 38px;
  padding: 0 13px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-soft);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.button.ghost:hover:not(:disabled) {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--primary-dark);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 36px;
  max-width: min(360px, 100%);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  color: var(--ink-soft);
  font-size: 0.83rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 95, 0.16);
}

/* ---------- Workspace + panels ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) minmax(272px, 322px);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.browser-panel,
.export-panel {
  position: sticky;
  top: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.panel-head.split {
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 11px;
}

.panel-subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* icon chips in panel headings */
.panel-head > svg,
.panel-title > svg {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 7px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.button > svg,
.icon-button > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

/* ---------- Inputs ---------- */

.search-box,
.quick-load {
  display: grid;
  gap: 9px;
}

.search-box {
  grid-template-columns: 1fr 44px;
}

.quick-load {
  grid-template-columns: minmax(74px, 0.72fr) 1.28fr;
  margin-top: 10px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:hover {
  border-color: #c4cad3;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(23, 105, 95, 0.13);
}

input::placeholder {
  color: var(--faint);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), box-shadow var(--transition), transform var(--transition);
}

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

.button {
  gap: 7px;
  min-height: 44px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-size: 0.875rem;
  letter-spacing: 0.005em;
}

.button.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 5px rgba(15, 82, 73, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(15, 82, 73, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--primary-dark);
}

.button.secondary:hover:not(:disabled) {
  background: var(--primary-tint);
  border-color: rgba(23, 105, 95, 0.4);
}

.button.full {
  width: 100%;
  margin-top: 11px;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
}

.icon-button:hover:not(:disabled) {
  background: var(--primary-tint);
  border-color: rgba(23, 105, 95, 0.4);
  color: var(--primary-dark);
}

/* ---------- Browser list ---------- */

.browser-meta {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
}

.browser-meta .icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

#pageInfo {
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.result-list {
  display: grid;
  gap: 9px;
  max-height: calc(100vh - 332px);
  min-height: 320px;
  overflow: auto;
  margin: 0 -4px;
  padding: 2px 4px;
}

.result-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition),
    box-shadow var(--transition), transform var(--transition);
}

.result-item:hover {
  border-color: rgba(23, 105, 95, 0.45);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.result-item.active {
  border-color: var(--primary);
  background: var(--primary-tint);
  box-shadow: 0 0 0 3px rgba(23, 105, 95, 0.12);
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 9px;
}

.result-code {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-id {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 550;
}

/* ---------- Empty states ---------- */

.empty-list,
.empty-state {
  display: grid;
  place-items: center;
  place-content: center;
  min-height: 240px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.empty-state {
  min-height: 486px;
  gap: 4px;
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--faint);
}

/* ---------- Detail / summary ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: var(--panel-soft);
}

.summary-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.record-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.muted {
  margin-bottom: 3px;
  color: var(--faint);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

a {
  color: var(--primary-dark);
  font-weight: 500;
  overflow-wrap: anywhere;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- Table ---------- */

.table-wrap {
  overflow: auto;
  max-height: 64vh;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--primary-tint);
}

td {
  font-size: 0.88rem;
}

td:first-child {
  width: 210px;
  color: var(--muted);
  font-weight: 600;
}

td:last-child {
  color: var(--ink);
  white-space: pre-wrap;
}

tr:last-child td {
  border-bottom: 0;
}

/* ---------- Export panel ---------- */

.divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.field-list {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.check-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.check-row input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 550;
}

.hint {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 9px;
  margin-top: 18px;
  padding: 12px 13px;
  border: 1px solid var(--amber-line);
  border-radius: var(--radius-md);
  background: var(--amber-bg);
  color: var(--amber-ink);
  font-size: 0.81rem;
  line-height: 1.45;
}

.hint svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.hidden {
  display: none !important;
}

/* ---------- Scrollbars ---------- */

.result-list::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

.result-list::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #d2d7df;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.result-list::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #b9c0cb;
  background-clip: padding-box;
}

/* ---------- Modal / wizard ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 25, 36, 0.55);
  backdrop-filter: blur(4px);
  animation: overlay-in 180ms ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 28px 64px -16px rgba(18, 25, 36, 0.45);
  overflow: hidden;
  animation: modal-in 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-head .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
}

.wizard-progress {
  display: flex;
  gap: 6px;
  padding: 16px 20px 6px;
}

.wizard-dot {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  transition: background var(--transition);
}

.wizard-dot.filled {
  background: var(--primary);
}

.modal-body {
  padding: 14px 20px 20px;
  overflow-y: auto;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
}

.step-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
}

.step-icon svg {
  width: 22px;
  height: 22px;
}

.step-kicker {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-head h3 {
  margin: 0;
  font-size: 1.07rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.step-text {
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  position: relative;
  padding-left: 26px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.step-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.modal-body code,
.modal-body kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.modal-body code {
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--accent);
  font-size: 0.82em;
}

.modal-body kbd {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 1px 0 var(--line-strong);
  color: var(--ink);
  font-size: 0.78em;
}

.modal-body strong {
  font-weight: 650;
  color: var(--ink);
}

.modal-body em {
  font-style: normal;
  font-weight: 600;
  color: var(--primary-dark);
}

.code-block {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 14px;
  max-height: 280px;
  overflow: auto;
}

.code-block code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre;
}

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.copy-button:hover {
  background: var(--primary-tint);
  border-color: rgba(23, 105, 95, 0.4);
  color: var(--primary-dark);
}

.copy-button.copied {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.copy-button svg {
  width: 13px;
  height: 13px;
}

.step-note {
  display: flex;
  gap: 9px;
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid var(--amber-line);
  border-radius: var(--radius-md);
  background: var(--amber-bg);
  color: var(--amber-ink);
  font-size: 0.83rem;
  line-height: 1.45;
}

.step-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.step-note.success {
  border-color: rgba(23, 105, 95, 0.3);
  background: var(--primary-tint);
  color: var(--primary-dark);
}

.step-note em {
  color: inherit;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.modal-foot .button {
  min-height: 40px;
}

.wizard-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }

  .export-panel {
    grid-column: 1 / -1;
    position: static;
  }

  .field-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  .shell {
    width: min(100% - 28px, 1380px);
    padding: 22px 0 34px;
  }

  .topbar,
  .panel-head.split,
  .record-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .browser-panel,
  .export-panel {
    position: static;
  }

  .result-list {
    max-height: none;
    min-height: 0;
  }

  .field-list,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .panel-head.split .button {
    width: 100%;
  }

  .empty-state {
    min-height: 280px;
  }
}
