/* =============================================================================
   AI Expiry Guard — Design System
   Inspired by Stripe, Linear, Notion, ClickUp
   ============================================================================= */

/* ─── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #FAFAFC;
  --card:         #FFFFFF;
  --primary:      #FF4F8B;
  --primary-dark: #E6416F;
  --secondary:    #FF7DAA;
  --soft-pink:    #FFF2F7;
  --text:         #1F2937;
  --text-muted:   #6B7280;
  --text-light:   #9CA3AF;
  --border:       #ECECEC;
  --border-light: #F3F4F6;
  --success:      #16A34A;
  --warning:      #F59E0B;
  --danger:       #DC2626;
  --info:         #3B82F6;

  --sidebar-w:    256px;
  --topbar-h:     64px;
  --radius:       12px;
  --radius-lg:    16px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.04);

  --font:         'Plus Jakarta Sans', sans-serif;
  --transition:   .18s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  background:  var(--bg);
  color:       var(--text);
  margin:      0;
  font-size:   14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition);
}

.page-content {
  padding: 24px 28px;
  flex: 1;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,79,139,.3);
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: block;
  line-height: 1.1;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  letter-spacing: .3px;
}

.sidebar-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* Nav */
.sidebar-nav {
  padding: 12px 12px 0;
  flex: 1;
}

.sb-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 12px 8px 4px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all var(--transition);
  position: relative;
}

.sb-item:hover {
  background: var(--soft-pink);
  color: var(--primary);
}

.sb-item.active {
  background: var(--soft-pink);
  color: var(--primary);
  font-weight: 600;
}

.sb-item.active .sb-icon {
  color: var(--primary);
}

.sb-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sb-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user {
  flex: 1;
  min-width: 0;
}

.sidebar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-role {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.sidebar-logout {
  margin-left: auto;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 8px;
  transition: all var(--transition);
  flex-shrink: 0;
  font-size: 15px;
}

.sidebar-logout:hover {
  color: var(--danger);
  background: #fee2e2;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all var(--transition);
}

.topbar-menu-btn:hover { background: var(--bg); color: var(--text); }

.topbar-title { flex: 1; }

.topbar-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.topbar-date {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-action-btn {
  width: 38px; height: 38px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 15px;
}

.topbar-action-btn:hover { background: var(--soft-pink); border-color: var(--primary); color: var(--primary); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card);
}

.topbar-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ─── Notification Dropdown ─────────────────────────────────────────────────── */
.notif-dropdown {
  width: 360px;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.mark-all-read-btn {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

.notif-body { max-height: 340px; overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
}

.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #fff9fb; }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.notif-alert   { background: #fee2e2; color: var(--danger); }
.notif-warning { background: #fef3c7; color: var(--warning); }
.notif-info    { background: #dbeafe; color: var(--info); }
.notif-success { background: #dcfce7; color: var(--success); }

.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-msg   { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.notif-time  { font-size: 11px; color: var(--text-light); margin-top: 4px; }

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

.notif-empty i { font-size: 28px; color: var(--success); margin-bottom: 8px; display: block; }
.notif-empty p { margin: 0; font-size: 13px; }

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

.notif-footer a { font-size: 12px; color: var(--primary); font-weight: 500; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.card-body { padding: 20px; }

/* ─── KPI Cards ──────────────────────────────────────────────────────────────── */
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--radius) 0 100%;
  opacity: .06;
}

.kpi-card.danger::after { background: var(--danger); }
.kpi-card.warning::after { background: var(--warning); }
.kpi-card.success::after { background: var(--success); }
.kpi-card.primary::after { background: var(--primary); }
.kpi-card.info::after { background: var(--info); }

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}

.kpi-icon.danger  { background: #fee2e2; color: var(--danger); }
.kpi-icon.warning { background: #fef3c7; color: var(--warning); }
.kpi-icon.success { background: #dcfce7; color: var(--success); }
.kpi-icon.primary { background: var(--soft-pink); color: var(--primary); }
.kpi-icon.info    { background: #dbeafe; color: var(--info); }

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .2px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 6px;
}

/* ─── Risk Badges ────────────────────────────────────────────────────────────── */
.risk-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge-critical { background: #DC2626; color: #ffffff; font-weight: 700; }
.badge-high   { background: #fee2e2; color: var(--danger); }
.badge-medium { background: #fef3c7; color: #92400E; }
.badge-low    { background: #dcfce7; color: var(--success); }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(255,79,139,.25);
}

.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255,79,139,.35);
  color: #fff;
}

.btn-primary-custom:active { transform: translateY(0); }

.btn-outline-custom {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-outline-custom:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--soft-pink);
}

.btn-danger-custom {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-danger-custom:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ─── Tables ─────────────────────────────────────────────────────────────────── */
.table-custom {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.table-custom thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-custom tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.table-custom tbody tr:hover { background: #fafafa; }

.table-custom tbody td {
  padding: 12px 14px;
  vertical-align: middle;
  color: var(--text);
}

/* ─── Form Elements ──────────────────────────────────────────────────────────── */
.form-control-custom,
.form-select-custom {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: var(--card);
  transition: all var(--transition);
  width: 100%;
  outline: none;
}

.form-control-custom:focus,
.form-select-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,79,139,.12);
}

.form-label-custom {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  display: block;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar .form-control-custom,
.filter-bar .form-select-custom {
  padding: 7px 12px;
  font-size: 13px;
  min-width: 160px;
}

/* ─── Product SKU ────────────────────────────────────────────────────────────── */
.product-sku {
  font-family: 'Courier New', monospace;
  font-size: 11.5px;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.product-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.product-brand { font-size: 12px; color: var(--text-muted); }

/* ─── Action Buttons (table) ─────────────────────────────────────────────────── */
.btn-action {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-action:hover { border-color: var(--primary); color: var(--primary); background: var(--soft-pink); }
.btn-action.danger:hover { border-color: var(--danger); color: var(--danger); background: #fee2e2; }

/* ─── Charts ─────────────────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
}

.chart-container-lg {
  position: relative;
  height: 320px;
}

/* ─── Login Page ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: 0 4px 14px rgba(255,79,139,.3);
}

.login-logo-text .app-name { font-size: 18px; font-weight: 800; color: var(--text); }
.login-logo-text .app-sub  { font-size: 12px; color: var(--text-muted); }

.login-title    { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

.input-with-icon { position: relative; }
.input-with-icon .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}
.input-with-icon input { padding-left: 38px; }
.input-with-icon .eye-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--text-muted);
}

/* ─── Stats Row (Analysis) ───────────────────────────────────────────────────── */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.stat-pill.high    { background: #fee2e2; color: var(--danger); }
.stat-pill.medium  { background: #fef3c7; color: #92400E; }
.stat-pill.low     { background: #dcfce7; color: var(--success); }

/* ─── Progress Bar ───────────────────────────────────────────────────────────── */
.progress-custom {
  height: 6px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}

.progress-custom .bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* ─── Modals ─────────────────────────────────────────────────────────────────── */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 18px 24px;
}

.modal-title { font-weight: 700; font-size: 16px; }

.modal-body { padding: 24px; }

.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 16px 24px;
}

/* ─── Page Header ────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-left h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}

.page-header-left p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ─── Recommendations ────────────────────────────────────────────────────────── */
.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.rec-item:last-child { border-bottom: none; }

.rec-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.rec-item.high   .rec-icon { background: #fee2e2; color: var(--danger); }
.rec-item.medium .rec-icon { background: #fef3c7; color: var(--warning); }

.rec-name  { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.rec-store { font-size: 12px; color: var(--text-muted); }
.rec-action { font-size: 12px; font-weight: 600; margin-top: 4px; }
.rec-loss   { font-size: 12.5px; font-weight: 700; color: var(--danger); margin-left: auto; white-space: nowrap; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.15);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .page-content { padding: 16px; }
  .kpi-value    { font-size: 20px; }
  .kpi-label    { font-size: 11px; }
  .kpi-card     { padding: 14px; }
  .kpi-icon     { width: 36px; height: 36px; font-size: 16px; }

  .page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .page-header .d-flex { width: 100%; flex-wrap: wrap; }

  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  .table-custom th,
  .table-custom td { padding: 8px 10px; font-size: 12px; }

  .modal-dialog { margin: 8px; }
  .modal-xl { max-width: calc(100vw - 16px); }

  .stat-pill { font-size: 12px; padding: 6px 10px; }
  .chart-container, .chart-container-lg { min-height: 200px; }
  
  /* Risk cards stack */
  .md-tab { font-size: 12px; padding: 8px 12px; }
}

@media (max-width: 575.98px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-bar .form-control-custom,
  .filter-bar .form-select-custom { min-width: unset; width: 100%; }

  .login-card { padding: 24px; margin: 12px; }
  .login-page { padding: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-right { gap: 8px; }

  .page-content { padding: 12px; }
  .page-header h2 { font-size: 18px; }

  /* KPI cards 2 columns on small phones */
  .row .col-6 { padding-left: 4px; padding-right: 4px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 18px; }
  .kpi-sub { font-size: 10px; }

  /* Buttons responsive */
  .btn-primary-custom,
  .btn-outline-custom { font-size: 12px; padding: 8px 12px; }
  .d-flex.gap-2 { gap: 6px !important; }

  /* Table scroll hint */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .table-custom { min-width: 600px; }

  /* Chart smaller */
  .chart-container { min-height: 180px; }
  .chart-container-lg { min-height: 200px; }

  /* Risk badges */
  .risk-badge { font-size: 10px; padding: 3px 8px; }

  /* Modal full width */
  .modal-dialog { margin: 4px; max-width: calc(100vw - 8px); }
  .modal-body .row .col-md-4,
  .modal-body .row .col-md-6,
  .modal-body .row .col-md-8 { margin-bottom: 4px; }

  /* Notification items */
  .notif-item { padding: 12px !important; }
  .notif-icon { width: 32px !important; height: 32px !important; }

  /* Settings tabs horizontal scroll on mobile */
  .settings-tab { padding: 8px 12px; font-size: 12px; }

  /* Rec items */
  .rec-item { flex-direction: column; align-items: flex-start; }
  .rec-loss { margin-left: 0; margin-top: 4px; }

  /* Demo credentials on login */
  .demo-credentials { font-size: 11px; }
  .demo-val { font-size: 11px; }

  /* Sidebar footer */
  .sidebar-footer { padding: 12px; }
  .sidebar-name { font-size: 12px; }
}

/* ─── Touch-friendly ──────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .btn-action { min-width: 36px; min-height: 36px; }
  .sb-item { min-height: 44px; }
  .form-control-custom,
  .form-select-custom { min-height: 44px; font-size: 16px; }
  .table-custom th,
  .table-custom td { padding: 10px 12px; }
}

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.gap-10 { gap: 10px; }
.fw-700  { font-weight: 700; }
.fw-800  { font-weight: 800; }
.text-primary-custom { color: var(--primary) !important; }
.bg-soft-pink { background: var(--soft-pink) !important; }

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-shine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner-primary {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,79,139,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

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

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
}

/* SweetAlert2 overrides */
.swal2-popup { font-family: var(--font) !important; border-radius: var(--radius-lg) !important; }
.swal2-confirm.swal2-styled {
  background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
  border-radius: 10px !important;
  font-family: var(--font) !important;
}

/* Bootstrap overrides */
.btn-check:focus + .btn, .btn:focus { box-shadow: none; }
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,79,139,.12);
}

/* ─── Missing Utilities ──────────────────────────────────────────────────── */
.flex-1 { flex: 1; }
.mb-20  { margin-bottom: 20px; }

/* Settings tabs */
.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.settings-tab:hover { background: var(--soft-pink); color: var(--primary); }
.settings-tab.active {
  background: var(--soft-pink);
  color: var(--primary);
  font-weight: 700;
}
.settings-tab .sb-icon { width: 20px; text-align: center; }

/* Notification item flex layout fix */
.notif-item { display: flex; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--soft-pink); }
