:root {
  --navy: #002147;
  --navy-deep: #00152E;
  --gold: #D4AF37;
  --gold-dark: #B8942E;
  --silver: #8A9199;
  --bg: #F4F6F9;
  --line: rgba(0, 33, 71, 0.1);
  --text: #1a2332;
  --muted: rgba(0, 33, 71, 0.62);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

/* Login */
.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 60% 50% at 10% 0%, rgba(212,175,55,.18), transparent 55%),
    linear-gradient(160deg, #00152E 0%, #002147 55%, #1B263B 100%);
  padding: 24px;
}
.admin-login__card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 30px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.admin-login__brand { text-align: center; margin-bottom: 26px; }
.admin-login__logo {
  width: 78px;
  height: 78px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(0, 33, 71, 0.08);
}
.admin-login__logo img,
.admin-login__brand img {
  width: auto;
  max-width: 120px;
  height: 52px;
  object-fit: contain;
  margin: 0;
}
.admin-login__brand h1 { margin: 0 0 6px; font-size: 24px; color: var(--navy); letter-spacing: -0.02em; }
.admin-login__brand p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.admin-login__form { display: grid; gap: 14px; }
.admin-login__form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy); }
.admin-login__form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.admin-login__form input:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}
.admin-login__submit {
  margin-top: 4px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  box-shadow: 0 10px 22px rgba(212, 175, 55, 0.35);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.admin-login__submit:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(212, 175, 55, 0.4);
}
.admin-login__submit:active { transform: translateY(0); }
.admin-login__submit i { font-size: 13px; }
.admin-login__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.admin-login__divider::before,
.admin-login__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.admin-login__back {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 12px;
  border: 1px solid rgba(0, 33, 71, 0.14);
  background: #fff;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.admin-login__back:hover {
  background: rgba(0, 33, 71, 0.04);
  border-color: rgba(0, 33, 71, 0.28);
  color: var(--navy-deep);
  transform: translateY(-1px);
}
.admin-login__back i { color: var(--gold-dark); }
.admin-login__hint { margin: 16px 0 8px; text-align: center; font-size: 12px; color: var(--muted); }

/* App shell */
.admin-app {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 21, 46, 0.55);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.admin-sidebar {
  --sidebar-w: 272px;
  width: var(--sidebar-w);
  flex-shrink: 0;
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  background:
    radial-gradient(ellipse 90% 40% at 0% 0%, rgba(212, 175, 55, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 35% at 100% 100%, rgba(138, 145, 153, 0.12), transparent 50%),
    linear-gradient(185deg, #00152E 0%, #002147 48%, #0A2A4A 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 8px 0 32px rgba(0, 21, 46, 0.18);
}

.admin-sidebar__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 14px 16px;
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar__logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.admin-sidebar__logo img {
  width: auto;
  max-width: 40px;
  height: 34px;
  object-fit: contain;
}

.admin-sidebar__brand-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.admin-sidebar__brand-text span {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.admin-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}

.admin-sidebar__label {
  margin: 14px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.admin-sidebar__label:first-child { margin-top: 4px; }

.admin-sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.admin-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.admin-sidebar__icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  transition: background .18s ease, color .18s ease;
}

.admin-sidebar__link:hover .admin-sidebar__icon {
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold);
}

.admin-sidebar__link.is-active {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.08));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.28);
}

.admin-sidebar__link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--gold);
}

.admin-sidebar__link.is-active .admin-sidebar__icon {
  background: var(--gold);
  color: var(--navy-deep);
}

.admin-sidebar__link--sub {
  margin-left: 12px;
  padding: 8px 12px 8px 10px;
  font-size: 13px;
  gap: 10px;
}

.admin-sidebar__link--sub .admin-sidebar__icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 12px;
}

.admin-sidebar__link--sub.is-active::before {
  top: 8px;
  bottom: 8px;
}

.admin-sidebar__badge {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.22);
  color: #f0d78c;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}

.admin-sidebar__link.is-active .admin-sidebar__badge {
  background: rgba(0, 21, 46, 0.35);
  color: #fff;
}

.admin-sidebar__badge--danger {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.admin-sidebar__link.is-active .admin-sidebar__badge--danger {
  background: rgba(239, 68, 68, 0.35);
  color: #fff;
}

.admin-sidebar__bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
}

.admin-sidebar__avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy-deep);
  background: linear-gradient(145deg, #F0D78C, var(--gold));
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
}

.admin-sidebar__user-meta {
  min-width: 0;
}

.admin-sidebar__user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar__user-meta span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: rgba(255, 255, 255, 0.5);
}

.admin-sidebar__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 4px;
}

.admin-sidebar__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.admin-sidebar__action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
}

.admin-sidebar__action--danger:hover {
  background: rgba(192, 57, 43, 0.28);
  border-color: rgba(192, 57, 43, 0.4);
  color: #fff;
}

.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar__title { min-width: 0; }
.admin-topbar h1 { margin: 0; font-size: 22px; color: var(--navy); letter-spacing: -0.02em; }
.admin-topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.admin-topbar__menu {
  display: none;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  color: var(--navy);
  font-size: 16px;
}
.admin-topbar__menu:hover { border-color: rgba(0, 33, 71, 0.22); background: #f8fafc; }
.admin-topbar__user { margin-left: auto; text-align: right; }
.admin-topbar__user--desktop span { display: block; font-weight: 700; color: var(--navy); }
.admin-topbar__user--desktop small { color: var(--muted); text-transform: capitalize; }

.admin-topbar__profile {
  display: none;
  margin-left: auto;
  flex-shrink: 0;
}

.admin-topbar__avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy-deep);
  background: linear-gradient(145deg, #F0D78C, var(--gold));
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.28);
}

.admin-content { padding: 24px; }

.admin-alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}
.admin-alert--success { background: #e8f7ee; color: #0f6f1c; }
.admin-alert--error { background: #fdecec; color: #b42318; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.admin-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.admin-stat__icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(138,145,153,.15); color: var(--navy);
}
.admin-stat__icon--gold { background: rgba(212,175,55,.18); color: var(--gold-dark); }
.admin-stat__icon--navy { background: rgba(0,33,71,.1); color: var(--navy); }
.admin-stat strong { display: block; font-size: 28px; color: var(--navy); line-height: 1.1; }
.admin-stat span { color: var(--muted); font-size: 13px; }

.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.admin-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.admin-card__head h2 { margin: 0; font-size: 18px; color: var(--navy); }

.admin-toolbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-toolbar--tabs {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}
.admin-tab.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.admin-toolbar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-card__intro {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.admin-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-filters input,
.admin-filters select,
.admin-form input,
.admin-form select,
.admin-form textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}
.admin-filters input { min-width: 180px; }

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}

.admin-table-head th {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: none;
  padding: 14px 12px;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table-head th:first-child {
  border-radius: 0;
}

.admin-th {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-th i {
  color: var(--gold);
  font-size: 11px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.admin-table-head__actions {
  text-align: center;
}

.admin-table-head__actions .admin-th {
  justify-content: center;
}
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.admin-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.admin-badge.is-on { background: rgba(212,175,55,.18); color: #8a6d16; }
.admin-badge.is-off { background: rgba(138,145,153,.18); color: #555; }

.admin-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  background: #f1f5f9;
}
.admin-thumb--empty {
  display: grid;
  place-items: center;
  color: var(--silver);
  font-size: 14px;
}
.admin-muted { color: var(--muted); }

.admin-module-row {
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 12px;
  background: #fbfcfe;
}
.admin-module-row__grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 100px 120px;
  gap: 10px;
  align-items: start;
}
.admin-module-row__grid .admin-form__full { grid-column: 1 / -1; }
.admin-module-row__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.admin-btn--sm { padding: 7px 10px; font-size: 12px; }
.admin-btn--gold { background: var(--gold); color: #fff; }
.admin-btn--gold:hover { background: var(--gold-dark); color: #fff; }
.admin-btn--navy { background: var(--navy); color: #fff; }
.admin-btn--danger { background: #c0392b; color: #fff; }
.admin-btn--ghost { background: #fff; border: 1px solid var(--line); color: var(--navy); }

.admin-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.admin-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy); }
.admin-form__full { grid-column: 1 / -1; }
.admin-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.admin-settings-group { margin-bottom: 28px; }
.admin-settings-group h2 {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--navy);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
  display: inline-block;
}

@media (max-width: 1200px) {
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) and (min-width: 992px) {
  .admin-form__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 992px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 88vw);
    transform: translateX(-105%);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1);
  }
  body.admin-sidebar-open .admin-sidebar { transform: none; }
  body.admin-sidebar-open .admin-sidebar-backdrop { display: block; }
  body.admin-sidebar-open { overflow: hidden; }
  .admin-topbar__menu { display: inline-flex; align-items: center; justify-content: center; }
  .admin-topbar__user--desktop { display: none; }
  .admin-topbar__profile { display: block; }
  .admin-content { padding: 18px 16px 28px; }
  .admin-topbar { padding: 14px 16px; }
  .admin-topbar h1 { font-size: 18px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .admin-stat { padding: 14px; }
  .admin-stat strong { font-size: 22px; }
  .admin-module-row__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .admin-login-body { padding: 16px; }
  .admin-login__card { padding: 28px 20px 22px; border-radius: 16px; }
  .admin-stats,
  .admin-grid-2,
  .admin-form__grid,
  .admin-module-row__grid {
    grid-template-columns: 1fr;
  }
  .admin-filters { width: 100%; }
  .admin-filters input,
  .admin-filters select {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-toolbar .admin-btn {
    width: 100%;
    justify-content: center;
  }
  .admin-card { padding: 14px; border-radius: 14px; }
  .admin-card__head {
    flex-wrap: wrap;
    gap: 10px;
  }
  .admin-card__head h2 { font-size: 16px; }
  .admin-table:not(.admin-table--responsive) {
    min-width: 640px;
  }
  .admin-table th,
  .admin-table td {
    padding: 10px 8px;
    font-size: 13px;
  }
  .admin-form__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .admin-form__actions .admin-btn {
    width: 100%;
    justify-content: center;
  }
  .admin-module-row__actions {
    justify-content: stretch;
  }
  .admin-module-row__actions .admin-btn {
    flex: 1;
    justify-content: center;
  }
  .admin-sidebar__actions {
    grid-template-columns: 1fr;
  }
  .admin-content { padding: 14px 12px 24px; }
  .admin-topbar h1 { font-size: 17px; }
  .admin-topbar p { display: none; }
}

@media (max-width: 480px) {
  .admin-login__brand h1 { font-size: 20px; }
  .admin-login__submit,
  .admin-login__back {
    padding: 12px 14px;
    font-size: 14px;
  }
  .admin-stats { gap: 8px; }
  .admin-stat {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }
  .admin-stat strong { font-size: 20px; }
  .admin-btn { padding: 10px 12px; font-size: 13px; }
  .admin-thumb {
    width: 52px;
    height: 40px;
  }
}

/* Lead Management extras */
.admin-badge.is-new { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
.admin-badge.is-contacted { background: rgba(14, 165, 233, 0.15); color: #0369a1; }
.admin-badge.is-qualified { background: rgba(168, 85, 247, 0.15); color: #7e22ce; }
.admin-badge.is-proposal { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.admin-badge.is-won { background: rgba(34, 197, 94, 0.18); color: #15803d; }
.admin-badge.is-lost { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }

.admin-badge--priority-low { background: rgba(138,145,153,.18); color: #555; }
.admin-badge--priority-medium { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.admin-badge--priority-high { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.admin-badge--product { background: rgba(15, 76, 129, 0.12); color: var(--admin-navy, #0f4c81); }

.lead-hero__product {
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
    color: var(--admin-muted, #64748b);
}

.admin-stat__icon.is-new { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
.admin-stat__icon.is-contacted { background: rgba(14, 165, 233, 0.15); color: #0369a1; }
.admin-stat__icon.is-qualified { background: rgba(168, 85, 247, 0.15); color: #7e22ce; }
.admin-stat__icon.is-proposal { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.admin-stat__icon.is-won { background: rgba(34, 197, 94, 0.18); color: #15803d; }
.admin-stat__icon.is-lost { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }

/* Lead View Page */
.lead-view { display: grid; gap: 18px; }

.lead-view__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.lead-view__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  transition: background .18s ease, border-color .18s ease;
}
.lead-view__back:hover {
  background: #f8fafc;
  border-color: rgba(0, 33, 71, 0.2);
}

.lead-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 24px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(ellipse 70% 80% at 0% 0%, rgba(212, 175, 55, 0.22), transparent 55%),
    linear-gradient(135deg, #00152e 0%, #002147 55%, #0a2a4a 100%);
  box-shadow: 0 16px 40px rgba(0, 21, 46, 0.22);
}
.lead-hero__profile {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}
.lead-hero__avatar {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--navy-deep);
  background: linear-gradient(145deg, #f0d78c, var(--gold));
  box-shadow: 0 8px 22px rgba(212, 175, 55, 0.35);
}
.lead-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}
.lead-hero__source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}
.lead-hero__name {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.lead-hero__company {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lead-hero__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-self: center;
}
.lead-metric {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
}
.lead-metric strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 2px;
}
.lead-metric span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}
.lead-metric__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.lead-metric__icon--gold { background: rgba(212, 175, 55, 0.25); color: #f0d78c; }
.lead-metric__icon--navy { background: rgba(255, 255, 255, 0.18); }
.lead-metric--follow.is-overdue { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.12); }
.lead-metric--follow.is-overdue strong { color: #fecaca; }
.lead-metric--follow.is-today { border-color: rgba(212, 175, 55, 0.55); background: rgba(212, 175, 55, 0.14); }

.lead-pipeline {
  padding: 16px 20px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}
.lead-pipeline__label {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.lead-pipeline__track {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.lead-pipeline__step {
  flex: 1;
  min-width: 88px;
  text-align: center;
  position: relative;
}
.lead-pipeline__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 11px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: rgba(0, 33, 71, 0.12);
}
.lead-pipeline__step.is-done:not(:last-child)::after { background: var(--gold); }
.lead-pipeline__dot {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 2px solid rgba(0, 33, 71, 0.18);
  background: #fff;
  position: relative;
  z-index: 1;
}
.lead-pipeline__step.is-done .lead-pipeline__dot {
  border-color: var(--gold);
  background: var(--gold);
}
.lead-pipeline__step.is-current .lead-pipeline__dot {
  border-color: var(--navy);
  background: var(--navy);
  box-shadow: 0 0 0 4px rgba(0, 33, 71, 0.12);
}
.lead-pipeline__step.is-won-step.is-current .lead-pipeline__dot { background: #15803d; border-color: #15803d; }
.lead-pipeline__step.is-lost-step.is-current .lead-pipeline__dot { background: #b91c1c; border-color: #b91c1c; }
.lead-pipeline__step small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.lead-pipeline__step.is-current small { color: var(--navy); }

.lead-hero .admin-badge {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.lead-view__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}
.lead-view__main,
.lead-view__aside { display: grid; gap: 18px; }

.lead-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.lead-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
a.lead-contact-item:hover {
  border-color: rgba(212, 175, 55, 0.45);
  background: #fff;
  transform: translateY(-1px);
}
.lead-contact-item__icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(0, 33, 71, 0.08);
  color: var(--navy);
  font-size: 14px;
}
.lead-contact-item strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.lead-contact-item span {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  word-break: break-word;
}
.lead-contact-item a { color: var(--navy); text-decoration: underline; }

.lead-notes {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
}
.lead-notes h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lead-notes p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.lead-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.lead-action-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.lead-action-box__head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 14px;
}
.lead-action-box__head i { color: var(--gold-dark); }
.lead-action-box select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.lead-activity-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.lead-activity-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.lead-activity-form select,
.lead-activity-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.activity-timeline--rich { display: grid; gap: 0; position: relative; }
.activity-timeline--rich::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), rgba(0, 33, 71, 0.12));
}
.activity-item {
  display: flex;
  gap: 14px;
  padding: 0 0 18px 0;
  position: relative;
}
.activity-item:last-child { padding-bottom: 0; }
.activity-item__marker {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--navy);
  font-size: 14px;
  position: relative;
  z-index: 1;
}
.activity-item--call .activity-item__marker { background: rgba(14, 165, 233, 0.12); border-color: rgba(14, 165, 233, 0.35); color: #0369a1; }
.activity-item--email .activity-item__marker { background: rgba(168, 85, 247, 0.12); border-color: rgba(168, 85, 247, 0.35); color: #7e22ce; }
.activity-item--meeting .activity-item__marker { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); color: #15803d; }
.activity-item--status_change .activity-item__marker { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.35); color: #b45309; }
.activity-item--assignment .activity-item__marker { background: rgba(0, 33, 71, 0.1); border-color: rgba(0, 33, 71, 0.25); color: var(--navy); }
.activity-item__body {
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fbfcfe;
  border: 1px solid var(--line);
}
.activity-item__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.activity-item__head span { color: var(--muted); white-space: nowrap; font-size: 12px; }
.activity-item__body p { margin: 0 0 8px; font-size: 14px; line-height: 1.55; }
.activity-item__body small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.activity-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
}
.activity-empty i {
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.45;
}
.activity-empty p { margin: 0; font-size: 14px; }

@media (max-width: 1100px) {
  .lead-hero__metrics { grid-template-columns: 1fr; width: 100%; }
  .lead-view__grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .lead-hero { padding: 18px; }
  .lead-hero__profile { flex-direction: column; align-items: flex-start; }
  .lead-contact-grid,
  .lead-actions-grid { grid-template-columns: 1fr; }
  .lead-pipeline__step { min-width: 72px; }
}

/* Legacy (kept for compatibility) */
.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  font-size: 14px;
}
.lead-detail-grid strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.lead-description {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.lead-description p { margin: 8px 0 0; line-height: 1.6; }

@media (max-width: 768px) {
  .lead-detail-grid { grid-template-columns: 1fr; }
}

/* Settings page */
.settings-intro {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
}
.settings-add-form__grid {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.settings-add-form__action {
  display: flex;
  align-items: flex-end;
}
.settings-table-wrap { margin-top: 20px; }
.settings-table-wrap input[type="text"],
.settings-table-wrap input[type="number"],
.settings-table-wrap select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
.settings-sort-input { max-width: 72px; }
.settings-key {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 12px;
  color: #475569;
}
.settings-info-title {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--navy);
}
.settings-info-text {
  margin: 0;
  font-size: 14px;
}
@media (max-width: 768px) {
  .settings-add-form__grid {
    grid-template-columns: 1fr;
  }
}

.is-hidden { display: none !important; }

.role-help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* DataTables — enhanced admin theme */
.dataTables_wrapper.admin-dt-wrapper {
  margin-top: 4px;
}

.admin-dt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 0;
  background: linear-gradient(180deg, rgba(0, 33, 71, 0.04) 0%, rgba(0, 33, 71, 0.02) 100%);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
}

.admin-dt-toolbar--compact {
  border-radius: 14px 14px 0 0;
  padding: 12px 14px;
}

.admin-dt-toolbar__left,
.admin-dt-toolbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-dt-toolbar__right {
  margin-left: auto;
}

.admin-dt-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0, 33, 71, 0.07);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.admin-dt-count i {
  color: var(--gold-dark);
  font-size: 11px;
}

.admin-dt-length label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: normal;
}

.admin-dt-length__select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dataTables_wrapper .dataTables_filter.admin-dt-search {
  float: none !important;
  text-align: left !important;
  margin: 0 !important;
  padding: 0 !important;
}

.admin-dt-search__box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 340px;
  width: 100%;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 33, 71, 0.04);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.admin-dt-search__box:focus-within {
  border-color: rgba(212, 175, 55, 0.75);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.14);
}

.admin-dt-search__label-text {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid rgba(0, 33, 71, 0.12);
}

.admin-dt-search__input,
.dataTables_wrapper .dataTables_filter.admin-dt-search input {
  display: block !important;
  flex: 1;
  width: 100% !important;
  min-width: 0 !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 0 4px 0 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.admin-dt-search__input::placeholder {
  color: rgba(0, 33, 71, 0.4);
}

.admin-dt-search__input::-webkit-search-decoration,
.admin-dt-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.admin-dt-toolbar__right .admin-dt-search {
  display: flex;
  justify-content: flex-end;
  width: auto;
  margin-left: auto;
}

.admin-dt-toolbar--compact .admin-dt-search {
  width: 100%;
}

.admin-dt-toolbar--compact .admin-dt-search__box {
  max-width: none;
  min-width: 0;
}

.admin-dt-length select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 34px 9px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23002147' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  cursor: pointer;
  min-width: 72px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.admin-dt-length select:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.75);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.16);
  background: #fff;
}

.admin-card .admin-table-wrap:has(.admin-table-head) {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 33, 71, 0.04);
}

.admin-card .admin-table-wrap:has(.admin-table-head) .admin-table {
  margin: 0;
}

.settings-table-wrap.admin-table-wrap:has(.admin-table-head) {
  margin-top: 8px;
}

.admin-card .admin-table-wrap:has(.admin-dt-wrapper) .admin-dt-toolbar {
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin: 0;
}

.admin-card .admin-table-wrap:has(.admin-dt-wrapper) table.dataTable {
  margin: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-card .admin-table-wrap:has(.admin-dt-wrapper) .admin-dt-footer {
  border-top: 1px solid var(--line);
  margin: 0;
  border-radius: 0;
}

table.dataTable.admin-table {
  width: 100% !important;
  margin: 0 !important;
}

table.dataTable.admin-table thead.admin-table-head th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%) !important;
  border-bottom: 2px solid rgba(212, 175, 55, 0.35) !important;
  padding: 14px 12px !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 21, 46, 0.15);
}

table.dataTable.admin-table thead.admin-table-head th .admin-th {
  color: #fff;
}

table.dataTable.admin-table thead.admin-table-head th .admin-th i {
  color: var(--gold);
}

table.dataTable.admin-table tbody td {
  padding: 14px 12px !important;
  border-bottom: 1px solid rgba(0, 33, 71, 0.06) !important;
  vertical-align: middle !important;
  font-size: 14px;
  background: #fff;
  transition: background .15s ease;
}

table.dataTable.admin-table tbody tr.admin-dt-row:hover td {
  background: rgba(212, 175, 55, 0.06);
}

table.dataTable.admin-table tbody tr.admin-dt-row--alt td {
  background: rgba(0, 33, 71, 0.018);
}

table.dataTable.admin-table tbody tr.admin-dt-row--alt:hover td {
  background: rgba(212, 175, 55, 0.08);
}

table.dataTable.admin-table tbody tr:last-child td {
  border-bottom: none !important;
}

table.dataTable.admin-table td.dataTables_empty {
  padding: 48px 20px !important;
  text-align: center !important;
  color: var(--muted) !important;
  font-size: 15px !important;
  font-weight: 500;
  background: linear-gradient(180deg, #fff 0%, rgba(0, 33, 71, 0.02) 100%) !important;
}

table.dataTable.admin-table td.dataTables_empty::before {
  content: "\f07c";
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  display: block;
  font-size: 28px;
  color: rgba(0, 33, 71, 0.15);
  margin-bottom: 10px;
}

table.dataTable.no-footer {
  border-bottom: none;
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc,
table.dataTable thead .sorting_disabled {
  background-image: none !important;
  position: relative;
  padding-right: 26px !important;
  cursor: pointer;
}

table.dataTable thead .sorting_disabled {
  cursor: default;
  padding-right: 12px !important;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 10px;
  line-height: 1;
}

table.dataTable thead .sorting:after {
  content: "\f0dc";
  color: rgba(255, 255, 255, 0.35);
}

table.dataTable thead .sorting_asc:after {
  content: "\f0de";
  color: var(--gold);
}

table.dataTable thead .sorting_desc:after {
  content: "\f0dd";
  color: var(--gold);
}

table.dataTable thead.admin-table-head .sorting:hover:after,
table.dataTable thead.admin-table-head .sorting_asc:after,
table.dataTable thead.admin-table-head .sorting_desc:after {
  color: var(--gold);
}

.admin-dt-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fafbfd;
}

.admin-dt-footer__info,
.admin-dt-footer__pages {
  float: none !important;
  margin: 0 !important;
}

.admin-dt-info {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}

.admin-dt-paginate {
  display: flex !important;
  align-items: center;
  gap: 4px !important;
}

.admin-dt-paginate .paginate_button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  padding: 0 10px !important;
  margin: 0 !important;
  background: #fff !important;
  color: var(--navy) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  box-shadow: 0 1px 2px rgba(0, 33, 71, 0.04);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.admin-dt-paginate .paginate_button:hover {
  background: rgba(0, 33, 71, 0.05) !important;
  border-color: rgba(0, 33, 71, 0.16) !important;
  color: var(--navy) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 33, 71, 0.08);
}

.admin-dt-paginate .paginate_button.current,
.admin-dt-paginate .paginate_button.current:hover {
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-deep) 100%) !important;
  border-color: var(--navy) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 33, 71, 0.22);
  transform: none;
}

.admin-dt-paginate .paginate_button.disabled,
.admin-dt-paginate .paginate_button.disabled:hover {
  opacity: 0.4;
  cursor: default;
  background: #fff !important;
  color: var(--muted) !important;
  transform: none;
  box-shadow: none;
}

.admin-dt-paginate .paginate_button.previous,
.admin-dt-paginate .paginate_button.next {
  gap: 6px;
  padding: 0 12px !important;
  min-width: auto;
}

.admin-dt-paginate .paginate_button.previous span,
.admin-dt-paginate .paginate_button.next span {
  font-size: 12px;
  font-weight: 700;
}

.admin-dt-toolbar .admin-dt-count {
  margin-right: auto;
}

.admin-dt-paginate .paginate_button i {
  font-size: 11px;
  pointer-events: none;
}

.admin-card .admin-table-wrap:has(.admin-dt-wrapper) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .admin-dt-toolbar,
  .admin-dt-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-dt-toolbar__left,
  .admin-dt-toolbar__right,
  .admin-dt-footer__info,
  .admin-dt-footer__pages {
    width: 100%;
    justify-content: space-between;
  }

  .admin-dt-search {
    width: 100%;
  }

  .admin-dt-search__box {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .admin-dt-search__input {
    font-size: 16px;
    height: 38px !important;
  }

  .admin-dt-paginate {
    flex-wrap: wrap;
    justify-content: center;
  }

  table.dataTable.admin-table thead th {
    position: static;
  }
}

/* ============================================================
   Full responsive system — mobile / tablet / laptop
   ============================================================ */

/* Laptop (992px – 1199px) */
@media (max-width: 1199px) {
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-content {
    padding: 20px 18px 28px;
  }
}

/* Tablet (768px – 991px) */
@media (max-width: 991px) {
  .admin-grid-2 {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 6px;
    margin: 0 -2px;
    scrollbar-width: none;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .admin-tab {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 13px;
    padding: 9px 14px;
  }

  .admin-toolbar--tabs .admin-toolbar__actions {
    width: 100%;
  }

  .admin-toolbar--tabs .admin-toolbar__actions .admin-btn {
    width: 100%;
    justify-content: center;
  }

  .lead-hero__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .lead-view__grid {
    grid-template-columns: 1fr;
  }

  .admin-form__grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile (< 768px) — card-style tables */
@media (max-width: 767px) {
  .admin-content {
    padding: 14px 12px max(24px, env(safe-area-inset-bottom));
  }

  .admin-topbar {
    padding: 12px 14px;
    gap: 12px;
  }

  .admin-filters input,
  .admin-filters select,
  .admin-form input,
  .admin-form select,
  .admin-form textarea {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .admin-form__grid {
    grid-template-columns: 1fr;
  }

  .admin-card__head .admin-btn {
    width: 100%;
    justify-content: center;
  }

  .lead-view__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .lead-view__toolbar .admin-actions,
  .lead-view__toolbar .lead-view__back {
    width: 100%;
  }

  .lead-view__toolbar .admin-actions .admin-btn,
  .lead-view__back {
    flex: 1;
    justify-content: center;
  }

  .lead-hero {
    padding: 16px;
    border-radius: 16px;
  }

  .lead-hero__profile {
    flex-direction: row;
    align-items: center;
  }

  .lead-hero__avatar {
    width: 56px;
    height: 56px;
    font-size: 22px;
    border-radius: 16px;
  }

  .lead-hero__metrics {
    grid-template-columns: 1fr;
  }

  .lead-contact-grid,
  .lead-actions-grid {
    grid-template-columns: 1fr;
  }

  .activity-item__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .activity-timeline--rich::before {
    left: 15px;
  }

  .activity-item__marker {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  /* Stack tables as cards */
  .admin-table-wrap:has(.admin-table--responsive),
  .admin-card .admin-table-wrap:has(.admin-table--responsive) {
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .admin-table--responsive {
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  .admin-table--responsive thead {
    display: none;
  }

  .admin-table--responsive tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 33, 71, 0.05);
    overflow: hidden;
  }

  .admin-table--responsive tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--line) !important;
    text-align: right;
    min-width: 0 !important;
    background: #fff !important;
  }

  .admin-table--responsive tbody td:last-child {
    border-bottom: none !important;
  }

  .admin-table--responsive tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
    min-width: 88px;
    max-width: 42%;
    padding-top: 2px;
  }

  .admin-table--responsive tbody td > * {
    flex: 1;
    min-width: 0;
  }

  .admin-table--responsive tbody td[data-label="Actions"] {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  .admin-table--responsive tbody td[data-label="Actions"]::before {
    margin-bottom: 2px;
  }

  .admin-table--responsive .admin-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .admin-table--responsive .admin-actions .admin-btn {
    flex: 1;
    min-height: 40px;
  }

  table.dataTable.admin-table--responsive tbody tr.admin-dt-row:hover td,
  table.dataTable.admin-table--responsive tbody tr.admin-dt-row--alt td {
    background: #fff !important;
  }

  .dataTables_wrapper.admin-dt-wrapper:has(.admin-table--responsive) {
    margin-top: 0;
  }

  .admin-dt-toolbar {
    border-radius: 14px;
    border: 1px solid var(--line);
    margin-bottom: 12px;
  }

  .admin-dt-toolbar .admin-dt-count {
    width: 100%;
    justify-content: center;
    margin-right: 0;
  }

  .admin-dt-length {
    width: 100%;
  }

  .admin-dt-length label {
    width: 100%;
    justify-content: space-between;
  }

  .admin-dt-search {
    width: 100%;
  }

  .admin-dt-toolbar__right .admin-dt-search {
    width: 100%;
    max-width: none;
  }

  .admin-dt-search__box {
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .admin-dt-search__input {
    font-size: 16px;
    height: 38px !important;
  }

  .admin-dt-footer {
    border-radius: 14px;
    border: 1px solid var(--line);
    margin-top: 12px;
  }

  .settings-table-wrap .admin-table--responsive tbody td[data-label="Sort"] input,
  .settings-table-wrap .admin-table--responsive tbody td[data-label="Label"] input {
    width: 100%;
    max-width: none;
  }

  .settings-sort-input {
    max-width: none;
  }
}

/* Small phones (< 480px) */
@media (max-width: 479px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-stat {
    flex-direction: row;
    align-items: center;
  }

  .admin-tab {
    font-size: 12px;
    padding: 8px 12px;
  }

  .admin-btn {
    min-height: 44px;
  }

  .admin-topbar__menu {
    width: 44px;
    height: 44px;
  }

  .admin-table--responsive .admin-actions {
    flex-direction: column;
  }

  .admin-table--responsive .admin-actions .admin-btn {
    width: 100%;
  }

  .lead-pipeline__step {
    min-width: 64px;
  }

  .lead-pipeline__step small {
    font-size: 10px;
  }
}
