@import url('app-ui.css');

/* 后台 / 业务端 - 侧栏与主区域布局 */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 250px;
  background: var(--ui-sidebar);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1020;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.admin-sidebar .brand {
  padding: 22px 20px;
  font-size: 17px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-sidebar .brand small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
  margin-top: 4px;
}
.admin-sidebar .nav-link {
  color: #cbd5e1;
  padding: 12px 20px;
  text-decoration: none;
  display: block;
  border-left: 3px solid transparent;
  transition: 0.15s;
  font-size: 13px;
}
.admin-sidebar .nav-link-top {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  padding-top: 14px;
  padding-bottom: 14px;
}
.admin-sidebar .nav-link-sub {
  padding: 9px 20px 9px 32px;
  font-size: 13px;
  font-weight: 400;
  color: #94a3b8;
}
.admin-sidebar .nav-link-logout { color: #fca5a5 !important; }
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  background: var(--ui-sidebar-hover);
  color: #fff;
  border-left-color: var(--ui-primary);
}
.admin-sidebar .nav-link-sub.active { color: #fff; font-weight: 500; }
.admin-sidebar .nav-section {
  padding: 16px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
}
.admin-sidebar .nav-group { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.admin-sidebar .nav-group:first-of-type { border-top: none; margin-top: 4px; }
.admin-sidebar .nav-group-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: #f1f5f9;
  padding: 14px 16px 14px 20px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}
.admin-sidebar .nav-group-toggle:hover { background: var(--ui-sidebar-hover); }
.admin-sidebar .nav-group-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.admin-sidebar .nav-group-arrow {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -2px;
}
.admin-sidebar .nav-group.is-open .nav-group-arrow {
  transform: rotate(225deg);
  margin-top: 2px;
}
.admin-sidebar .nav-group-body { display: none; padding-bottom: 6px; }
.admin-sidebar .nav-group.is-open .nav-group-body { display: block; }

.admin-main {
  flex: 1;
  margin-left: 250px;
  padding: 24px 28px;
  min-width: 0;
  min-height: 100vh;
}
.admin-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--ui-card);
  border-radius: var(--ui-radius);
  border: 1px solid var(--ui-border);
  box-shadow: var(--ui-shadow);
}
.admin-header-start {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.admin-sidebar-toggle {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.admin-sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ui-text);
  border-radius: 1px;
}
.admin-sidebar-backdrop {
  display: none;
}
.admin-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
}
.admin-header .ui-header-meta {
  font-size: 13px;
  color: var(--ui-muted);
}

@media (max-width: 768px) {
  .admin-wrap { flex-direction: column; }
  .admin-sidebar-toggle { display: inline-flex; }
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }
  .admin-wrap.is-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }
  .admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(15, 23, 42, 0.45);
  }
  .admin-wrap.is-sidebar-open .admin-sidebar-backdrop {
    display: block;
  }
  .admin-main {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    padding: 12px;
    overflow-x: visible;
  }
  .admin-wrap {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .admin-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .admin-header-start {
    width: 100%;
  }
  .admin-header h1 { font-size: 17px; }
  .admin-header .ui-header-meta {
    width: 100%;
    font-size: 12px;
    padding-left: 0;
    word-break: break-word;
  }
}

/* 视频奖励规则：档位内纵向填写上级提成，避免层数多时表格过宽 */
.tier-comm-cell {
  vertical-align: top;
  min-width: 11rem;
  max-width: 15rem;
}
.tier-comm-wrap {
  padding: 2px 0;
}
.tier-comm-details {
  margin: 0;
}
.tier-comm-summary {
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  user-select: none;
  list-style: none;
}
.tier-comm-summary::-webkit-details-marker {
  display: none;
}
.tier-comm-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}
.tier-comm-details[open] .tier-comm-summary::before {
  transform: rotate(90deg);
}
.tier-comm-stack {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
  padding-right: 4px;
}
.tier-comm-stack--flat {
  max-height: none;
  overflow: visible;
}
.tier-comm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.tier-comm-row:last-child {
  margin-bottom: 0;
}
.tier-comm-label {
  flex: 0 0 4.8rem;
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  color: #64748b;
  white-space: nowrap;
}
.tier-comm-row .form-control-sm {
  flex: 1;
  min-width: 0;
}

/* 视频奖励试算结果表 */
.reward-preview-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px 14px;
  max-height: 520px;
  overflow: auto;
}
.reward-preview-section {
  margin-bottom: 16px;
}
.reward-preview-section:last-child {
  margin-bottom: 0;
}
.reward-preview-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}
.reward-preview-kv {
  width: 100%;
  margin: 0;
  font-size: 13px;
}
.reward-preview-kv th {
  width: 38%;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  vertical-align: top;
  padding: 6px 10px;
}
.reward-preview-kv td {
  color: #0f172a;
  padding: 6px 10px;
}
.reward-preview-table {
  font-size: 13px;
  margin: 0;
  background: #fff;
}
.reward-preview-table th {
  background: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
}
.reward-preview-alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin: 0;
}
.reward-preview-alert.is-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}
.reward-preview-total td {
  font-weight: 600;
  background: #eff6ff;
}

.nav-sort-input {
  width: 4.25rem;
  min-width: 4.25rem;
  text-align: center;
  display: inline-block;
}
