/* 智融 · 管理中心（/admin/）
 *
 * 和 /camera/、/zion/ 一样用门户的 styles.css + portal.css 打底，
 * 这里只补「左侧导航 + 数据表格」这类后台专属的东西。
 */

.admin-page {
  background: var(--bg);
}

.admin-wrap {
  width: min(1180px, calc(100% - 80px));
}

.admin-layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* 侧栏 */

.admin-side {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-side-title {
  padding: 6px 10px 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.4px;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.admin-nav:hover {
  background: #f3f5fa;
  color: var(--ink);
}

.admin-nav.is-active {
  background: var(--tint);
  color: var(--brand);
  font-weight: 550;
}

.admin-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.admin-side-foot {
  margin-top: 8px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.admin-side-foot strong {
  color: var(--ink);
  font-weight: 550;
}

/* 内容区 */

.admin-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.admin-head h1 {
  font-size: 24px;
  letter-spacing: -0.5px;
}

.admin-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* 指标卡 */

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

.metric {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 550;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}

.metric-note {
  margin-top: 4px;
  color: #98a2b3;
  font-size: 12px;
}

/* 面板与表格 */

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

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

.admin-panel-head h2 {
  font-size: 15px;
  font-weight: 550;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.admin-input,
.admin-select {
  height: 38px;
  border: 1px solid #dce0e9;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.admin-input {
  flex: 1;
  min-width: 180px;
  padding: 0 12px;
}

.admin-select {
  padding: 0 8px;
}

.admin-input:focus,
.admin-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(82, 98, 213, 0.12);
}

.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f3f8;
  vertical-align: middle;
}

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

.admin-table tr.is-hidden {
  background: #fff8f6;
}

.admin-table tr.is-hidden:hover {
  background: #fff3f0;
}

.cell-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 550;
}

.cell-sub {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 12px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.faint {
  color: #98a2b3;
  font-size: 12px;
}

/* 小标签 */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-feature {
  background: #fff6e5;
  border-color: #f3ddb0;
  color: #9a6a19;
}

.tag-hide {
  background: #fdeceb;
  border-color: #f6cdc9;
  color: #b4433a;
}

.tag-seed {
  background: #f2f4f8;
  border-color: #e3e7ef;
  color: #7b8494;
}

.tag-ok {
  background: #e9f7ee;
  border-color: #c9ebd4;
  color: #2f7d4a;
}

/* 按钮 */

.admin-btn {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.admin-btn:hover:not(:disabled) {
  border-color: #c9d0e3;
  color: var(--ink);
  background: #f7f8fc;
}

.admin-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.admin-btn.is-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.admin-btn.is-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.admin-btn.is-danger:hover:not(:disabled) {
  border-color: #f0c4bf;
  background: #fdeceb;
  color: #b4433a;
}

.btn-row {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.admin-btn.is-mini {
  padding: 4px 8px;
  font-size: 12px;
}

/* 分页 */

.admin-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* 空态 */

.admin-empty {
  padding: 36px 0;
  color: #98a2b3;
  font-size: 13px;
  text-align: center;
}

/* 登录卡片 */

.admin-auth {
  display: grid;
  place-items: center;
  padding: 40px 0 60px;
}

.admin-auth-card {
  width: min(392px, 100%);
  padding: 28px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-auth-card h1 {
  font-size: 20px;
  letter-spacing: -0.3px;
}

.admin-auth-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.admin-auth-card label {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: #3d4658;
  font-size: 13px;
  font-weight: 550;
}

.admin-auth-card input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #dce0e9;
  border-radius: 9px;
  font-size: 14px;
  outline: none;
}

.admin-auth-card input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(82, 98, 213, 0.12);
}

.admin-auth-card .admin-btn {
  width: 100%;
  height: 42px;
  margin-top: 20px;
  font-size: 14px;
}

/* 图表 */

.admin-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 132px;
  padding-top: 18px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 100%;
}

.chart-bar {
  position: relative;
  width: 100%;
  max-width: 52px;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #7f8cf0 0%, #5262d5 100%);
}

.chart-bar span {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
}

.chart-day {
  color: #98a2b3;
  font-size: 11px;
}

/* 列表行（Top / 最近 / 日志） */

.flat-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid #f1f3f8;
  font-size: 13px;
}

.flat-row:last-child {
  border-bottom: 0;
}

.flat-row .w-100 {
  width: 104px;
  flex: 0 0 104px;
  color: #98a2b3;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.flat-row .w-72 {
  width: 76px;
  flex: 0 0 76px;
  color: var(--muted);
  font-size: 12px;
}

/* 抽屉与弹窗 */

.admin-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  background: rgba(32, 39, 56, 0.32);
}

.admin-drawer {
  width: min(440px, 100%);
  height: 100%;
  padding: 22px 22px 32px;
  overflow-y: auto;
  background: var(--bg);
}

.admin-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(32, 39, 56, 0.4);
}

.admin-modal {
  width: min(580px, 100%);
  max-height: 88vh;
  padding: 20px 22px;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
}

.admin-drawer h2,
.admin-modal h2 {
  font-size: 16px;
  font-weight: 550;
}

.drawer-form {
  display: grid;
  gap: 0;
  margin-top: 16px;
}

.drawer-form .field {
  margin-bottom: 14px;
}

.drawer-form .field input,
.drawer-form .field select,
.drawer-form .field textarea {
  padding: 9px 11px;
  border: 1px solid #dce0e9;
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  outline: none;
  width: 100%;
}

.drawer-form .field input:focus,
.drawer-form .field select:focus,
.drawer-form .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(82, 98, 213, 0.12);
}

.form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.meta-list span {
  color: #98a2b3;
  margin-right: 6px;
}

#track-canvas {
  display: block;
  width: 100%;
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f8fc;
}

/* 提示条 */

.admin-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 70;
  padding: 10px 16px;
  border-radius: 9px;
  background: #202738;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.admin-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.admin-toast.is-error {
  background: #b4433a;
}

@media (max-width: 900px) {
  .admin-wrap {
    width: calc(100% - 32px);
  }

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

  .admin-side {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-side-title,
  .admin-side-foot {
    display: none;
  }

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

  .admin-drawer {
    width: 100%;
  }
}

/* 概览 · 首页小程序码 */
.qr-admin {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.qr-admin-thumb {
  flex: 0 0 132px;
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

/* 百分比高度在 auto 行高的栅格里算不出来，用 max-* 让图自己缩 */
.qr-admin-thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.qr-admin-thumb.is-empty {
  border-style: dashed;
  background: #fafbfe;
  color: #9aa3b5;
  font-size: 12px;
}

.qr-admin-info {
  min-width: 0;
  display: grid;
  gap: 10px;
  justify-items: start;
}

.qr-admin-info p {
  font-size: 13px;
  color: var(--muted);
}

.qr-upload {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

@media (max-width: 720px) {
  .qr-admin {
    flex-direction: column;
    gap: 14px;
  }
}
