/*
 * CLCP 进销存管理系统 v8.0 样式
 * 主色 #2E6EB5，企业级管理系统风格
 */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13px;
  color: #262626;
  background: #F5F7FA;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 16px;
  border: 1px solid #D9D9D9;
  border-radius: 4px;
  background: #fff;
  color: #595959;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #2E6EB5; color: #2E6EB5; }
.btn:active:not(:disabled) { opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: #2E6EB5;
  border-color: #2E6EB5;
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #1E4E8C;
  border-color: #1E4E8C;
  color: #fff;
}

.btn-success {
  background: #52C41A;
  border-color: #52C41A;
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #389E0D;
  border-color: #389E0D;
  color: #fff;
}

.btn-danger {
  background: #F5222D;
  border-color: #F5222D;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #CF1322;
  border-color: #CF1322;
  color: #fff;
}

.btn-text {
  background: none;
  border: none;
  color: #2E6EB5;
  padding: 0 4px;
  height: auto;
}
.btn-text:hover:not(:disabled) { background: #E8F0FA; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 36px; padding: 0 20px; font-size: 15px; }

/* ========== 表单 ========== */
.form-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
}
.form-label {
  width: 100px;
  flex-shrink: 0;
  text-align: right;
  padding-right: 12px;
  padding-top: 7px;
  color: #595959;
  font-size: 13px;
}
.form-label.required::before {
  content: '*';
  color: #F5222D;
  margin-right: 4px;
}
.form-control {
  flex: 1;
}
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=tel], input[type=email], select, textarea {
  width: 100%;
  height: 32px;
  padding: 4px 10px;
  border: 1px solid #D9D9D9;
  border-radius: 4px;
  font-size: 13px;
  color: #262626;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}
textarea {
  height: auto;
  min-height: 64px;
  resize: vertical;
  padding: 8px 10px;
}
input:focus, select:focus, textarea:focus {
  border-color: #2E6EB5;
  box-shadow: 0 0 0 2px rgba(46, 110, 181, 0.15);
}
input:disabled, select:disabled, textarea:disabled {
  background: #F5F7FA;
  color: #8C8C8C;
  cursor: not-allowed;
}
.input-error { border-color: #F5222D !important; }

/* 客户收货地址簿（多地址行） */
.cust-addr-row {
  padding: 8px;
  border: 1px solid #F0F0F0;
  border-radius: 6px;
  background: #FAFAFA;
}

.cust-addr-row .form-input {
  height: 30px;
  padding: 4px 8px;
  border: 1px solid #D9D9D9;
  border-radius: 4px;
  font-size: 13px;
  color: #262626;
  background: #fff;
}

.cust-addr-row .form-input:focus {
  border-color: #2E6EB5;
  outline: none;
}

/* 出库单：地址簿下拉 */
#outAddressPick {
  width: 100%;
  height: 32px;
  padding: 4px 10px;
  border: 1px solid #D9D9D9;
  border-radius: 4px;
  font-size: 13px;
  color: #262626;
  background: #fff;
}
.error-text { color: #F5222D; font-size: 12px; margin-top: 4px; }

/* ========== 卡片 ========== */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 16px;
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #262626;
}
.card-body { padding: 16px; }

/* ========== 表格 ========== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #E8E8E8;
  border-radius: 4px;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  background: #FAFAFA;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: #262626;
  border-bottom: 1px solid #E8E8E8;
  white-space: nowrap;
}
table.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #F0F0F0;
  color: #595959;
}
table.data-table tbody tr:hover {
  background: #E8F0FA;
}
table.data-table tbody tr:nth-child(even) {
  background: #FAFAFA;
}
table.data-table tbody tr:nth-child(even):hover {
  background: #E8F0FA;
}
.table-empty {
  padding: 40px;
  text-align: center;
  color: #8C8C8C;
}

/* ========== 标签/徽标 ========== */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 18px;
  background: #E8F0FA;
  color: #2E6EB5;
}
.tag-success { background: #F6FFED; color: #52C41A; }
.tag-warning { background: #FFFBE6; color: #FAAD14; }
.tag-danger  { background: #FFF1F0; color: #F5222D; }
.tag-default { background: #F5F5F5; color: #595959; }

/* ========== 登录页 ========== */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E4E8C 0%, #2E6EB5 50%, #4A90D9 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}
.login-card {
  width: 400px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 40px;
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo h1 {
  color: #2E6EB5;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-logo p {
  color: #8C8C8C;
  font-size: 13px;
}
.login-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid #E8E8E8;
}
.login-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  cursor: pointer;
  color: #8C8C8C;
  font-size: 15px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.login-tab.active {
  color: #2E6EB5;
  border-bottom-color: #2E6EB5;
  font-weight: 600;
}
.login-btn {
  width: 100%;
  height: 40px;
  font-size: 15px;
  margin-top: 8px;
}
.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: #8C8C8C;
}
.login-forgot {
  text-align: right;
  margin-bottom: 16px;
}
.login-forgot a {
  color: #2E6EB5;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}
.login-forgot a:hover { text-decoration: underline; }
.login-role-hint {
  margin-top: 12px;
  padding: 8px 12px;
  background: #F6FFED;
  border-radius: 4px;
  font-size: 12px;
  color: #52C41A;
}

/* ========== 主布局 ========== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* 侧边栏 */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: #001529;
  color: rgba(255, 255, 255, 0.75);
  transition: width 0.2s;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-brand {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 0 16px;
}
.sidebar-brand h2 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-menu {
  flex: 1;
  padding: 8px 0;
  list-style: none;
}
.sidebar-menu li {
  padding: 0;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}
.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.menu-item.active {
  background: #2E6EB5;
  color: #fff;
  border-right: 3px solid #fff;
}
.menu-icon {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

/* 页脚 ICP 备案号 */
.sidebar-icp {
  margin-top: 4px;
}

.sidebar-icp a {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-icp a:hover {
  color: rgba(255,255,255,0.8);
  text-decoration: underline;
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 顶部栏 */
.header {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hamburger-btn {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 20px;
  color: #595959;
  align-items: center;
  justify-content: center;
}
.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-center::-webkit-scrollbar { display: none; }
.product-tabs {
  display: flex;
  gap: 0;
  border-bottom: none;
}
.product-tab {
  padding: 8px 18px;
  cursor: pointer;
  color: #595959;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.product-tab:hover { color: #2E6EB5; }
.product-tab.active {
  color: #2E6EB5;
  border-bottom-color: #2E6EB5;
  font-weight: 600;
}
.product-tab.all { font-weight: 600; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background 0.2s;
}
.user-info:hover { background: #F5F7FA; }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2E6EB5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.user-name { font-size: 13px; color: #262626; }
.user-role {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 2px;
  background: #E8F0FA;
  color: #2E6EB5;
}

/* 内容区 */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ========== 仪表盘 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #2E6EB5;
}
.stat-card.success { border-left-color: #52C41A; }
.stat-card.warning { border-left-color: #FAAD14; }
.stat-card.danger  { border-left-color: #F5222D; }
.stat-label {
  color: #8C8C8C;
  font-size: 13px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #262626;
}
.stat-sub {
  margin-top: 6px;
  font-size: 12px;
  color: #8C8C8C;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-end;
}
.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-item label {
  font-size: 12px;
  color: #8C8C8C;
}
.filter-item input, .filter-item select {
  height: 30px;
  min-width: 140px;
  font-size: 13px;
}

/* 操作栏 */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: #fff;
  border-radius: 6px;
  width: 560px;
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.25s ease-out;
}
.modal.large { width: 720px; }
.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #262626;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #8C8C8C;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: #262626; }
.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #E8E8E8;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 12px;
  font-size: 13px;
}
.pagination .btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

/* ========== 下拉菜单 ========== */
.dropdown-menu {
  position: absolute;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  min-width: 140px;
  z-index: 1001;
  padding: 4px 0;
}
.dropdown-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #595959;
  transition: background 0.15s;
}
.dropdown-item:hover {
  background: #E8F0FA;
  color: #2E6EB5;
}
.dropdown-item.danger {
  color: #F5222D;
}
.dropdown-item.danger:hover {
  background: #FFF1F0;
}
.dropdown-divider {
  height: 1px;
  background: #F0F0F0;
  margin: 4px 0;
}

/* ========== 打印样式 ========== */
.print-container {
  padding: 20px;
  background: #fff;
  color: #000;
}
.print-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}
.print-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
}
.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.print-table th, .print-table td {
  border: 1px solid #000;
  padding: 6px 10px;
  text-align: left;
}
.print-table th {
  background: #f0f0f0;
  font-weight: 600;
}
.print-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  font-size: 13px;
}

@media print {
  .layout, .sidebar, .header, .content > *:not(.print-container) {
    display: none !important;
  }
  .print-container {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 9999;
  }
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -200px;
    top: 0;
    bottom: 0;
    z-index: 999;
    transition: left 0.3s;
  }
  .sidebar.mobile-open { left: 0; }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    display: none;
  }
  .sidebar-overlay.show { display: block; }

  .hamburger-btn { display: flex; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  .content { padding: 10px; }
  .card { margin-bottom: 10px; }
  .card-body { padding: 12px; }

  .form-item { flex-direction: column; }
  .form-label {
    width: auto;
    text-align: left;
    padding-right: 0;
    padding-top: 0;
    margin-bottom: 4px;
  }

  .filter-bar { gap: 8px; }
  .filter-item { width: calc(50% - 4px); }
  .filter-item input, .filter-item select { min-width: 0; width: 100%; }

  .header-center { padding: 0 8px; }
  .product-tab { padding: 6px 12px; font-size: 13px; }

  .modal { width: 95vw; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { width: 92vw; padding: 24px 20px; }
  .user-name { display: none; }
}

/* 数字列右对齐 */
.num-col { text-align: right; font-variant-numeric: tabular-nums; }

/* 详情页分组样式 */
.detail-section { margin-bottom: 16px; }
.detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #262626;
  padding: 8px 12px;
  background: #F5F7FA;
  border-left: 3px solid #2E6EB5;
  margin-bottom: 8px;
  border-radius: 2px;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.detail-table th {
  width: 100px;
  text-align: right;
  padding: 8px 12px;
  background: #FAFAFA;
  color: #595959;
  font-weight: 500;
  border: 1px solid #E8E8E8;
}
.detail-table td {
  padding: 8px 12px;
  color: #262626;
  border: 1px solid #E8E8E8;
}
.detail-text {
  padding: 10px 12px;
  background: #FAFAFA;
  border: 1px solid #E8E8E8;
  border-radius: 4px;
  color: #262626;
  font-size: 13px;
  line-height: 1.6;
}

/* 打印样式增强 */
@media print {
  @page { size: A4; margin: 15mm 12mm; }
  body { background: #fff !important; }
  .print-container { padding: 0 !important; }
}

.print-company {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 4px;
  letter-spacing: 2px;
}
.print-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 16px 0;
  letter-spacing: 8px;
  color: #262626;
}
.print-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  color: #595959;
}
.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.print-table th, .print-table td {
  border: 1px solid #333;
  padding: 8px 10px;
  text-align: left;
}
.print-table th {
  background: #F5F7FA;
  font-weight: 600;
  color: #262626;
  width: 100px;
}
.print-summary {
  display: flex;
  gap: 24px;
  padding: 10px 0;
  font-size: 13px;
  color: #595959;
}
.print-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 13px;
  color: #595959;
}
