/* ==================================================================
   OrderIQ — custom layer on top of Bootstrap 5.3
   ================================================================== */

:root {
  --iq-ink:        #101828;
  --iq-muted:      #667085;
  --iq-line:       #e6e8ec;
  --iq-bg:         #f6f7f9;
  --iq-surface:    #ffffff;
  --iq-primary:    #1f3a5f;
  --iq-primary-2:  #2c5282;
  --iq-accent:     #b08968;
  --iq-good:       #2e7d5b;
  --iq-bad:        #c0392b;
  --iq-warn:       #b7791f;
  --iq-sidebar-w:  236px;
  --iq-topbar-h:   62px;
}

body {
  background: var(--iq-bg);
  color: var(--iq-ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.app-topbar {
  height: var(--iq-topbar-h);
  background: var(--iq-primary);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  z-index: 1030;
}
.app-topbar .navbar-brand { color: #fff; }
.app-topbar .navbar-brand:hover { color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .12);
  color: #fff; font-size: 1rem;
}
.brand-name { font-weight: 650; letter-spacing: .2px; font-size: 1.05rem; }
.brand-tag  { color: rgba(255, 255, 255, .62); font-size: .72rem; margin-top: -2px; }

.btn-user {
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff; border-radius: 9px; padding: .3rem .6rem;
}
.btn-user:hover, .btn-user:focus { background: rgba(255, 255, 255, .18); color: #fff; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--iq-accent); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}
.role-tag { font-size: .68rem; color: rgba(255, 255, 255, .65); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: calc(100vh - var(--iq-topbar-h)); }

.app-sidebar {
  width: var(--iq-sidebar-w); flex: 0 0 var(--iq-sidebar-w);
  background: var(--iq-surface);
  border-right: 1px solid var(--iq-line);
  padding: 1rem .75rem;
  position: sticky; top: var(--iq-topbar-h);
  height: calc(100vh - var(--iq-topbar-h));
  display: flex; flex-direction: column;
}
.app-sidebar .nav-link,
.app-offcanvas .nav-link {
  display: flex; align-items: center; gap: .7rem;
  color: #46526b; font-weight: 500;
  padding: .6rem .8rem; border-radius: 9px; margin-bottom: 2px;
}
.app-sidebar .nav-link i,
.app-offcanvas .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.app-sidebar .nav-link:hover,
.app-offcanvas .nav-link:hover { background: #f1f3f6; color: var(--iq-primary); }
.app-sidebar .nav-link.active,
.app-offcanvas .nav-link.active {
  background: var(--iq-primary); color: #fff;
}
.sidebar-foot { margin-top: auto; color: #98a2b3; padding: .5rem .8rem; }
.app-offcanvas { width: 250px; }
.app-offcanvas .nav { padding: .75rem; }

.app-main {
  flex: 1 1 auto; min-width: 0;
  padding: 1.5rem 1.5rem 3rem;
}
@media (max-width: 575.98px) { .app-main { padding: 1.1rem .9rem 2.5rem; } }

/* ---------- Page head ---------- */
.page-title    { font-size: 1.4rem; font-weight: 650; margin: 0; letter-spacing: -.2px; }
.page-subtitle { color: var(--iq-muted); font-size: .875rem; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--iq-line);
  border-radius: 12px;
  background: var(--iq-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--iq-line);
  padding: .85rem 1.1rem;
  font-weight: 600; font-size: .95rem;
}
.card-body { padding: 1.1rem; }

/* ---------- KPI tiles ---------- */
.kpi { position: relative; overflow: hidden; height: 100%; }
.kpi .kpi-label {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .7px;
  color: var(--iq-muted); font-weight: 600;
}
.kpi .kpi-value { font-size: 1.75rem; font-weight: 680; line-height: 1.15; letter-spacing: -.5px; }
.kpi .kpi-sub   { font-size: .78rem; color: var(--iq-muted); }
.kpi .kpi-icon {
  position: absolute; right: .9rem; top: .9rem;
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; font-size: 1.05rem;
}
.kpi-icon.tone-blue  { background: #e8eefb; color: #2c5282; }
.kpi-icon.tone-green { background: #e4f4ec; color: var(--iq-good); }
.kpi-icon.tone-red   { background: #fdeceb; color: var(--iq-bad); }
.kpi-icon.tone-amber { background: #fdf3e2; color: var(--iq-warn); }
.kpi-icon.tone-slate { background: #eef1f5; color: #475467; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .6px;
  color: var(--iq-muted); font-weight: 650;
  border-bottom: 1px solid var(--iq-line);
  white-space: nowrap; padding: .65rem .75rem; background: #fbfbfc;
}
.table > tbody td { padding: .68rem .75rem; vertical-align: middle; border-color: #f0f1f4; }
.table-hover > tbody > tr:hover > * { background: #f8fafc; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }

/* ---------- Badges / pills ---------- */
.badge-status { font-weight: 600; font-size: .74rem; padding: .32rem .6rem; border-radius: 999px; }
.sku-pill {
  display: inline-block; background: #f1f3f6; border: 1px solid var(--iq-line);
  border-radius: 6px; padding: .1rem .42rem; margin: .1rem .15rem .1rem 0;
  font-size: .76rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #344054;
}

/* ---------- Mini bar inside tables ---------- */
.minibar { height: 6px; border-radius: 4px; background: #eef1f5; overflow: hidden; min-width: 70px; }
.minibar > span { display: block; height: 100%; border-radius: 4px; background: var(--iq-bad); }
.minibar.good > span { background: var(--iq-good); }

/* ---------- Auth screen ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(150deg, #1f3a5f 0%, #2c5282 48%, #16283f 100%);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff;
  border-radius: 16px; padding: 2rem 1.85rem;
  box-shadow: 0 20px 50px rgba(9, 20, 38, .35);
}
.auth-logo {
  width: 50px; height: 50px; border-radius: 13px;
  background: var(--iq-primary); color: #fff;
  display: grid; place-items: center; font-size: 1.35rem; margin-bottom: 1rem;
}

/* ---------- Misc ---------- */
.form-label { font-weight: 550; font-size: .85rem; margin-bottom: .3rem; }
.form-control, .form-select { border-color: #d8dce3; border-radius: 8px; }
.form-control:focus, .form-select:focus {
  border-color: var(--iq-primary-2);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, .12);
}
.btn-primary {
  background: var(--iq-primary); border-color: var(--iq-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--iq-primary-2); border-color: var(--iq-primary-2);
}
.btn { border-radius: 8px; font-weight: 550; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--iq-muted); }
.empty-state i { font-size: 2.4rem; opacity: .35; display: block; margin-bottom: .6rem; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 360px; }
.dropzone {
  border: 2px dashed #c8cfda; border-radius: 12px; background: #fbfcfe;
  padding: 2.2rem 1.2rem; text-align: center; cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--iq-primary-2); background: #f2f6fc; }
.dropzone i { font-size: 2rem; color: var(--iq-primary-2); }
.table-responsive { border-radius: 10px; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.card a.stretched-link:hover { text-decoration: none; }

/* ---------- Date filter bar ---------- */
.date-bar { background: #fbfcfe; }
.date-bar .form-label { font-size: .78rem; color: var(--iq-muted); }

/* ---------- Rank badges (best performers) ---------- */
.rank {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: #eef1f5; color: #667085;
  font-size: .72rem; font-weight: 700; margin-right: .5rem;
}
.rank-1 { background: #fdf3e2; color: #a97a1f; }
.rank-2 { background: #eef1f5; color: #5a6b8c; }
.rank-3 { background: #f7ece3; color: #a0653a; }

/* ---------- Courier dot ---------- */
.courier-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; flex: 0 0 10px; vertical-align: middle;
}
