/* RuoYi 风格 SaaS 总平台原型样式 */
:root {
  --sidebar-width: 210px;
  --header-height: 50px;
  --primary: #409eff;
  --sidebar-bg: #304156;
  --sidebar-active: #263445;
  --sidebar-text: #bfcbd9;
  --sidebar-active-text: #409eff;
  --bg: #f0f2f5;
  --border: #e6ebf5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif; font-size: 14px; color: #606266; background: var(--bg); }

.app-wrapper { display: flex; min-height: 100vh; }
.sidebar-container { width: var(--sidebar-width); background: var(--sidebar-bg); position: fixed; top: 0; left: 0; bottom: 0; overflow-x: hidden; overflow-y: auto; z-index: 1001; transition: width 0.22s ease; }
.sidebar-container.collapsed { width: 64px; }
.main-container { margin-left: var(--sidebar-width); min-height: 100vh; width: calc(100% - var(--sidebar-width)); transition: margin-left 0.22s, width 0.22s; }
.sidebar-container.collapsed + .main-container { margin-left: 64px; width: calc(100% - 64px); }

/* Logo 区 — 对齐 jianshenyueke */
.logo-container {
  height: var(--header-height); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: #2b2f3a; border-bottom: 1px solid rgba(255,255,255,.06);
  color: #fff; flex-shrink: 0; overflow: hidden;
}
.logo-container .logo-mark {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #36cfc9, #409eff);
  display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 13px; color: #fff; font-weight: 600;
}
.logo-container .logo-title, .logo-container .logo-text {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 14px; font-weight: 600; color: #fff;
}
.logo-container .logo-title span { color: var(--primary); }
.nav-toggle {
  width: 28px; height: 28px; border: 0; background: transparent; color: #bfcbd9;
  cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-toggle:hover { background: rgba(0,0,0,.18); color: #fff; }
.sidebar-container.collapsed .logo-text, .sidebar-container.collapsed .logo-title,
.sidebar-container.collapsed .nav-label, .sidebar-container.collapsed .nav-title .arrow { display: none; }
.sidebar-container.collapsed .logo-container { justify-content: center; padding: 0 8px; }
.sidebar-container.collapsed .nav-toggle { display: none; }
.sidebar-container.collapsed .nav-item, .sidebar-container.collapsed .nav-title { justify-content: center; padding: 0; }
.sidebar-container.collapsed .nav-children { display: none !important; }

/* 若依侧栏导航 — jianshenyueke 同款 */
.ruoyi-nav, .sidebar-container > nav { padding: 6px 0 24px; }
.nav-item, .nav-title {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px;
  color: var(--sidebar-text); font-size: 14px; cursor: pointer; text-decoration: none; user-select: none;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-title:hover { background: rgba(0,0,0,.12); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-active-text); border-left-color: var(--primary); }
.nav-submenu .nav-title .arrow { margin-left: auto; font-size: 11px; opacity: .75; transition: transform .2s; }
.nav-submenu.open .nav-title .arrow { transform: rotate(180deg); }
.nav-children { display: none; background: #1f2d3d; overflow: hidden; }
.nav-submenu.open .nav-children { display: block; }
.nav-children a {
  display: block; padding: 11px 16px 11px 50px; color: var(--sidebar-text); font-size: 13px;
  cursor: pointer; text-decoration: none; border-left: 3px solid transparent;
}
.nav-children a:hover { background: rgba(0,0,0,.12); color: #fff; }
.nav-children a.active { background: #001528; color: var(--sidebar-active-text); border-left-color: var(--primary); padding-left: 47px; }
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; opacity: .92; }
.nav-ico svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 旧版菜单类名兼容（逐步废弃） */
.el-menu { border-right: none !important; background: var(--sidebar-bg) !important; }
.menu-item { display: flex; align-items: center; gap: 8px; padding: 0 20px; height: 48px; line-height: 1; color: var(--sidebar-text); cursor: pointer; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.menu-item .menu-icon { width: 18px; height: 18px; flex-shrink: 0; object-fit: contain; opacity: .85; }
.menu-item:hover { background: var(--sidebar-active); color: #fff; }
.menu-item.active { background: var(--sidebar-active); color: var(--sidebar-active-text); border-left-color: var(--primary); }
.menu-group-title { padding: 12px 20px 8px; color: #7d8ba0; font-size: 12px; }
.menu-sub .menu-item { padding-left: 40px; height: 44px; line-height: 44px; }
.stat-icon img { width: 28px; height: 28px; object-fit: contain; }

.navbar { height: var(--header-height); background: #fff; box-shadow: 0 1px 4px rgba(0,21,41,.08); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; position: sticky; top: 0; z-index: 1000; }
.navbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger { font-size: 20px; cursor: pointer; color: #5a5e66; padding: 4px 8px; }
.breadcrumb { color: #97a8be; font-size: 14px; }
.breadcrumb span { color: #606266; }
.navbar-right { display: flex; align-items: center; gap: 16px; }
.navbar-right .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }

.app-main { padding: 16px; min-height: calc(100vh - var(--header-height)); }
.page-header { margin-bottom: 16px; }
.page-title { font-size: 18px; font-weight: 600; color: #303133; margin-bottom: 4px; }
.page-desc { font-size: 13px; color: #909399; }

/* 卡片 */
.el-card { background: #fff; border-radius: 4px; border: 1px solid var(--border); margin-bottom: 16px; }
.el-card__header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; color: #303133; display: flex; justify-content: space-between; align-items: center; }
.el-card__body { padding: 16px; }

/* 统计卡片 */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 4px; padding: 20px; border: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 56px; height: 56px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-icon.blue { background: #ecf5ff; color: var(--primary); }
.stat-icon.green { background: #f0f9eb; color: #67c23a; }
.stat-icon.orange { background: #fdf6ec; color: #e6a23c; }
.stat-icon.red { background: #fef0f0; color: #f56c6c; }
.stat-value { font-size: 28px; font-weight: 700; color: #303133; line-height: 1.2; }
.stat-label { font-size: 13px; color: #909399; margin-top: 4px; }
.stat-trend { font-size: 12px; margin-top: 4px; }
.stat-trend.up { color: #67c23a; }
.stat-trend.down { color: #f56c6c; }

/* 搜索区：标签与控件同一行，筛选项横向排布 */
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 16px;
}
.search-form .form-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}
.search-form .form-item label {
  font-size: 13px;
  color: #606266;
  line-height: 32px;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-form .form-item input,
.search-form .form-item select {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
  min-width: 140px;
  width: 160px;
  outline: none;
  box-sizing: border-box;
}
.search-form .form-item input:focus,
.search-form .form-item select:focus {
  border-color: var(--primary);
}
.search-form .btn-group,
.search-form > .btn {
  flex-shrink: 0;
}
.search-form .btn-group {
  display: flex;
  gap: 8px;
}

/* 表单（弹窗等） */
.form-grid .form-item,
.form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-grid .form-item label,
.form-item label {
  font-size: 13px;
  color: #606266;
}
.form-grid .form-item input,
.form-grid .form-item select,
.form-item input,
.form-item select {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}
.form-grid .form-item input,
.form-grid .form-item select {
  width: 100%;
}
.form-item input:focus,
.form-item select:focus {
  border-color: var(--primary);
}

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 16px; border-radius: 4px; font-size: 14px; cursor: pointer; border: 1px solid transparent; gap: 4px; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #66b1ff; }
.btn-default { background: #fff; color: #606266; border-color: #dcdfe6; }
.btn-default:hover { color: var(--primary); border-color: #c6e2ff; background: #ecf5ff; }
.btn-success { background: #67c23a; color: #fff; }
.btn-warning { background: #e6a23c; color: #fff; }
.btn-danger { background: #f56c6c; color: #fff; }
.btn-text { background: none; border: none; color: var(--primary); padding: 0 8px; height: auto; }
.btn-text.danger { color: #f56c6c; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* 表格 */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #fafafa; color: #909399; font-weight: 500; }
.data-table tbody tr:hover { background: #f5f7fa; }
.data-table .actions { white-space: nowrap; }
.actions .btn-text { padding: 0 6px; font-size: 13px; cursor: pointer; }
.data-table .actions { min-width: 280px; }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; line-height: 1.5; }
.tag-success { background: #f0f9eb; color: #67c23a; border: 1px solid #e1f3d8; }
.tag-warning { background: #fdf6ec; color: #e6a23c; border: 1px solid #faecd8; }
.tag-danger { background: #fef0f0; color: #f56c6c; border: 1px solid #fde2e2; }
.tag-info { background: #f4f4f5; color: #909399; border: 1px solid #e9e9eb; }
.tag-primary { background: #ecf5ff; color: var(--primary); border: 1px solid #d9ecff; }

/* 分页 */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 16px 0 0; font-size: 13px; color: #606266; }
.pagination .page-btn { min-width: 32px; height: 32px; border: 1px solid #dcdfe6; background: #fff; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pagination .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 图表占位 */
.chart-placeholder { height: 280px; background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #c0c4cc; border: 1px dashed var(--border); }
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { width: 420px; background: #fff; border-radius: 8px; padding: 40px; box-shadow: 0 8px 32px rgba(0,0,0,.15); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 24px; color: #303133; margin-bottom: 8px; }
.login-logo p { color: #909399; font-size: 14px; }
.login-form .form-item { margin-bottom: 20px; }
.login-form .form-item input { width: 100%; height: 40px; }
.login-form .btn-primary { width: 100%; height: 40px; font-size: 16px; margin-top: 8px; }

/* 弹窗 */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: 8px; width: 560px; max-width: 90vw; max-height: 90vh; overflow: auto; box-shadow: 0 4px 24px rgba(0,0,0,.15); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600; display: flex; justify-content: space-between; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { cursor: pointer; color: #909399; font-size: 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* 表单分区（挂账设置等） */
.form-section {
  grid-column: 1 / -1;
  border: 1px solid #ebeef5;
  border-radius: 4px;
  background: #fafafa;
  padding: 12px 14px;
}
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ebeef5;
}
.form-section-body { display: flex; flex-direction: column; gap: 10px; }
.form-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 14px;
  color: #606266;
  cursor: pointer;
  user-select: none;
}
.form-inline-check input { margin: 0; width: 16px; height: 16px; cursor: pointer; }
.credit-limit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.credit-limit-row > label {
  width: auto;
  flex-shrink: 0;
  font-size: 13px;
  color: #606266;
  white-space: nowrap;
}
.credit-limit-row input {
  width: 140px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
}
.credit-limit-row .field-tip { font-size: 12px; color: #909399; }
.credit-limit-row.is-disabled { opacity: .55; }
.credit-limit-row.is-disabled input { background: #f5f7fa; cursor: not-allowed; }
.form-item textarea {
  min-height: 72px;
  padding: 8px 12px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  width: 100%;
}
.form-item .input-with-btn { display: flex; gap: 8px; align-items: center; }
.form-item .input-with-btn input { flex: 1; min-width: 0; }

.content-frame { display: none; }
.content-frame.active { display: block; }

@media (max-width: 1200px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .chart-row { grid-template-columns: 1fr; }
}

/* Toast 提示 */
.proto-toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px);
  padding: 10px 20px; border-radius: 4px; font-size: 14px; color: #fff;
  background: #67c23a; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 9999;
  opacity: 0; pointer-events: none; transition: all .3s;
}
.proto-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.proto-toast.warning { background: #e6a23c; }
.proto-toast.error { background: #f56c6c; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 14px; }
.detail-grid .label { color: #909399; display: block; font-size: 12px; margin-bottom: 4px; }

/* 全页垂直表单（新增商品等） */
.product-form-card { max-width: 960px; }
.product-form-card .el-card__body { padding: 28px 32px 16px; }
.vertical-form { max-width: 820px; }
.vf-item { display: flex; align-items: flex-start; margin-bottom: 22px; }
.vf-item.required .vf-label::before { content: '*'; color: #f56c6c; margin-right: 4px; }
.vf-label { width: 120px; flex-shrink: 0; text-align: right; padding-right: 12px; line-height: 36px; font-size: 14px; font-weight: 500; color: #606266; }
.vf-control { flex: 1; min-width: 0; line-height: 36px; }
.vf-control.full-width { width: 100%; max-width: 680px; }
.vf-control input, .vf-control select { height: 36px; padding: 0 12px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 14px; }
.vf-control input:focus, .vf-control select:focus { border-color: var(--primary); outline: none; }
.field-tip { margin: 8px 0 0; font-size: 12px; color: #909399; line-height: 1.5; }
.field-tip.inline { margin: 0 0 0 12px; display: inline; }
.radio-inline { margin-right: 16px; font-size: 14px; cursor: pointer; }
.radio-inline input { margin-right: 4px; vertical-align: middle; }
.switch-inline { font-size: 14px; cursor: pointer; }
.vf-actions { padding: 8px 0 16px 120px; display: flex; gap: 12px; }

/* 多图上传 */
.image-upload-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-card { width: 120px; height: 120px; border-radius: 6px; position: relative; overflow: hidden; }
.upload-card.add-card { border: 1px dashed #dcdfe6; display: flex; align-items: center; justify-content: center; cursor: pointer; background: #fafafa; transition: border-color .2s; }
.upload-card.add-card:hover { border-color: var(--primary); }
.upload-card .plus { font-size: 28px; color: #8c939d; line-height: 1; }
.upload-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-card .remove-btn { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 14px; line-height: 22px; padding: 0; }

/* 富文本编辑器 */
.rich-text-editor { width: 100%; border: 1px solid #dcdfe6; border-radius: 4px; overflow: hidden; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 10px; background: #fafafa; border-bottom: 1px solid #ebeef5; }
.rte-btn { height: 28px; min-width: 32px; padding: 0 8px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; cursor: pointer; font-size: 13px; color: #606266; }
.rte-btn:hover { color: var(--primary); border-color: #c6e2ff; background: #ecf5ff; }
.rte-sep { width: 1px; height: 20px; background: #e4e7ed; margin: 0 4px; }
.rte-body { min-height: 280px; max-height: 480px; overflow-y: auto; padding: 12px 14px; font-size: 14px; line-height: 1.7; color: #303133; outline: none; }
.rte-body:empty::before { content: attr(data-placeholder); color: #c0c4cc; }
.rte-body ul, .rte-body ol { padding-left: 1.5em; }
.detail-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.detail-images img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid #ebeef5; }
.detail-html { margin-top: 4px; font-size: 14px; line-height: 1.7; color: #303133; }

/* 弹窗垂直表单：左标签右控件，单选横向 */
.modal-form-vertical .vf-item { display: flex; align-items: flex-start; margin-bottom: 18px; }
.modal-form-vertical .vf-item:last-child { margin-bottom: 0; }
.modal-form-vertical .vf-label { width: 80px; flex-shrink: 0; text-align: right; padding-right: 12px; line-height: 32px; font-size: 13px; color: #606266; }
.modal-form-vertical .vf-label.required::before { content: '*'; color: #f56c6c; margin-right: 4px; }
.modal-form-vertical .vf-control { flex: 1; min-width: 0; }
.modal-form-vertical .vf-control input[type=text] { width: 100%; height: 32px; padding: 0 12px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 14px; outline: none; box-sizing: border-box; }
.modal-form-vertical .vf-control input[type=text]:focus { border-color: var(--primary); }
.modal-form-vertical .vf-control textarea { width: 100%; padding: 8px 12px; border: 1px solid #dcdfe6; border-radius: 4px; font-size: 14px; font-family: inherit; resize: vertical; min-height: 120px; outline: none; box-sizing: border-box; }
.modal-form-vertical .vf-control textarea:focus { border-color: var(--primary); }
.modal-form-vertical .vf-control select { width: 100%; }
.modal-form-vertical .radio-group-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; min-height: 32px; line-height: 32px; }
.modal-form-vertical .field-tip { margin-top: 6px; font-size: 12px; color: #909399; line-height: 1.5; }
