@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f5f7fb;
  --sidebar: #111827;
  --sidebar-hover: #1f2937;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #ff9900;
  --primary-dark: #e88900;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --shadow: 0 4px 18px rgba(15,23,42,.06);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, select, textarea {
  font-family: inherit;
}

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

/* SIDEBAR */
.sidebar {
  width: 255px;
  background: var(--sidebar);
  color: white;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  padding: 22px 15px;
  z-index: 100;
  transition: transform .3s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 28px;
  font-size: 20px;
  font-weight: 800;
  color: white;
  text-decoration: none;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #111827;
}

.logo span {
  color: #9ca3af;
  font-weight: 500;
}

.section-title {
  font-size: 10px;
  color: #6b7280;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 20px 12px 8px;
  text-transform: uppercase;
}

.nav-item {
  height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 3px;
  text-decoration: none;
  transition: .2s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background: #292f3b;
  color: white;
}

.nav-item.active i, .nav-item.active svg {
  color: var(--primary);
}

.nav-item i, .nav-item svg {
  width: 18px;
}

.nav-badge {
  margin-left: auto;
  background: #374151;
  color: white;
  padding: 3px 7px;
  border-radius: 10px;
  font-size: 10px;
}

.sidebar-bottom {
  position: absolute;
  bottom: 20px;
  left: 15px;
  right: 15px;
}

.store-card {
  background: #1f2937;
  border: 1px solid #374151;
  padding: 13px;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.store-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f59e0b;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #111827;
}

.store-info {
  min-width: 0;
}

.store-info strong {
  display: block;
  font-size: 12px;
  color: white;
}

.store-info small {
  color: #9ca3af;
  font-size: 10px;
}

/* MAIN */
.main {
  margin-left: 255px;
  width: calc(100% - 255px);
}

/* TOPBAR */
.topbar {
  height: 70px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.search {
  width: 390px;
  height: 39px;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 9px;
}

.search:focus-within {
  background: white;
  border-color: #d1d5db;
}

.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 17px;
}

.icon-button {
  width: 35px;
  height: 35px;
  border: 0;
  background: white;
  display: grid;
  place-items: center;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  color: var(--text);
}

.icon-button:hover {
  background: #f3f4f6;
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  border: 1px solid white;
}

.user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 15px;
  border-left: 1px solid var(--border);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #111827;
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.user-text strong {
  font-size: 12px;
  display: block;
}

.user-text span {
  font-size: 10px;
  color: var(--muted);
}

/* CONTENT */
.content {
  padding: 30px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.5px;
}

.page-title p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.header-actions {
  display: flex;
  gap: 9px;
}

.btn {
  border: 1px solid var(--border);
  background: white;
  height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #f9fafb;
}

.btn-primary {
  background: #111827;
  color: white;
  border-color: #111827;
}

.btn-primary:hover {
  background: #1f2937;
  color: white;
}

.btn-success {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

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

.btn-warning {
  background: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.btn-delete {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.btn-delete:hover {
  background: #dc2626;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 10px;
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.kpi {
  padding: 19px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.kpi-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.orange { background: #fff3df; color: #e88900; }
.green { background: #e9faf4; color: #059669; }
.blue { background: #eaf2ff; color: #2563eb; }
.purple { background: #f1edff; color: #7c3aed; }

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.5px;
}

.kpi-bottom {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 7px;
  font-size: 10px;
}

.up { color: #059669; font-weight: 700; }
.down { color: #ef4444; font-weight: 700; }
.muted { color: var(--muted); }

/* CHART AREA */
.grid-main {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.chart-card {
  padding: 20px;
  min-height: 350px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
}

.card-subtitle {
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.select {
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 10px;
  outline: 0;
}

.chart-container {
  height: 260px;
}

/* SALES CHANNEL */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.channel {
  display: grid;
  grid-template-columns: 35px 1fr auto;
  align-items: center;
  gap: 10px;
}

.channel-icon {
  width: 35px;
  height: 35px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: var(--text);
}

.channel-info strong {
  display: block;
  font-size: 11px;
}

.channel-info span {
  color: var(--muted);
  font-size: 9px;
}

.channel-price {
  font-size: 11px;
  font-weight: 700;
}

.progress {
  height: 5px;
  background: #f0f0f0;
  border-radius: 5px;
  margin-top: 7px;
  overflow: hidden;
}

.progress div {
  height: 100%;
  border-radius: 5px;
  background: #111827;
}

/* Compact Orders Table Styling */
#ordersTable th {
  padding: 9px 12px !important;
  font-size: 8.5px !important;
  letter-spacing: 0.5px !important;
}

#ordersTable td {
  padding: 9px 12px !important;
  font-size: 10.5px !important;
  line-height: 1.3 !important;
}

#ordersTable .btn-sm {
  height: 28px !important;
  padding: 0 8px !important;
  font-size: 9.5px !important;
}

#ordersTable .status, #ordersTable .status-badge {
  padding: 3px 7px !important;
  font-size: 8.5px !important;
}

/* TABLES */
.table-card {
  overflow: hidden;
  margin-bottom: 20px;
}

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

.table-title {
  font-size: 13px;
  font-weight: 700;
}

.view-all {
  font-size: 10px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table, .data-table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 9px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 20px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 20px;
  font-size: 11px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

.product {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-name {
  font-weight: 600;
}

.product-sku {
  font-size: 9px;
  color: #9ca3af;
  margin-top: 2px;
}

.code-tag, .order-id-tag {
  font-family: monospace;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.size-pill {
  background: #eef2ff;
  color: #4f46e5;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.status, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.status::before, .status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.status.success, .status-badge.in-stock, .status-badge.success {
  background: #ecfdf5;
  color: #059669;
}

.status.success::before, .status-badge.in-stock::before, .status-badge.success::before {
  background: #10b981;
}

.status.pending, .status-badge.low-stock, .status-badge.pending {
  background: #fff7ed;
  color: #ea580c;
}

.status.pending::before, .status-badge.low-stock::before, .status-badge.pending::before {
  background: #f97316;
}

.status.shipped {
  background: #eff6ff;
  color: #2563eb;
}

.status.shipped::before {
  background: #3b82f6;
}

.status.danger, .status-badge.out-stock, .status-badge.danger {
  background: #fef2f2;
  color: #ef4444;
}

.status.danger::before, .status-badge.out-stock::before, .status-badge.danger::before {
  background: #ef4444;
}

.action-btn-group {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

/* BOTTOM GRID */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.stock-list {
  padding: 5px 20px 15px;
}

.stock-row {
  padding: 13px 0;
  border-bottom: 1px solid #f0f0f0;
}

.stock-row:last-child {
  border-bottom: 0;
}

.stock-top {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
}

.stock-bar {
  margin-top: 7px;
  height: 5px;
  background: #f0f0f0;
  border-radius: 5px;
}

.stock-bar span {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: #111827;
}

.low {
  color: #ef4444;
}

/* ACTIVITY */
.activity {
  padding: 5px 20px 15px;
}

.activity-item {
  display: flex;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  color: var(--text);
}

.activity-text {
  font-size: 10px;
  line-height: 1.5;
}

.activity-text strong {
  font-weight: 700;
}

.activity-time {
  color: #9ca3af;
  font-size: 9px;
  margin-top: 3px;
}

/* FORMS & INPUTS */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
}

.form-group input, .form-group select, .form-group textarea {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: #111827;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

/* TOAST CONTAINERS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #111827;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

/* MOBILE */
.mobile-menu {
  display: none;
}

@media(max-width:1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2,1fr);
  }

  .grid-main {
    grid-template-columns: 1fr;
  }
}

@media(max-width:800px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    width: 100%;
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    padding: 0 15px;
  }

  .search {
    width: 200px;
  }

  .content {
    padding: 18px;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: span 1;
  }
}

@media(max-width:600px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .search {
    display: none;
  }

  .user-text {
    display: none;
  }

  .page-header {
    flex-direction: column;
    gap: 15px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .table-card {
    overflow-x: auto;
  }

  table, .data-table {
    min-width: 700px;
  }
}
