/* ===================================================================
   车辆维修管理系统 — Slate Modern Pro Design System v3.0
   设计理念：简洁专业 · 清晰易读 · 现代质感
   =================================================================== */

/* ===== CSS Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ===== Design Tokens ===== */
:root {
  /* Brand Colors */
  --brand: #2563EB;
  --brand-dark: #1D4ED8;
  --brand-light: #DBEAFE;
  --brand-lighter: #EFF6FF;
  --brand-gradient: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);

  /* Accent */
  --accent: #0EA5E9;
  --accent-light: #E0F2FE;

  /* Semantic */
  --success: #10B981;
  --success-light: #ECFDF5;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --info: #8B5CF6;
  --info-light: #F5F3FF;

  /* Neutrals — Slate */
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Surfaces */
  --bg-body: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E293B;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
  --bg-sidebar-active: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.05) 100%);
  --bg-input: #FFFFFF;
  --bg-header: #FFFFFF;

  /* Text */
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-inverse: #F8FAFC;
  --text-sidebar: rgba(248, 250, 252, 0.70);
  --text-sidebar-active: #FFFFFF;

  /* Borders */
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-input: #CBD5E1;
  --border-focus: #2563EB;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.12);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05);

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", "Courier New", monospace;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  position: fixed;
  top: 0;
  left: 0;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Auth Pages ===== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E293B 0%, #334155 50%, #1E3A5F 100%);
  overflow-y: auto;
  position: relative;
}

.auth-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(37, 99, 235, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(14, 165, 233, 0.08) 0%, transparent 50%);
}

.auth-container {
  width: 420px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 22px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-form { }

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.auth-footer a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.auth-footer a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-input);
  transition: var(--transition-fast);
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.validation-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
  height: 16px;
}

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

.form-row .form-group {
  flex: 1;
}

.detail-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.detail-item {
  flex: 1;
}

.detail-item label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.detail-item span {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

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

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  min-width: 80px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

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

.btn-success:hover {
  background: #059669;
}

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

.btn-danger:hover {
  background: #DC2626;
}

.btn-default {
  background: #FFFFFF;
  color: var(--slate-700);
  border: 1px solid var(--border);
}

.btn-default:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-lighter);
}

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

.search-btn {
  height: 36px !important;
  padding: 0 16px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px !important;
  border-radius: var(--radius-sm);
}

.auth-form .btn-primary {
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}

.modal-footer .btn-primary {
  width: auto;
  padding: 8px 24px;
  flex: 1;
  max-width: 140px;
}

.modal-footer .btn-default {
  width: auto;
  padding: 8px 24px;
  flex: 1;
  max-width: 140px;
}

/* Password strength */
.password-strength {
  margin-top: 8px;
  display: flex;
  gap: 4px;
}

.password-strength-bar {
  flex: 1;
  height: 4px;
  background: var(--slate-200);
  border-radius: 2px;
  transition: background 0.3s;
}

.password-strength-bar.weak { background: var(--danger); }
.password-strength-bar.medium { background: var(--warning); }
.password-strength-bar.strong { background: var(--success); }

.password-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.password-hint div {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.password-hint .valid { color: var(--success); }
.password-hint .invalid { color: var(--danger); }

.invite-info {
  margin-top: 8px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: none;
}

.invite-info.valid {
  display: block;
  background: var(--success-light);
  color: #047857;
  border: 1px solid #A7F3D0;
}

.invite-info.invalid {
  display: block;
  background: var(--danger-light);
  color: #B91C1C;
  border: 1px solid #FECACA;
}

/* ===== Layout ===== */
.layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.06);
}

.sidebar-logo {
  padding: 22px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo h2 {
  font-size: 17px;
  color: #FFFFFF;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.sidebar-menu {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.sidebar-links {
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-link-item {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.50);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  font-size: 13px;
}

.sidebar-link-item:hover {
  background: var(--bg-sidebar-hover);
  color: #FFFFFF;
}

.sidebar-link-item .icon {
  margin-right: 10px;
  width: 16px;
  text-align: center;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 11px 24px;
  color: var(--text-sidebar);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.menu-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.menu-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  border-left-color: var(--brand);
}

.menu-item .icon {
  margin-right: 10px;
  width: 16px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100vh;
  overflow: hidden;
}

/* ===== Header ===== */
.header {
  height: 60px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.header-left {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--slate-600);
  transition: var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--slate-100);
  border-color: var(--brand);
  color: var(--brand);
}

.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
}

.modal-backdrop.show {
  display: block;
}

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-info span {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* 移动端退出按钮 - 桌面端默认隐藏 */
.mobile-logout-btn {
  display: none !important;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
  align-items: center;
  justify-content: center;
}
.mobile-logout-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===== Content ===== */
.content {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 24px;
  box-sizing: border-box;
  display: block;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.vehicle-count-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: var(--radius-full);
  vertical-align: middle;
}

.btn-copy-plate {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  margin-left: 4px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  color: var(--slate-500);
  transition: var(--transition-fast);
  vertical-align: middle;
}

.btn-copy-plate:hover {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-bar .form-group {
  margin-bottom: 0;
  min-width: 180px;
}

.filter-bar .btn {
  padding: 8px 16px;
  font-size: 13px;
  height: 38px;
  align-self: flex-end;
}

/* ===== Tables ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  background: var(--slate-50);
  font-weight: 600;
  font-size: 13px;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.table td {
  font-size: 14px;
  color: var(--text-primary);
}

.table tr:hover td {
  background: var(--slate-50);
}

/* ===== Status Badges ===== */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.status-pending {
  background: var(--warning-light);
  color: #B45309;
}

.status-submitted {
  background: var(--brand-light);
  color: #1D4ED8;
}

.status-repairing {
  background: var(--success-light);
  color: #047857;
}

.status-completed {
  background: #F0F9FF;
  color: #0369A1;
}

.status-audited {
  background: var(--info-light);
  color: #6D28D9;
}

.status-rejected {
  background: var(--danger-light);
  color: #B91C1C;
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  height: 90px;
  transition: var(--transition-fast);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--slate-300);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

.stat-card.primary .stat-value { color: var(--brand); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.info .stat-value { color: var(--info); }

.stat-card.maintenance-warning {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border-color: transparent;
}

.stat-card.maintenance-warning .stat-value,
.stat-card.maintenance-warning .stat-label {
  color: #FFFFFF;
}

.stat-card.inspection-warning {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  border-color: transparent;
}

.stat-card.inspection-warning .stat-value,
.stat-card.inspection-warning .stat-label {
  color: #FFFFFF;
}

.stat-card.mini-stat {
  padding: 12px 10px;
}

.stat-card.mini-stat .stat-value {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.stat-card.mini-stat .stat-label {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.mini-extra {
  font-size: 10px;
  opacity: 0.75;
  line-height: 1.3;
  margin-top: 2px;
}

.dashboard-top {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}

.dashboard-top .filter-bar {
  flex: 1;
  min-width: 400px;
}

.utility-row {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  align-items: stretch;
}

.stats-grid-8 {
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
}

.stats-grid-6 {
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stats-grid-4 .stat-card {
  padding: 16px 14px;
  min-height: 90px;
  height: 90px;
}

.stats-grid-4 .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.1;
}

.stats-grid-4 .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.stats-grid-4 .stat-card.primary .stat-value { color: var(--brand); }
.stats-grid-4 .stat-card.success .stat-value { color: var(--success); }
.stats-grid-4 .stat-card.info .stat-value { color: var(--info); }
.stats-grid-4 .stat-card.danger .stat-value { color: var(--danger); }

.stat-card-sm {
  padding: 16px 10px;
  min-height: 90px;
  height: 90px;
}

.stat-card-sm .stat-value {
  font-size: 22px;
  margin-bottom: 4px;
}

.stat-card-sm .stat-label {
  font-size: 12px;
}

.stat-card-sm.maintenance-warning {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.stat-card-sm.inspection-warning {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

/* ===== Notification Bell ===== */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.notification-bell:hover {
  background: var(--slate-100);
}

.bell-icon {
  font-size: 20px;
}

.notification-bell .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: #FFFFFF;
  border-radius: var(--radius-full);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-weight: 600;
  box-shadow: 0 0 0 2px #FFFFFF;
}

.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  margin-top: 8px;
  z-index: 100;
  overflow: hidden;
  border: 1px solid var(--border);
}

.notification-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.notification-header a {
  font-size: 12px;
  color: var(--brand);
  cursor: pointer;
  font-weight: 500;
}

.notification-list {
  max-height: 300px;
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition-fast);
}

.notification-item:hover {
  background: var(--slate-50);
}

.notification-item.unread {
  background: var(--brand-lighter);
}

.notification-item.unread .notification-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  margin-right: 8px;
}

.notification-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.notification-content {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-time {
  font-size: 11px;
  color: var(--text-muted);
}

.notification-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--border-light);
}

.notification-footer a {
  font-size: 13px;
  color: var(--brand);
  cursor: pointer;
  font-weight: 500;
}

.notification-list-full {
  min-height: 300px;
}

.notification-item-full {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition-fast);
}

.notification-item-full:hover {
  background: var(--slate-50);
}

.notification-item-full.unread {
  background: var(--brand-lighter);
  border-left: 3px solid var(--brand);
}

.notification-item-full .notification-title {
  font-size: 15px;
  margin-bottom: 8px;
}

.notification-item-full .notification-content {
  font-size: 13px;
  white-space: normal;
  margin-bottom: 8px;
  line-height: 1.6;
}

.notification-item-full .notification-time {
  font-size: 12px;
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  width: 600px;
  max-height: 85vh;
  overflow: hidden;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalSlideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 20px;
}

.tab-item {
  padding: 12px 24px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-fast);
  font-weight: 500;
}

.tab-item:hover {
  color: var(--brand);
}

.tab-item.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.vehicle-detail-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 20px;
}

.vehicle-detail-tab {
  padding: 12px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  font-weight: 500;
}

.vehicle-detail-tab:hover {
  color: var(--brand);
}

.vehicle-detail-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* ===== Upload ===== */
.upload-box {
  position: relative;
}

.upload-area {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  background: var(--slate-50);
}

.upload-area:hover {
  border-color: var(--brand);
  background: var(--brand-lighter);
}

.upload-area .upload-icon {
  font-size: 48px;
  color: var(--slate-300);
  margin-bottom: 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--slate-100);
  border: 1px solid var(--border);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-item .photo-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
}

.photo-item:hover .photo-actions {
  display: block;
}

.photo-item .photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  line-height: 22px;
  text-align: center;
  background: rgba(239, 68, 68, 0.9);
  color: #FFFFFF;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: none;
  backdrop-filter: blur(4px);
}

.photo-item:hover .photo-delete {
  display: block;
}

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

.empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

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

.alert-warning {
  background: var(--warning-light);
  border: 1px solid #FDE68A;
  color: #92400E;
}

.alert-danger {
  background: var(--danger-light);
  border: 1px solid #FECACA;
  color: #B91C1C;
}

.alert-success {
  background: var(--success-light);
  border: 1px solid #A7F3D0;
  color: #065F46;
}

/* ===== Detail Grid ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.detail-item {
  display: flex;
  gap: 8px;
}

.detail-label {
  color: var(--text-muted);
  min-width: 80px;
  font-size: 13px;
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 500;
}

.action-btns {
  display: flex;
  gap: 8px;
}

/* ===== Tags ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--slate-100);
  color: var(--slate-600);
  font-weight: 500;
}

.tag-warning {
  background: var(--warning-light);
  color: #B45309;
}

.tag-danger {
  background: var(--danger-light);
  color: #B91C1C;
}

.tag-success {
  background: var(--success-light);
  color: #065F46;
}

/* ===== Page Sections ===== */
.page-section {
  display: none;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 100%;
}

.page-section.active {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  animation: fadeInPage 0.15s ease;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
.page-section.active::-webkit-scrollbar {
  width: 8px;
}
.page-section.active::-webkit-scrollbar-track {
  background: transparent;
}
.page-section.active::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 4px;
}
.page-section.active::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

/* ===== Amount Text ===== */
.amount-text {
  font-weight: 600;
  color: var(--danger);
}

.discount-text {
  color: var(--success);
}

/* ===== Settings ===== */
.settings-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card {
  background: #FFFFFF;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.settings-card .card-header {
  padding: 14px 20px;
  margin-bottom: 0;
  background: var(--slate-50);
  border-bottom: 1px solid var(--border-light);
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
}

.settings-grid .form-group {
  margin-bottom: 0;
}

.settings-grid-inline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 20px;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.form-group-inline label {
  flex: 0 0 auto;
  min-width: 140px;
  font-size: 13px;
  color: var(--slate-700);
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.form-group-inline input,
.form-group-inline select {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
  height: 32px;
  outline: none;
  transition: var(--transition-fast);
  background: #FFFFFF;
  color: var(--text-primary);
}

.form-group-inline input:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.form-group-inline.form-group-checkbox {
  min-height: 32px;
}

.form-group-inline.form-group-checkbox .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-700);
  cursor: pointer;
}

.form-group-inline.form-group-checkbox .checkbox-text {
  font-weight: 500;
}

.settings-actions {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.settings-actions .btn {
  min-width: 160px;
}

/* ===== Checkbox ===== */
.form-group-checkbox {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-input);
  border-radius: var(--radius-sm);
  position: relative;
  transition: var(--transition-fast);
  flex-shrink: 0;
  background: #FFFFFF;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--brand);
  border-color: var(--brand);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-text {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Pull Refresh ===== */
.pull-refresh-wrap {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pull-refresh-indicator {
  position: absolute;
  top: -50px;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  pointer-events: none;
  z-index: 5;
}
.pull-refresh-indicator::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--slate-200);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin-right: 8px;
  transition: transform 0.3s ease;
}
.pull-refresh-wrap.pulling .pull-refresh-indicator::before {
  transform: rotate(180deg);
}
.pull-refresh-wrap.refreshing .pull-refresh-indicator::before {
  animation: pullRefreshSpin 0.8s linear infinite;
}
@keyframes pullRefreshSpin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive: Large screens ===== */
@media (max-width: 1400px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats-grid-8 {
    grid-template-columns: repeat(4, 1fr);
  }
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-top {
    flex-direction: column;
  }
  .dashboard-top .filter-bar {
    min-width: unset;
    width: 100%;
  }
  .utility-row {
    width: 100%;
  }
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid-8 {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Print ===== */
.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}
.receipt { max-width: 800px; margin: 0 auto; border: 1px solid #333; padding: 24px; font-size: 14px; background: #fff; }
.receipt-header { text-align: center; margin-bottom: 20px; }
.receipt-header h2 { font-size: 20px; margin-bottom: 8px; }
.receipt-info { display: flex; justify-content: space-between; margin-bottom: 16px; }
.receipt-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.receipt-table th, .receipt-table td { border: 1px solid #333; padding: 6px 8px; text-align: left; font-size: 12px; }
.receipt-table th { background: #f8f9fa; }
.receipt-total { margin-top: 16px; text-align: right; font-weight: 600; }
.receipt-footer { margin-top: 24px; text-align: center; font-size: 12px; color: #666; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

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

.pagination-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pagination-btns button {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--slate-700);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination-btns button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-lighter);
}

.pagination-btns button.active {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}

.pagination-btns button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 4px 8px;
  color: var(--text-muted);
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--slate-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--brand);
  transition: var(--transition-fast);
}

.timeline-item:hover {
  background: var(--slate-100);
  box-shadow: var(--shadow-sm);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 20px;
  width: 12px;
  height: 12px;
  background: var(--brand);
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 2px var(--brand);
}

.timeline-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.timeline-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.timeline-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-amount {
  color: var(--danger);
  font-weight: 600;
}

/* ===== Chart Container ===== */
.chart-container {
  width: 100%;
  height: 400px;
  margin-bottom: 20px;
}

/* ===== Pub Order Table ===== */
.pub-order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pub-order-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pub-order-table td {
  padding: 14px 16px;
  color: var(--slate-700);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 14px;
}

.pub-order-table tr:hover {
  background: var(--slate-50);
}

.pub-order-table .order-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--slate-100);
  color: var(--slate-600);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
}

.pub-order-table .plate-text {
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
}

.pub-order-table .amount-normal {
  color: var(--slate-500);
  font-weight: 500;
}

.pub-order-table .amount-final {
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
}

.pub-order-table .order-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ===== Repair Cost Summary ===== */
.repair-cost-summary {
  background: var(--slate-50);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.repair-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--slate-500);
}

.repair-cost-row .cost-label {
  color: var(--slate-500);
  font-size: 13px;
}

.repair-cost-row .cost-value {
  font-weight: 500;
  color: var(--slate-700);
  font-size: 13px;
}

.repair-cost-row.discount .cost-value {
  color: var(--success);
}

.repair-cost-row.total {
  padding: 10px 0 0 0;
  margin-top: 6px;
  border-top: 1px solid var(--slate-300);
}

.repair-cost-row.total .cost-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.repair-cost-row.total .cost-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
}

/* ===== Pub Order Items Table ===== */
.pub-order-items-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pub-order-items-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  padding: 12px 10px;
  border-bottom: 2px solid var(--border);
  font-size: 13px;
}

.pub-order-items-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-primary);
}

.pub-order-items-table input[type="text"],
.pub-order-items-table input[type="number"],
.pub-order-items-table select {
  width: 100%;
  min-width: 60px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition-fast);
  font-family: var(--font);
  background: #FFFFFF;
  color: var(--text-primary);
  outline: none;
}

.pub-order-items-table input[type="text"]:focus,
.pub-order-items-table input[type="number"]:focus,
.pub-order-items-table select:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.pub-order-cost-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 28px;
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--slate-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.pub-order-cost-bar .cost-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.pub-order-cost-bar .cost-label {
  color: var(--slate-500);
  font-weight: 500;
}

.pub-order-cost-bar .cost-value {
  font-weight: 600;
  color: var(--slate-700);
  font-size: 15px;
  min-width: 50px;
  text-align: right;
}

.pub-order-cost-bar .cost-value.discount {
  color: var(--success);
}

.pub-order-cost-bar .cost-unit {
  color: var(--text-muted);
  font-size: 13px;
}

.pub-order-cost-bar .discount-input {
  width: 80px !important;
  padding: 6px 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 14px !important;
  text-align: center;
  outline: none;
}

.pub-order-cost-bar .cost-item.highlight .cost-label {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
}

.pub-order-cost-bar .cost-item.highlight .cost-value {
  color: var(--danger);
  font-size: 22px;
  font-weight: 700;
}

/* ===== Template Table ===== */
.template-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  font-size: 13px;
  margin: 12px 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.template-table th {
  background: var(--slate-50);
  color: var(--slate-700);
  font-weight: 600;
  padding: 12px 14px;
  border: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}

.template-table td {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  color: var(--slate-600);
  font-size: 13px;
}

.template-table tr:nth-child(even) td {
  background: var(--slate-50);
}

.template-table .example-row td {
  background: var(--warning-light);
  color: #92400E;
  font-style: italic;
}

/* ===== Global Loading ===== */
.global-loading-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.75);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  pointer-events: none;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.global-loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
}

.global-loading-overlay::after {
  content: '加载中...';
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -60%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Mobile Components ===== */
.mobile-tabbar { display: none; }
.mobile-more-panel { display: none; }
.mobile-fab { display: none; }

/* ===== Responsive: Tablet (768px) ===== */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 80%;
    max-width: 280px;
    z-index: 101;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .header { padding: 0 16px; height: 56px; }
  .header-left { font-size: 16px; }
  .header-links { display: none !important; }
  .content {
    padding: 16px !important;
    padding-bottom: calc(16px + 56px + env(safe-area-inset-bottom, 0)) !important;
  }
  .page-section { padding: 0; margin: 0; }
  .card { padding: 16px; margin-bottom: 16px; border-radius: var(--radius); }
  .card-header { margin-bottom: 12px; padding-bottom: 10px; }
  .card-title { font-size: 15px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
  .stats-grid-6 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 16px; }
  .stat-card-sm { padding: 10px 6px; }
  .stat-card-sm .stat-value { font-size: 20px; }
  .stat-card .stat-value { font-size: 28px; }
  .stat-card .stat-label { font-size: 12px; }
  .dashboard-top { flex-direction: column; }
  .dashboard-top .filter-bar { min-width: unset; width: 100%; }
  .utility-row { width: 100%; }
  .mini-card { flex: 1; min-width: 0; padding: 6px 8px; }
  .filter-bar { gap: 10px; margin-bottom: 16px; }
  .filter-bar .form-group { width: 100%; min-width: 100%; }
  .filter-bar .btn { width: 100%; height: 40px; font-size: 14px; }
  .table th, .table td { padding: 10px 8px; font-size: 13px; white-space: nowrap; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .detail-grid { grid-template-columns: 1fr; gap: 12px; }
  .modal-content { width: 95%; max-width: 100%; max-height: 90vh; }
  .modal-header { padding: 16px; }
  .modal-title { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .btn { padding: 10px 18px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab-item { padding: 10px 16px; font-size: 13px; white-space: nowrap; }
  .pagination { flex-direction: column; gap: 10px; align-items: flex-start; }
  .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .settings-card .card-header { padding: 12px 16px; }
  .settings-card .card-body { padding: 12px 16px; }
  .settings-groups { gap: 12px; }
  .settings-grid-inline { grid-template-columns: 1fr; }
  .form-group-inline { flex-wrap: wrap; }
  .form-group-inline label { min-width: 100%; }

  .auth-container { width: calc(100% - 32px) !important; max-width: none !important; margin: 16px auto !important; border-radius: var(--radius-lg) !important; }
  .auth-header { padding: 20px 24px !important; }
  .auth-header h1 { font-size: 18px !important; }
  .auth-header p { font-size: 13px !important; }
  .auth-form { padding: 24px !important; }
  .auth-form .form-group label { font-size: 13px !important; }
  .auth-form .form-group input { padding: 10px 14px !important; font-size: 15px !important; }
  .auth-form .btn-primary { padding: 12px 24px !important; font-size: 15px !important; }
  .auth-footer { padding: 16px 24px !important; }
  .password-hint { font-size: 10px !important; }
  .password-hint .hint-item { padding: 2px 6px !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid-6 { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-4 { grid-template-columns: 1fr; }
  .stat-card .stat-value { font-size: 24px; }
  .stat-card-sm .stat-value { font-size: 18px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .form-group { flex: 1; min-width: 120px; }
  .utility-row { flex-direction: column; }
  .mini-card { max-width: 100%; }
  .content { padding: 12px !important; padding-bottom: calc(12px + 56px + env(safe-area-inset-bottom, 0)) !important; }
  .page-section { padding: 0; margin: 0; }
  .card { padding: 12px; margin-bottom: 12px; }
  .header-left { font-size: 15px; }
  .user-info span { display: none; }
  .btn { padding: 8px 14px; font-size: 12px; }
  .btn-sm { padding: 4px 8px; font-size: 11px; }
  .modal-footer .btn-primary, .modal-footer .btn-default { max-width: none; }
  .form-group { margin-bottom: 16px; }
  .form-group input, .form-group select, .form-group textarea { padding: 10px 12px; font-size: 13px; }
  .action-btns { flex-wrap: wrap; gap: 4px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-container { width: calc(100% - 24px) !important; margin: 12px auto !important; }
  .auth-header h1 { font-size: 16px !important; }
  .auth-form { padding: 20px 16px !important; }
}

/* ===== Mobile Full Adaptation (<=768px) ===== */
@media (max-width: 768px) {
  .mobile-hide { display: none !important; }
  .sidebar { display: none !important; }
  .main { margin-left: 0 !important; }
  .header { height: 50px; padding: 0 12px; position: sticky; top: 0; z-index: 50; }
  .header-left { font-size: 16px; }
  .menu-toggle { display: none !important; }
  .content { padding: 12px !important; padding-bottom: calc(12px + 56px + env(safe-area-inset-bottom, 0)) !important; }
  .page-section { padding: 0; margin: 0; }
  .page-title { font-size: 17px; margin-bottom: 12px; }

  .mobile-tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #FFFFFF;
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
  }

  .tabbar-item .tabbar-icon { font-size: 20px; margin-bottom: 2px; line-height: 1; }
  .tabbar-item.active { color: var(--brand); }
  .tabbar-item:active { background: var(--slate-100); }

  .mobile-more-panel {
    display: none;
    position: fixed;
    bottom: 56px;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.12);
    z-index: 999;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    max-height: 60vh;
    overflow-y: auto;
  }

  .mobile-more-panel.show {
    display: block;
    animation: slideUp 0.25s ease;
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .mobile-more-panel .more-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .mobile-more-grid .more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-more-grid .more-item:active { background: var(--brand-lighter); }
  .mobile-more-grid .more-item .more-icon { font-size: 24px; }
  .mobile-more-grid .more-item .more-text { font-size: 11px; color: var(--text-secondary); }
  .mobile-more-grid a.more-item { color: inherit; text-decoration: none; }
  .mobile-more-grid a.more-item .more-text { color: var(--text-secondary); }

  .mobile-more-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 998;
  }

  .mobile-more-backdrop.show { display: block; }

  .mobile-fab { display: none !important; }
  .mobile-fab:active { transform: scale(0.9); }

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

  .table-container { overflow-x: visible !important; }
  .card .table, .pub-order-table { display: block; }
  .card .table thead, .pub-order-table thead { display: none; }
  .card .table tbody, .pub-order-table tbody { display: block; }

  .card .table tbody tr, .pub-order-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: #FFFFFF;
    box-shadow: var(--shadow-xs);
  }

  .card .table tbody tr:hover, .pub-order-table tbody tr:hover { background: #FFFFFF; }

  .card .table tbody td, .pub-order-table tbody td {
    display: flex;
    align-items: center;
    width: 50%;
    padding: 4px 0;
    border: none;
    font-size: 13px;
    white-space: normal;
    text-align: left;
  }

  .card .table tbody td:before, .pub-order-table tbody td:before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
  }

  .card .table tbody td:last-child, .pub-order-table tbody td:last-child {
    width: 100%;
    justify-content: flex-end;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
  }

  .card .table tbody td[colspan], .pub-order-table tbody td[colspan] {
    width: 100%;
    justify-content: center;
    padding: 20px;
    color: var(--text-muted);
  }

  .card .table tbody td[colspan]:before, .pub-order-table tbody td[colspan]:before { content: ''; }

  .card .table.repair-items-table { display: table !important; width: 100%; }
  .card .table.repair-items-table thead { display: table-header-group !important; }
  .card .table.repair-items-table tbody { display: table-row-group !important; }
  .card .table.repair-items-table tbody tr { display: table-row !important; border-radius: 0; border: none; box-shadow: none; margin-bottom: 0; padding: 0; flex-wrap: nowrap; }
  .card .table.repair-items-table tbody td, .card .table.repair-items-table thead th { display: table-cell !important; width: auto !important; flex: none; padding: 8px 4px; border: 1px solid var(--border-light); font-size: 12px; white-space: nowrap; text-align: center; }
  .card .table.repair-items-table tbody td:before { content: '' !important; margin: 0; }
  .card .table.repair-items-table tbody td:last-child { justify-content: center; margin-top: 0; padding-top: 8px; border-top: 1px solid var(--border-light); }

  .empty-state { text-align: center; padding: 20px; color: var(--text-muted); }

  .modal { align-items: stretch !important; padding: 0 !important; }
  .modal.show { display: flex; }
  .modal-content { width: 100% !important; max-width: 100% !important; max-height: 100vh !important; height: 100vh !important; border-radius: 0 !important; margin: 0 !important; }
  .modal-header { padding: 12px 16px !important; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; background: #FFFFFF; z-index: 10; }
  .modal-title { font-size: 16px !important; }
  .modal-body { padding: 16px !important; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-footer { padding: 10px 16px !important; border-top: 1px solid var(--border-light); position: sticky; bottom: 0; background: #FFFFFF; z-index: 10; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0)); }
  .modal-footer .btn { flex: 1; max-width: none !important; min-height: 44px; }

  .form-row { flex-direction: column !important; gap: 0 !important; }
  .form-group input, .form-group select, .form-group textarea { min-height: 44px; font-size: 15px !important; }
  .form-group label { font-size: 13px; }

  .filter-bar { flex-direction: column !important; gap: 8px !important; align-items: stretch !important; }
  .filter-bar .form-group { min-width: 0 !important; width: 100%; }
  .filter-bar .form-group input, .filter-bar .form-group select { min-height: 40px; }
  .filter-bar .btn, .search-btn { min-height: 40px; width: 100%; }

  .btn { min-height: 44px; font-size: 14px !important; padding: 10px 16px; }
  .btn-sm { min-height: 36px; font-size: 13px !important; padding: 6px 12px; }

  .card { padding: 14px !important; margin-bottom: 12px !important; border-radius: var(--radius); }
  .card-header { flex-wrap: wrap; gap: 8px; padding-bottom: 10px !important; }
  .card-title { font-size: 14px !important; }

  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; }
  .tab-item { white-space: nowrap; padding: 8px 12px !important; font-size: 13px !important; min-height: 44px; display: flex; align-items: center; }

  .detail-grid { grid-template-columns: 1fr !important; }
  .detail-row { flex-direction: column !important; gap: 0 !important; }
  .photo-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .upload-area { padding: 16px !important; }
  .upload-area .upload-icon { font-size: 32px !important; }
  .settings-grid { grid-template-columns: 1fr !important; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; }
  .pagination button { min-width: 36px; min-height: 36px; font-size: 12px; }
  .header-right { gap: 8px; }
  .user-info span:not(.user-avatar) { display: none; }
  #bindWorkshopBtn, #userName, #userWorkshopInfo { display: none !important; }
  .user-avatar { width: 32px !important; height: 32px !important; font-size: 14px !important; }
  .notification-dropdown { position: fixed; top: 50px; right: 0; left: 0; width: 100% !important; max-height: 60vh; border-radius: 0 0 var(--radius-md) var(--radius-md); }
  #repairStepTabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #repairStepTabs .tab-item { min-width: 80px; justify-content: center; }
  #repairItemsBody tr td { font-size: 12px; padding: 6px 4px; }
  .modal-content[style*="900px"], .modal-content[style*="800px"], .modal-content[style*="600px"], .modal-content[style*="500px"], .modal-content[style*="450px"], .modal-content[style*="400px"] { width: 100% !important; max-width: 100% !important; }
  .action-btns { flex-wrap: wrap; gap: 4px; }
  .order-actions { flex-wrap: wrap; gap: 4px; }
  .repair-cost-summary { padding: 10px !important; }
  .repair-cost-row.total .cost-value { font-size: 15px !important; }
  #sidebarBackdrop { display: none !important; }

  .menu-item[data-desktop-only] { display: none !important; }
  .sidebar-logo, .sidebar-footer { display: none !important; }
  .notification-bell { display: none !important; }
  .user-info { display: none !important; }
  .mobile-logout-btn { display: flex !important; }
  #bindWorkshopBtn { display: none !important; }
  .btn[onclick="switchPage('password')"] { display: none !important; }
  .header { justify-content: space-between !important; }
  .header-left { flex: 1; }
  #pageTitle { font-size: 16px; font-weight: 600; }

  .mobile-tabbar { display: flex !important; }
  .mobile-more-panel.show { display: block !important; }
  .mobile-more-backdrop.show { display: block !important; }

  #page-repairs .btn-back, #page-repairs [onclick*="showPage('dashboard')"], #page-repairs [onclick*="switchPage('dashboard')"] { display: none !important; }
  #page-repairs .filter-bar { flex-direction: column; gap: 10px; }
  #page-repairs .filter-bar .form-group { width: 100%; }
  #page-repairs .filter-bar .btn { width: 100%; height: 44px; font-size: 15px; }
  #page-repairs input[type="text"], #page-repairs input[type="number"], #page-repairs input[type="date"], #page-repairs select, #page-repairs textarea { min-height: 44px; font-size: 15px; padding: 10px 12px; }
  #page-repairs .btn { min-height: 44px; font-size: 15px; }
  #page-repairs .form-group label { font-size: 14px; margin-bottom: 6px; }
  #page-repairs .form-group { margin-bottom: 14px; }
  #page-repairs .upload-box, #page-repairs .upload-area { min-height: 80px; font-size: 14px; }
  #page-repairs .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  #page-repairs .tabs { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; white-space: nowrap; width: 100%; border-bottom: none; margin-bottom: 0; padding-bottom: 8px; border-bottom: 2px solid var(--border-light); }
  #page-repairs .tabs::-webkit-scrollbar { display: none; }
  #page-repairs .tab-item { flex-shrink: 0; padding: 10px 16px; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; }
  #page-repairs .tab-item.active { border-bottom-color: var(--brand); color: var(--brand); font-weight: 500; }
  #page-repairs .filter-bar input, #page-repairs .filter-bar select { width: 100%; min-height: 44px; }
  #page-repairs .card { border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); }
  #page-repairs #newRepairBtn { min-height: 40px; padding: 0 16px; font-size: 14px; }
  #page-repairs .repair-filter-bar { display: none !important; }

  .form-group input, .form-group select, .form-group textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
  .filter-group select, .filter-group input, .filter-bar select, .filter-bar input { width: 100%; max-width: 100%; box-sizing: border-box; }
  .form-row { flex-direction: column; gap: 10px; }
  .form-row .form-group { width: 100%; }
  .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
  .btn-sm { padding: 6px 10px; font-size: 12px; }
  .upload-box { padding: 12px; width: 100%; box-sizing: border-box; }
  .upload-preview img { max-width: 100%; height: auto; }
  .modal { width: 95%; max-width: 95vw; max-height: 90vh; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; overflow-y: auto; }
  .modal-content { width: 100%; box-sizing: border-box; padding: 16px; }
  .table-wrapper, .card table { max-width: 100%; overflow-x: auto; display: block; }
  .detail-grid, .detail-item { max-width: 100%; box-sizing: border-box; }
  .card .actions, .card [style*="display:flex"][style*="gap"] { flex-wrap: wrap; gap: 8px; }
  .btn, .tab-item, .menu-item, .more-item { -webkit-tap-highlight-color: transparent; }
  .btn { min-height: 40px; font-size: 14px; }
  .btn-sm { min-height: 32px; }
  .form-group input, .form-group select, .form-group textarea { min-height: 42px; font-size: 15px; }
  .card { margin-bottom: 12px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  #page-password .card { max-width: 100% !important; }
  #page-invite-codes .card-header { flex-direction: column; align-items: stretch; }
  #page-invite-codes #inviteCodeActionArea { width: 100%; }
  #page-invite-codes #inviteCodeActionArea .btn { flex: 1; }
  #page-public-orders .card-header { flex-direction: column; align-items: stretch; }
  .table-wrapper { -webkit-overflow-scrolling: touch; }
  .pagination button, .pagination .page-btn { min-width: 36px; min-height: 36px; font-size: 13px; }
  .modal { overflow-y: auto; }
  .modal-content { max-height: 85vh; }

  html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }
  #app { overflow-x: hidden; width: 100%; max-width: 100vw; }
  .main { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .content { padding: 12px !important; padding-bottom: calc(12px + 56px + env(safe-area-inset-bottom, 0)) !important; }
  .page-section { padding: 0; margin: 0; }
  .card { width: 100%; max-width: 100%; box-sizing: border-box; overflow-x: hidden; }
  .header { width: 100%; box-sizing: border-box; padding: 8px 12px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .stats-grid-6 { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-grid-4 { grid-template-columns: 1fr !important; }
  .mobile-more-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-card .stat-value { font-size: 18px !important; }
  .stat-card-sm .stat-value { font-size: 16px !important; }
  .card .table tbody td, .pub-order-table tbody td { width: 100% !important; }
  .card .table tbody td:before, .pub-order-table tbody td:before { width: 70px; }
  .header-left { font-size: 14px; }
}

/* Desktop: repair filter toggle */
@media (min-width: 769px) {
  #repairFilterToggle { display: none; }
  #repairDateFilter { display: flex !important; }
}

/* ===== Chat System ===== */
#page-chat.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.chat-layout {
  display: flex;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-sidebar {
  width: 300px;
  min-width: 260px;
  background: var(--slate-50);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: #FFFFFF;
}

.chat-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
}

.chat-sidebar-icon { font-size: 18px; }

.chat-new-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #FFFFFF;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.chat-new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.chat-search {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
}

.chat-search-icon {
  color: var(--text-muted);
  font-size: 13px;
}

.chat-search input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--slate-50);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition-fast);
  color: var(--text-primary);
}

.chat-search input:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
  background: #FFFFFF;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.chat-list-tip {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: var(--transition-fast);
}

.conversation-item:hover {
  background: var(--brand-lighter);
}

.conversation-item.active {
  background: var(--brand-light);
  border-left-color: var(--brand);
}

.conversation-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #06B6D4);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

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

.conversation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.conversation-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.conversation-msg {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-unread {
  background: var(--danger);
  color: #FFFFFF;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--slate-50);
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.chat-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.chat-empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.chat-empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.chat-new-btn-large {
  border: none;
  border-radius: var(--radius);
  padding: 10px 22px;
  background: var(--brand-gradient);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: var(--transition-fast);
}

.chat-new-btn-large:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-head {
  padding: 12px 18px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-back-btn {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--slate-700);
  font-size: 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.chat-back-btn:hover {
  background: var(--slate-100);
}

.chat-head-main {
  flex: 1;
  min-width: 0;
}

.chat-head-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-readonly-badge {
  background: var(--warning-light);
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.chat-clear-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-muted);
  font-size: 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.chat-clear-btn:hover {
  color: var(--danger);
  border-color: #FECACA;
  background: var(--danger-light);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
  max-width: 72%;
}

.message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.received {
  align-self: flex-start;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: linear-gradient(135deg, var(--slate-300), var(--slate-400));
  color: #FFFFFF;
}

.message.sent .message-avatar {
  background: var(--brand-gradient);
  margin-left: 8px;
}

.message.received .message-avatar {
  margin-right: 8px;
}

.message-body {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  min-width: 0;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message.sent .message-meta {
  flex-direction: row-reverse;
}

.message-sender {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.message.sent .message-sender {
  color: var(--brand);
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
}

.message-sending {
  font-size: 11px;
  color: var(--text-muted);
}

.message-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.message.sent .message-bubble {
  background: var(--brand-gradient);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
  background: #FFFFFF;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-temp .message-bubble {
  opacity: 0.75;
}

.message-error .message-bubble {
  background: var(--danger-light) !important;
  color: var(--danger) !important;
  border-color: #FECACA !important;
}

.message-error .message-sending {
  color: var(--danger);
}

.chat-composer {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.chat-attach-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-attach-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--brand);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.chat-attach-btn:hover {
  background: var(--brand-lighter);
  border-color: #93C5FD;
  transform: rotate(45deg);
}

.chat-attach-menu {
  position: absolute;
  bottom: 48px;
  left: 0;
  width: 250px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 8px;
  z-index: 300;
  display: none;
}

.chat-attach-menu.show {
  display: block;
  animation: chatMenuIn 0.18s ease;
}

@keyframes chatMenuIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-attach-item {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.chat-attach-item:hover {
  background: var(--slate-50);
}

.chat-attach-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--brand-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-attach-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.chat-attach-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-composer textarea {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
  font-size: 14px;
  font-family: var(--font);
  line-height: 1.5;
  outline: none;
  max-height: 110px;
  transition: var(--transition-fast);
  color: var(--text-primary);
  background: #FFFFFF;
}

.chat-composer textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.chat-send-btn {
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  background: var(--brand-gradient);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.chat-send-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Order card in chat */
.order-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-width: 240px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.order-card:hover {
  border-color: #93C5FD;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.order-card-no {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.order-card-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-lighter);
  color: var(--brand);
  font-weight: 500;
}

.order-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.order-card-amount {
  color: var(--danger);
  font-weight: 600;
  margin-top: 6px;
  font-size: 13px;
}

.order-card-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--brand);
  font-weight: 500;
}

/* Picker item */
.picker-item {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFFFF;
}

.picker-item:hover {
  border-color: #93C5FD;
  background: var(--brand-lighter);
}

.picker-item-info {
  flex: 1;
  min-width: 0;
}

.picker-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.picker-item-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.picker-item-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Chat new partner */
.chat-new-partner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.chat-new-partner:hover {
  background: var(--brand-lighter);
}

.chat-new-partner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #06B6D4);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.chat-new-partner-info {
  flex: 1;
  min-width: 0;
}

.chat-new-partner-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.chat-new-partner-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-new-partner-action {
  color: var(--brand);
  font-size: 12px;
  flex-shrink: 0;
  font-weight: 500;
}

/* Chat image */
.chat-msg-image {
  max-width: 220px;
  max-height: 260px;
  border-radius: var(--radius);
  display: block;
  cursor: zoom-in;
  box-shadow: var(--shadow-sm);
}

.chat-images-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.chat-image-wrap {
  position: relative;
  display: inline-block;
}

/* Chat mobile */
@media (max-width: 768px) {
  .chat-layout {
    flex-direction: row;
    border: none;
    border-radius: 0;
  }
  .chat-sidebar { width: 100%; min-width: 0; border-right: none; }
  .chat-sidebar.hidden { display: none; }
  .chat-main { display: none; flex: 1; }
  .chat-main.show { display: flex; }
  .chat-back-btn { display: flex !important; }
  .chat-messages { padding: 14px; }
  .message { max-width: 85%; }
  .chat-composer { padding: 10px 12px; }
  .chat-composer textarea { font-size: 16px; }
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }

/* ===== Selection ===== */
::selection {
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* ===== Dropdown Items ===== */
.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--slate-50);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--slate-800);
  color: #FFFFFF;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  max-width: 90%;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--danger);
}

.toast.success {
  background: var(--success);
}

/* ===== Sidebar Menu Badges (Dark Sidebar Safe) ===== */
#chatUnreadBadge,
#notificationMenuBadge,
#inviteCodeMenuBadge {
  background: #ff4d4f !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 1px 7px !important;
  border-radius: 9999px !important;
  margin-left: auto !important;
  line-height: 1.5 !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 2px 6px rgba(255, 77, 79, 0.4);
  min-width: 18px;
  text-align: center;
  display: inline-block;
}

.menu-item {
  position: relative;
}

.menu-item span[style*="margin-left:auto"] {
  align-self: center;
}
