/* 铭泉懋纺织ERP — 蓝色系响应式样式 */
:root {
  --blue-900: #0d3a91;
  --blue-800: #1f64cb;
  --blue-700: #2974d9;
  --blue-600: #3b82e0;
  --blue-500: #4d92e6;
  --blue-400: #6ba3ea;
  --blue-300: #8bb7ef;
  --blue-200: #b3cff5;
  --blue-100: #d4e3f9;
  --blue-50:  #e8f1fc;
  --primary: var(--blue-800);
  --primary-light: var(--blue-700);
  --accent: var(--blue-600);
  --accent-hover: var(--blue-700);
  --success: var(--blue-500);
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f3f7fd;
  --card-bg: #fff;
  --border: #d4e3f9;
  --text: #333;
  --text-muted: #5f7da6;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(31,100,203,0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-800); }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 120px; background: linear-gradient(180deg, var(--blue-800), var(--blue-900));
  color: #fff; padding: 0; position: fixed;
  top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100;
  display: flex; flex-direction: column;
  transition: transform 0.3s;
}
.sidebar-brand { padding: 10px 8px; font-size: 17px; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; }
.sidebar-brand img { width: 100%; max-width: 100px; max-height: 40px; object-fit: contain; }
.sidebar-nav { padding: 6px 0; }
.sidebar-nav a {
  display: block; padding: 12px 10px;
  color: rgba(255,255,255,0.85); text-decoration: none; font-size: 12px; transition: 0.2s;
  text-align: center; white-space: nowrap;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav .badge { margin-left: auto; background: var(--danger); color:#fff; border-radius:10px; padding:2px 8px; font-size:12px; }

.main { margin-left: 120px; flex: 1; min-width: 0; }
.topbar {
  background: var(--card-bg); padding: 14px 28px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 50;
}
.topbar-user { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topbar-user a { color: var(--text-muted); }
.topbar-user a:hover { color: var(--blue-600); }
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--blue-800); }

.content { padding: 28px; }

/* Cards */
.card {
  background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); margin-bottom: 24px;
}
.card-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 16px; font-weight: 600; color: var(--green-800); }
.card-body { padding: 24px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: var(--blue-50); font-weight: 600; color: var(--blue-800); font-size: 13px; letter-spacing: 0.3px; }
tr:nth-child(even) { background: #f5f6f8; }
tr:hover { background: #eef1f7; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--card-bg);
  color: var(--text); font-size: 14px; cursor: pointer; text-decoration: none; transition: 0.2s;
}
.btn:hover { background: #eef3fb; }
.btn-primary { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.btn-primary:hover { background: var(--blue-700); }
.btn-success { background: var(--blue-500); color: #fff; border-color: var(--blue-500); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 500; color: var(--text-muted); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 14px; transition: border-color 0.2s; outline: none;
}
.form-control:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(77,146,230,0.15); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 22px 24px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .value { font-size: 32px; font-weight: 700; color: var(--blue-800); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 5px; font-size: 12px; font-weight: 500; }
.badge-success { background: #e8f1fc; color: #1f64cb; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 200; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card-bg); border-radius: var(--radius); padding: 28px; width: 90%; max-width: 520px;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 6px 24px rgba(0,0,0,0.15);
}
.modal h3 { margin-bottom: 18px; font-size: 17px; color: var(--blue-800); }

/* Tags */
.tag { display: inline-block; padding: 3px 10px; border-radius: 5px; font-size: 12px; margin-right: 5px; margin-bottom: 5px; background: var(--blue-50); color: var(--blue-700); }

/* Stage progress */
.stage-progress { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-item {
  padding: 9px 16px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; cursor: pointer; transition: 0.2s; background: #fff; white-space: nowrap;
}
.stage-item.completed { background: #e8f1fc; border-color: var(--blue-500); color: var(--blue-700); }
.stage-item.current { background: #e3f2fd; border-color: var(--accent); color: var(--accent); }

/* Image thumb */
.img-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.img-preview { max-width: 450px; max-height: 450px; border-radius: var(--radius); border: 1px solid var(--border); }

/* Alerts */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.alert-danger { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-success { background: #e8f1fc; color: #1f64cb; border: 1px solid #b3cff5; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 24px; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; text-decoration: none; color: var(--text); }
.pagination a:hover { background: var(--blue-600); color: #fff; }
.pagination .current { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .content { padding: 12px; }
  .card-body { padding: 10px; overflow-x: auto; }
  table { font-size: 12px; }
  th, td { padding: 6px 8px; white-space: nowrap; }
  .topbar-user span, .topbar-user a { font-size: 12px; }
  h2 { font-size: 18px; }
  .modal { max-width: 95vw; margin: 10px; padding: 16px; }
  .btn { padding: 6px 10px; font-size: 12px; }
  .btn-sm { padding: 4px 8px; font-size: 11px; }
  input.form-control, select.form-control, textarea.form-control { font-size: 14px; }
}

/* Print */
@media print {
  .sidebar, .topbar, .btn, .menu-toggle { display: none; }
  .main { margin-left: 0; }
  .card { border: none; box-shadow: none; }
}

.qr-display { text-align: center; padding: 24px; }
.qr-display img { width: 200px; height: 200px; }

.toast {
  position: fixed; top: 20px; right: 20px; padding: 14px 22px; border-radius: 7px;
  color: #fff; font-size: 14px; z-index: 999; animation: fadeIn 0.3s;
}
.toast-success { background: var(--blue-600); }
.toast-error { background: var(--danger); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input { flex: 1; max-width: 320px; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 36px;
  text-align: center; color: var(--text-muted); cursor: pointer; transition: 0.2s; font-size: 14px;
}
.upload-zone:hover { border-color: var(--blue-500); color: var(--blue-600); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 14px; }
.empty .icon { font-size: 56px; margin-bottom: 14px; }

h2 { font-size: 20px; font-weight: 600; color: var(--blue-800); margin-bottom: 20px; }

.checkbox-col { width: 40px; text-align: center; }
.checkbox-col input { width: 16px; height: 16px; cursor: pointer; }

/* Input group with unit suffix */
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .unit-suffix {
  display: flex; align-items: center; padding: 0 14px;
  border: 1px solid var(--border); border-left: none;
  border-radius: 0 7px 7px 0; background: var(--blue-50);
  font-size: 13px; color: var(--blue-700); font-weight: 500;
  white-space: nowrap;
}
.input-group select.unit-suffix {
  width: auto; appearance: auto;
  background: var(--blue-50); color: var(--blue-700);
  font-weight: 500; font-size: 13px;
  cursor: pointer;
}
