/* ==========================================================================
   星卡铺 · 管理后台样式
   ========================================================================== */

.admin-body {
  background: #f4f5fa;
}

/* ---------------- 登录 ---------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 380px at 85% 0%, rgba(139, 92, 246, 0.25), transparent 60%),
    radial-gradient(600px 340px at 5% 100%, rgba(91, 91, 214, 0.22), transparent 60%),
    linear-gradient(160deg, #101223, #1a1c35 55%, #241c45);
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 38px 36px 30px;
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.7);
}

.login-logo {
  margin-bottom: 18px;
}

.login-logo .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 24px;
}

.login-card h1 {
  font-size: 23px;
  letter-spacing: -0.3px;
}

.login-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 6px 0 24px;
}

.login-card .form-hint {
  margin-top: 14px;
  line-height: 1.7;
}

.login-card code {
  background: #f4f5fa;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11.5px;
}

.back-link {
  display: inline-block;
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.back-link:hover {
  color: var(--brand);
}

/* ---------------- 布局 ---------------- */

.admin-shell {
  min-height: 100vh;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #121428 0%, #181a33 55%, #221a42 100%);
  color: #b7bbd4;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 20px;
  color: #fff;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.sidebar-brand-text small {
  display: block;
  font-size: 11px;
  color: #8b90ad;
  letter-spacing: 1.5px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 1px solid transparent;
  background: none;
  color: #9ea3c0;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  padding: 11px 13px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.side-link span {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.side-link.active {
  background: linear-gradient(120deg, rgba(91, 91, 214, 0.42), rgba(139, 92, 246, 0.22));
  border-color: rgba(139, 92, 246, 0.4);
  color: #fff;
  box-shadow: 0 10px 26px -18px rgba(0, 0, 0, 0.8);
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 13px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
  font-size: 12.5px;
}

.sidebar-foot a {
  color: #9ea3c0;
}

.sidebar-foot a:hover {
  color: #fff;
}

.sidebar-user {
  color: #6f748f;
  font-size: 11.5px;
  letter-spacing: 0.4px;
}

.admin-main {
  margin-left: 236px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 30px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e9ebf3;
}

.admin-topbar h1 {
  font-size: 19px;
  letter-spacing: -0.2px;
}

.admin-topbar p {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-content {
  padding: 24px 30px 64px;
}

.view {
  display: block;
}

/* ---------------- 统计卡片 ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px 20px;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 91, 214, 0.1), transparent 70%);
}

.stat-label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  font-size: 26px;
  letter-spacing: -0.6px;
  margin: 7px 0 3px;
  font-weight: 800;
}

.stat-card small {
  font-size: 12px;
  color: #98a2b3;
}

/* ---------------- 面板 ---------------- */

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  margin-bottom: 22px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 22px;
  border-bottom: 1px solid #f0f1f7;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 15.5px;
  letter-spacing: -0.1px;
}

.panel-head p {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.panel-actions .select,
.panel-actions .input {
  width: auto;
  min-width: 130px;
  padding: 8px 12px;
  font-size: 13px;
}

.panel-actions .input[type="search"] {
  min-width: 210px;
}

.panel-body {
  padding: 20px 22px;
}

.panel + .panel {
  margin-top: 0;
}

/* ---------------- 表格 ---------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}

.table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  background: #fafbfe;
  padding: 10px 16px;
  border-bottom: 1px solid #eef0f6;
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f2f3f8;
  vertical-align: middle;
}

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

.table tbody tr:hover td {
  background: #fafbff;
}

.table .ta-r {
  text-align: right;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 38px 16px !important;
  font-size: 13px;
}

.cell-main {
  font-weight: 600;
  color: #1d2939;
}

.cell-sub {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.cell-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.mini-thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

.act-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  color: #475467;
  cursor: pointer;
  transition: all 0.15s ease;
}

.act-btn:hover {
  border-color: #c6caea;
  color: var(--brand);
  background: #fafaff;
}

.act-btn.danger:hover {
  color: var(--danger);
  border-color: #f5c9cb;
  background: #fff7f7;
}

.price-cell {
  color: #d92d20;
  font-weight: 700;
}

/* ---------------- 卡密 ---------------- */

.import-box {
  background: #f8f9fc;
  border: 1px dashed #d9dcec;
  border-radius: 12px;
  padding: 14px;
}

.import-box .textarea {
  background: #fff;
  min-height: 92px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
}

.import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

.cards-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 6px;
}

.summary-chip {
  font-size: 12px;
  color: #475467;
  background: #f4f5fa;
  border: 1px solid #eceef6;
  border-radius: 999px;
  padding: 4px 11px;
}

.summary-chip b {
  color: var(--ink);
  margin-left: 4px;
}

/* ---------------- 表单 ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}

.settings-grid .panel {
  margin-bottom: 0;
}

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

.pay-method-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: #fff;
}

.pay-method-row label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.pay-method-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.pay-method-row .input {
  padding: 7px 10px;
  font-size: 13px;
}

.pay-method-row .pm-name {
  width: 110px;
}

.pay-method-row .pm-icon {
  width: 64px;
  text-align: center;
}

.pay-method-row code {
  margin-left: auto;
  color: #98a2b3;
  font-size: 11px;
}

/* ---------------- 库存预警 ---------------- */

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

.low-stock-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fffaf2;
  border: 1px solid #f8e7c8;
  font-size: 13px;
}

.low-stock-item .emoji {
  font-size: 18px;
}

.low-stock-item b {
  color: #b54708;
}

.low-stock-item .name {
  flex: 1;
  font-weight: 600;
  color: #3f2e12;
}

.empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 0;
}

/* ---------------- 弹窗 ---------------- */

.modal-card.wide {
  width: min(720px, 100%);
}

.modal-form .field:last-of-type {
  margin-bottom: 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.order-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  margin-bottom: 18px;
}

.order-detail-grid div {
  padding: 8px 0;
  border-bottom: 1px dashed #f0f1f7;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
}

.order-detail-grid dt {
  color: var(--muted);
  flex-shrink: 0;
}

.order-detail-grid dd {
  margin: 0;
  text-align: right;
  word-break: break-all;
}

.detail-cards {
  background: #f8f9fc;
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 7px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
}

.detail-cards .none {
  font-family: var(--font);
  color: var(--muted);
}

.modal-actions-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .admin-sidebar {
    position: static;
    width: 100%;
    padding: 14px 16px;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
  }

  .sidebar-brand {
    padding: 0;
    flex-shrink: 0;
  }

  .sidebar-brand-text small {
    display: none;
  }

  .side-nav {
    flex-direction: row;
    margin: 0;
    gap: 4px;
  }

  .side-link {
    white-space: nowrap;
    width: auto;
    padding: 8px 12px;
  }

  .sidebar-foot {
    display: none;
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-topbar {
    padding: 14px 18px;
  }

  .admin-content {
    padding: 18px 18px 48px;
  }
}

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

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

  .admin-topbar h1 {
    font-size: 17px;
  }

  .topbar-actions .btn:first-child {
    display: none;
  }

  .panel-head {
    padding: 14px 16px;
  }

  .panel-body {
    padding: 16px;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-actions .input[type="search"],
  .panel-actions .select {
    flex: 1;
    min-width: 0;
  }

  .order-detail-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 28px 22px 24px;
  }
}
