:root {
  --ink: #19221c;
  --muted: #677269;
  --paper: #f4f5ef;
  --surface: #ffffff;
  --line: #dfe4db;
  --green: #176b45;
  --green-dark: #0f4e33;
  --green-soft: #e5f3eb;
  --amber: #9c5a08;
  --amber-soft: #fff2d8;
  --red: #a53030;
  --red-soft: #fde7e4;
  --shadow: 0 18px 50px rgba(35, 52, 41, 0.09);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(69, 142, 96, 0.12), transparent 28rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  min-height: 76px;
  padding: 14px clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(223, 228, 219, 0.85);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 13px; color: white; font-weight: 800; letter-spacing: -0.04em;
  background: linear-gradient(145deg, #25885b, #0d5134);
  box-shadow: 0 8px 20px rgba(23, 107, 69, 0.22);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.nav-actions form { margin: 0; }
.nav-link {
  display: inline-flex; padding: 9px 12px; border: 0; border-radius: 9px;
  color: #465249; background: transparent; text-decoration: none; cursor: pointer;
}
.nav-link:hover { background: #edf1ea; color: var(--green-dark); }
.button-link { appearance: none; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 80px; }
.flash-stack { display: grid; gap: 10px; margin-bottom: 20px; }
.flash { padding: 13px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; }
.flash-error { color: var(--red); background: var(--red-soft); border-color: #efc1bb; }
.flash-success { color: var(--green-dark); background: var(--green-soft); border-color: #b7d9c4; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 24px; align-items: stretch; }
.query-panel, .result-panel, .admin-card, .account-list-card, .login-card {
  background: var(--surface); border: 1px solid rgba(218, 224, 215, .95); box-shadow: var(--shadow);
}
.query-panel { padding: clamp(28px, 5vw, 52px); border-radius: 24px; }
.result-panel { min-height: 460px; padding: 32px; border-radius: 24px; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 12px 0 12px; font-size: clamp(30px, 4.2vw, 48px); line-height: 1.12; letter-spacing: -.04em; }
.lead { max-width: 620px; color: var(--muted); line-height: 1.8; }
.query-form { margin-top: 32px; }
label { display: block; margin-bottom: 9px; color: #344139; font-size: 14px; font-weight: 700; }
input, textarea {
  width: 100%; border: 1px solid #cfd7cd; border-radius: 13px; padding: 13px 15px;
  color: var(--ink); background: #fbfcfa; outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; line-height: 1.65; }
input:focus, textarea:focus { border-color: #4e9b70; box-shadow: 0 0 0 4px rgba(44, 135, 84, .12); background: white; }
.form-footer { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.form-footer span, .helper { color: var(--muted); font-size: 13px; line-height: 1.7; }
.primary-button, .secondary-button {
  min-height: 46px; padding: 0 21px; border: 0; border-radius: 12px; font-weight: 800; cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.primary-button { color: white; background: var(--green); box-shadow: 0 8px 18px rgba(23, 107, 69, .2); }
.primary-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.secondary-button { color: var(--green-dark); background: var(--green-soft); }
.secondary-button:hover { background: #d5eadf; }
.query-form .primary-button { min-width: 132px; }

.empty-result { text-align: center; color: var(--muted); }
.empty-result h2 { margin: 18px 0 8px; color: var(--ink); font-size: 21px; }
.empty-result p { margin: 0 auto; max-width: 360px; line-height: 1.7; }
.empty-icon { width: 72px; height: 72px; margin: 0 auto; display: grid; place-items: center; border-radius: 23px; color: var(--green); background: var(--green-soft); font-size: 23px; font-weight: 900; }
.result-status { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; padding: 12px 14px; border-radius: 12px; font-weight: 800; }
.result-status.is-match { color: var(--green-dark); background: var(--green-soft); }
.result-status.is-miss { color: var(--red); background: var(--red-soft); }
.result-status.is-unknown { color: var(--amber); background: var(--amber-soft); }
.status-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(255,255,255,.55); }
.field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.member-card, .note-card { padding: 18px; border-radius: 16px; background: #f7f9f5; border: 1px solid #e2e7df; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.member-row strong { font-size: clamp(24px, 3vw, 31px); letter-spacing: .02em; }
.copy-button { padding: 7px 10px; border: 0; border-radius: 8px; color: var(--green); background: var(--green-soft); cursor: pointer; }
.note-card { margin-top: 12px; }
.note-card.has-note { border-color: #b9d9c5; background: #f0f8f3; }
.note-card p { margin: 0; line-height: 1.65; }
.product-summary { display: flex; gap: 12px; align-items: center; margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.product-summary img { width: 52px; height: 52px; flex: none; border-radius: 11px; object-fit: cover; background: #eee; }

.login-wrap { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.login-card { width: min(440px, 100%); padding: 38px; border-radius: 24px; }
.login-card h1 { font-size: 34px; }
.login-card > p { color: var(--muted); line-height: 1.7; }
.stack-form { display: grid; gap: 12px; margin-top: 24px; }
.stack-form label { margin: 5px 0 -3px; }

.admin-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 28px; }
.admin-heading h1 { font-size: clamp(30px, 4vw, 44px); }
.admin-heading p { max-width: 680px; color: var(--muted); line-height: 1.7; }
.stat-card { min-width: 155px; padding: 19px 22px; border-radius: 16px; color: white; background: var(--green-dark); }
.stat-card strong, .stat-card span { display: block; }
.stat-card strong { font-size: 30px; }
.stat-card span { margin-top: 2px; font-size: 12px; opacity: .72; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.admin-card { padding: 26px; border-radius: 20px; }
.tkl-import-card { grid-column: 1 / -1; }
.preview-box { margin-top: 20px; padding: 20px; border: 1px solid #d9e2d8; border-radius: 16px; background: #f8faf7; }
.preview-member-id { display: block; font-size: 25px; letter-spacing: .02em; }
.preview-product { color: var(--muted); line-height: 1.65; }
.cancel-preview-form { margin-top: 10px; text-align: center; }
.admin-card h2, .account-list-card h2 { margin: 0; font-size: 19px; }
.account-list-card { margin-top: 20px; padding: 26px; border-radius: 20px; }
.list-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.list-heading span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-top: 1px solid #e7ebe4; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; }
td { font-size: 14px; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.text-button { padding: 6px 8px; border: 0; border-radius: 7px; color: var(--green); background: transparent; cursor: pointer; }
.text-button:hover { background: var(--green-soft); }
.text-button.danger { color: var(--red); }
.text-button.danger:hover { background: var(--red-soft); }
.delete-form { margin: 0; }
.list-empty { padding: 34px; border-radius: 13px; color: var(--muted); background: #f7f9f5; text-align: center; }

@media (max-width: 850px) {
  .page-shell { width: min(100% - 28px, 680px); padding-top: 30px; }
  .workspace-grid, .admin-grid { grid-template-columns: 1fr; }
  .result-panel { min-height: 340px; }
  .admin-heading { align-items: stretch; flex-direction: column; }
  .stat-card { align-self: flex-start; }
}
@media (max-width: 600px) {
  .topbar { min-height: 68px; padding: 12px 15px; align-items: flex-start; }
  .brand small { display: none; }
  .brand strong { max-width: 126px; line-height: 1.25; }
  .nav-actions { align-items: flex-end; flex-direction: column; gap: 0; }
  .nav-link { padding: 5px 8px; font-size: 13px; }
  .query-panel, .result-panel, .login-card { padding: 24px; border-radius: 18px; }
  h1 { font-size: 31px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .member-row { align-items: flex-start; flex-direction: column; }
  .admin-card, .account-list-card { padding: 19px; }
  th:nth-child(2), td:nth-child(2) { min-width: 180px; }
}
