/* ═══════════════════════════════════════════════
   PLM Design System — 深蓝工业风
   Color: #0A2B4E (primary) / #1A4A7A (hover)
          #2B8CDE (accent) / #E8F4F8 (light bg)
          #F0F4F8 (page bg) / #5A6A7A (text 2nd)
   ═══════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg, #f0f4f8);
  color: #1a2332;
  min-height: 100vh;
  line-height: 1.5;
}

:root {
  --primary: #0a2b4e;
  --primary-hover: #1a4a7a;
  --primary-light: #e8f4f8;
  --accent: #2b8cde;
  --accent-hover: #1a7bc8;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --success: #27ae60;
  --warning: #f39c12;
  --bg: #f0f4f8;
  --card-bg: #fff;
  --text: #1a2332;
  --text-secondary: #5a6a7a;
  --text-muted: #8ba4be;
  --border: #e2e8f0;
  --border-dark: #c8d6e5;
  --shadow-sm: 0 1px 3px rgba(10,43,78,0.06);
  --shadow-md: 0 2px 8px rgba(10,43,78,0.08);
  --shadow-lg: 0 4px 16px rgba(10,43,78,0.1);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 200px;
  --topbar-height: 48px;
}

/* ── Topbar ── */
.topbar {
  background: var(--primary);
  color: #fff;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

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

.topbar-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.topbar-left .logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}

.topbar-right .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c8d6e5;
}

.topbar-right .user-avatar {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.topbar-right .role-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  background: rgba(255,255,255,0.1);
  color: #c8d6e5;
}

.topbar-right a {
  color: #8ba4be;
  text-decoration: none;
  transition: color 0.15s;
  font-size: 13px;
}

.topbar-right a:hover {
  color: #fff;
}

/* ── Topbar ── */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  cursor: pointer; border: none;
  background: transparent; color: #fff;
  padding: 4px; border-radius: 4px;
  flex-shrink: 0;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }

.hamburger-line {
  display: block;
  width: 20px; height: 2px;
  background: #fff;
  position: relative;
  transition: background 0.2s;
}
.hamburger-line::before, .hamburger-line::after {
  content: ''; display: block;
  width: 20px; height: 2px;
  background: #fff;
  position: absolute; left: 0;
  transition: transform 0.2s;
}
.hamburger-line::before { top: -6px; }
.hamburger-line::after  { top: 6px; }
.hamburger.open .hamburger-line { background: transparent; }
.hamburger.open .hamburger-line::before { transform: translateY(6px) rotate(45deg); }
.hamburger.open .hamburger-line::after  { transform: translateY(-6px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 60;
  opacity: 0; transition: opacity 0.25s;
}
.sidebar-overlay.visible { display: block; opacity: 1; }

.mobile-user-name {
  display: none;
  font-size: 13px; color: #c8d6e5; margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 120px;
}

/* ── Main Layout ── */
.main-layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-section {
  padding: 0 8px;
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 13px;
  transition: all 0.15s;
  margin: 1px 0;
}

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

.sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-item .si-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-item .si-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

/* ── Content ── */
.content {
  flex: 1;
  padding: 24px;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-header .breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-header .breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.page-header .breadcrumb a:hover {
  text-decoration: underline;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

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

.card-header h2, .card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  padding: 20px;
}

.card-body.compact {
  padding: 16px 20px;
}

.card + .card { margin-top: 20px; }

/* ── Stat Cards (Dashboard) ── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--warning); }
.stat-card:nth-child(4)::before { background: var(--danger); }

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card .stat-trend {
  font-size: 12px;
  margin-top: 8px;
}

.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.warn { color: var(--warning); }

/* ── Tables ── */
.table-card { overflow: hidden; }

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: #fafbfc;
}

table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f2f5;
  color: var(--text);
  font-size: 13px;
}

table tr:hover td {
  background: #f8fafc;
}

table tr:last-child td {
  border-bottom: none;
}

/* Row-card style (alternative to flat table) */
.table-row-card td {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 12px 16px;
}

.table-row-card td:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: none;
}

.table-row-card td:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

.table-row-card + .table-row-card td {
  border-top: none;
}

table th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

table th a:hover {
  color: var(--accent);
}

/* ── Forms ── */
.form-card { max-width: 680px; }

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-group .form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43,140,222,0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #b8c8d8;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select {
  appearance: auto;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 160px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #219a52;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-outline {
  border: 1px solid var(--border-dark);
  background: #fff;
  color: var(--text-secondary);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 9px 12px;
}

.btn-ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-icon {
  padding: 6px;
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius);
}

/* ── Tags / Badges ── */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.tag-blue {
  background: var(--primary-light);
  color: var(--primary);
}

.tag-green {
  background: #eafaf1;
  color: #1a7a42;
}

.tag-orange {
  background: #fef5e7;
  color: #b77814;
}

.tag-red {
  background: #fdedec;
  color: #c0392b;
}

.tag-purple {
  background: #f4ecf7;
  color: #7d3c98;
}

.tag-gray {
  background: #f0f2f5;
  color: var(--text-secondary);
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-danger {
  background: #fdedec;
  border: 1px solid #f5c6cb;
  color: #c0392b;
}

.alert-success {
  background: #eafaf1;
  border: 1px solid #a9dfbf;
  color: #1a7a42;
}

.alert-warning {
  background: #fef5e7;
  border: 1px solid #f8c471;
  color: #b77814;
}

.alert-info {
  background: var(--primary-light);
  border: 1px solid #b8dce8;
  color: var(--primary);
}

/* ── Filter Bar ── */
.filter-bar {
  margin-bottom: 20px;
}

.filter-bar .card-body {
  padding: 16px 20px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
  padding: 7px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
  min-width: 120px;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(43,140,222,0.1);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 1px;
}

.filter-actions .divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

.filter-toggle-mob {
  display: none;
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px; cursor: pointer;
  text-align: left; font-family: inherit;
  margin-bottom: 12px;
}
.filter-toggle-mob:hover { border-color: var(--accent); color: var(--accent); }

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.tab-btn {
  padding: 12px 24px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--primary);
  background: #f8fafc;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Part Info Header ── */
.part-header {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  display: flex;
  gap: 24px;
}

.part-header-info { flex: 1; min-width: 0; }

.part-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.part-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.part-meta-item strong {
  color: var(--text);
  margin-right: 4px;
}

.part-image-box {
  flex-shrink: 0;
  width: 260px;
  min-height: 195px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fafbfc;
  overflow: hidden;
}

.part-image-box img {
  max-width: 100%;
  max-height: 195px;
  object-fit: contain;
}

.part-image-box:hover img {
  transform: scale(1.02);
  transition: transform 0.2s;
}

/* ── BOM Tree ── */
.bom-tree {
  list-style: none;
}

.bom-tree li {
  border-left: 3px solid var(--border);
  padding: 8px 12px;
  margin: 4px 0;
  background: #fafbfc;
  border-radius: 0 4px 4px 0;
}

.bom-tree li .bom-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── File Category ── */
.file-category-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-category-title .count {
  color: var(--text-muted);
  font-weight: normal;
  font-size: 12px;
}

/* ── Upload Area ── */
.upload-area {
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.upload-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-form input[type="file"] {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 16px 0;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Login Page ── */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #0d3b66 50%, #1a4a7a 100%);
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-card .login-logo {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  color: #fff;
}

.login-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.login-card .company-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-card .btn-login {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 48px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  font-family: inherit;
}

.login-card .btn-login:hover {
  background: var(--primary-hover);
}

.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Approval Banner ── */
.approval-banner {
  background: #fef5e7;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid #f8c471;
  margin-bottom: 24px;
  border-left: 4px solid var(--warning);
}

.approval-banner h3 {
  color: #b77814;
  font-size: 14px;
  margin-bottom: 4px;
}

.approval-banner p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}

.approval-item {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid #f8c471;
}

.approval-item:last-child {
  border-bottom: none;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}

/* ── Print ── */
.print-section {
  max-width: 800px;
  margin: 0 auto;
}

.print-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
}

.print-header h1 {
  font-size: 20px;
  color: var(--primary);
}

/* ── Sidebar Divider ── */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* ── Utility ── */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* ── 1024px: tabs scrollable ── */
@media (max-width: 1024px) {
  .tab-bar {
    overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; }
}

/* ── 768px: tablet / large phone ── */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .sidebar {
    position: fixed; top: var(--topbar-height); left: 0; bottom: 0;
    width: 260px; min-width: 0; z-index: 70;
    transform: translateX(-100%); transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  }
  .sidebar.open { transform: translateX(0); }

  .content { margin-left: 0; padding: 16px; }

  .topbar-right .role-badge,
  .topbar-right .user-avatar { display: none; }
  .topbar-right .user-info span { font-size: 12px; }

  .mobile-user-name { display: block; }

  .page-header h1 { font-size: 18px; }

  /* Dashboard stats: vertical list */
  .stat-cards { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px 16px; text-align: left; display: flex; align-items: center; gap: 12px; }
  .stat-card .stat-icon { font-size: 22px; margin-bottom: 0; flex-shrink: 0; }
  .stat-card .stat-value { font-size: 20px; line-height: 1.1; }
  .stat-card .stat-label { font-size: 11px; margin-top: 2px; }
  .stat-card .stat-sub { display: none; }

  .part-header { flex-direction: column; }
  .part-image-box { width: 100% !important; min-height: 150px !important; }

  .form-row { flex-direction: column; }
  .form-row .form-group { min-width: auto; }

  .tab-btn { padding: 10px 14px; font-size: 12px; }

  .filter-form { flex-direction: column; }
  .filter-group select, .filter-group input { min-width: auto; width: 100%; }

  .filter-actions { flex-wrap: wrap; }
  .filter-actions .divider { display: none; }

  .card-body { padding: 14px; }
  .card-body.compact { padding: 12px 14px; }

  .upload-form { flex-direction: column; align-items: stretch; }
  .upload-form .filter-group { width: 100%; }
  .upload-form input[type="file"] { font-size: 12px; }

  .pagination { flex-wrap: wrap; gap: 8px; }
  .pagination-info { width: 100%; text-align: center; order: -1; }

  .approval-item { flex-direction: column; align-items: stretch; }
  .approval-item .filter-group { flex-wrap: wrap; }

  .form-actions { flex-wrap: wrap; }
  .btn-group { flex-wrap: wrap; }

  .table-wrap { margin: 0 -14px; }
  .table-wrap table th,
  .table-wrap table td { padding: 10px 12px; white-space: nowrap; }

  .part-meta { gap: 8px 16px; font-size: 12px; }

  .bom-tree li .bom-item { flex-direction: column; align-items: flex-start; gap: 6px; }

  .login-card { padding: 36px 24px 28px; }
  .login-card .btn-login { width: 100%; justify-content: center; }
}

/* ── 480px: small phone ── */
@media (max-width: 480px) {
  .topbar-left .logo { font-size: 13px; }

  .stat-card { padding: 10px 14px; }
  .stat-card .stat-icon { font-size: 20px; }
  .stat-card .stat-value { font-size: 18px; }
  .stat-card .stat-label { font-size: 10px; }

  .login-card { padding: 28px 20px 24px; }
  .login-card h2 { font-size: 18px; }
  .login-card .btn-login { padding: 12px 32px; font-size: 15px; }

  .page-header h1 { font-size: 16px; }
  .content { padding: 12px; }

  .card-body { padding: 12px; }

  .part-header { padding: 14px; }
  .part-header h2 { font-size: 16px; }

  .btn { font-size: 13px; padding: 8px 14px; }
  .btn-sm { font-size: 11px; padding: 4px 10px; }

  .tab-btn { padding: 8px 12px; font-size: 11px; }

  .sidebar { width: 240px; }

  .file-category-title { font-size: 13px; }
}

/* ── 769px+: desktop stat-grid restore ── */
@media (min-width: 769px) {
  .stat-cards { grid-template-columns: repeat(4, 1fr); }
  .stat-card { display: block; }
  .stat-card .stat-icon { font-size: 14px; opacity: 0.5; margin-bottom: 8px; }
  .stat-card .stat-value { font-size: 28px; }
}
