/* ===========================================================================
   omniServ — application styles
   Palette derived from the Mindserv wordmark:
     mind  #4A8AC9   (mid blue)
     serv  #16357F   (navy)
   Layered on top of Bootstrap 5; only overrides and app-specific components
   live here.
   ======================================================================== */

:root {
  --brand-navy:   #16357F;
  --brand-blue:   #4A8AC9;
  --brand-navy-d: #0F2559;
  --brand-tint:   #EEF3FB;

  --ink:      #16203A;
  --ink-soft: #5B6478;
  --line:     #E4E9F2;
  --bg:       #F4F6FB;
  --card:     #FFFFFF;

  --ok:    #0B7A48;
  --ok-bg: #E6F7EE;
  --warn:  #A35B00;
  --warn-bg:#FFF4E5;
  --bad:   #B42318;
  --bad-bg:#FEECEA;

  --ch-whatsapp: #25D366;
  --ch-rcs:      #7C3AED;
  --ch-sms:      #0EA5E9;
  --ch-voice:    #F59E0B;

  --radius: 12px;
  --shadow: 0 4px 20px rgba(16, 24, 64, .07);
}

* { box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

a { color: var(--brand-navy); text-decoration: none; }
a:hover { color: var(--brand-blue); }

.btn-primary {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-navy-d);
  border-color: var(--brand-navy-d);
}
.btn-outline-primary { color: var(--brand-navy); border-color: var(--brand-navy); }
.btn-outline-primary:hover { background: var(--brand-navy); border-color: var(--brand-navy); }

.form-control:focus, .form-select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(74, 138, 201, .18);
}

/* ---------------------------------------------------------------- Auth --- */
.auth-body { background: var(--bg); margin: 0; }

.auth-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
}

.auth-brand {
  background: linear-gradient(150deg, var(--brand-navy) 0%, #1E4AA8 55%, var(--brand-blue) 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-logo {
  height: 46px;
  margin-bottom: 40px;
  align-self: flex-start;
  background: #fff;
  padding: 10px 16px;
  border-radius: 10px;
}
.auth-brand h1 { font-size: 34px; font-weight: 700; line-height: 1.22; margin-bottom: 16px; }
.auth-brand p  { font-size: 15px; opacity: .88; max-width: 42ch; line-height: 1.6; }

.auth-chan {
  list-style: none;
  padding: 0;
  margin: 34px 0 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.auth-chan li {
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.auth-chan i { filter: brightness(1.6); }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-weight: 700; font-size: 26px; margin-bottom: 4px; }
.input-group-text { background: #fff; border-right: 0; color: var(--ink-soft); }
.input-group .form-control { border-left: 0; }
.input-group .form-control:focus { border-left: 0; box-shadow: none; border-color: #dee2e6; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 40px 28px; }
  .auth-brand h1 { font-size: 26px; }
}

/* --------------------------------------------------------------- Shell --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.sidebar-logo img { height: 30px; display: block; }
.sidebar-logo .suite {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: 7px;
}

.nav-group { padding: 16px 12px 4px; }
.nav-group-title {
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #97A0B5;
  font-weight: 700;
  padding: 0 10px 8px;
}
.nav-item-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav-item-link i { width: 17px; text-align: center; font-size: 14px; }
.nav-item-link:hover { background: var(--brand-tint); color: var(--brand-navy); }
.nav-item-link.active {
  background: var(--brand-navy);
  color: #fff;
  box-shadow: 0 2px 10px rgba(22, 53, 127, .28);
}
.nav-item-link .count {
  margin-left: auto;
  font-size: 11px;
  background: var(--line);
  color: var(--ink-soft);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-item-link.active .count { background: rgba(255, 255, 255, .22); color: #fff; }

.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; }
.topbar .crumb { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12.5px;
}

.content { padding: 24px 26px 48px; }

/* ---------------------------------------------------------------- Card --- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 15px 18px;
  font-weight: 700;
  font-size: 14.5px;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header .sub { font-weight: 400; font-size: 12.5px; color: var(--ink-soft); }

/* ----------------------------------------------------------- Stat tile --- */
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  height: 100%;
}
.stat .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  font-weight: 600;
}
.stat .value { font-size: 25px; font-weight: 700; margin-top: 6px; line-height: 1.15; }
.stat .value.sm { font-size: 19px; }
.stat .foot { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }
.stat .ico {
  float: right;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-tint);
  color: var(--brand-navy);
  font-size: 15px;
}

/* --------------------------------------------------------------- Table --- */
.table { font-size: 13.5px; margin: 0; }
.table > thead > tr > th {
  background: #FAFBFE;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 11px 14px;
  white-space: nowrap;
}
.table > tbody > tr > td { padding: 12px 14px; vertical-align: middle; border-color: #F0F3F8; }
.table > tbody > tr:hover { background: #FBFCFE; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- Badges --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-ok    { background: var(--ok-bg);   color: var(--ok); }
.pill-warn  { background: var(--warn-bg); color: var(--warn); }
.pill-bad   { background: var(--bad-bg);  color: var(--bad); }
.pill-mute  { background: #EEF1F7;        color: var(--ink-soft); }
.pill-info  { background: var(--brand-tint); color: var(--brand-navy); }

.chan-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 7px;
  color: #fff;
}
.chan-whatsapp { background: var(--ch-whatsapp); }
.chan-rcs      { background: var(--ch-rcs); }
.chan-sms      { background: var(--ch-sms); }
.chan-voice    { background: var(--ch-voice); }

/* ------------------------------------------------- Feature toggle matrix -- */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.toggle-tile {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: border-color .12s, background .12s;
}
.toggle-tile.on { border-color: var(--brand-blue); background: var(--brand-tint); }
.toggle-tile .t-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 13px; flex: 0 0 30px; }
.toggle-tile .t-name { font-weight: 600; font-size: 13px; }
.toggle-tile .t-desc { font-size: 11.5px; color: var(--ink-soft); }
.toggle-tile .form-check { margin: 0 0 0 auto; }
.form-check-input:checked { background-color: var(--brand-navy); border-color: var(--brand-navy); }

/* ------------------------------------------------- Impersonation bar ----- */
/* Deliberately loud. An operator must never forget they are acting inside
   someone else's account — every spend here comes out of the vendor's wallet. */
.impersonate-bar {
  position: sticky;
  top: 0;
  z-index: 1060;
  background: linear-gradient(90deg, #7C3AED, #9333EA);
  color: #fff;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(124, 58, 237, .35);
}
.impersonate-bar .msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impersonate-bar .meta { opacity: .85; font-weight: 500; font-size: 12px; margin-left: 8px; }
.impersonate-bar a.return {
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .15s, color .15s;
}
.impersonate-bar a.return:hover { background: #fff; color: #7C3AED; }

/* The sidebar and topbar are sticky too — push them below the bar. */
.impersonate-bar ~ .app-shell .sidebar { height: calc(100vh - 40px); top: 40px; }
.impersonate-bar ~ .app-shell .topbar  { top: 40px; }

/* --------------------------------------------------------------- Misc ---- */
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money.neg { color: var(--bad); }
.money.pos { color: var(--ok); }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-soft); }
.empty i { font-size: 30px; opacity: .35; display: block; margin-bottom: 12px; }

.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin: 26px 0 10px; }

.toast-host { position: fixed; top: 18px; right: 18px; z-index: 1080; display: flex; flex-direction: column; gap: 9px; }

@media (max-width: 992px) {
  .sidebar { position: fixed; left: -260px; z-index: 1050; transition: left .2s; }
  .sidebar.open { left: 0; }
  .content { padding: 18px 14px 40px; }
}
