:root {
  --primary: #1a2332;
  --primary-light: #253447;
  --accent: #c8a96e;
  --accent-dark: #b8944f;
  --bg: #f4f5f7;
  --white: #ffffff;
  --text: #1a2332;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --sidebar-w: 240px;
}

*,*::before,*::after { box-sizing: border-box; margin:0; padding:0; }
html { font-size: 15px; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* LAYOUT */
.layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .5px;
}
.sidebar-logo img { height: 32px; width: auto; filter: brightness(0) invert(1); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.7);
  transition: background .2s, color .2s;
  font-size: .9rem;
  font-weight: 500;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(200,169,110,.15); color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; height: 100%; width: 3px; background: var(--accent); border-radius: 0 3px 3px 0; }
.badge { background: var(--accent); color: #fff; border-radius: 20px; font-size: .7rem; font-weight: 700; padding: 1px 6px; margin-left: auto; min-width: 20px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.user-company { font-size: .85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-email { font-size: .72rem; color: rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.btn-logout { display: block; text-align: center; padding: 7px; border-radius: var(--radius); background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); font-size: .82rem; transition: background .2s; }
.btn-logout:hover { background: rgba(239,68,68,.3); color: #fff; }

/* MAIN CONTENT */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; padding: 32px; }
.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-light); margin-top: 4px; font-size: .9rem; }

/* CARDS */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--text); }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.stat-icon.blue { background: #eff6ff; color: var(--info); }
.stat-icon.green { background: #f0fdf4; color: var(--success); }
.stat-icon.yellow { background: #fffbeb; color: var(--warning); }
.stat-icon.accent { background: #fdf6ed; color: var(--accent-dark); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-light); margin-top: 4px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: .88rem; font-weight: 600; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

/* FORMS (auth pages) */
.auth-page { min-height: 100vh; background: var(--primary); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { background: var(--white); border-radius: 16px; padding: 40px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo img { height: 50px; }
.auth-logo h1 { font-size: 1.4rem; font-weight: 700; margin-top: 12px; color: var(--primary); }
.auth-logo p { color: var(--text-light); font-size: .88rem; margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .92rem; color: var(--text); background: #fff; transition: border-color .2s, box-shadow .2s; }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,169,110,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-btn { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .2s; margin-top: 8px; }
.auth-btn:hover { background: var(--primary-light); }
.auth-links { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--text-light); }
.auth-links a { color: var(--accent-dark); font-weight: 500; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .88rem; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; padding: 10px 14px; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); border-bottom: 2px solid var(--border); background: #f9fafb; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f9fafb; }

/* STATUS BADGES */
.status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .76rem; font-weight: 600; }
.status-pending   { background: #fffbeb; color: #92400e; }
.status-confirmed { background: #eff6ff; color: #1e40af; }
.status-shipped   { background: #f0fdf4; color: #166534; }
.status-delivered { background: #f0fdf4; color: #065f46; }
.status-cancelled { background: #fef2f2; color: #991b1b; }

/* PRODUCT GRID */
.brands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.brand-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.brand-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.brand-card-img { height: 160px; overflow: hidden; background: #f9f9f9; display: flex; align-items: center; justify-content: center; }
.brand-card-img img { width: 100%; height: 100%; object-fit: cover; }
.brand-card-img .no-img { font-size: 2.5rem; color: var(--text-light); }
.brand-card-body { padding: 14px; }
.brand-card-name { font-weight: 700; font-size: 1rem; }
.brand-card-cat { font-size: .78rem; color: var(--text-light); margin-top: 3px; }
.brand-card-count { font-size: .78rem; color: var(--accent-dark); margin-top: 6px; font-weight: 500; }

/* PRODUCT ITEMS */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.product-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.product-card-img { height: 140px; background: #f9f9f9; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 12px; }
.product-name { font-weight: 600; font-size: .9rem; }
.product-sku { font-size: .75rem; color: var(--text-light); margin-top: 2px; }
.product-price { font-size: 1.05rem; font-weight: 700; color: var(--accent-dark); margin: 6px 0; }
.product-add { display: flex; gap: 6px; margin-top: 10px; }
.qty-input { width: 56px; padding: 6px 8px; border: 1.5px solid var(--border); border-radius: 6px; text-align: center; }

/* CART */
.cart-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cart-item-img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; background: #f3f4f6; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: .9rem; }
.cart-item-brand { font-size: .78rem; color: var(--text-light); }
.cart-item-price { font-weight: 700; color: var(--accent-dark); }
.cart-total { font-size: 1.2rem; font-weight: 700; text-align: right; padding-top: 16px; }

/* CHAT */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 220px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 70%; padding: 10px 14px; border-radius: 12px; font-size: .88rem; line-height: 1.5; }
.chat-msg.user { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.chat-msg.admin { background: var(--white); box-shadow: var(--shadow); align-self: flex-start; border-bottom-left-radius: 3px; }
.chat-msg-time { font-size: .7rem; opacity: .6; margin-top: 4px; }
.chat-input-row { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; resize: none; }
.chat-input:focus { outline: none; border-color: var(--accent); }

/* BREADCRUMB */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-light); margin-bottom: 20px; }
.breadcrumb a { color: var(--accent-dark); }
.breadcrumb span { color: var(--text-light); }

/* PENDING PAGE */
.pending-page { min-height: 100vh; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.pending-box { background: var(--white); border-radius: 16px; padding: 48px 40px; max-width: 480px; text-align: center; }
.pending-icon { font-size: 3rem; margin-bottom: 16px; }
.pending-box h2 { font-size: 1.5rem; margin-bottom: 12px; }
.pending-box p { color: var(--text-light); line-height: 1.6; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ADMIN SPECIFIC */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #111827; color: #fff; position: fixed; top:0; left:0; height:100vh; overflow-y:auto; display:flex; flex-direction:column; }
.admin-sidebar .sidebar-logo { padding:20px 16px; font-size:.95rem; border-bottom:1px solid rgba(255,255,255,.08); }
.admin-sidebar .nav-item { font-size:.85rem; padding:10px 16px; }
.admin-main { margin-left:220px; flex:1; padding:28px; background:var(--bg); }
.admin-topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }

/* ORDER STATUS TIMELINE */
.order-timeline { display:flex; gap:0; margin:24px 0; }
.timeline-step { flex:1; text-align:center; position:relative; }
.timeline-step::before { content:''; position:absolute; top:16px; left:50%; width:100%; height:2px; background:var(--border); z-index:0; }
.timeline-step:last-child::before { display:none; }
.timeline-dot { width:32px; height:32px; border-radius:50%; background:var(--border); color:var(--text-light); display:inline-flex; align-items:center; justify-content:center; font-size:.8rem; font-weight:700; position:relative; z-index:1; }
.timeline-dot.done { background:var(--success); color:#fff; }
.timeline-dot.active { background:var(--accent); color:#fff; }
.timeline-label { font-size:.72rem; margin-top:6px; color:var(--text-light); }
