* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3f5f8;
  color: #17202a;
}

button,
input,
select {
  font: inherit;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 480px);
}

.login-panel,
.panel {
  background: #ffffff;
  border: 1px solid #d7deea;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20, 32, 50, 0.06);
}

.login-panel {
  padding: 32px;
}

.panel-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e9eef7;
  color: #32445b;
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 12px;
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

.panel-subtitle,
.panel-header p {
  margin-top: 8px;
  color: #5c6b7d;
  line-height: 1.6;
}

.form-stack,
.form-grid {
  margin-top: 24px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

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

.field span {
  font-size: 14px;
  color: #506072;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #c8d2df;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
}

input:focus,
select:focus {
  outline: 2px solid #94b7ff;
  border-color: #6e95e8;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
}

.primary-button {
  background: #2457d6;
  color: #ffffff;
}

.ghost-button {
  background: #ffffff;
  border-color: #c8d2df;
  color: #1f3047;
}

.danger-button {
  background: #fff2f2;
  border-color: #f0bbbb;
  color: #a62929;
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.hint-block {
  margin-top: 20px;
  display: grid;
  gap: 8px;
  color: #617182;
  font-size: 14px;
}

code {
  display: inline-block;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 6px;
  background: #eef3fb;
}

.error-text {
  margin-top: 12px;
  color: #a62929;
}

.app-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 24px auto 40px;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.employee-chip {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #d7deea;
  border-radius: 8px;
}

.employee-chip small {
  color: #617182;
}

.notice-banner {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #fff8db;
  border: 1px solid #f0dfa3;
  border-radius: 8px;
  color: #745a00;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.admin-grid > .panel {
  min-height: 620px;
  display: flex;
  flex-direction: column;
}

.panel {
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.search-row {
  display: grid;
  grid-template-columns: 280px 150px auto;
  gap: 12px;
}

.admin-search-row {
  grid-template-columns: 180px 150px 1fr auto;
}

.admin-form {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.recharge-form {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 180px auto;
  gap: 12px;
  align-items: end;
}

.checkbox-row {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #506072;
}

.checkbox-row input {
  width: 16px;
  min-height: auto;
  margin: 0;
}

.result-card {
  margin-top: 24px;
  min-height: 220px;
  padding: 20px;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #f8fafc;
  display: grid;
  gap: 18px;
}

.wallet-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.wallet-metric {
  padding: 16px;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #f8fafc;
}

.wallet-metric small {
  display: block;
  color: #617182;
  margin-bottom: 8px;
}

.query-used-box {
  margin-top: 16px;
  min-height: 180px;
  padding: 16px;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
  word-break: break-all;
}

.empty-card {
  place-items: center;
  color: #6a7684;
}

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

.result-row small {
  display: block;
  margin-bottom: 6px;
  color: #617182;
}

.message-box {
  min-height: 72px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #d7deea;
  border-radius: 8px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.action-row,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.pagination-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  color: #617182;
  font-size: 14px;
}

.phone-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-copy-button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #c8d2df;
  background: #ffffff;
  color: #1f3047;
  cursor: pointer;
}

.inline-strong {
  display: inline-block;
  margin-right: 8px;
}

.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
}

.employee-table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.employee-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-tool-panel {
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #e4eaf2;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

thead th {
  color: #617182;
  font-weight: 600;
  background: #f8fafc;
}

.message-column {
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-all;
}

.key-column code {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.manager-key-row {
  display: grid;
  grid-template-columns: minmax(70px, 110px) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.muted-text {
  color: #6a7684;
}

.compact-table table {
  table-layout: fixed;
}

.muted-cell {
  text-align: center;
  color: #6a7684;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2457d6;
  cursor: pointer;
}

.danger-link {
  color: #b12d2d;
}

@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .form-grid,
  .search-row,
  .admin-form,
  .admin-search-row,
  .recharge-form {
    grid-template-columns: 1fr;
  }

  .wallet-summary {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .result-row {
    grid-template-columns: 1fr;
  }
}
