/* ==========================================================================
   Admin. Reuses the public tokens, adds the dashboard shell.
   ========================================================================== */

.admin { background: var(--stone); }

.admin-wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Login -------------------------------------------------------------------- */

.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: var(--dark);
  color: var(--on-dark);
}

.login__card {
  width: 100%;
  max-width: 24rem;
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  border: 1px solid rgba(239, 236, 229, 0.18);
  border-radius: var(--radius);
}

.login .label { color: var(--on-dark-muted); }
.login__title { font-size: 1.5rem; margin-block: 0.5rem 1.75rem; }
.login__back { margin-top: 1.5rem; font-size: var(--fs-small); }
.login__back a { color: var(--on-dark-muted); }
.login .btn--solid { background: var(--on-dark); color: var(--dark); }
.login .btn--solid:hover { background: #fff; }

/* Shell -------------------------------------------------------------------- */

.admin-bar {
  background: var(--dark);
  color: var(--on-dark);
  padding-block: 1.5rem;
}

.admin-bar .label { color: var(--on-dark-muted); }
.admin-bar__title { font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem); margin-top: 0.35rem; }

.admin-bar__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.admin-bar__right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-bar__user { font-size: var(--fs-small); color: var(--on-dark-muted); }
.admin-bar .btn--line { border-color: rgba(239, 236, 229, 0.3); color: var(--on-dark); background: transparent; }
.admin-bar .btn--line:hover { border-color: var(--on-dark); }

.admin-main { padding-block: 2rem 4rem; }
.admin-note { font-size: var(--fs-small); color: var(--muted); margin-block: 1rem; }

/* Stats -------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 48rem) { .stats { grid-template-columns: repeat(5, 1fr); } }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.stat__value { font-size: 1.5rem; font-weight: 500; }
.stat__label {
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Toolbar ------------------------------------------------------------------ */

.toolbar { display: grid; gap: 0.75rem; }
@media (min-width: 48rem) { .toolbar { grid-template-columns: 1fr auto; align-items: center; } }

.toolbar__filters { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toolbar select { min-width: 10rem; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--ink); }

/* Lead list ---------------------------------------------------------------- */

.leads { display: grid; gap: 0.75rem; }

.lead {
  width: 100%;
  display: grid;
  gap: 0.5rem 1rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.lead:hover { border-color: var(--ink); }
.lead:active { transform: translateY(1px); }

@media (min-width: 56rem) {
  .lead {
    grid-template-columns: 1.4fr 1fr 1fr 0.8fr auto;
    align-items: center;
  }
}

.lead__name { display: block; font-weight: 500; }
.lead__sub { display: block; font-size: var(--fs-small); color: var(--muted); word-break: break-word; }
.lead__cell { font-size: var(--fs-small); color: var(--muted); }

.pill {
  justify-self: start;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill[data-status="New"] { background: #eef1e6; border-color: #d3ddbf; color: #4a5a2c; }
.pill[data-status="Contacted"] { background: #eceef4; border-color: #ccd3e4; color: #3c4763; }
.pill[data-status="Qualified"] { background: #f4ece6; border-color: #e0cbbb; color: #7a4f31; }
.pill[data-status="Closed"] { background: #eeeceb; border-color: #d8d3cf; color: #5d564f; }

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Detail panel ------------------------------------------------------------- */

.panel { position: fixed; inset: 0; z-index: 120; display: flex; justify-content: flex-end; }
.panel__backdrop { position: absolute; inset: 0; background: rgba(26, 24, 21, 0.45); }

.panel__body {
  position: relative;
  width: min(100%, 34rem);
  height: 100%;
  overflow-y: auto;
  background: var(--dark);
  color: var(--on-dark);
  padding: clamp(1.25rem, 1rem + 2vw, 2.25rem);
}

.panel__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.panel .label { color: var(--on-dark-muted); }
.panel__title { font-size: 1.375rem; margin-top: 0.35rem; word-break: break-word; }

.icon-btn {
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  background: none;
  border: 1px solid rgba(239, 236, 229, 0.25);
  border-radius: var(--radius);
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--on-dark); }

.panel__form .field > span { color: var(--on-dark-muted); }

.panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.panel .btn--solid { background: var(--on-dark); color: var(--dark); }
.panel .btn--solid:hover { background: #fff; }

.btn--danger {
  background: transparent;
  border-color: rgba(216, 141, 106, 0.6);
  color: #e0a184;
}
.btn--danger:hover { background: rgba(216, 141, 106, 0.12); border-color: #d98d6a; }

@media (min-width: 34rem) {
  .panel__actions .btn { min-width: 9rem; }
}

/* The hidden attribute has to beat the display rules declared above. */
[hidden] { display: none !important; }
