:root {
  --brand-blue: #165ac6;
  --brand-blue-dark: #0c45a7;
  --brand-bg: #eef5ff;
  --text-main: #0f172a;
  --text-subtle: #475569;
  --card-bg: rgba(255, 255, 255, 0.96);
  --border-soft: rgba(203, 213, 225, 0.8);
  --danger-bg: #fff5f5;
  --danger-text: #c53030;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text-main);
  font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #f5f8fd;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

.query-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 10%, rgba(91, 168, 255, 0.24), transparent 18%),
    radial-gradient(circle at 12% 86%, rgba(73, 130, 255, 0.22), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f4f8ff 54%, #e8f1ff 100%);
  overflow-x: hidden;
}

.query-page {
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
  padding: 22px 14px 40px;
}

.query-shell {
  min-height: calc(100vh - 58px);
  position: relative;
}

.brand-strip {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 48px;
}

.brand-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.brand-logo-left {
  width: 154px;
}

.brand-logo-right {
  width: 178px;
}

.query-header {
  text-align: center;
  margin-bottom: 28px;
}

.query-header h1 {
  margin: 0 0 10px;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.query-header p {
  margin: 0;
  color: #4b5563;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-wrap: pretty;
}

.query-form {
  position: relative;
  display: block;
  padding: 14px 14px 14px 18px;
  border-radius: 32px;
  border: 1.5px solid rgba(91, 107, 132, 0.52);
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 10px 24px rgba(186, 208, 241, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  min-height: 114px;
}

.query-input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px 68px;
  outline: none;
  font-size: 18px;
  color: #64748b;
}

.query-button,
.admin-primary-button,
.secondary-button,
.text-button,
.action-button,
.danger-button {
  border: 0;
  cursor: pointer;
}

.query-button,
.admin-primary-button {
  border-radius: 24px;
  background: linear-gradient(180deg, #4588ff 0%, var(--brand-blue) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 14px 24px rgba(26, 88, 191, 0.24);
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), box-shadow 180ms cubic-bezier(0.2, 0, 0, 1);
}

.query-button {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  min-height: 54px;
}

.query-button:active,
.admin-primary-button:active,
.login-form button:active,
.action-button:active,
.danger-button:active,
.secondary-button:active {
  transform: scale(0.96);
}

.query-feedback {
  min-height: 24px;
  padding: 10px 4px 0;
  color: var(--brand-blue-dark);
  font-size: 14px;
}

.result-area {
  padding-top: 12px;
}

.result-card,
.empty-card {
  background: var(--card-bg);
  border: 1px solid rgba(210, 223, 243, 0.8);
  border-radius: 28px;
  padding: 24px 22px;
  box-shadow:
    0 18px 42px rgba(31, 73, 147, 0.16),
    0 2px 0 rgba(255, 255, 255, 0.85) inset;
}

.result-card-default {
  margin-top: 12px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--brand-blue);
  font-weight: 700;
  font-size: 15px;
}

.result-logo {
  color: #454545;
  font-weight: 700;
}

.result-logo-image {
  display: block;
  width: 144px;
  height: auto;
}

.result-divider {
  height: 1px;
  margin: 14px 0 24px;
  background: rgba(148, 163, 184, 0.35);
}

.result-title {
  margin: 0 0 20px;
  text-align: center;
  color: var(--brand-blue);
  font-size: 34px;
  font-weight: 800;
  text-wrap: balance;
}

.result-group {
  background: #fbfdff;
  border-radius: 22px;
  border: 1px solid rgba(226, 232, 240, 0.86);
  padding: 12px 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.result-group-label {
  display: inline-flex;
  width: 100%;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #fff;
  padding: 14px 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.result-group-value {
  color: #334155;
  line-height: 1.7;
  padding: 0 12px;
  text-wrap: pretty;
}

.device-block {
  text-align: center;
  padding-top: 12px;
}

.device-cert {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.device-visual {
  position: relative;
  padding-top: 4px;
}

.device-visual-spacer {
  min-height: 210px;
}

.device-cert-image {
  display: block;
  width: 138px;
  height: auto;
  margin: 0 auto 10px;
}

.device-image {
  display: block;
  width: 80%;
  height: auto;
  margin: 0 auto;
}

.seal-image {
  display: block;
  width: 82px;
  height: auto;
  margin: -8px auto 0;
}

.empty-card {
  text-align: center;
  color: #64748b;
  line-height: 1.8;
}

.admin-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 86% 10%, rgba(91, 168, 255, 0.18), transparent 22%),
    radial-gradient(circle at 12% 86%, rgba(73, 130, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #fbfdff 0%, #eef4fb 100%);
}

.login-page,
.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 96px;
}

.login-card,
.admin-shell,
.admin-form-card {
  background: #fff;
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
}

.login-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 28px;
}

.login-card h1,
.admin-header h1 {
  margin: 0 0 8px;
}

.login-card p,
.admin-header p {
  margin: 0;
  color: var(--text-subtle);
}

.login-form,
.store-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-form input,
.store-form input,
.store-form textarea {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  background: #f8fbff;
}

.login-form button {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(180deg, #4588ff 0%, var(--brand-blue) 100%);
  box-shadow: 0 14px 24px rgba(26, 88, 191, 0.24);
}

.admin-shell {
  padding: 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.admin-header-compact h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.admin-header-compact p {
  margin-top: 4px;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 18px;
}

.admin-feedback-inline {
  padding-top: 0;
  min-height: 20px;
}

.admin-primary-button {
  min-width: 116px;
  min-height: 46px;
  border-radius: 14px;
  padding: 0 18px;
}

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

.admin-store-card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.96);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.06);
}

.admin-store-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-store-name {
  margin: 0 0 8px;
  font-size: 20px;
}

.admin-store-cert {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--brand-blue-dark);
  background: var(--brand-bg);
  font-size: 12px;
  font-weight: 700;
}

.admin-store-field {
  background: #f8fbff;
  border: 1px solid rgba(226, 232, 240, 0.88);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.admin-store-field strong {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 8px;
}

.admin-store-actions {
  display: flex;
  gap: 10px;
}

.action-button,
.danger-button,
.secondary-button,
.text-button {
  border-radius: 12px;
  min-height: 42px;
}

.action-button,
.secondary-button {
  background: var(--brand-bg);
  color: var(--brand-blue-dark);
  font-weight: 700;
}

.danger-button {
  background: var(--danger-bg);
  color: var(--danger-text);
  font-weight: 700;
}

.admin-empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  color: #64748b;
  border: 1px dashed rgba(203, 213, 225, 0.9);
  border-radius: 20px;
  background: rgba(248, 251, 255, 0.75);
}

.admin-form-panel {
  position: fixed;
  inset: 0;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-form-panel-hidden {
  display: none;
}

.admin-form-card {
  width: min(100%, 520px);
  padding: 22px;
}

.admin-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-form-head h2 {
  margin: 0;
}

.text-button {
  background: transparent;
  color: var(--brand-blue-dark);
}

.store-form label span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-subtle);
  font-size: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.secondary-button {
  padding: 0 18px;
}

@media (max-width: 768px) {
  .query-form,
  .admin-header,
  .form-actions,
  .admin-store-actions,
  .admin-toolbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .query-form {
    padding: 14px;
  }

  .query-button {
    left: 14px;
    right: 14px;
  }

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

  .admin-primary-button,
  .action-button,
  .danger-button,
  .secondary-button {
    width: 100%;
  }
}
