* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1677ff;
  --primary-light: #e9f2ff;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-main: #f0f2f5;
  --bg-white: #fff;
  --border-color: #e8e8e8;
  --icon-sidebar-width: 64px;
  --sub-sidebar-width: 180px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
  position: relative;
}

/* ========== 图标侧边栏 ========== */
.icon-sidebar {
  width: var(--icon-sidebar-width);
  min-width: var(--icon-sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  position: relative;
}

.icon-logo {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0 8px;
}

.icon-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s;
}

.icon-nav-item span {
  font-size: 12px;
  line-height: 1;
}

.icon-nav-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.icon-nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* ========== 子菜单浮层 ========== */
.sub-sidebar {
  position: absolute;
  left: var(--icon-sidebar-width);
  top: 0;
  width: var(--sub-sidebar-width);
  height: 100%;
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 15;
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s ease, opacity 0.15s ease, visibility 0.2s;
}

.sub-sidebar.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.sub-menu {
  padding: 16px 0;
}

.sub-menu-group {
  margin-bottom: 8px;
}

.sub-menu-group-title {
  padding: 10px 20px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.sub-menu-item {
  display: block;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.sub-menu-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.sub-menu-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* ========== 主区域 ========== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ========== 顶栏 ========== */
.topbar {
  height: 56px;
  min-height: 56px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 5;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.system-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-divider {
  width: 1px;
  height: 18px;
  background: #d9d9d9;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.breadcrumb-item {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1;
}

.breadcrumb-item:hover {
  color: var(--primary);
}

.breadcrumb-item.current {
  color: var(--text-primary);
  font-weight: 500;
  cursor: default;
}

.breadcrumb-item.current:hover {
  color: var(--text-primary);
}

.breadcrumb-sep {
  color: #ccc;
  font-size: 11px;
  user-select: none;
  line-height: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  position: relative;
  margin-right: 8px;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  width: 200px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0 12px 0 32px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  border-color: var(--primary);
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.topbar-icon-btn:hover {
  background: #f5f5f5;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.user-info:hover {
  background: #f5f5f5;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
}

.user-name {
  font-size: 14px;
  color: var(--text-primary);
}

/* ========== 内容区 ========== */
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-main);
}

/* ========== 内容区 · 内嵌原型页模式 ========== */
.content.embed-mode {
  display: flex;
  padding: 0;
  overflow: hidden;
}

.content.embed-mode .embed-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: #fff;
}

.embed-missing {
  margin: 24px;
  padding: 20px 24px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-secondary);
}

.embed-missing code {
  padding: 2px 6px;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 12px;
  color: #d4380d;
}

/* ========== 遮罩层 ========== */
.sub-sidebar-mask {
  position: absolute;
  left: var(--icon-sidebar-width);
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.08);
  z-index: 14;
  display: none;
}

.sub-sidebar-mask.show {
  display: block;
}

/* ========== 首页欢迎 ========== */
.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
}

.welcome-icon {
  width: 100px;
  height: 100px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.welcome-icon svg {
  width: 60px;
  height: 60px;
}

.welcome-text {
  font-size: 20px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ========== 通用页面 ========== */
.page-container {
  background: var(--bg-white);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.page-header h2 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.page-header .actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 7px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: #3d9bf0;
  color: white;
}

/* ========== 表格 ========== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th,
table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table th {
  background: #fafafa;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}

table tbody tr:hover {
  background: #fafafa;
}

/* ========== 滚动条 ========== */
.sub-sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar {
  width: 4px;
}

.sub-sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 2px;
}

.sub-sidebar::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
  background: transparent;
}

/* ========== 抽屉遮罩 ========== */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.drawer-mask.show {
  opacity: 1;
  visibility: visible;
}

/* ========== 抽屉 ========== */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 680px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-white);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.drawer-close:hover {
  background: #f5f5f5;
  color: var(--text-primary);
}

.drawer-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ========== 通知分类侧边栏 ========== */
.notif-sidebar {
  width: 180px;
  min-width: 180px;
  border-right: 1px solid var(--border-color);
  padding: 16px 0;
  overflow-y: auto;
}

.notif-sidebar-title {
  padding: 0 16px 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.notif-category {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  gap: 6px;
}

.notif-category:hover {
  background: #f9f9f9;
  color: var(--text-primary);
}

.notif-category.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 500;
}

.notif-category.parent {
  font-weight: 500;
  color: var(--text-primary);
}

.notif-category .expand-icon {
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.notif-category.parent.expanded .expand-icon {
  transform: rotate(180deg);
}

.notif-badge {
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #f0f0f0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.notif-category.active .notif-badge {
  background: rgba(79, 172, 254, 0.15);
  color: var(--primary);
}

.notif-category-children {
  overflow: hidden;
  transition: max-height 0.25s;
}

.notif-category-children.collapsed {
  max-height: 0;
}

.notif-category.child {
  padding-left: 36px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ========== 通知主区域 ========== */
.notif-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-tabs {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 48px;
  min-height: 48px;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
}

.notif-tab {
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.notif-tab:hover {
  color: var(--primary);
}

.notif-tab.active {
  color: var(--primary);
  font-weight: 500;
}

.notif-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.unread-count {
  margin-left: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.notif-tab.active .unread-count {
  color: var(--primary);
}

.notif-tab-action {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.notif-tab-action:hover {
  color: var(--primary);
}

/* ========== 通知列表 ========== */
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.notif-item {
  display: flex;
  padding: 16px 24px;
  border-bottom: 1px solid #f5f5f5;
  gap: 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.notif-item:hover {
  background: #fafbfc;
}

.notif-item.unread .notif-dot {
  background: var(--primary);
}

.notif-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 6px;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.notif-title {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notif-tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.notif-tag {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.notif-tag.tag-return { background: #fff7e6; color: #d46b08; }
.notif-tag.tag-dynamic { background: #e6f7ff; color: #1890ff; }
.notif-tag.tag-assign { background: #f6ffed; color: #52c41a; }
.notif-tag.tag-cancel { background: #fff1f0; color: #f5222d; }
.notif-tag.tag-pause { background: #f9f0ff; color: #722ed1; }
.notif-tag.tag-accept { background: #e6fffb; color: #13c2c2; }

.notif-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 通知列表滚动条 */
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-sidebar::-webkit-scrollbar { width: 4px; }
.notif-sidebar::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }
.notif-sidebar::-webkit-scrollbar-track { background: transparent; }
