/* ========================================
   Nội Thất KENDO - Design System
   Clean Minimal | Navy & Copper
   ======================================== */

:root {
  /* Primary palette - Navy Blue */
  --primary-900: #0c1445;
  --primary-800: #0f172a;
  --primary-700: #1e3a8a;
  --primary-600: #1e40af;
  --primary-500: #1d4ed8;
  --primary-400: #60a5fa;
  --primary-300: #93c5fd;
  --primary-200: #bfdbfe;
  --primary-100: #dbeafe;
  --primary-50: #eff6ff;

  /* Accent - Copper/Bronze */
  --accent-600: #92400e;
  --accent-500: #b45309;
  --accent-400: #d97706;
  --accent-300: #fbbf24;
  --accent-100: #fef3c7;

  /* Success */
  --success-500: #10b981;
  --success-600: #059669;
  --success-100: #d1fae5;
  --success-700: #047857;

  /* Danger */
  --danger-500: #ef4444;
  --danger-100: #fee2e2;
  --danger-200: #fecaca;
  --danger-700: #b91c1c;

  /* Warning */
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-100: #fef3c7;
  --warning-700: #92400e;

  /* Neutral - Warm tones */
  --gray-900: #18181b;
  --gray-800: #27272a;
  --gray-700: #3f3f46;
  --gray-600: #52525b;
  --gray-500: #71717a;
  --gray-400: #a1a1aa;
  --gray-300: #d4d4d8;
  --gray-200: #e4e4e7;
  --gray-100: #f4f4f5;
  --gray-50: #fafafa;
  --white: #ffffff;

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

  /* Radius - Larger for modern feel */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Sidebar dark palette */
  --sidebar-bg: #ffffff;
  --sidebar-bg-hover: rgba(29,78,216,0.06);
  --sidebar-bg-active: rgba(29,78,216,0.1);
  --sidebar-text: #52525b;
  --sidebar-text-active: #1d4ed8;
  --sidebar-border: #e4e4e7;
  --sidebar-section: #a1a1aa;

  /* Shadows - Pro subtle */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.12);

  /* Layout */
  --top-bar-height: 60px;
  --bottom-nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ======== RESET & BASE ======== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
a { color: var(--primary-500); text-decoration: none; }
input, select, textarea, button { font-family: var(--font); font-size: inherit; }

/* ======== LOADING SCREEN ======== */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--sidebar-bg, #1e1b4b);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
.loading-screen.fade-out { opacity: 0; pointer-events: none; }
.loading-logo { text-align: center; color: var(--white); }
.logo-icon-large {
  width: 72px; height: 72px; border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.08); display: flex; align-items: center;
  justify-content: center; margin: 0 auto var(--sp-4);
  border: 1px solid rgba(255,255,255,0.1);
  animation: logoPulse 2s ease-in-out infinite;
}
.logo-icon-large .material-icons-round { font-size: 36px; color: var(--primary-300); }
.loading-logo h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; letter-spacing: 0.5px; }
.loading-logo p { font-size: 0.85rem; opacity: 0.65; margin-bottom: var(--sp-6); }
.loading-bar {
  width: 180px; height: 3px; background: rgba(255,255,255,0.15);
  border-radius: var(--radius-full); margin: 0 auto; overflow: hidden;
}
.loading-bar-inner {
  height: 100%; width: 30%;
  background: var(--primary-400);
  border-radius: var(--radius-full);
  animation: loading-slide 1.4s ease-in-out infinite;
}
@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(500%); }
}
@keyframes logoPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.9; }
}

/* ======== LOGIN ======== */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--sidebar-bg, #1e1b4b);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
}
.login-container {
  width: 100%; max-width: 380px;
  background: var(--white); border-radius: var(--radius-lg);
  padding: 36px 32px; box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.login-header { text-align: center; margin-bottom: var(--sp-6); }
.login-logo {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  background: var(--sidebar-bg, #1e1b4b);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-4);
}
.login-logo .material-icons-round { font-size: 32px; color: var(--white); }
.login-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.3px; }
.login-header p { font-size: 0.85rem; color: var(--gray-400); }
.login-form .form-group { margin-bottom: var(--sp-4); }
.input-icon {
  position: relative; display: flex; align-items: center;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); transition: all 0.2s ease;
}
.input-icon:focus-within {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.08);
  background: var(--white);
}
.input-icon .material-icons-round {
  padding: 0 var(--sp-3); color: var(--gray-400); font-size: 20px;
  transition: color 0.2s;
}
.input-icon:focus-within .material-icons-round { color: var(--primary-500); }
.input-icon input {
  flex: 1; padding: 13px var(--sp-3) 13px 0;
  border: none; outline: none; background: transparent;
  font-size: 0.95rem; color: var(--gray-800);
}
.form-error {
  background: var(--danger-100); color: var(--danger-700);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  font-size: 0.85rem; margin-bottom: var(--sp-3);
}
.login-footer { text-align: center; margin-top: var(--sp-5); }
.login-footer p { font-size: 0.75rem; color: var(--gray-400); }
.login-footer strong { color: var(--primary-500); }

/* ======== TOP BAR ======== */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--top-bar-height); padding: 0 var(--sp-5);
  background: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
}
.top-bar-left { display: flex; align-items: center; gap: var(--sp-3); }
.logo-small {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; transition: transform 0.2s;
}
.logo-small:active { transform: scale(0.92); }
.logo-small .material-icons-round { font-size: 20px; color: var(--white); }
.top-bar-title h2 { font-size: 1.05rem; font-weight: 600; color: var(--gray-800); letter-spacing: -0.2px; }
.top-bar-right { display: flex; gap: var(--sp-2); }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100); background: var(--white); color: var(--gray-500);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all 0.2s ease; position: relative;
}
.icon-btn:hover { background: var(--gray-50); color: var(--gray-700); border-color: var(--gray-200); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn .material-icons-round { font-size: 20px; }
.badge {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  background: var(--danger-500); color: var(--white); font-size: 0.55rem;
  font-weight: 700; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid var(--white);
}

/* ======== BOTTOM NAV ======== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--white);
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: flex-start; justify-content: space-around;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 8px 0; gap: 2px;
  border: none; background: none; cursor: pointer;
  color: var(--gray-400); transition: all 0.2s ease; height: var(--bottom-nav-height);
  position: relative;
}
.nav-item .material-icons-round { font-size: 22px; transition: all 0.2s ease; }
.nav-item span:last-child { font-size: 0.62rem; font-weight: 500; }
.nav-item.active { color: var(--primary-600); }
.nav-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 2px; background: var(--primary-500); border-radius: 0 0 2px 2px;
}
.nav-item.active .material-icons-round { color: var(--primary-600); }

/* ======== PAGE CONTENT ======== */
.page-content {
  margin-top: var(--top-bar-height);
  margin-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  min-height: calc(100vh - var(--top-bar-height) - var(--bottom-nav-height) - var(--safe-bottom));
  min-height: calc(100dvh - var(--top-bar-height) - var(--bottom-nav-height) - var(--safe-bottom));
  padding: var(--sp-4);
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ======== CARDS ======== */
.card {
  background: var(--white); border-radius: var(--radius-md);
  padding: var(--sp-5); margin-bottom: var(--sp-4);
  border: 1px solid var(--gray-100);
  transition: all 0.2s ease;
}
.card:hover { border-color: var(--gray-200); box-shadow: var(--shadow-sm); }
.card:active { box-shadow: var(--shadow-sm); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.card-header h3 { font-size: 1rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.2px; }
.card-header .card-badge {
  font-size: 0.7rem; font-weight: 600; padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* ======== STAT CARDS (Dashboard) ======== */
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.stat-card {
  background: var(--white); border-radius: var(--radius-md);
  padding: var(--sp-4); border: 1px solid var(--gray-100);
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--gray-200); }
.stat-card.highlight {
  background: linear-gradient(135deg, var(--primary-800), var(--primary-600));
  border: none; color: var(--white);
}
.stat-card.highlight .stat-label { color: rgba(255,255,255,0.7); }
.stat-card.highlight .stat-value { color: var(--white); }
.stat-card.highlight .stat-icon { background: rgba(255,255,255,0.12); color: var(--white); }
.stat-card.accent {
  background: linear-gradient(135deg, var(--accent-600), var(--accent-400));
  border: none; color: var(--white);
}
.stat-card.accent .stat-label { color: rgba(255,255,255,0.8); }
.stat-card.accent .stat-value { color: var(--white); }
.stat-card.accent .stat-icon { background: rgba(255,255,255,0.12); color: var(--white); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--primary-50); color: var(--primary-500);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon .material-icons-round { font-size: 20px; }
.stat-label { font-size: 0.72rem; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-value { font-size: 1.35rem; font-weight: 700; color: var(--gray-900); margin-top: 4px; letter-spacing: -0.5px; }
.stat-sub { font-size: 0.7rem; color: var(--gray-400); margin-top: 2px; }

/* ======== BUTTONS ======== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 20px; border: none; border-radius: var(--radius-md);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: all 0.25s ease; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--primary-600); color: var(--white);
}
.btn-primary:hover { background: var(--primary-500); }
.btn-accent {
  background: var(--accent-500); color: var(--white);
}
.btn-accent:hover { background: var(--accent-600); }
.btn-outline {
  background: transparent; border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--primary-400); color: var(--primary-600); background: var(--primary-50); }
.btn-danger { background: var(--danger-500); color: var(--white); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success-500); color: var(--white); }
.btn-success:hover { background: var(--success-600); }
.btn-small { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-fab {
  position: fixed; bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
  right: 16px; width: 52px; height: 52px; border-radius: var(--radius-md);
  z-index: 40; padding: 0;
  box-shadow: var(--shadow-lg);
}
.btn-fab:hover { box-shadow: var(--shadow-xl); }
.btn-fab .material-icons-round { font-size: 26px; }

/* ======== FORMS ======== */
.form-section { margin-bottom: var(--sp-5); }
.form-section-title {
  font-size: 0.85rem; font-weight: 600; color: var(--primary-600);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: var(--sp-3); display: flex; align-items: center; gap: var(--sp-2);
}
.form-section-title .material-icons-round { font-size: 18px; }
.form-group { margin-bottom: var(--sp-4); }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--gray-600); margin-bottom: var(--sp-1);
}
.form-label.required::after { content: ' *'; color: var(--danger-500); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px var(--sp-3);
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 0.9rem; background: var(--white); color: var(--gray-800);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.08);
}
.form-input.readonly { background: var(--gray-50); color: var(--gray-500); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { 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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: 0.75rem; color: var(--gray-400); margin-top: 2px; }
.form-row { display: flex; gap: var(--sp-3); }
.form-row .form-group { flex: 1; }
.form-actions {
  display: flex; gap: var(--sp-3); padding: var(--sp-4) 0;
  position: sticky; bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  background: var(--gray-50); z-index: 5;
}

/* ======== CHIPS & TAGS ======== */
.chip-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  padding: 6px 12px; border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-600);
  transition: all 0.15s;
}
.chip.active { background: var(--primary-600); color: var(--white); border-color: var(--primary-600); }
.chip:hover { border-color: var(--gray-300); }
.chip:active { transform: scale(0.97); }

/* Status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 0.68rem; font-weight: 600;
}
.status-new { background: var(--primary-100); color: var(--primary-700); }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-overdue { background: var(--danger-100); color: var(--danger-700); }
.status-completed { background: var(--success-100); color: var(--success-700); }
.status-cancelled { background: var(--gray-200); color: var(--gray-600); }
.status-packing { background: var(--warning-100); color: #92400e; }
.status-shipped { background: #e0e7ff; color: #3730a3; }
.status-delivered { background: var(--success-100); color: var(--success-700); }
.status-paid { background: #d1fae5; color: #065f46; }
.status-active { background: var(--success-100); color: var(--success-700); }
.status-in_repair { background: var(--warning-100); color: #92400e; }
.status-resolved { background: #d1fae5; color: #065f46; }
.status-open { background: var(--danger-100); color: var(--danger-700); }
.status-closed { background: var(--gray-200); color: var(--gray-600); }
.status-assigned { background: #e0e7ff; color: #3730a3; }
.status-accepted { background: #dbeafe; color: #1d4ed8; }
.status-expired { background: var(--gray-200); color: var(--gray-500); }
.status-unpaid { background: var(--danger-100); color: var(--danger-700); }
.status-deposit_paid { background: var(--warning-100); color: #92400e; }
.status-fully_paid { background: #d1fae5; color: #065f46; }

/* ======== LIST ITEMS ======== */
.list-item {
  background: var(--white); border-radius: var(--radius-md);
  padding: var(--sp-4); margin-bottom: var(--sp-3);
  border: 1px solid var(--gray-100);
  cursor: pointer; transition: all 0.2s ease;
  animation: fadeIn 0.25s ease;
}
.list-item:hover { border-color: var(--gray-200); box-shadow: var(--shadow-sm); }
.list-item:active { box-shadow: var(--shadow-sm); }
.list-item-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.list-item-code { font-size: 0.68rem; font-weight: 500; color: var(--gray-500); }
.list-item-name { font-size: 0.92rem; font-weight: 700; color: var(--gray-800); }
.list-item-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  font-size: 0.8rem; color: var(--gray-500); margin-top: var(--sp-2);
}
.list-item-meta .meta-item { display: flex; align-items: center; gap: 3px; }
.list-item-meta .material-icons-round { font-size: 14px; }
.list-item-amount {
  font-size: 1rem; font-weight: 700; color: var(--primary-700);
  text-align: right;
}
.list-item-debt { color: var(--danger-500); }

/* ======== SEARCH BAR ======== */
.search-bar {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--white); border-radius: var(--radius-sm);
  padding: 6px var(--sp-3); margin-bottom: var(--sp-3);
  border: 1px solid var(--gray-200);
}
.search-bar .material-icons-round { color: var(--gray-400); font-size: 20px; }
.search-bar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 0.9rem; padding: 6px 0;
}
.search-bar .filter-btn {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--primary-500);
}

/* ======== TABS ======== */
.tabs {
  display: flex; gap: var(--sp-2); overflow-x: auto;
  margin-bottom: var(--sp-4); padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 500; white-space: nowrap;
  border: 1.5px solid var(--gray-200); background: var(--white);
  color: var(--gray-600); cursor: pointer; transition: all 0.2s;
}
.tab.active {
  background: var(--primary-500); color: var(--white);
  border-color: var(--primary-500);
}
.tab .tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.3); font-size: 0.65rem; font-weight: 700;
  margin-left: 4px; padding: 0 4px;
}

/* ======== CHECKLIST ======== */
.checklist-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); background: var(--gray-50);
  border-radius: var(--radius-md); margin-bottom: var(--sp-2);
  transition: background 0.2s;
}
.checklist-item.completed { background: var(--success-100); }
.checklist-check {
  width: 24px; height: 24px; border-radius: 6px;
  border: 2px solid var(--gray-300); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all 0.2s;
}
.checklist-item.completed .checklist-check {
  background: var(--success-500); border-color: var(--success-500);
}
.checklist-item.completed .checklist-check::after {
  content: '✓'; color: var(--white); font-size: 14px; font-weight: 700;
}
.checklist-text { flex: 1; font-size: 0.85rem; }
.checklist-item.completed .checklist-text { color: var(--gray-400); text-decoration: line-through; }
.checklist-photo {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px dashed var(--gray-300); display: flex; align-items: center;
  justify-content: center; cursor: pointer; flex-shrink: 0;
  overflow: hidden;
}
.checklist-photo img { width: 100%; height: 100%; object-fit: cover; }
.checklist-photo .material-icons-round { font-size: 16px; color: var(--gray-400); }

/* ======== MENU ITEMS (Shipping Module) ======== */
.menu-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.menu-item {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--white); padding: var(--sp-4); border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.2s ease;
  border: 1px solid var(--gray-100);
}
.menu-item:hover { background: var(--gray-50); border-color: var(--gray-200); }
.menu-item:active { background: var(--gray-50); }
.menu-item-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.menu-item-icon.blue { background: var(--primary-100); color: var(--primary-600); }
.menu-item-icon.orange { background: var(--accent-100); color: var(--accent-600); }
.menu-item-icon.green { background: var(--success-100); color: var(--success-700); }
.menu-item-icon.red { background: var(--danger-100); color: var(--danger-700); }
.menu-item-icon.purple { background: #f3e8ff; color: #7c3aed; }
.menu-item-icon .material-icons-round { font-size: 24px; }
.menu-item-content { flex: 1; }
.menu-item-content h4 { font-size: 0.95rem; font-weight: 600; color: var(--gray-800); }
.menu-item-content p { font-size: 0.75rem; color: var(--gray-400); }
.menu-item-arrow { color: var(--gray-300); }

/* ======== MODAL ======== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 100; backdrop-filter: blur(2px);
}
.modal-container {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 101;
  background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  animation: slideUpModal 0.3s ease;
  padding-bottom: var(--safe-bottom);
}

/* Form 2-column grid — mobile: 1 cột, desktop: 2 cột */
.pj-form-grid { display: flex; flex-direction: column; }
.pj-form-col { display: flex; flex-direction: column; }
@keyframes slideUpModal {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-handle {
  width: 40px; height: 4px; background: var(--gray-300);
  border-radius: var(--radius-full); margin: var(--sp-3) auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  border: none; background: var(--gray-100); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: var(--sp-4); }
.modal-body .form-actions { bottom: 0; background: var(--white); padding-bottom: var(--sp-3); }
.modal-footer {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--gray-100);
  display: flex; gap: var(--sp-3); justify-content: flex-end;
}

/* Full-screen modal for forms */
.modal-container.fullscreen {
  top: 0; border-radius: 0; max-height: 100vh; max-height: 100dvh;
}
.modal-container.fullscreen .modal-header {
  padding: var(--sp-3) var(--sp-4);
  background: var(--primary-700);
  color: var(--white); border-bottom: none;
}
.modal-container.fullscreen .modal-close { background: rgba(255,255,255,0.1); color: var(--white); }

/* ======== TOAST ======== */
.toast-container {
  position: fixed; top: calc(var(--top-bar-height) + var(--sp-3));
  left: var(--sp-3); right: var(--sp-3); z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500; color: var(--white);
  box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease;
  pointer-events: auto; display: flex; align-items: center; gap: var(--sp-2);
}
.toast.success { background: var(--gray-900); }
.toast.error { background: var(--danger-700); }
.toast.info { background: var(--gray-900); }
@keyframes toastIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
  to { transform: translateY(-20px); opacity: 0; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ======== PROFIT/LOSS ======== */
.profit-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: var(--sp-4); margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.profit-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-2) 0;
}
.profit-row.total {
  border-top: 2px solid var(--gray-200); margin-top: var(--sp-2);
  padding-top: var(--sp-3); font-weight: 700; font-size: 1.1rem;
}
.profit-row .label { color: var(--gray-600); }
.profit-row .value { font-weight: 600; }
.profit-row .value.positive { color: var(--success-700); }
.profit-row .value.negative { color: var(--danger-700); }

/* ======== MULTI-SELECT TAGS ======== */
.tag-input-container {
  display: flex; flex-wrap: wrap; gap: var(--sp-1); padding: 6px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--white); min-height: 42px; cursor: text;
}
.tag-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-full);
  background: var(--primary-100); color: var(--primary-700);
  font-size: 0.8rem; font-weight: 500;
}
.tag-item .tag-remove {
  cursor: pointer; font-size: 14px; opacity: 0.7; background: none;
  border: none; color: var(--primary-700); padding: 0;
}

/* ======== FILE UPLOAD ======== */
.file-upload-area {
  border: 2px dashed var(--gray-300); border-radius: var(--radius-md);
  padding: var(--sp-5); text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--gray-50);
}
.file-upload-area:hover { border-color: var(--primary-500); background: var(--primary-50); }
.file-upload-area .material-icons-round { font-size: 32px; color: var(--gray-400); }
.file-upload-area p { color: var(--gray-500); font-size: 0.85rem; margin-top: var(--sp-2); }
.file-preview-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2); margin-top: var(--sp-3);
}
.file-preview {
  aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
  position: relative;
}
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-preview .remove-file {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  border-radius: var(--radius-full); background: rgba(0,0,0,0.6);
  color: var(--white); border: none; display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 12px;
}

/* ======== DETAIL PAGE ======== */
.detail-back {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 0.9rem; font-weight: 500; color: var(--gray-600);
  margin-bottom: var(--sp-3); cursor: pointer; background: none;
  border: none; padding: 0;
}
.detail-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--sp-2); margin-bottom: var(--sp-4);
}
.info-item { padding: var(--sp-2) 0; }
.info-label { font-size: 0.7rem; color: var(--gray-400); text-transform: uppercase; font-weight: 500; }
.info-value { font-size: 0.9rem; font-weight: 500; color: var(--gray-800); margin-top: 2px; }
.info-value.accent { color: var(--accent-600); font-weight: 700; }

/* ======== SECTION TABS (Detail page) ======== */
.section-tabs {
  display: flex; overflow-x: auto; gap: 0;
  border-bottom: none;
  margin-bottom: var(--sp-3);
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab {
  padding: var(--sp-2) var(--sp-3); font-size: 0.8rem; font-weight: 500;
  color: var(--gray-400); white-space: nowrap; cursor: pointer;
  border: none; background: none; position: relative;
  transition: all 0.15s; border-radius: 8px;
}
.section-tab .material-icons-round { transition: color 0.15s; }
.section-tab.active {
  color: var(--primary-700); font-weight: 600;
  background: var(--primary-50);
  border-radius: var(--radius-sm);
}
.section-tab.active .material-icons-round { color: var(--primary-600); }
.section-tab.active::after { display: none; }

/* ======== TABLE (Simple) ======== */
.simple-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
.simple-table th {
  text-align: left; padding: var(--sp-2) var(--sp-3);
  font-weight: 600; color: var(--gray-500); font-size: 0.72rem;
  border-bottom: 1px solid var(--gray-200);
  text-transform: uppercase; letter-spacing: 0.3px;
  background: var(--gray-50);
}
.simple-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--gray-100);
}
.simple-table tr:last-child td { border-bottom: none; }

/* ======== EMPTY STATE ======== */
.empty-state {
  text-align: center; padding: var(--sp-8) var(--sp-4);
  color: var(--gray-400);
}
.empty-state .material-icons-round { font-size: 48px; margin-bottom: var(--sp-3); }
.empty-state p { font-size: 0.9rem; margin-bottom: var(--sp-4); }

/* Desktop sidebar — hidden by default on mobile */
.desktop-sidebar { display: none; }

/* ========== Materials Page ========== */
.mat-kpi-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.mat-kpi { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--white); border-radius: var(--radius-md); border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm); }
.mat-kpi-warn { border-color: var(--danger-200); background: #fffbfb; }
.mat-kpi-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mat-kpi-icon .material-icons-round { font-size: 20px; }
.mat-kpi-value { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.mat-kpi-label { font-size: 0.7rem; color: var(--gray-400); font-weight: 500; }
.mat-toolbar { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.mat-search { flex: 1; position: relative; }
.mat-search .material-icons-round { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--gray-400); }
.mat-search .form-input { padding-left: 36px; font-size: 0.85rem; }
.mat-toolbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mat-btn-label { display: none; }
.mat-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.mat-chip { padding: 5px 12px; border-radius: var(--radius-full); border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-500); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 4px; }
.mat-chip:hover { border-color: var(--gray-300); background: var(--gray-50); }
.mat-chip.active { border-color: var(--chip-color, var(--primary-500)); background: var(--primary-50); color: var(--chip-color, var(--primary-700)); }
.mat-chip-count { font-size: 0.65rem; background: var(--gray-100); color: var(--gray-500); border-radius: 10px; padding: 0 6px; min-width: 18px; text-align: center; }
.mat-chip.active .mat-chip-count { background: var(--primary-100); color: var(--chip-color, var(--primary-600)); }
.mat-chip-settings { border-style: dashed; padding: 5px 8px; }
.mat-results-bar { font-size: 0.75rem; color: var(--gray-400); margin-bottom: 10px; font-weight: 500; }
/* Mobile: list view */
.mat-grid { display: flex; flex-direction: column; gap: 1px; background: var(--gray-100); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.mat-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--white); cursor: pointer; transition: background 0.15s; }
.mat-card:hover { background: var(--gray-50); }
.mat-card-img { width: 52px; height: 52px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; background: var(--gray-100); display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; }
.mat-card-img img { width: 100%; height: 100%; object-fit: cover; }
.mat-card-img > .material-icons-round { font-size: 22px; color: var(--gray-300); }
.mat-card-badge-low { position: absolute; top: 2px; left: 2px; font-size: 0.55rem; font-weight: 700; background: var(--danger-500); color: white; padding: 1px 4px; border-radius: 4px; line-height: 1.3; }
.mat-card-body { flex: 1; min-width: 0; }
.mat-card-cat { font-size: 0.65rem; font-weight: 600; color: var(--cat-color, var(--gray-500)); margin-bottom: 1px; }
.mat-card-name { font-weight: 600; font-size: 0.85rem; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-card-prices { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.mat-price-sell { font-weight: 700; font-size: 0.82rem; color: var(--primary-700); }
.mat-price-unit { font-weight: 400; font-size: 0.7rem; color: var(--gray-400); }
.mat-card-desc { font-size: 0.68rem; color: var(--gray-500); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-card-dims { font-size: 0.65rem; color: var(--primary-500); margin-top: 2px; font-weight: 500; }
.mat-price-cost { font-size: 0.68rem; color: var(--gray-400); }
.mat-card-stock { margin-top: 4px; }
.mat-stock-info { display: flex; justify-content: space-between; align-items: center; font-size: 0.68rem; color: var(--gray-400); margin-bottom: 2px; }
.mat-stock-num { font-weight: 600; }
.mat-stock-bar { height: 4px; background: var(--gray-100); border-radius: 2px; overflow: hidden; }
.mat-stock-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.mat-card-actions { display: flex; gap: 2px; flex-shrink: 0; }
.mat-action-btn { width: 30px; height: 30px; border-radius: var(--radius-sm); border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; color: var(--gray-400); }
.mat-action-btn:hover { background: var(--gray-100); color: var(--primary-500); }
.mat-action-btn.mat-action-danger:hover { background: var(--danger-100); color: var(--danger-500); }
.mat-action-btn .material-icons-round { font-size: 16px; }
.mat-empty { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.mat-empty p { margin-top: 8px; font-size: 0.85rem; }

/* ======== RESPONSIVE - TABLET ======== */
@media (min-width: 768px) {
  .page-content { max-width: 700px; margin-left: auto; margin-right: auto; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-container { max-width: 500px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-xl); bottom: 50%; transform: translate(-50%, 50%); }
  .modal-container.fullscreen { max-width: 600px; }

  /* Materials - tablet 2-col grid */
  .mat-kpi-row { grid-template-columns: repeat(4, 1fr); }
  .mat-btn-label { display: inline; }
  .mat-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
    background: transparent; border-radius: 0; box-shadow: none;
  }
  .mat-card {
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0; border-radius: var(--radius-md); border: 1px solid var(--gray-100);
    box-shadow: var(--shadow-sm); overflow: hidden;
  }
  .mat-card-img { width: 100%; height: 0; padding-bottom: 60%; border-radius: 0; position: relative; }
  .mat-card-img img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
  .mat-card-img > .material-icons-round { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 32px; }
  .mat-card-badge-low { top: 6px; left: 6px; font-size: 0.6rem; padding: 2px 6px; }
  .mat-card-body { padding: 12px; }
  .mat-card-name { white-space: normal; }
  .mat-card-prices { flex-direction: column; gap: 0; }
  .mat-card-stock { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--gray-100); }
  .mat-card-actions { justify-content: flex-end; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--gray-100); }
}

/* ======== RESPONSIVE - DESKTOP (Sidebar layout) ======== */
@media (min-width: 1024px) {
  html { font-size: 15px; }
  /* Sidebar — Light Clean Pro */
  .desktop-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 51;
    background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.1) transparent;
  }
  .desktop-sidebar::-webkit-scrollbar { width: 4px; }
  .desktop-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
  .desktop-sidebar .sidebar-logo {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 18px; border-bottom: 1px solid var(--sidebar-border);
    cursor: pointer;
  }
  .desktop-sidebar .sidebar-logo-icon {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    position: relative; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(29,78,216,0.25);
  }
  .desktop-sidebar .sidebar-logo-icon svg { display: block; border-radius: 10px; }
  .desktop-sidebar .sidebar-logo-icon img { width: 100%; height: 100%; object-fit: cover; }
  .desktop-sidebar .sidebar-logo-text h3 { font-size: 0.9rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; letter-spacing: -0.2px; }
  .desktop-sidebar .sidebar-logo-text p { font-size: 0.68rem; color: var(--sidebar-text); }
  .desktop-sidebar .sidebar-nav { flex: 1; padding: 12px 0; }
  .desktop-sidebar .sidebar-section { padding: 16px 20px 6px; font-size: 0.6rem; font-weight: 600; color: var(--sidebar-section); text-transform: uppercase; letter-spacing: 1.5px; }
  .desktop-sidebar .sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px; margin: 1px 10px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-size: 0.82rem; font-weight: 400;
    cursor: pointer; transition: background 0.2s ease, color 0.2s ease; border: none; background: none; width: calc(100% - 20px);
    text-align: left; position: relative;
  }
  .desktop-sidebar .sidebar-item:hover { background: var(--sidebar-bg-hover); color: var(--primary-600); }
  .desktop-sidebar .sidebar-item.active {
    background: var(--sidebar-bg-active); color: var(--sidebar-text-active); font-weight: 500;
  }
  .desktop-sidebar .sidebar-item.active::before {
    content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--primary-500); border-radius: 0 3px 3px 0;
  }
  .desktop-sidebar .sidebar-item .material-icons-round { font-size: 19px; opacity: 0.7; transition: opacity 0.2s ease, color 0.2s ease; }
  .desktop-sidebar .sidebar-item.active .material-icons-round { color: var(--primary-500); opacity: 1; }
  .desktop-sidebar .sidebar-item:hover .material-icons-round { color: var(--primary-600); opacity: 1; }
  .desktop-sidebar .sidebar-item .sidebar-badge {
    margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--accent-500); color: white; font-size: 0.55rem; font-weight: 700;
    border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center;
  }
  .desktop-sidebar .sidebar-user {
    padding: 14px 20px; border-top: 1px solid var(--sidebar-border);
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    transition: background 0.15s;
  }
  .desktop-sidebar .sidebar-user:hover { background: var(--sidebar-bg-hover); }
  .desktop-sidebar .sidebar-user-avatar {
    width: 34px; height: 34px; border-radius: var(--radius-full);
    background: var(--primary-100);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
  }
  .desktop-sidebar .sidebar-user-avatar .material-icons-round { font-size: 18px; color: var(--primary-500); }
  .desktop-sidebar .sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .desktop-sidebar .sidebar-user-info { flex: 1; }
  .desktop-sidebar .sidebar-user-info h4 { font-size: 0.78rem; font-weight: 500; color: var(--gray-800); line-height: 1.2; }
  .desktop-sidebar .sidebar-user-info span { font-size: 0.65rem; color: var(--sidebar-text); }

  /* Hide bottom nav, show sidebar */
  .bottom-nav { display: none !important; }

  /* Top bar shifts right — desktop pro style */
  .top-bar { left: 260px; border-bottom: 1px solid var(--gray-100); background: var(--gray-50); }
  .top-bar .logo-small { display: none; }

  /* Page content with sidebar offset */
  .page-content {
    margin-left: 260px; margin-bottom: 0;
    max-width: none; padding: 24px 32px;
    min-height: calc(100vh - var(--top-bar-height));
    background: var(--gray-50);
  }

  /* Dashboard — desktop layout */
  .home-dashboard {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    max-width: 1100px;
  }
  .home-dashboard > .home-kpi-row { grid-column: span 1; }
  .home-dashboard > .card { grid-column: span 1; margin-bottom: 0; }
  .home-dashboard > .card[style*="border-left:3px solid var(--danger-500)"],
  .home-dashboard > .card[style*="border-left:3px solid #ef4444"] { grid-column: span 1; }

  /* Dashboard grid helpers */
  .dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .dashboard-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .dashboard-full { grid-column: 1 / -1; }

  /* Cards on desktop */
  .card { transition: border-color 0.2s; }
  .card:hover { border-color: var(--gray-200); }
  .card:active { }

  /* Modal centered on desktop */
  .modal-container {
    max-width: 620px; left: calc(50% + 130px); bottom: 50%;
    transform: translate(-50%, 50%); border-radius: var(--radius-xl);
    max-height: 88vh;
  }
  .modal-container.fullscreen { max-width: 1100px; max-height: 92vh; }

  /* 2-column form layout on desktop */
  .pj-form-grid { flex-direction: row; gap: 0; align-items: flex-start; }
  .pj-form-col { flex: 1; min-width: 0; }
  .pj-form-col:first-child { border-right: 1px solid var(--gray-100); }
  .pj-form-col .form-section { margin: 0; border-bottom: none; padding: 16px 20px; }
  .pj-form-col .form-section + .form-section { border-top: 1px solid var(--gray-100); }

  /* Lists & tables wider */
  .list-item { padding: 12px 16px; }
  .menu-item { padding: 14px 16px; }

  /* Notification panel */
  .notif-panel { right: 16px; top: 64px; }

  /* Wider chart bars on desktop */
  .home-dashboard .card .chart-container { height: 100px; }

  /* Report page grid */
  .report-stats-grid { grid-template-columns: repeat(4, 1fr) !important; }

  /* Materials page - desktop card grid (4 columns) */
  .mat-kpi-row { grid-template-columns: repeat(4, 1fr); }
  .mat-btn-label { display: inline; }
  .mat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
    background: transparent; border-radius: 0; box-shadow: none;
  }
  .mat-card {
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0; border-radius: var(--radius-md); border: 1px solid var(--gray-100);
    overflow: hidden; transition: box-shadow 0.2s, border-color 0.2s;
  }
  .mat-card:hover { border-color: var(--primary-200); box-shadow: var(--shadow-md); }
  .mat-card-img {
    width: 100%; height: 0; padding-bottom: 60%; border-radius: 0; position: relative;
  }
  .mat-card-img img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
  .mat-card-img > .material-icons-round { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 32px; }
  .mat-card-badge-low {
    top: 6px; left: 6px; font-size: 0.6rem; padding: 2px 7px; border-radius: 5px;
  }
  .mat-card-body { padding: 10px 12px 12px; }
  .mat-card-name { font-size: 0.82rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .mat-card-prices { flex-direction: column; gap: 0; }
  .mat-price-sell { font-size: 0.82rem; }
  .mat-card-stock { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--gray-100); }
  .mat-card-actions {
    justify-content: flex-end; gap: 4px; margin-top: 4px;
    padding-top: 6px; border-top: 1px solid var(--gray-100);
  }
}

/* ======== RESPONSIVE - WIDE DESKTOP ======== */
@media (min-width: 1400px) {
  html { font-size: 16px; }
  .page-content { padding: 28px 48px; }
  .home-dashboard { grid-template-columns: 1fr 1fr 1fr; max-width: 1400px; }
  .home-dashboard > .home-kpi-row:first-child { grid-column: span 2; }

  /* Materials 5-column on wide */
  .mat-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; }
}

/* ======== UTILITY ======== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-600); }
.text-accent { color: var(--accent-500); }
.text-success { color: var(--success-500); }
.text-danger { color: var(--danger-500); }
.text-muted { color: var(--gray-400); }
.text-bold { font-weight: 600; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.hidden { display: none !important; }

/* ======== LIGHTBOX ======== */
.lightbox-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.95); z-index: 10000; display: none;
  align-items: center; justify-content: center; flex-direction: column;
}
.lightbox-img {
  max-width: 92vw; max-height: 80vh; object-fit: contain;
  border-radius: 4px; user-select: none;
}
.lightbox-close {
  position: absolute; top: 12px; right: 12px; background: none;
  border: none; color: white; cursor: pointer; z-index: 10001; padding: 8px;
}
.lightbox-close .material-icons-round { font-size: 28px; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.15); border: none; color: white;
  cursor: pointer; padding: 12px 6px; border-radius: 8px;
  display: flex; align-items: center;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav .material-icons-round { font-size: 32px; }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-counter {
  position: absolute; bottom: 20px; color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

/* ======== UPLOAD PROGRESS ======== */
.upload-progress {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--gray-800); color: white; padding: 10px 20px;
  border-radius: 20px; font-size: 0.8rem; z-index: 9000;
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-lg);
}
.upload-progress .material-icons-round { font-size: 16px; animation: spin 1s linear infinite; }

/* ======== AVATAR ======== */
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-lg { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-placeholder {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-100); color: var(--primary-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
/* ======== PROJECT CARD WITH COVER ======== */
.project-card .project-card-body {
  display: flex; gap: 10px; align-items: center;
}
.project-cover {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--gray-200);
}
.project-card-info { flex: 1; min-width: 0; }
/* Deadline urgency highlights */
.deadline-soon { border-left: 3px solid #f59e0b !important; }
.deadline-urgent { border-left: 3px solid #ef4444 !important; }

/* ======== ATTENDANCE & SALARY ======== */
.att-session-btn { border: 2px solid var(--gray-200); border-radius: 10px; padding: 10px; cursor: pointer; text-align: center; transition: all 0.15s; }
.att-session-btn.selected, .att-session-btn:has(input:checked) { border-color: var(--primary-500); background: var(--primary-50); }
.salary-table th, .salary-table td { padding: 10px 8px; white-space: nowrap; }
.salary-table tfoot td { font-weight: 700; background: var(--gray-50); border-top: 2px solid var(--gray-200); }

/* ======== CAMERA OVERLAY ======== */
#camera-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000;
  z-index: 10000; display: flex; align-items: center; justify-content: center;
}
.camera-container { position: relative; width: 100%; height: 100%; }
#camera-video { width: 100%; height: 100%; object-fit: cover; }
.camera-controls {
  position: absolute; bottom: 30px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 24px; align-items: center;
}
.camera-btn {
  width: 50px; height: 50px; border-radius: 50%; border: 2px solid white;
  background: rgba(255,255,255,0.2); color: white; display: flex;
  align-items: center; justify-content: center; cursor: pointer;
}
.camera-btn.camera-capture { width: 68px; height: 68px; background: white; color: #333; border: 3px solid white; }
.camera-btn .material-icons-round { font-size: 28px; }

/* ======== BEFORE/AFTER COMPARISON ======== */
.compare-slider { position: relative; width: 100%; overflow: hidden; border-radius: 8px; cursor: col-resize; user-select: none; }
.compare-slider img { width: 100%; display: block; }
.compare-before { position: absolute; top: 0; left: 0; width: 50%; height: 100%; overflow: hidden; }
.compare-before img { position: absolute; top: 0; left: 0; width: 200%; max-width: none; }
.compare-handle {
  position: absolute; top: 0; width: 3px; height: 100%; background: white;
  box-shadow: 0 0 6px rgba(0,0,0,0.5); z-index: 2; left: 50%;
}
.compare-handle::after {
  content: '⟨⟩'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 32px; height: 32px; background: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #333; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.compare-labels { display: flex; justify-content: space-between; margin-top: 4px; }
.compare-labels span { font-size: 11px; color: var(--gray-500); font-weight: 600; }

/* ======== TIMELINE ======== */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--primary-500); border: 2px solid white; box-shadow: 0 0 0 2px var(--primary-200);
}
.timeline-date { font-size: 11px; color: var(--gray-500); font-weight: 600; margin-bottom: 6px; }
.timeline-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.timeline-photos img { width: 100%; height: 70px; object-fit: cover; border-radius: 6px; cursor: pointer; }

.w-full { width: 100%; }
.flex-1 { flex: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); }

/* ========== Progress bar ========== */
.progress-mini { display: flex; align-items: center; gap: 6px; }
.progress-mini-track { flex: 1; height: 4px; background: var(--gray-200); border-radius: 2px; overflow: hidden; }
.progress-mini-track > div { height: 100%; background: var(--success-500); border-radius: 2px; transition: width 0.3s; }
.progress-mini-text { font-size: 11px; color: var(--gray-500); white-space: nowrap; }
.progress-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--success-500); border-radius: 4px; transition: width 0.3s; }
.progress-section { padding: 0 var(--sp-2); }

/* ========== CEO Notes ========== */
.ceo-notes-section { background: var(--gray-50); border: 1px dashed var(--gray-300); border-radius: var(--radius-md); padding: var(--sp-3); }
.ceo-note-card { background: var(--white); border-left: 3px solid var(--primary-500); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); margin-bottom: var(--sp-2); }
.ceo-note-label { font-size: 11px; color: var(--gray-500); font-weight: 600; margin-bottom: 2px; }

/* ======== GANTT / TIMELINE ======== */
.gantt-container { margin: 0 -16px; }
.gantt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gantt-chart { position: relative; }
.gantt-header { position: sticky; top: 0; z-index: 2; background: var(--white); border-bottom: 1px solid var(--gray-200); }
.gantt-months { display: flex; position: relative; height: 24px; }
.gantt-month { position: absolute; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--gray-600); border-right: 1px solid var(--gray-200); }
.gantt-days { display: flex; position: relative; height: 24px; }
.gantt-day { position: absolute; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--gray-400); border-right: 1px solid var(--gray-100); }
.gantt-day.today { background: var(--primary-50); color: var(--primary-500); font-weight: 700; }
.gantt-day.weekend { background: var(--gray-50); }
.gantt-body { padding: 4px 0; }
.gantt-row { height: 32px; position: relative; border-bottom: 1px solid var(--gray-50); }
.gantt-bar { position: absolute; top: 4px; height: 24px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; padding: 0 8px; overflow: hidden; transition: opacity 0.2s; min-width: 28px; }
.gantt-bar:hover { opacity: 0.85; }
.gantt-bar-label { font-size: 10px; color: white; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-status-new { background: var(--primary-400); }
.gantt-status-in_progress { background: #3b82f6; }
.gantt-status-overdue { background: var(--danger-500); }
.gantt-status-completed { background: var(--success-500); }
.gantt-status-cancelled { background: var(--gray-400); }
.gantt-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger-500); z-index: 1; opacity: 0.5; }

/* ========== Photo Tags ========== */
.photo-tag-badge { position: absolute; bottom: 4px; left: 4px; font-size: 10px; padding: 1px 6px; border-radius: 3px; color: white; font-weight: 600; }
.photo-tag-before { background: var(--gray-500); }
.photo-tag-during { background: var(--primary-500); }
.photo-tag-after { background: var(--success-500); }
.photo-tag-select { position: absolute; bottom: 4px; right: 4px; font-size: 10px; padding: 1px 4px; border-radius: 3px; background: rgba(255,255,255,0.9); border: 1px solid var(--gray-200); }

/* ========== Log Entry ========== */
.log-entry { padding: var(--sp-3) 0; border-bottom: 1px solid var(--gray-100); }
.log-entry:last-child { border-bottom: none; }

/* ========== Task Type Chips ========== */
.task-type-chip { display:inline-block; font-size:0.65rem; padding:2px 8px; border-radius:10px; font-weight:500; }
.task-type-installation { background:#E3F2FD; color:#1565C0; }
.task-type-maintenance { background:#FFF3E0; color:#E65100; }
.task-type-repair { background:#FFEBEE; color:#C62828; }
.task-type-inspection { background:#E8F5E9; color:#2E7D32; }
.task-type-wiring { background:#F3E5F5; color:#7B1FA2; }
.task-type-configuration { background:#E0F7FA; color:#00695C; }

/* ========== Notification Panel ========== */
.notif-panel { position: fixed; top: 56px; right: 8px; width: min(340px, calc(100vw - 16px)); max-height: 72vh; background: var(--white); border-radius: var(--radius-xl); box-shadow: 0 8px 32px rgba(0,0,0,0.18); z-index: 1000; display: flex; flex-direction: column; overflow: hidden; }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--gray-100); }
.notif-header-actions { display: flex; align-items: center; gap: 4px; }
.notif-mark-all { font-size: 0.72rem; color: var(--primary-500); background: none; border: none; cursor: pointer; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.notif-mark-all:hover { background: var(--primary-50, #EEF2FF); }
.notif-filter-bar { display: flex; gap: 5px; padding: 8px 12px; border-bottom: 1px solid var(--gray-100); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.notif-filter-bar::-webkit-scrollbar { display: none; }
.notif-filter-bar .chip { font-size: 0.7rem; padding: 3px 10px; white-space: nowrap; flex-shrink: 0; border-radius: 20px; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--gray-50); transition: background 0.15s; }
.notif-item:hover { background: var(--gray-50); }
.notif-item:active { background: var(--gray-100); }
.notif-item-icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item-icon .material-icons-round { font-size: 16px; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary-500); flex-shrink: 0; margin-top: 5px; }
.notif-unread { background: var(--primary-50, #EEF2FF); }
.notif-unread:hover { background: #e4eaff; }
/* Toggle switch for preferences */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: var(--radius-full); transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--white); border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary-500); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Warranty timeline */
.warranty-timeline { position: relative; padding-left: 20px; }
.warranty-timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-dot { position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--gray-300); background: var(--white); }
.timeline-item.resolved .timeline-dot { border-color: var(--success-500); background: var(--success-500); }
.timeline-item.open .timeline-dot { border-color: var(--warning-500); background: var(--warning-100); }
.timeline-content { background: var(--gray-50); border-radius: var(--radius-md); padding: 10px 12px; border: 1px solid var(--gray-200); }
.text-danger { color: var(--danger-500, #EF4444) !important; }
.text-warning { color: var(--warning-500, #F59E0B) !important; }
