* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: #f0f2f5; color: #1f2329; }
a { color: #2563eb; text-decoration: none; }
button { cursor: pointer; }

/* ─── Layout ─── */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #001529; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 20px 16px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #1f2d3d; display: flex; align-items: center; gap: 8px; }
.sidebar-logo img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #c0c4cc; cursor: pointer; transition: all 0.2s; font-size: 14px; }
.sidebar-item:hover { background: #1f2d3d; color: #fff; }
.sidebar-item.active { background: #2563eb; color: #fff; border-radius: 0 24px 24px 0; margin-right: 12px; }
.sidebar-item .icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer { padding: 12px 16px; font-size: 12px; color: #5c6370; border-top: 1px solid #1f2d3d; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: #fff; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #5c6370; }
.content { flex: 1; overflow-y: auto; padding: 20px; }

/* ─── Login / Register ─── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #001529 0%, #1f2d3d 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 24px; font-size: 28px; font-weight: 700; color: #2563eb; }
.login-logo span { color: #001529; }
.login-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #e5e6eb; }
.login-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; font-size: 15px; color: #5c6370; border-bottom: 2px solid transparent; }
.login-tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.demo-tip { background: #fff7e6; border: 1px solid #ffd591; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 12px; color: #d46b08; line-height: 1.6; }

/* ─── Form ─── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: #5c6370; margin-bottom: 6px; font-weight: 500; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid #e5e6eb; border-radius: 8px; font-size: 14px; transition: border 0.2s; background: #fff; }
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ─── Button ─── */
.btn { padding: 9px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-default { background: #fff; color: #1f2329; border: 1px solid #e5e6eb; }
.btn-default:hover { border-color: #2563eb; color: #2563eb; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-link { background: none; color: #2563eb; padding: 0; font-size: 12px; }
.btn-link:hover { text-decoration: underline; }

/* ─── Card / Table ─── */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #fafbfc; padding: 10px 12px; text-align: left; color: #5c6370; font-weight: 500; border-bottom: 1px solid #e5e6eb; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.table tr:hover td { background: #f8fafc; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Badge / Tag ─── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-orange { background: #ffedd5; color: #ea580c; }

/* ─── Detail pages ─── */
.detail-back { display: inline-block; margin-bottom: 12px; font-size: 13px; color: #5c6370; }
.detail-back:hover { color: #2563eb; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f2f5; }
.detail-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.detail-meta { font-size: 12px; color: #9ca3af; margin-top: 6px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-section { margin-bottom: 24px; }
.detail-section-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; padding-left: 10px; border-left: 3px solid #2563eb; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 16px; }
.info-item { font-size: 13px; }
.info-item .k { color: #9ca3af; margin-right: 6px; }
.info-item .v { color: #1f2329; font-weight: 500; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; color: #5c6370; }
.summary-row.grand { border-top: 1px dashed #e5e6eb; margin-top: 6px; padding-top: 12px; font-size: 16px; color: #1f2329; font-weight: 700; }
.section-total { text-align: right; font-size: 12px; color: #5c6370; padding: 6px 0; }
.section-total b { color: #1f2329; font-size: 14px; }

/* ─── Modal ─── */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 560px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 22px; color: #9ca3af; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #1f2329; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ─── Dashboard ─── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-value { font-size: 28px; font-weight: 700; color: #1f2329; margin-top: 6px; }
.stat-label { font-size: 13px; color: #5c6370; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 8px; }

/* ─── Section Title ─── */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-title { font-size: 18px; font-weight: 600; }

/* ─── Empty ─── */
.empty { text-align: center; padding: 48px 0; color: #9ca3af; font-size: 14px; }

/* ─── Steps (repair order) ─── */
.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step { flex: 1; text-align: center; padding: 8px; border-radius: 8px; background: #f0f2f5; font-size: 12px; color: #9ca3af; }
.step.active { background: #dbeafe; color: #2563eb; font-weight: 600; }

/* ─── Dynamic rows ─── */
.dynamic-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.dynamic-row .form-control { flex: 1; }

/* ─── Print Preview ─── */
.print-area { background: #fff; padding: 24px; font-size: 12px; line-height: 1.6; }
.print-header { text-align: center; margin-bottom: 16px; }
.print-header h2 { font-size: 20px; margin-bottom: 4px; }
.print-header p { color: #5c6370; }
.print-section { margin-bottom: 12px; }
.print-section h4 { font-size: 13px; border-bottom: 1px solid #000; padding-bottom: 4px; margin-bottom: 8px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.print-table th, .print-table td { border: 1px solid #000; padding: 4px 6px; text-align: left; }
.print-footer { margin-top: 24px; display: flex; justify-content: space-between; font-size: 11px; color: #5c6370; }
.print-total { text-align: right; font-size: 14px; font-weight: 700; margin-top: 8px; }

/* ─── Toast ─── */
.toast { position: fixed; top: 20px; right: 20px; z-index: 2000; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s; }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #2563eb; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-item span:not(.icon), .sidebar-logo span:not(.icon) { display: none; }
  .sidebar-logo { justify-content: center; padding: 16px 0; }
  .sidebar-item { justify-content: center; padding: 14px 0; }
  .sidebar-item.active { margin-right: 0; border-radius: 12px; margin-left: 8px; }
}
