:root {
  color-scheme: dark;
  --bg: #050b18;
  --bg-soft: #081121;
  --surface: rgba(11, 19, 39, 0.94);
  --surface-2: rgba(14, 24, 46, 0.96);
  --border: rgba(132, 156, 255, 0.16);
  --border-strong: rgba(132, 156, 255, 0.28);
  --text: #f5f8ff;
  --text-soft: #d9e3ff;
  --muted: #9ba8cf;
  --primary: #7ca7ff;
  --accent: #9a6aff;
  --cyan: #48d0ff;
  --success: #56e0b1;
  --danger: #ff8a8a;
  --shadow: 0 24px 64px rgba(2, 6, 14, 0.45);
  --radius-lg: 1.35rem;
  --radius-md: 1rem;
  --container: min(1220px, calc(100vw - 2rem));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, rgba(121, 167, 255, 0.2), transparent 24%),
    radial-gradient(circle at 84% 6%, rgba(140, 101, 255, 0.18), transparent 26%),
    linear-gradient(180deg, #050b18 0%, #071020 42%, #050914 100%);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(141, 164, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 164, 255, 0.04) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 86%);
  opacity: 0.32;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.admin-login-page {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-shell {
  width: min(100%, 32rem);
}

.login-card,
.panel-card,
.stat-card {
  background: linear-gradient(180deg, rgba(12, 20, 40, 0.96), rgba(8, 15, 29, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 2rem;
}

.login-kicker,
.admin-kicker {
  margin: 0 0 0.8rem;
  color: var(--text-soft);
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.login-title,
.admin-title {
  margin: 0 0 0.8rem;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.2;
}

.login-copy,
.admin-copy {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.85;
}

.login-form,
.lead-update-form {
  display: grid;
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-group--wide {
  min-width: min(100%, 20rem);
}

.field-label {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.field-input {
  width: 100%;
  min-height: 3rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(5, 11, 24, 0.72);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.field-input:focus {
  border-color: rgba(121, 167, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(121, 167, 255, 0.12);
}

.textarea-input {
  min-height: 7rem;
  resize: vertical;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.1rem;
  padding: 0.85rem 1.2rem;
  border-radius: 1rem;
  border: none;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.button-primary {
  background: linear-gradient(135deg, #9ce3ff 0%, #7ca7ff 44%, #a36cff 100%);
  color: #04101c;
  font-weight: 700;
  box-shadow: 0 18px 34px rgba(78, 124, 255, 0.34);
}

.button-primary:hover,
.button-secondary:hover {
  transform: translateY(-1px);
}

.button-secondary {
  background: rgba(121, 167, 255, 0.1);
  color: var(--text-soft);
  border: 1px solid rgba(132, 156, 255, 0.18);
}

.button-secondary--full {
  width: 100%;
}

.alert {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  line-height: 1.7;
}

.alert-success {
  background: rgba(17, 73, 57, 0.38);
  border: 1px solid rgba(86, 224, 177, 0.28);
  color: #ddfff3;
}

.alert-danger {
  background: rgba(95, 24, 24, 0.35);
  border: 1px solid rgba(255, 138, 138, 0.24);
  color: #ffdede;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5, 11, 24, 0.86);
  border-bottom: 1px solid rgba(132, 156, 255, 0.08);
  backdrop-filter: blur(18px);
}

.admin-header__inner,
.admin-main {
  width: var(--container);
  margin: 0 auto;
}

.admin-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.2rem 0;
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.admin-user {
  min-width: 12rem;
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: rgba(8, 15, 29, 0.72);
}

.admin-user span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.admin-main {
  padding: 1.4rem 0 2.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  padding: 1.2rem;
}

.stat-card__label {
  display: block;
  color: var(--muted);
  margin-bottom: 0.7rem;
  line-height: 1.6;
}

.stat-card__value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  line-height: 1;
}

.panel-card {
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

.panel-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-card__header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.panel-card__header span {
  color: var(--muted);
}

.filters-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.table-wrap {
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.leads-table th,
.leads-table td {
  padding: 1rem;
  border-top: 1px solid rgba(132, 156, 255, 0.08);
  text-align: right;
  vertical-align: top;
}

.leads-table thead th {
  border-top: none;
  color: var(--text-soft);
  font-weight: 600;
  background: rgba(121, 167, 255, 0.04);
}

.lead-primary {
  display: grid;
  gap: 0.35rem;
}

.lead-primary strong {
  font-size: 1rem;
}

.lead-primary span,
.lead-details span,
.lead-details a,
.leads-table small {
  color: var(--muted);
  line-height: 1.65;
  display: block;
}

.lead-details {
  display: grid;
  gap: 0.3rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(132, 156, 255, 0.18);
  background: rgba(121, 167, 255, 0.08);
  margin-bottom: 0.45rem;
}

.badge-status--new {
  background: rgba(72, 208, 255, 0.12);
}

.badge-status--contacted {
  background: rgba(121, 167, 255, 0.14);
}

.badge-status--qualified {
  background: rgba(86, 224, 177, 0.14);
}

.badge-status--closed {
  background: rgba(140, 101, 255, 0.14);
}

.empty-state {
  text-align: center !important;
  color: var(--muted);
  padding: 2rem 1rem !important;
}

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

  .filters-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --container: min(1220px, calc(100vw - 1.2rem));
  }

  .admin-header__inner,
  .panel-card__header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-header__actions {
    width: 100%;
  }

  .admin-header__actions > * {
    flex: 1 1 100%;
  }

  .stats-grid,
  .filters-form {
    grid-template-columns: 1fr;
  }
}
