/* ========== 秀去水印管理后台 · 统一视觉 ========== */
:root {
  --wm-primary: #2563eb;
  --wm-primary-dark: #1d4ed8;
  --wm-primary-soft: #eff6ff;
  --wm-sidebar: #0f172a;
  --wm-sidebar-hover: #1e293b;
  --wm-accent: #d4a017;
  --wm-surface: #f1f5f9;
  --wm-card: #ffffff;
  --wm-border: #e2e8f0;
  --wm-text: #0f172a;
  --wm-muted: #64748b;
  --wm-radius: 14px;
  --wm-radius-sm: 9px;
  --wm-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --wm-btn-h: 36px;
  --wm-font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

html, body {
  font-family: var(--wm-font) !important;
  color: var(--wm-text);
}

body.bg-body-tertiary {
  background: var(--wm-surface) !important;
}

/* ---- Top bar ---- */
.app-header {
  border-bottom: 1px solid var(--wm-border) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(8px);
}

.app-header .nav-link {
  font-weight: 500;
  color: var(--wm-text) !important;
}

/* ---- Sidebar ---- */
.app-sidebar[data-bs-theme="dark"] {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%) !important;
}

.sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1rem 1.1rem;
}

.sidebar-brand .brand-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #f0c14b, #d4a017);
  color: #1a1408;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(212, 160, 23, 0.35);
}

.brand-text {
  font-size: 1.02rem !important;
  font-weight: 700 !important;
  color: #f8fafc !important;
}

.app-sidebar .nav-header {
  color: rgba(255, 255, 255, 0.32) !important;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1.1rem 1.15rem 0.35rem;
}

.app-sidebar .sidebar-menu .nav-link {
  border-radius: 10px;
  margin: 2px 0.7rem;
  padding: 0.58rem 0.9rem;
  color: rgba(255, 255, 255, 0.7) !important;
  transition: background 0.15s, color 0.15s;
}

.app-sidebar .sidebar-menu .nav-link p {
  margin: 0;
  font-weight: 500;
}

.app-sidebar .sidebar-menu .nav-link:hover {
  background: var(--wm-sidebar-hover) !important;
  color: #fff !important;
}

.app-sidebar .sidebar-menu .nav-link.active {
  background: var(--wm-primary) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.app-sidebar .nav-icon {
  margin-right: 0.55rem;
  opacity: 0.92;
}

/* ---- Page header ---- */
.app-content-header {
  padding-top: 1.35rem !important;
  padding-bottom: 0.25rem !important;
}

.app-content-header h3 {
  font-weight: 750;
  color: var(--wm-text);
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.app-content {
  padding-bottom: 2.5rem;
}

.breadcrumb {
  background: transparent;
  margin-bottom: 0;
  font-size: 0.82rem;
}

.breadcrumb-item a {
  color: var(--wm-primary);
  text-decoration: none;
  font-weight: 500;
}

/* ---- Cards ---- */
.card {
  border: 1px solid var(--wm-border) !important;
  border-radius: var(--wm-radius) !important;
  box-shadow: var(--wm-shadow) !important;
  overflow: hidden;
  background: var(--wm-card);
}

.card-header {
  background: #fff !important;
  border-bottom: 1px solid var(--wm-border) !important;
  padding: 1rem 1.25rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  min-height: 64px;
}

/* 覆盖 AdminLTE 默认 card-tools 浮动，避免错位 */
.card-header .card-tools,
.card-header .card-toolbar {
  float: none !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-weight: 700 !important;
  font-size: 1.02rem !important;
  margin: 0 !important;
  color: var(--wm-text);
  display: inline-flex;
  align-items: center;
  line-height: 1.3;
}

.card-body {
  padding: 1.25rem !important;
}

.card-body.table-responsive.p-0 {
  padding: 0 !important;
}

.card-footer {
  background: #f8fafc !important;
  border-top: 1px solid var(--wm-border) !important;
  padding: 0.95rem 1.25rem !important;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.card-outline.card-primary { border-top: 3px solid var(--wm-primary) !important; }
.card-outline.card-success { border-top: 3px solid #16a34a !important; }
.card-outline.card-warning { border-top: 3px solid #d97706 !important; }

/* ---- Buttons: 统一高度，消灭错位 ---- */
.btn {
  border-radius: var(--wm-radius-sm) !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem;
  line-height: 1.2 !important;
  min-height: var(--wm-btn-h);
  padding: 0.45rem 0.9rem !important;
  white-space: nowrap;
}

.btn-sm,
.btn.btn-sm {
  min-height: 32px;
  padding: 0.3rem 0.7rem !important;
  font-size: 0.8125rem !important;
}

.btn i {
  font-size: 1em;
  line-height: 1;
}

.btn-primary {
  background: var(--wm-primary) !important;
  border-color: var(--wm-primary) !important;
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--wm-primary-dark) !important;
  border-color: var(--wm-primary-dark) !important;
}

.btn-success {
  background: #16a34a !important;
  border-color: #16a34a !important;
}

.btn-soft {
  background: var(--wm-primary-soft) !important;
  color: var(--wm-primary) !important;
  border: 1px solid transparent !important;
}

.btn-soft:hover {
  background: #dbeafe !important;
  color: var(--wm-primary-dark) !important;
}

.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-success {
  background: #fff !important;
}

.btn-group,
.btn-group-actions {
  display: inline-flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-group-actions-nowrap {
  flex-wrap: nowrap !important;
}

.btn-group-actions form {
  display: inline-flex;
  margin: 0;
}

.td-actions {
  white-space: nowrap;
  width: 1%;
}

.td-actions .btn-group-actions {
  justify-content: flex-end;
}

/* ---- Filter bar ---- */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}

.filter-bar .filter-actions {
  display: flex;
  align-items: end;
  gap: 0.5rem;
}

.search-inline {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 320px;
  width: 100%;
}

.search-inline .form-control {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.search-inline .btn {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  min-height: auto;
  height: auto;
  padding-left: 0.85rem !important;
  padding-right: 0.85rem !important;
}

/* ---- Inline setting form ---- */
.settings-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.settings-inline .field {
  flex: 1 1 160px;
  max-width: 220px;
}

.settings-inline .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 2px;
}

.settings-inline .hint {
  color: var(--wm-muted);
  font-size: 0.8rem;
}

/* ---- Tables（紧凑行高） ---- */
.table-wm {
  margin-bottom: 0;
}

.table-wm thead th {
  background: #f8fafc;
  color: var(--wm-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--wm-border) !important;
  white-space: nowrap;
  padding: 0.5rem 0.85rem !important;
  line-height: 1.25;
}

.table-wm tbody td {
  padding: 0.42rem 0.85rem !important;
  vertical-align: middle;
  border-color: #f1f5f9 !important;
  color: var(--wm-text);
  font-size: 0.875rem;
  line-height: 1.35;
}

.table-wm tbody tr:hover {
  background: #f8fbff !important;
}

.table-wm tfoot td {
  padding: 0.5rem 0.85rem !important;
  background: #f8fafc;
  border-top: 1px solid var(--wm-border) !important;
}

.table-wm .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: #475569;
  word-break: break-all;
}

.table-wm .btn-sm,
.table-wm .btn.btn-sm {
  min-height: 28px;
  padding: 0.2rem 0.55rem !important;
  font-size: 0.78rem !important;
}

.table-wm .badge {
  padding: 0.25em 0.5em;
  font-size: 0.72rem;
}

/* 套餐列表：按内容排列表格，避免标题列被撑出大空白 */
.table-fit-wrap {
  overflow-x: auto;
}

.table-wm-compact.table-fit {
  table-layout: auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.table-wm-compact.table-fit thead th {
  padding: 0.4rem 0.7rem !important;
  white-space: nowrap;
}

.table-wm-compact.table-fit tbody td {
  padding: 0.3rem 0.7rem !important;
  font-size: 0.84rem;
}

.table-wm-compact.table-fit .col-sort {
  width: 52px;
  text-align: center;
}

.table-wm-compact.table-fit .col-code {
  white-space: nowrap;
}

.table-wm-compact.table-fit .col-title {
  max-width: 200px;
}

.table-wm-compact.table-fit .col-title .title-text {
  display: inline;
}

.table-wm-compact.table-fit .col-price,
.table-wm-compact.table-fit .col-dur,
.table-wm-compact.table-fit .col-status,
.table-wm-compact.table-fit .col-ops {
  white-space: nowrap;
}

.table-wm-compact.table-fit .btn-sm,
.table-wm-compact.table-fit .btn.btn-sm {
  min-height: 26px;
  width: 28px;
  padding: 0 !important;
  justify-content: center;
}

.price-cell {
  font-weight: 700;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}

/* ---- Forms ---- */
.form-label {
  font-weight: 600;
  color: #334155;
  font-size: 0.84rem;
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  border-radius: var(--wm-radius-sm) !important;
  border-color: #cbd5e1 !important;
  padding: 0.55rem 0.85rem;
  min-height: var(--wm-btn-h);
  font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--wm-primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.form-text {
  color: var(--wm-muted);
  font-size: 0.78rem;
}

.form-panel {
  max-width: 640px;
}

.form-check {
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-check-input {
  margin-top: 0;
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--wm-radius-sm) !important;
  border: none;
  font-size: 0.9rem;
}

.badge {
  border-radius: 6px;
  padding: 0.35em 0.6em;
  font-weight: 650;
  font-size: 0.75rem;
}

.badge-soft-danger { background: #fef2f2; color: #b91c1c; }
.badge-soft-success { background: #ecfdf5; color: #047857; }
.badge-soft-warning { background: #fffbeb; color: #b45309; }
.badge-soft-muted { background: #f1f5f9; color: #64748b; }
.badge-soft-primary { background: var(--wm-primary-soft); color: var(--wm-primary); }

/* ---- Dashboard ---- */
.metric-card {
  background: var(--wm-card);
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius);
  box-shadow: var(--wm-shadow);
  padding: 1.1rem 1.15rem;
  height: 100%;
  border-top: 3px solid #cbd5e1;
}

.metric-card .metric-label {
  font-size: 0.75rem;
  color: var(--wm-muted);
  font-weight: 650;
  margin-bottom: 0.4rem;
}

.metric-card .metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--wm-text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  word-break: break-all;
}

.metric-card .metric-hint {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: #94a3b8;
}

.metric-blue { border-top-color: #2563eb; }
.metric-sky { border-top-color: #0ea5e9; }
.metric-green { border-top-color: #16a34a; }
.metric-teal { border-top-color: #0d9488; }
.metric-amber { border-top-color: #d97706; }
.metric-rose { border-top-color: #e11d48; }

.dash-tile {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--wm-card);
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius);
  box-shadow: var(--wm-shadow);
  padding: 1.25rem 1.35rem 1.4rem;
  height: 100%;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}

.dash-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
  color: inherit;
}

.dash-tile .tile-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.85rem;
}

.dash-tile .tile-title {
  font-weight: 750;
  font-size: 1.02rem;
  margin-bottom: 0.2rem;
}

.dash-tile .tile-desc {
  color: var(--wm-muted);
  font-size: 0.82rem;
  margin: 0;
  padding-right: 1.5rem;
}

.dash-tile .tile-arrow {
  position: absolute;
  right: 1.1rem;
  bottom: 1.1rem;
  color: #94a3b8;
}

.tile-blue .tile-icon { background: #eff6ff; color: var(--wm-primary); }
.tile-green .tile-icon { background: #ecfdf5; color: #16a34a; }
.tile-amber .tile-icon { background: #fffbeb; color: #d97706; }
.tile-rose .tile-icon { background: #fff1f2; color: #e11d48; }

.stat-chip {
  background: #fff;
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--wm-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}

.stat-chip .chip-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-chip .chip-label {
  font-size: 0.78rem;
  color: var(--wm-muted);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.stat-chip .chip-value {
  font-size: 1.3rem;
  font-weight: 750;
  color: var(--wm-text);
  line-height: 1.2;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--wm-muted);
}

.empty-state i {
  font-size: 2.4rem;
  opacity: 0.4;
  display: block;
  margin-bottom: 0.75rem;
}

.welcome-banner {
  background: linear-gradient(125deg, #1e3a8a 0%, #2563eb 48%, #3b82f6 100%);
  color: #fff;
  border-radius: var(--wm-radius);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.28);
}

.welcome-banner h4 {
  margin: 0 0 0.3rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.welcome-banner p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.welcome-banner .btn-light {
  color: var(--wm-primary) !important;
  font-weight: 650;
}

.app-footer {
  border-top: 1px solid var(--wm-border) !important;
  color: var(--wm-muted);
  font-size: 0.84rem;
  background: transparent !important;
}

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top left, rgba(37, 99, 235, 0.14), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(212, 160, 23, 0.12), transparent 45%),
    #eef2f7 !important;
  font-family: var(--wm-font) !important;
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.login-logo a {
  color: var(--wm-text);
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 750;
}

.login-card-body {
  padding: 1.85rem !important;
}

.login-box .card {
  border: none !important;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.1) !important;
}

.login-box-msg {
  font-weight: 600;
  color: var(--wm-muted);
}

/* 表格内嵌 form 不产生额外空隙 */
table form {
  margin: 0;
}

@media (max-width: 768px) {
  .card-header {
    align-items: flex-start !important;
  }
  .settings-inline .field {
    max-width: none;
  }
}

/* ---- 自定义确认弹窗 ---- */
body.wm-dialog-open {
  overflow: hidden;
}

.wm-dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  animation: wm-fade-in 0.18s ease;
}

.wm-dialog-mask[hidden] {
  display: none !important;
}

.wm-dialog {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  padding: 1.6rem 1.5rem 1.35rem;
  text-align: center;
  animation: wm-pop-in 0.2s ease;
}

.wm-dialog-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--wm-primary);
  font-size: 1.45rem;
}

.wm-dialog-icon-danger {
  background: linear-gradient(135deg, #fff1f2, #fecdd3);
  color: #e11d48;
}

.btn-danger {
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  color: #fff !important;
}

.btn-danger:hover {
  background: #be123c !important;
  border-color: #be123c !important;
  color: #fff !important;
}

.wm-dialog-title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--wm-text);
  letter-spacing: -0.02em;
}

.wm-dialog-desc {
  margin: 0 0 1.35rem;
  font-size: 0.9rem;
  color: var(--wm-muted);
  line-height: 1.5;
}

.wm-dialog-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
}

.wm-dialog-actions .btn {
  min-width: 110px;
}

@keyframes wm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes wm-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
