/* ============================================================
   布局：左侧可收起侧边导航栏 + 右侧主内容区域
   ============================================================ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  /* 哆啦A梦身体蓝渐变 */
  background: linear-gradient(180deg, #17ACEC 0%, #0B8AC9 44%, #0672A9 78%, #055C8C 100%);
  display: flex;
  flex-direction: column;
  transition: width var(--t), flex-basis var(--t);
  position: relative;
  z-index: 30;
  box-shadow: 2px 0 14px rgba(4, 78, 119, .24);
}
/* 右缘红项圈细线 */
.sidebar::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--nose) 0%, #B00010 100%);
}
.app.collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
  flex-basis: var(--sidebar-w-collapsed);
}

/* —— 顶部：Logo + 展开/收起按钮 —— */
.sb-head {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
.sb-logo {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: #fff; padding: 1px;
  box-shadow: 0 2px 6px rgba(4, 60, 92, .3);
}
.sb-title { flex: 1; min-width: 0; overflow: hidden; }
.sb-title b {
  display: block; font-size: 14px; color: #FFFFFF; font-weight: 700;
  letter-spacing: .3px; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(4, 60, 92, .35);
}
.sb-title span {
  display: block; font-size: 10.5px; color: #CDEDFF;
  white-space: nowrap; letter-spacing: .5px;
}
.sb-toggle {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  transition: background var(--t), transform var(--t);
}
.sb-toggle:hover { background: var(--bell); }
.sb-toggle:hover svg { stroke: #6A4B00; }
.sb-toggle svg { width: 14px; height: 14px; stroke: #FFFFFF; stroke-width: 2.1; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--t); }
.app.collapsed .sb-toggle svg { transform: rotate(180deg); }

.app.collapsed .sb-title { display: none; }
.app.collapsed .sb-head { justify-content: center; padding: 0; gap: 0; }
.app.collapsed .sb-logo { display: none; }

/* —— 菜单 —— */
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 8px; }
.sb-nav::-webkit-scrollbar { width: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 10px; margin-bottom: 3px;
  border-radius: 21px;              /* 胶囊形，呼应哆啦A梦圆润造型 */
  cursor: pointer;
  color: #E3F5FF;
  transition: background var(--t), color var(--t), box-shadow var(--t);
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, .18); color: #fff; }
/* 选中态＝白肚皮胶囊 + 蓝字 */
.nav-item.active {
  background: #FFFFFF; color: var(--blue-800); font-weight: 600;
  box-shadow: 0 2px 8px rgba(4, 60, 92, .26);
}
/* 选中指示条＝红项圈 */
.nav-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--nose);
}
/* 圆形图片图标 */
.nav-icon {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  transition: transform var(--t), box-shadow var(--t);
  box-shadow: 0 1px 3px rgba(4, 60, 92, .28);
}
.nav-item:hover .nav-icon { transform: scale(1.08) rotate(-6deg); }
.nav-item.active .nav-icon { box-shadow: 0 0 0 2px var(--bell); }
.nav-text { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  margin-left: auto; font-size: 10.5px; padding: 1px 7px; border-radius: 9px;
  background: rgba(255, 255, 255, .24); color: #fff; line-height: 1.5;
}
.nav-item.active .nav-badge { background: var(--blue-100); color: var(--blue-800); }

.app.collapsed .nav-text,
.app.collapsed .nav-badge { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 0; }

/* 折叠态悬浮提示 */
.app.collapsed .nav-item:hover::after {
  content: attr(data-title);
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--dora-900); color: #fff;
  padding: 5px 10px; border-radius: 6px; font-size: 12px;
  white-space: nowrap; z-index: 100; box-shadow: var(--shadow);
  pointer-events: none;
}

/* —— 底部 —— */
.sb-foot {
  padding: 10px 8px;
  border-top: 1px solid rgba(255, 255, 255, .2);
}
.sb-stat {
  display: flex; gap: 6px; padding: 8px 10px;
  background: rgba(255, 255, 255, .16); border-radius: 12px;
  color: #DFF3FF; font-size: 11.5px;
}
.sb-stat b { color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; display: block; }
.sb-stat > div { flex: 1; text-align: center; }
.app.collapsed .sb-stat { display: none; }
.sb-foot .nav-item { height: 34px; }

/* ==================== 主内容区 ==================== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-app);
}

.topbar {
  height: 58px; flex: 0 0 58px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.topbar h1 {
  font-size: 16.5px; font-weight: 600; letter-spacing: .2px;
  display: flex; align-items: center; gap: 9px;
}
.topbar h1 .bar {
  width: 18px; height: 18px; flex: 0 0 18px;
  background: url('../assets/img/bell.svg') center/contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15));
}
.topbar .desc { font-size: 12.5px; color: var(--text-3); }
.topbar .spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 34px;
  position: relative;
}
.view.no-pad { padding: 0; overflow: hidden; }

/* ---- 工具条 ---- */
.toolbar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.toolbar .field { min-width: 130px; }
.toolbar .grow { flex: 1; }

/* ---- 网格 ---- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 1500px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1180px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }

/* ---- 区块标题 ---- */
.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
}
.sec-title .bar { width: 3px; height: 13px; background: var(--nose); border-radius: 2px; }
.sec-title .n { font-size: 12px; color: var(--text-3); font-weight: 400; }
.sec-title .right { margin-left: auto; display: flex; gap: 6px; }

/* ---- 统计小卡 ---- */
.stat-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-card .ic {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  background: linear-gradient(160deg, #17ACEC, #0672A9);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(6, 105, 156, .3);
}
.stat-card .ic img { width: 26px; height: 26px; border-radius: 50%; }
.stat-card .num { font-size: 21px; font-weight: 600; line-height: 1.15; }
.stat-card .lb { font-size: 12px; color: var(--text-3); }

/* ==================== 弹窗 ==================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 47, 71, .48);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .18s ease;
  backdrop-filter: blur(2px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card); border-radius: 12px;
  width: 100%; max-width: 540px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: popIn .22s cubic-bezier(.3, 1.2, .5, 1);
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 780px; }
.modal.xwide { max-width: 1000px; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; font-weight: 600; flex: 1; }
.modal-close {
  width: 26px; height: 26px; border-radius: 6px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1;
}
.modal-close:hover { background: var(--dora-100); color: var(--text-1); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 18px; border-top: 1px solid var(--border); background: var(--bg-sub);
  border-radius: 0 0 12px 12px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }

/* ==================== 提示条 ==================== */
.toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px;
  background: var(--dora-800); color: #fff; font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .24s cubic-bezier(.3, 1.2, .5, 1);
}
.toast.err { background: var(--nose); }
.toast.ok { background: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
