﻿:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #172033;
  --muted: #667085;
  --line: #e6eaf0;
  --nav: #101828;
  --nav-soft: #1d2939;
  --brand: #2364aa;
  --brand-deep: #173f7a;
  --brand-soft: #eaf3ff;
  --success: #16865a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
  --radius-card: 8px;
  --radius-control: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100vh;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button:active {
  transform: translateY(1px);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: 248px;
  padding: 18px 14px;
  color: #eef4ff;
  background: var(--nav);
  border-right: 1px solid rgba(255, 255, 255, .08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  height: 56px;
  padding: 0 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 11px;
}

.nav-sections {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0;
}

.nav-sections section {
  margin-bottom: 12px;
}

.nav-sections p {
  margin: 10px 10px 6px;
  color: #7c8798;
  font-size: 12px;
  font-weight: 700;
}

.sidebar button {
  display: block;
  width: 100%;
  height: 38px;
  margin: 2px 0;
  padding: 0 12px;
  border-radius: var(--radius-control);
  color: #cdd5e1;
  background: transparent;
  text-align: left;
}

.sidebar button:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.sidebar button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 20px rgba(229, 57, 53, .22);
}

.logout-btn {
  flex: 0 0 auto;
  color: #fca5a5 !important;
  background: rgba(220, 38, 38, .1) !important;
}

.workspace {
  min-height: 100vh;
  margin-left: 248px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}

.topbar span,
.topbar b {
  display: block;
}

.topbar span {
  color: var(--muted);
  font-size: 12px;
}

.topbar b {
  margin-top: 2px;
  font-size: 16px;
}

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

.topbar-actions a,
.topbar-actions button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  line-height: 32px;
}

.content {
  padding: 24px 28px 36px;
}

body[data-page="login"] .sidebar,
body[data-page="login"] .topbar {
  display: none;
}

body[data-page="login"] .workspace {
  margin-left: 0;
}

body[data-page="login"] .content {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login {
  width: min(420px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login h1,
.page-head h1 {
  margin: 0;
}

.login p,
.page-head p {
  color: var(--muted);
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 24px;
}

.page-head p {
  margin: 7px 0 0;
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.stat,
.panel,
.mini-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel);
}

.stat {
  min-height: 108px;
  padding: 16px;
  color: inherit;
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.stat:hover,
.mini-stat:hover {
  border-color: #ffc9c5;
  box-shadow: 0 8px 18px rgba(229, 57, 53, .08);
}

.stat.wide {
  grid-column: span 2;
}

.stat span,
.mini-stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat b {
  display: block;
  margin-top: 12px;
  font-size: 28px;
}

.mini-stat {
  min-height: 82px;
  padding: 13px;
  color: inherit;
  text-align: left;
}

.mini-stat b {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.mini-stat.warn b {
  color: var(--warning);
}

.mini-stat.danger b {
  color: var(--danger);
}

.mini-stat.active {
  border-color: #ffaaa3;
  background: #fff1f0;
  box-shadow: 0 8px 18px rgba(229, 57, 53, .08);
}

.panel {
  margin-top: 16px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.resource-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(380px, .85fr);
  gap: 16px;
  align-items: start;
}

.resource-layout.wide {
  grid-template-columns: minmax(0, 1.25fr) minmax(460px, .95fr);
}

.resource-main,
.resource-side {
  min-width: 0;
}

.resource-side {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.empty-editor {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.empty-editor b {
  color: var(--ink);
  font-size: 16px;
}

.empty-editor span {
  max-width: 280px;
  font-size: 13px;
  line-height: 1.6;
}

.editor-panel:empty {
  display: none;
}

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

.toolbar h2 {
  margin: 0;
  font-size: 16px;
}

.inline-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-tools input {
  width: 230px;
  height: 36px;
}

.inline-tools select {
  width: auto;
  min-width: 128px;
  height: 36px;
  padding-top: 0;
  padding-bottom: 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(5, minmax(130px, 1fr)) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.filter-grid input,
.filter-grid select {
  height: 36px;
}

.order-overview {
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.form-grid label,
.login label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 9px 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  border-color: #ffaaa3;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, .1);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.wide-field {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}

.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-control);
  background: var(--panel-soft);
}

.bulk-bar span {
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

td.actions {
  min-width: max-content;
  text-align: center;
  vertical-align: middle;
}

th:last-child,
td.actions:last-child {
  text-align: center;
}

table td.actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  width: 1%;
  min-width: 180px;
  white-space: nowrap;
}

table td.actions:has(.btn:nth-child(3)) {
  min-width: 248px;
}

table td.actions.actions-3 {
  min-width: 248px;
}

.btn {
  min-height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-control);
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 16px rgba(229, 57, 53, .14);
  font-weight: 600;
}

.btn:hover {
  background: var(--brand-deep);
}

.btn.secondary {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.secondary:hover {
  color: var(--brand-deep);
  border-color: #ffc9c5;
  background: var(--brand-soft);
}

.btn.danger {
  background: var(--danger);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--ink);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--brand-deep);
  border-color: #ffc9c5;
  background: var(--brand-soft);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .46;
}

.btn.accent {
  background: var(--success);
}

#loginBtn,
#saveSite,
#saveCategory,
#saveProduct {
  min-width: 104px;
}

.actions .btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-control);
  font-size: 13px;
  box-shadow: none;
  white-space: nowrap;
}

.actions .btn.danger {
  color: var(--danger);
  background: #fff;
  border: 1px solid #fecaca;
}

input[readonly] {
  color: #98a2b3;
  background: #f8fafc;
}

.status-select {
  min-width: 96px;
  height: 32px;
  padding: 0 30px 0 12px;
  border-radius: 999px;
  color: var(--brand-deep);
  background-color: var(--brand-soft);
  font-size: 13px;
  font-weight: 700;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475467;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

tr:hover td {
  background: #fbfdff;
}

tr[data-order-row] {
  cursor: pointer;
}

td img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-control);
}

.main-cell {
  max-width: 380px;
}

.main-cell b,
.main-cell small {
  display: block;
}

.main-cell small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  color: var(--success);
  background: #ecfdf3;
}

.badge.danger {
  color: var(--danger);
  background: #fef2f2;
}

.badge.muted {
  color: #667085;
  background: #f2f4f7;
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1fr);
  gap: 18px;
}

.detail-grid h3 {
  margin: 0 0 12px;
}

.order-line {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.order-line img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-control);
  object-fit: cover;
}

.order-line b,
.order-line span {
  display: block;
}

.order-line span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.summary-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-control);
  background: var(--panel-soft);
  color: var(--muted);
}

.summary-box b {
  color: var(--danger);
  font-size: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.info-grid span {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.info-grid b {
  color: var(--ink);
  font-size: 13px;
  word-break: break-all;
}

.order-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel-soft);
}

.order-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(420px, .85fr);
  gap: 16px;
  align-items: start;
}

.order-list-panel,
.order-detail-panel {
  min-width: 0;
}

.order-detail-panel {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.order-detail-panel:not(.active) {
  display: grid;
  place-items: center;
  min-height: 320px;
}

.empty-detail {
  display: grid;
  gap: 8px;
  max-width: 300px;
  text-align: center;
  color: var(--muted);
}

.empty-detail b {
  color: var(--ink);
  font-size: 16px;
}

.empty-detail span {
  font-size: 13px;
  line-height: 1.6;
}

.detail-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  margin: 18px -18px -18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
}

.order-followup {
  margin-top: 18px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline article {
  position: relative;
  padding: 0 0 12px 18px;
  border-left: 1px solid var(--line);
}

.timeline article::before {
  content: "";
  position: absolute;
  top: 3px;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}

.timeline b,
.timeline p,
.timeline small {
  display: block;
}

.timeline b {
  font-size: 14px;
}

.timeline p {
  margin: 5px 0;
  color: var(--ink);
  font-size: 13px;
}

.timeline small {
  color: var(--muted);
  font-size: 12px;
}

.track-form {
  margin-top: 12px;
}

.refund-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel-soft);
}

.refund-records {
  margin-top: 14px;
}

.refund-records h3 {
  margin: 0 0 12px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.trend-list {
  display: grid;
  gap: 12px;
}

.trend-list article {
  display: grid;
  grid-template-columns: 96px minmax(120px, 1fr) 100px 60px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.trend-list div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-soft);
}

.trend-list i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.trend-list b,
.rank-list strong {
  color: var(--ink);
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-list article {
  display: grid;
  grid-template-columns: 28px 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.rank-list article:last-child {
  border-bottom: 0;
}

.rank-list span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-control);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 700;
}

.rank-list img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-control);
  object-fit: cover;
  background: var(--panel-soft);
}

.rank-list b,
.rank-list small {
  display: block;
}

.rank-list small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.user-cell {
  display: flex;
  gap: 9px;
  align-items: center;
}

.user-cell img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f2f4f7;
}

.permission-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--panel-soft);
}

.permission-box > b {
  font-size: 14px;
}

.permission-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.permission-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.permission-group strong {
  width: 72px;
  color: var(--ink);
  font-size: 13px;
}

.check-line {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.check-line input {
  width: 14px;
  height: 14px;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 24px;
  bottom: 24px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  color: #fff;
  background: rgba(16, 24, 40, .94);
  box-shadow: 0 12px 26px rgba(16, 24, 40, .18);
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    max-height: none;
  }

  .brand,
  .nav-sections,
  .nav-sections section {
    display: contents;
  }

  .nav-sections p {
    display: none;
  }

  .sidebar {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding: 10px;
  }

  .sidebar button {
    flex: 0 0 auto;
    width: auto;
    padding: 0 12px;
  }

  .brand > span,
  .brand div {
    display: none;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 16px;
  }

  .grid,
  .mini-grid,
  .filter-grid,
  .info-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stat.wide {
    grid-column: auto;
  }

  .toolbar,
  .inline-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-tools input {
    width: 100%;
  }

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

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

  .resource-layout,
  .resource-layout.wide {
    grid-template-columns: 1fr;
  }

  .resource-side {
    position: static;
    max-height: none;
  }

  .order-detail-panel {
    position: static;
    max-height: none;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .trend-list article {
    grid-template-columns: 86px minmax(80px, 1fr);
  }

  .trend-list b,
  .trend-list small {
    grid-column: 2;
  }

  .pager {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
