/* ─── iMES-ERP Design System ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:          #0f1419;
  --bg2:         #141c24;
  --bg3:         #1a2535;
  --bg4:         #1e2d40;
  --sidebar:     #0a1118;
  --accent:      #1ad1e6;
  --accent-h:    #45e6f7;
  --accent2:     #3b82f6;
  --accent-dim:  rgba(26,209,230,.16);
  --accent-dim2: rgba(26,209,230,.07);
  --glow:        0 0 16px rgba(26,209,230,.30);
  --glow-strong: 0 0 0 1px rgba(26,209,230,.55), 0 0 22px rgba(26,209,230,.35);
  --text:        #e2e8f0;
  --text2:       #94a3b8;
  --text3:       #5a6a7a;
  --border:      #2a3545;
  --border2:     #1e2d3d;
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --sidebar-w:   260px;
  --topbar-h:    60px;
  --transition:  .2s ease;
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Brightness Slider ────────────────────────────────────── */
.brightness-ctrl {
  display: flex; align-items: center; gap: 7px;
  padding: 0 4px;
}
.brightness-ctrl .bicon {
  font-size: 14px; line-height: 1; opacity: .65; user-select: none; flex-shrink: 0;
}
.brightness-slider {
  -webkit-appearance: none; appearance: none;
  width: 88px; height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--bpct,0%), var(--border) var(--bpct,0%), var(--border) 100%);
  outline: none; cursor: pointer; flex-shrink: 0;
  transition: background .1s;
}
.brightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg2); cursor: pointer;
  box-shadow: 0 0 0 2px var(--accent-dim);
  transition: box-shadow .2s;
}
.brightness-slider:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-dim); }
.brightness-slider::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg2);
  cursor: pointer;
}

/* ─── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab-btn {
  padding: 8px 18px; border: none; background: transparent;
  color: var(--text2); cursor: pointer; font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 4px 4px 0 0; transition: all .15s;
}
.tab-btn:hover { color: var(--text); background: var(--bg3); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--bg3); }

/* ─── Toolbar ──────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ─── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Layout ───────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--border2);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border2);
}

.brand-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.brand-text { line-height: 1.2; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .5px; }
.brand-sub  { font-size: 9px; font-weight: 500; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section { padding: 12px 16px 4px; font-size: 10px; font-weight: 600; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  border-left: 3px solid transparent;
}

.nav-item:hover { color: var(--text); background: var(--accent-dim2); }
.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.nav-item svg, .nav-item .nav-icon {
  width: 18px; height: 18px;
  opacity: .7;
  flex-shrink: 0;
}
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: .5px;
}

/* ─── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.user-info { text-align: right; line-height: 1.3; }
.user-name  { font-size: 13px; font-weight: 600; }
.user-role  { font-size: 11px; color: var(--text2); }

/* ─── Page Content ─────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }

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

.btn-ghost { background: var(--bg3); color: var(--text2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--bg4); }

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

.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

.btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ─── Stat Cards ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}
.stat-icon.orange { background: var(--accent-dim); color: var(--accent); }
.stat-icon.green  { background: rgba(16,185,129,.15); color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,.15); color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,.15); color: var(--danger); }
.stat-icon.blue   { background: rgba(59,130,246,.15); color: var(--info); }

.stat-value { font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text2); }
.stat-trend { font-size: 11px; margin-top: 6px; }
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }

/* ─── Info Card (BOM style with orange left border) ──────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.info-field {
  background: var(--bg3);
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
}
.info-field-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; font-weight: 500; letter-spacing: .3px; }
.info-field-value { font-size: 14px; font-weight: 600; color: var(--text); }
.info-field-value.accent { color: var(--accent); }

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

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

thead th {
  background: var(--bg2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text2);
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr { border-bottom: 1px solid var(--border2); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg4); }

tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }
.td-code  { font-family: monospace; font-size: 12px; color: var(--text2); }
.td-num   { text-align: right; font-variant-numeric: tabular-nums; }
.td-actions { white-space: nowrap; }

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .3px;
}
.badge-draft     { background: rgba(148,163,184,.15); color: var(--text2); }
.badge-pending   { background: rgba(245,158,11,.15);  color: var(--warning); }
.badge-progress  { background: rgba(59,130,246,.15);  color: var(--info); }
.badge-done      { background: rgba(16,185,129,.15);  color: var(--success); }
.badge-frozen    { background: rgba(99,102,241,.15);  color: #818cf8; }
.badge-cancelled { background: rgba(239,68,68,.15);   color: var(--danger); }
.badge-sent      { background: rgba(232,99,10,.15);   color: var(--accent); }
.badge-approved  { background: rgba(16,185,129,.15);  color: var(--success); }
.badge-high      { background: rgba(239,68,68,.15);   color: var(--danger); }
.badge-normal    { background: rgba(59,130,246,.15);  color: var(--info); }
.badge-low       { background: rgba(148,163,184,.15); color: var(--text2); }

/* ─── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.form-label .req { color: var(--accent); margin-left: 3px; }

.form-control, .form-select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}
.form-control:focus, .form-select:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }

.form-select option { background: var(--bg3); }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.form-grid.cols2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.span2 { grid-column: span 2; }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { accent-color: var(--accent); width: 15px; height: 15px; }

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

/* ─── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 90%; max-width: 600px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  transform: translateY(16px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 860px; }
.modal-sm { max-width: 420px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--text2); cursor: pointer;
  font-size: 20px; line-height: 1;
  padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ─── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar .form-control { max-width: 240px; }
.filter-bar .form-select  { max-width: 160px; }

/* ─── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--text2); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Alert / Toast ────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .3s ease;
  min-width: 260px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    { background: var(--info);    color: #fff; }

@keyframes slideIn { from { opacity:0; transform: translateX(24px); } to { opacity:1; transform: translateX(0); } }

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text2);
}
.empty-state svg { margin-bottom: 12px; opacity: .3; }
.empty-state p   { font-size: 14px; }

/* ─── Loading ──────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr 440px;
}

.login-left {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg) 100%);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: center;
  border-right: 1px solid var(--border2);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.login-logo .brand-icon { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; }
.login-headline { font-size: 36px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.login-headline span { color: var(--accent); }
.login-sub  { font-size: 15px; color: var(--text2); margin-bottom: 40px; line-height: 1.7; }
.login-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.feature-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color var(--transition);
}
.feature-card:hover { border-color: var(--accent); }
.feature-icon {
  width: 36px; height: 36px;
  background: var(--accent-dim);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; margin-bottom: 8px;
}
.feature-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.feature-desc { font-size: 11px; color: var(--text2); line-height: 1.4; }

.login-right {
  padding: 48px 40px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}

.login-status { position: absolute; top: 20px; right: 20px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.4;} }

.login-form-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-form-sub   { font-size: 13px; color: var(--text2); margin-bottom: 28px; }

.login-version { position: absolute; bottom: 20px; left: 40px; font-size: 11px; color: var(--text3); }

/* ─── BOM Tree ──────────────────────────────────────────────── */
.tree-connector {
  font-family: 'Consolas','Courier New',monospace;
  font-size: 12px;
  color: var(--text3);
  white-space: pre;
  user-select: none;
  letter-spacing: 0;
}
.tree-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  width: 18px; height: 18px;
  font-size: 8px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
  vertical-align: middle;
}
.tree-toggle:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.tree-spacer { display: inline-block; width: 18px; height: 18px; vertical-align: middle; }
.tree-input {
  width: 78px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 3px 6px;
  text-align: right;
  font-size: 12px;
  transition: border-color 0.15s;
}
.tree-input:focus { border-color: var(--accent); outline: none; }
.row-selected { background: var(--accent-dim) !important; }
.info-highlight {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
}

/* ─── Version History ───────────────────────────────────────── */
.version-card {
  border-left: 3px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--bg2);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: border-color var(--transition);
}
.version-card.active-ver  { border-left-color: var(--accent); }
.version-card.frozen-ver  { border-left-color: #818cf8; }
.version-card:hover { border-left-color: var(--accent); }
.version-tag { font-weight: 700; font-size: 14px; margin-right: 8px; }
.version-meta { font-size: 12px; color: var(--text2); margin-top: 3px; }
.version-note { font-size: 12px; color: var(--text); margin-top: 4px; }

/* ─── Activate Page ─────────────────────────────────────────── */
.activate-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.activate-card {
  width: 100%; max-width: 500px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.activate-icon {
  width: 64px; height: 64px;
  background: var(--accent-dim);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 20px;
}
.machine-id-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: monospace;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--accent);
  text-align: center;
  margin: 12px 0;
  user-select: all;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .sidebar.open { transform: translateX(0); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid.cols3 { grid-template-columns: 1fr 1fr; }
}

/* ─── Utilities ─────────────────────────────────────────────── */
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 12px; }
.mb-4  { margin-bottom: 16px; }
.text-sm   { font-size: 12px; }
.text-xs   { font-size: 11px; }
.text-muted{ color: var(--text2); }
.text-accent{ color: var(--accent); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.font-bold  { font-weight: 700; }
.font-mono  { font-family: monospace; }
.w-full     { width: 100%; }
.hidden     { display: none !important; }
.truncate   { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ════════════════════════════════════════════════════════════
   工業 4.0 深色科技風 視覺強化（2026-06-25）— neon cyan + glow
   ════════════════════════════════════════════════════════════ */
body{
  background-image:
    radial-gradient(900px 500px at 100% -10%, rgba(26,209,230,.06), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(59,130,246,.06), transparent 60%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 34px 34px, 34px 34px;
  background-attachment: fixed;
}
/* 側欄：深色漸層 + 右緣微光 */
.sidebar{
  background: linear-gradient(180deg,#0b131c 0%, #0a1118 60%, #0a0f16 100%);
  box-shadow: 1px 0 0 rgba(26,209,230,.08), 4px 0 30px rgba(0,0,0,.35);
}
.brand-icon{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  box-shadow: var(--glow);
}
.brand-name{ background:linear-gradient(90deg,var(--accent),#bdeef5); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.nav-item{ border-radius:0 8px 8px 0; }
.nav-item.active{
  background: linear-gradient(90deg, var(--accent-dim), transparent 80%);
  box-shadow: inset 2px 0 12px rgba(26,209,230,.15);
}
.nav-item.active .nav-icon{ filter: drop-shadow(0 0 6px rgba(26,209,230,.7)); }
.nav-badge{ background:var(--accent); color:#04161a; font-weight:700; box-shadow:var(--glow); }
/* 頂欄：底部霓虹分隔線 */
.topbar{
  background: linear-gradient(180deg, var(--bg2), color-mix(in srgb, var(--bg2) 85%, #000));
  border-bottom: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(26,209,230,.22), 0 4px 18px rgba(0,0,0,.25);
}
.topbar-title{ letter-spacing:.5px; }
.topbar-title::before{ content:''; display:inline-block; width:8px; height:8px; border-radius:2px;
  background:var(--accent); box-shadow:var(--glow); margin-right:9px; vertical-align:middle; }
/* 卡片：科技邊框 + hover 發光 */
.card, .stat-card{
  background: linear-gradient(180deg, var(--bg3), color-mix(in srgb, var(--bg3) 88%, #000));
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card:hover{ border-color: rgba(26,209,230,.35); }
.stat-card{ position:relative; overflow:hidden; }
.stat-card::before{ content:''; position:absolute; left:0; top:0; height:100%; width:3px;
  background:linear-gradient(180deg,var(--accent),var(--accent2)); opacity:.85; }
.stat-card:hover{ border-color: rgba(26,209,230,.5); box-shadow: var(--glow); transform: translateY(-3px); }
.stat-value{ background:linear-gradient(90deg,#eaf6f8,var(--accent)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
/* 主要按鈕：漸層 + 發光 */
.btn-primary{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 120%);
  border-color: transparent; color:#04161a; font-weight:700;
  box-shadow: 0 2px 10px rgba(26,209,230,.25);
}
.btn-primary:hover{ background:linear-gradient(135deg,var(--accent-h),var(--accent2)); box-shadow: var(--glow); transform: translateY(-1px); }
.btn{ transition: all .18s ease; }
/* 表頭科技藍 + KPI 卡發光（涵蓋各頁內嵌 .kpi-card） */
.table thead th, .acc-table th{ background: color-mix(in srgb, var(--bg4) 70%, #0a1a24); color:var(--accent); letter-spacing:.3px; }
.kpi-card:hover{ box-shadow: var(--glow); border-color: rgba(26,209,230,.4); }
/* 徽章發光描邊 */
.badge{ border:1px solid rgba(255,255,255,.06); }
/* 捲軸 */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:#1d2c3e; border-radius:6px; border:2px solid transparent; background-clip:content-box; }
::-webkit-scrollbar-thumb:hover{ background:var(--accent); background-clip:content-box; }
