/*
 * Sales Companion — UI refresh on top of SB Admin 2 (Bootstrap 4.6).
 * Loaded after sb-admin-2.min.css. Only restyles; no layout markup depends on it,
 * so removing this file returns the old look.
 */

:root {
  --sc-primary: #1f5fbf;
  --sc-primary-dark: #174a96;
  --sc-primary-soft: #e8f0fb;
  --sc-sidebar: #13233f;
  --sc-sidebar-active: #1d355e;
  --sc-text: #1f2a37;
  --sc-muted: #6b7686;
  --sc-border: #e3e8ef;
  --sc-bg: #f4f6fa;
  --sc-surface: #ffffff;
  --sc-success: #1a8754;
  --sc-danger: #c23a3a;
  --sc-warning: #b7791f;
  --sc-radius: 10px;
  --sc-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

/* ---------- Base ---------- */
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--sc-text);
  background: var(--sc-bg);
  -webkit-font-smoothing: antialiased;
}
#content-wrapper, #content { background: var(--sc-bg) !important; }
.text-gray-800 { color: var(--sc-text) !important; }
a { color: var(--sc-primary); }
.btn-primary { background: var(--sc-primary); border-color: var(--sc-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--sc-primary-dark); border-color: var(--sc-primary-dark); }
.text-primary { color: var(--sc-primary) !important; }
.btn { border-radius: 8px; font-weight: 500; }
.form-control, .custom-select { border-radius: 8px; border-color: var(--sc-border); }
.form-control:focus, .custom-select:focus { border-color: var(--sc-primary); box-shadow: 0 0 0 3px rgba(31, 95, 191, .15); }
label { font-size: .8rem; font-weight: 600; color: var(--sc-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .3rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Sidebar & topbar ---------- */
.sidebar.bg-gradient-primary { background: var(--sc-sidebar) !important; }
.sidebar .sidebar-brand { height: 4.25rem; }
.sidebar .sidebar-brand-text { font-weight: 700; letter-spacing: .02em; text-transform: none; font-size: 1rem; }
.sidebar-dark .nav-item .nav-link { color: rgba(255, 255, 255, .72); border-radius: 8px; margin: 2px .6rem; width: auto; padding: .7rem .9rem; }
.sidebar-dark .nav-item .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar-dark .nav-item.active .nav-link { color: #fff; background: var(--sc-sidebar-active); font-weight: 600; }
.sidebar-dark .nav-item .nav-link i { color: rgba(255, 255, 255, .5); }
.sidebar-dark .nav-item.active .nav-link i { color: #8db4f0; }
.sidebar .sidebar-heading { color: rgba(255, 255, 255, .4) !important; font-size: .68rem; padding: 0 1.4rem; margin-top: .8rem; }
.sidebar hr.sidebar-divider { border-top-color: rgba(255, 255, 255, .08); margin: .6rem 1rem; }
.topbar { box-shadow: none !important; border-bottom: 1px solid var(--sc-border); margin-bottom: 0 !important; }
.sc-topbar-title { font-weight: 600; color: var(--sc-text); font-size: 1rem; padding-left: .5rem; }
.sidebar .sidebar-heading { margin-top: 1rem; margin-bottom: .2rem; }
.sidebar .nav-item .nav-link span { white-space: nowrap; }
.sidebar.toggled .sidebar-heading { display: none; }
.sticky-footer { background: transparent !important; color: var(--sc-muted); font-size: .8rem; padding: 1.25rem 0; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--sc-border); border-radius: var(--sc-radius); box-shadow: var(--sc-shadow) !important; }
.card-header { background: var(--sc-surface); border-bottom: 1px solid var(--sc-border); border-radius: var(--sc-radius) var(--sc-radius) 0 0 !important; }
.card-header h6, .card-header .card-title { font-size: .95rem; font-weight: 600; color: var(--sc-text) !important; margin: 0; }

/* ---------- Tables ---------- */
.table { color: var(--sc-text); }
.table thead th { background: #f8fafc; color: var(--sc-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--sc-border); border-top: 0; white-space: nowrap; }
.table td { border-top: 1px solid var(--sc-border); vertical-align: middle; }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--sc-border); }
.table-hover tbody tr:hover { background: #f5f8fd; }
.table-sm td, .table-sm th { padding: .45rem .6rem; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { border-radius: 8px; border: 1px solid var(--sc-border); }
.page-item.active .page-link { background: var(--sc-primary); border-color: var(--sc-primary); }
.page-link { color: var(--sc-primary); }

/* ---------- Page header ---------- */
.sc-page { padding: 1.5rem 1.5rem 2rem; }
.sc-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.sc-page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--sc-text); }
.sc-page-header p { margin: .25rem 0 0; color: var(--sc-muted); font-size: .9rem; }

/* ---------- Filter bar ---------- */
.sc-filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.sc-filters .form-group { margin: 0; min-width: 150px; flex: 1 1 150px; }
.sc-filters .sc-filters-actions { flex: 0 0 auto; display: flex; gap: .5rem; }

/* ---------- KPI tiles ---------- */
.sc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.sc-kpi { background: var(--sc-surface); border: 1px solid var(--sc-border); border-radius: var(--sc-radius); padding: .9rem 1rem; box-shadow: var(--sc-shadow); }
.sc-kpi-label { font-size: .72rem; font-weight: 700; color: var(--sc-muted); text-transform: uppercase; letter-spacing: .04em; }
.sc-kpi-value { font-size: 1.35rem; font-weight: 700; color: var(--sc-text); margin-top: .2rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-kpi-sub { font-size: .78rem; color: var(--sc-muted); }

/* ---------- Bars (simple horizontal bar lists) ---------- */
.sc-bars { list-style: none; margin: 0; padding: 0; }
.sc-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; padding: .45rem 0; border-bottom: 1px solid var(--sc-border); font-size: .875rem; }
.sc-bars li:last-child { border-bottom: 0; }
.sc-bars .sc-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-bars .sc-bar-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.sc-bars .sc-bar-track { grid-column: 1 / -1; height: 6px; background: var(--sc-primary-soft); border-radius: 3px; overflow: hidden; }
.sc-bars .sc-bar-fill { height: 100%; background: var(--sc-primary); border-radius: 3px; }

/* ---------- States ---------- */
.sc-empty { text-align: center; padding: 3rem 1rem; color: var(--sc-muted); }
.sc-empty i { font-size: 2rem; opacity: .5; margin-bottom: .75rem; display: block; }
.sc-loading { position: relative; min-height: 120px; }
.sc-loading::after { content: ""; position: absolute; inset: 0; background: rgba(244, 246, 250, .7); border-radius: var(--sc-radius); }
.sc-loading::before { content: ""; position: absolute; z-index: 2; top: 50%; left: 50%; width: 2.2rem; height: 2.2rem; margin: -1.1rem 0 0 -1.1rem; border: 3px solid var(--sc-primary-soft); border-top-color: var(--sc-primary); border-radius: 50%; animation: sc-spin .8s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ---------- Badges ---------- */
.sc-badge { display: inline-block; min-width: 1.9rem; padding: .2rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-align: center; background: #eef1f5; color: var(--sc-text); }
.sc-badge-0 { background: #dcf3e7; color: #146c43; }
.sc-badge-1 { background: #e1ebfb; color: #174a96; }
.sc-badge-2 { background: #fdf0d8; color: #8a5a12; }
.sc-badge-3 { background: #f6e1e1; color: #9b2c2c; }
.sc-badge-4 { background: #ebe4f7; color: #5b3b99; }
.sc-neg { color: var(--sc-danger); }

@media (max-width: 576px) {
  .sc-page { padding: 1rem .75rem 1.5rem; }
  .sc-page-header h1 { font-size: 1.25rem; }
  .sc-kpi-value { font-size: 1.1rem; }
}

/* ---------- Trend chips (dashboard) ---------- */
.sc-trend { display: inline-flex; align-items: center; gap: .2rem; font-size: .75rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; background: #eef1f5; color: var(--sc-muted); }
.sc-trend.up { background: #dcf3e7; color: #146c43; }
.sc-trend.down { background: #f6e1e1; color: #9b2c2c; }
.sc-card-link { font-size: .8rem; font-weight: 600; white-space: nowrap; }

/* ---------- Sign-in pages ---------- */
.sc-auth-body { background: var(--sc-bg); min-height: 100vh; }
.sc-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sc-auth-brand { background: linear-gradient(150deg, #13233f 0%, #1d355e 55%, #1f5fbf 130%); color: #fff; padding: 3rem clamp(2rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.sc-auth-brand::after { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(141, 180, 240, .22), rgba(141, 180, 240, 0) 70%); }
.sc-auth-logo { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.1rem; }
.sc-auth-logo i { width: 2.5rem; height: 2.5rem; border-radius: 10px; background: rgba(255, 255, 255, .12); display: inline-flex; align-items: center; justify-content: center; }
.sc-auth-brand h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); font-weight: 700; line-height: 1.2; margin: 0 0 .75rem; color: #fff; }
.sc-auth-brand p { color: rgba(255, 255, 255, .72); max-width: 30rem; margin: 0; }
.sc-auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .9rem; position: relative; z-index: 1; }
.sc-auth-points li { display: flex; gap: .75rem; align-items: flex-start; color: rgba(255, 255, 255, .85); font-size: .92rem; }
.sc-auth-points i { color: #8db4f0; margin-top: .2rem; width: 1rem; text-align: center; }
.sc-auth-foot { font-size: .78rem; color: rgba(255, 255, 255, .5); position: relative; z-index: 1; }
.sc-auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.sc-auth-card { width: 100%; max-width: 400px; }
.sc-auth-card h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 .35rem; color: var(--sc-text); }
.sc-auth-card .sc-auth-sub { color: var(--sc-muted); margin-bottom: 1.75rem; }
.sc-auth-card .form-control { height: calc(1.5em + 1.3rem + 2px); padding: .65rem .9rem; font-size: .95rem; }
.sc-auth-card label { text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--sc-text); }
.sc-auth-card .btn-block { padding: .7rem 1rem; font-size: .95rem; font-weight: 600; }
.sc-auth-card .input-group .btn { border: 1px solid var(--sc-border); border-left: 0; background: #fff; color: var(--sc-muted); border-radius: 0 8px 8px 0; }
.sc-auth-card .input-group .form-control { border-right: 0; }
.sc-auth-help { margin-top: 1.5rem; font-size: .85rem; color: var(--sc-muted); text-align: center; }
.sc-auth-mobile-logo { display: none; }

@media (max-width: 860px) {
  .sc-auth { grid-template-columns: 1fr; }
  .sc-auth-brand { display: none; }
  .sc-auth-mobile-logo { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--sc-text); margin-bottom: 2rem; }
  .sc-auth-mobile-logo i { width: 2.2rem; height: 2.2rem; border-radius: 9px; background: var(--sc-sidebar); color: #8db4f0; display: inline-flex; align-items: center; justify-content: center; }
}

/* ---------- Brand (logo) ---------- */
.sidebar .sidebar-brand.sc-brand { justify-content: flex-start; gap: .6rem; padding: 0 1.1rem; height: 4.5rem; text-decoration: none; }
.sc-brand-mark { height: 30px; width: auto; flex: none; display: block; }
.sc-brand-text { color: #fff; font-weight: 700; font-size: 1.02rem; line-height: 1.1; letter-spacing: .01em; margin: 0 !important; white-space: nowrap; }
.sc-brand-text span { font-weight: 400; color: rgba(255, 255, 255, .7); }
.sidebar.toggled .sidebar-brand.sc-brand { justify-content: center; padding: 0; }
.sc-topbar-logo img { display: block; height: 28px; width: auto; }

/* ---------- Phone menu (< 768px): slide-over panel instead of the template's shrinking sidebar ---------- */
.sc-sidebar-backdrop { display: none; }
@media (max-width: 767.98px) {
  .sidebar, .sidebar.toggled {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1045;
    width: 16.5rem !important; max-width: 85vw; overflow-x: hidden; overflow-y: auto;
    transform: translateX(-105%); transition: transform .22s ease; -webkit-overflow-scrolling: touch;
  }
  body.sc-sidebar-open .sidebar { transform: none; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
  .sc-sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 36, .5); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.sc-sidebar-open .sc-sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.sc-sidebar-open { overflow: hidden; }

  /* undo the template's narrow, centred phone sidebar */
  body .sidebar .sidebar-brand .sidebar-brand-text { display: block; }
  body .sidebar .nav-item .nav-link { display: flex; align-items: center; width: auto; text-align: left; padding: .7rem .9rem; }
  body .sidebar .nav-item .nav-link i { font-size: .9rem; margin-right: .6rem; }
  body .sidebar .nav-item .nav-link span { font-size: .92rem; display: inline; }
  body .sidebar .sidebar-heading { text-align: left; padding: 0 1.4rem; display: block; }
  #content-wrapper { width: 100%; }
  .topbar { position: sticky; top: 0; z-index: 1030; }
}

/* sign-in logos */
.sc-auth-logo img { height: 34px; width: auto; display: block; }
.sc-auth-logo i { display: none; }
.sc-auth-form-logo { display: block; width: 240px; max-width: 70%; height: auto; margin: 0 0 2rem -4px; }
@media (max-width: 860px) { .sc-auth-form-logo { margin-left: auto; margin-right: auto; } }
