:root{
  --bg:#ffffff;
  --text:#0b1220;
  --muted:#6b7280;
  --line:#e5e7eb;

  --blue:#2563eb;
  --blue-2:#1d4ed8;

  --yellow:#f59e0b;
  --yellow-2:#d97706;

  --black:#0b1220;
  --card:#ffffff;
  --soft:#f8fafc;

  --radius:14px;
  --shadow: 0 8px 24px rgba(11,18,32,.08);
  --shadow-2: 0 10px 30px rgba(37,99,235,.10);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background:var(--bg);
}

a{ color:inherit; text-decoration:none; }
.muted{ color:var(--muted); }
.td-muted{ color:var(--muted); text-align:center; padding:18px !important; }

.badge{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px; padding:3px 8px; border-radius:999px;
  border:1px solid var(--line);
  background:var(--soft);
  color:var(--text);
}
.badge-blue{ border-color: rgba(37,99,235,.25); background: rgba(37,99,235,.08); color: var(--blue); }
.badge-yellow{ border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.12); color: var(--yellow-2); }

.tag{
  font-size:12px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background:var(--soft);
}
.tag-yellow{ border-color: rgba(245,158,11,.25); background: rgba(245,158,11,.10); color: var(--yellow-2); }

.alert{
  border-radius:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  background:var(--soft);
  font-size:14px;
}
.alert-danger{
  border-color: rgba(245,158,11,.35);
  background: rgba(245,158,11,.12);
}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  border-radius:12px;
  padding:10px 14px;
  border:1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor:pointer;
  user-select:none;
  transition: .15s ease;
  font-weight:600;
}
.btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active{ transform: translateY(0); box-shadow:none; }

.btn-sm{ padding:7px 10px; border-radius:10px; font-size:13px; }
.btn-block{ width:100%; }

.btn-primary{
  background: var(--blue);
  border-color: rgba(37,99,235,.35);
  color:#fff;
  box-shadow: var(--shadow-2);
}
.btn-primary:hover{ background: var(--blue-2); }

.btn-ghost{
  background: transparent;
}
.btn-ghost:hover{
  background: rgba(37,99,235,.06);
  border-color: rgba(37,99,235,.25);
  box-shadow:none;
}

.icon-btn{
  width:36px; height:36px; border-radius:12px;
  border:1px solid var(--line);
  background: var(--card);
  cursor:pointer;
  transition:.15s ease;
}
.icon-btn:hover{ box-shadow: var(--shadow); transform: translateY(-1px); }

.form-label{ display:block; font-size:13px; margin:10px 0 6px; color: var(--muted); }
.form-input, .form-select, .form-textarea{
  width:100%;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: #fff;
  outline:none;
  transition: .15s ease;
}
.form-textarea{ min-height: 140px; resize: vertical; font-family: var(--sans); }
.form-input:focus, .form-select:focus, .form-textarea:focus{
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.link{ color: var(--blue); }
.link:hover{ text-decoration:underline; }

.checkbox{
  display:inline-flex; align-items:center; gap:8px;
  color: var(--muted);
  font-size:13px;
}
.checkbox input{ width:16px; height:16px; accent-color: var(--blue); }

.divider{ height:1px; background: var(--line); margin:14px 0; }

/* 登录页 */
.auth-body{
  background: linear-gradient(180deg, rgba(37,99,235,.06), rgba(245,158,11,.06));
}


.auth-wrap{
  display: flex;
  height: 100vh;
  width: 100%;
  justify-content: center;
  align-items: center;
}
.auth-card{
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
  width: min(420px, calc(100% - 32px));
  background: #fff;
  border:1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.auth-brand{
  display:flex; align-items:center; gap:12px;
  margin-bottom: 10px;
}
.brand-logo{
  width:44px; height:44px;
  border-radius:14px;
  background: rgba(37,99,235,.10);
  border:1px solid rgba(37,99,235,.18);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.brand-logo img{ width:28px; height:28px; }
.brand-title{ font-weight:800; font-size:18px; }
.brand-sub{ font-size:13px; color: var(--muted); margin-top:2px; }

.auth-tip{
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(245,158,11,.10);
  border: 1px solid rgba(245,158,11,.25);
  font-size: 13px;
  color: var(--text);
}
.auth-form{ margin-top: 8px; }
.form-row{
  margin: 10px 0 14px;
  display:flex; align-items:center; justify-content:space-between;
}
.auth-footnote{
  margin-top: 12px;
  font-size:12px;
  color: var(--muted);
  text-align:center;
}

.auth-side{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 26px;
}
.auth-side-inner{
  max-width: 720px;
  width: 100%;
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(37,99,235,.18);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.side-title{ font-size: 28px; font-weight: 900; letter-spacing: .2px; }
.side-desc{ color: var(--muted); margin-top: 8px; font-size: 15px; }
.side-points{ margin-top: 18px; display:grid; gap:10px; }
.point{ display:flex; align-items:center; gap:10px; color: var(--text); }
.dot{ width:10px; height:10px; border-radius: 999px; display:inline-block; }
.dot-blue{ background: var(--blue); }
.dot-yellow{ background: var(--yellow); }
.dot-black{ background: var(--black); }

/* 后台布局 */
.layout{
  min-height:100vh;
  display:grid;
  grid-template-columns: 260px 1fr;
  background: #f6f8fb;
}
.sidebar-overlay{
  display:none;
  position: fixed;
  inset: 0;
  background: rgba(11,18,32,.45);
  z-index: 40;
}
.sidebar-toggle{ display:none; }

.sidebar{
  background:#fff;
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
}
.sidebar-top{
  padding: 16px 14px 10px;
  border-bottom:1px solid var(--line);
}
.sidebar-brand{
  display:flex; align-items:center; gap:10px;
  padding:10px 10px;
  border-radius:14px;
}
.brand-mark{
  width:14px; height:14px; border-radius: 4px;
  background: linear-gradient(135deg, var(--blue), var(--yellow));
}
.brand-name{ font-weight:900; }

.menu{ padding: 10px 10px 14px; overflow:auto; }
.menu-group{
  margin-top: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.85);
  overflow: hidden;
  border: 0;
  box-shadow: none;
}
.menu-group:first-child{ margin-top: 6px; }
.menu-group > summary::-webkit-details-marker{ display:none; }
.menu-group > summary{ list-style:none; }
/* Firefox/Chromium: hide default marker triangle */
.menu-group > summary::marker{ content:""; }
.menu-title{
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
  padding: 16px 16px;
  margin: 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  cursor: pointer;
  user-select: none;
  transition: .15s ease;
  background: #fff;
  border-bottom: 1px solid rgba(229,231,235,.9);
}
.menu-title .mg-left{ display:flex; align-items:center; gap:10px; min-width:0; }
.menu-title .mg-ico{
  width: 40px;
  height: 40px;
  border-radius: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(37,99,235,.20);
  flex: 0 0 auto;
  font-size: 18px;
}
.menu-title .mg-text{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.menu-title:hover{
  background: rgba(37,99,235,.06);
}
.menu-title::after{
  content: "▾";
  font-size: 13px;
  opacity: .65;
  transform: rotate(0deg);
  transition: transform .15s ease, opacity .15s ease;
}
.menu-group:not([open]) > .menu-title::after{
  transform: rotate(-90deg);
  opacity: .45;
}
.menu-items{
  padding: 12px 12px 14px;
  background: linear-gradient(180deg, rgba(37,99,235,.02), rgba(245,158,11,.01));
}
.menu-items .menu-item{ margin-top: 6px; }
.menu-items .menu-item:first-child{ margin-top: 0; }
/* 二级菜单不显示图标，只保留分组图标 */
.menu .menu-item .mi-ico{ display:none !important; }
.menu-items .menu-item{
  justify-content:flex-start;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
}
.menu-items .mi-text{
  margin-left: 0;
  font-weight: 650;
}
.menu-item{
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 10px;
  border-radius: 14px;
  border:1px solid rgba(229,231,235,.85);
  background: rgba(255,255,255,.92);
  transition: .15s ease;
}
.menu-item .mi-ico{ width:26px; text-align:center; }
.menu-item .mi-text{ flex:1; font-weight:700; }
.menu-item:hover{
  background: rgba(37,99,235,.06);
  border-color: rgba(37,99,235,.25);
}
.menu-item.is-active{
  background: rgba(255,255,255,.92);
  border-color: rgba(229,231,235,.85);
  box-shadow: none;
}
.menu-item.disabled{
  opacity:.7;
  cursor:not-allowed;
}
.menu-item.disabled:hover{
  background: transparent;
  border-color: transparent;
  box-shadow:none;
}

.sidebar-bottom{
  margin-top:auto;
  padding: 14px;
  border-top:1px solid var(--line);
  background: #fff;
}
.sidebar-user{
  display:flex; align-items:center; gap:12px;
  margin-bottom: 12px;
}
.avatar{
  width:44px; height:44px;
  border-radius: 16px;
  background: rgba(37,99,235,.10);
  border:1px solid rgba(37,99,235,.20);
  display:flex; align-items:center; justify-content:center;
  font-weight: 900;
  color: var(--blue);
}
.user-name{ font-weight:900; }
.user-role{ font-size:12px; color: var(--muted); margin-top:2px; }

.main{
  display:flex;
  flex-direction:column;
}
.topbar{
  height:64px;
  background:#fff;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 16px;
}
.crumb{
  display:flex; align-items:center; gap:10px;
}

/* 移动端：侧边栏抽屉 */
@media (max-width: 980px){
  body.sidebar-open{ overflow:hidden; }

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

  .sidebar{
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 86vw);
    z-index: 50;
    transform: translateX(-110%);
    transition: transform .2s ease;
  }

  body.sidebar-open .sidebar{
    transform: translateX(0);
  }
  body.sidebar-open .sidebar-overlay{
    display:block;
  }

  .sidebar-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 18px;
    line-height: 1;
  }
}

/* 兼容：文件末尾还有一段把 .sidebar 直接 display:none（导致只剩遮罩） */
@media (max-width: 980px){
  body.sidebar-open .sidebar{ display:flex !important; }
  body.sidebar-open .sidebar-overlay{ display:block !important; }
  body.sidebar-open .sidebar-toggle{ display:inline-flex !important; }
}
.crumb-dot{
  width:10px; height:10px;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(245,158,11,.14);
}
.crumb-text{ font-weight:900; }

.topbar-search{
  display:flex; align-items:center; gap:10px;
}
.topbar-input{
  width: 320px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid var(--line);
  outline:none;
}
.topbar-input:focus{
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.content{
  padding: 16px;
  display:grid;
  gap: 14px;
}
.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.panel-actions{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
}
.h-title{ font-size: 16px; font-weight: 900; }
.h-sub{ font-size: 13px; margin-top: 4px; }

.kpi-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi-card{
  border:1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(37,99,235,.05), rgba(245,158,11,.04));
}
.kpi-k{ color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi-v{ font-size: 26px; font-weight: 950; margin-top: 8px; letter-spacing:.2px; }
.kpi-t{ margin-top: 8px; font-size: 12px; display:flex; align-items:center; gap:8px; }

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.table-wrap{
  border:1px solid var(--line);
  border-radius: 16px;
  overflow:hidden;
}
.table-wrap.table-scroll-x{
  overflow:auto;
}
.table.table-fixed{
  table-layout: fixed;
}
.table.table-wide th,
.table.table-wide td{
  white-space: nowrap;
}
.cell-ellipsis{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.table{
  width:100%;
  border-collapse: collapse;
  background:#fff;
}
.table th, .table td{
  padding: 12px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  font-size: 13px;
}
.table th{
  background: #fbfcfe;
  color: var(--muted);
  font-weight: 900;
}
.table tr:hover td{ background: rgba(37,99,235,.03); }

.pill{
  display:inline-flex;
  align-items:center;
  padding: 4px 10px;
  border-radius: 999px;
  border:1px solid var(--line);
  font-weight: 800;
  font-size: 12px;
}
.pill.blue{ border-color: rgba(37,99,235,.25); background: rgba(37,99,235,.08); color: var(--blue); }
.pill.yellow{ border-color: rgba(245,158,11,.30); background: rgba(245,158,11,.12); color: var(--yellow-2); }
.pill.black{ border-color: rgba(11,18,32,.25); background: rgba(11,18,32,.06); color: var(--black); }

.filters{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr;
  gap: 12px;
  margin-bottom: 12px;
}
.f-label{ font-size: 12px; color: var(--muted); font-weight: 900; margin: 2px 0 6px; }
.f-actions{ display:flex; align-items:flex-end; gap: 10px; }

.pager{
  margin-top: 12px;
  display:flex; align-items:center; justify-content:space-between;
}
.pager-page{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 36px;
  height: 34px;
  border-radius: 12px;
  border:1px solid var(--line);
  background:#fff;
  font-weight: 900;
}

.footer{
  margin-top:auto;
  padding: 12px 16px;
  border-top:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  color: var(--muted);
  font-size: 12px;
}

/* toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: min(520px, calc(100% - 32px));
  background: rgba(11,18,32,.92);
  color: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  display:none;
  box-shadow: var(--shadow);
  font-size: 13px;
  /* 确保在 layui 弹窗/遮罩之上 */
  z-index: 999999;
}
.toast.show{ display:block; }

.img-grid{ display:grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
.img-item{ border:1px solid var(--line); border-radius: 14px; overflow:hidden; background:#fff; }
.img-item img{ width:100%; height: 90px; object-fit:cover; display:block; }
.img-item .img-meta{ padding: 8px 10px; font-size:12px; color: var(--muted); display:flex; justify-content:space-between; gap:8px; }

@media (max-width: 1100px){
  .auth-wrap{ grid-template-columns: 1fr; }
  .auth-side{ display:none; }
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ display:none; }
  .kpi-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2{ grid-template-columns: 1fr; }
  .filters{ grid-template-columns: 1fr 1fr; }
  .topbar-search{ display:none; }
  .img-grid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
}
