:root {
  --navy: #0d1728;
  --panel: #15233a;
  --line: rgba(196, 154, 126, 0.28);
  --copper: #c49a7e;
  --text: #f4efe9;
  --muted: rgba(244, 239, 233, 0.68);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--navy);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.admin-login, .admin-app { min-height: 100vh; }
.admin-login {
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card, .editor, .list-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.login-card { width: min(420px, 100%); padding: 28px; }
.login-card h1, .topbar h1 { margin: 0 0 8px; letter-spacing: 0.08em; }
.muted { color: var(--muted); }
label { display: grid; gap: 6px; font-size: 0.82rem; color: var(--muted); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0d1728;
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 12px; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--copper);
  color: #1a120e;
  font-weight: 700;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.warn { background: #8d3b3b; color: white; }
.topbar, .layout, .toolbar { display: flex; gap: 16px; }
.topbar {
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 8px; }
.tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 999px; padding: 8px 14px; }
.tabs button.active { color: var(--text); border-color: var(--copper); }
.layout { align-items: start; padding: 22px; }
.list-card { width: 320px; padding: 12px; display: grid; gap: 8px; }
.editor { flex: 1; padding: 18px; }
.person, .entry {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}
.person.active, .entry.active { border-color: var(--copper); }
.person img, .thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: #0d1728;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #101b30;
  border: 1px solid var(--copper);
  padding: 12px 14px;
  border-radius: 10px;
}
.hidden { display: none !important; }
.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 92px; height: 68px; object-fit: cover; border-radius: 8px; }
.gallery button { position: absolute; top: 4px; right: 4px; }
@media (max-width: 860px) {
  .layout, .row { grid-template-columns: 1fr; display: grid; }
  .list-card, .editor { width: auto; }
}

/* Dashboard layout */
body {
  background:
    radial-gradient(circle at 80% 0%, rgba(196, 154, 126, 0.08), transparent 28rem),
    var(--navy);
  font-size: 15px;
}
.admin-app { padding-bottom: 40px; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 84px;
  padding: 16px max(24px, calc((100vw - 1440px) / 2));
  background: rgba(13, 23, 40, 0.94);
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: 1.35rem; }
.topbar p { margin: 0; font-size: 0.88rem; }
.tabs {
  position: sticky;
  z-index: 19;
  top: 84px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 24px !important;
  background: rgba(13, 23, 40, 0.94);
  backdrop-filter: blur(14px);
}
.tabs button {
  min-width: 104px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tabs button.active {
  color: #18100c;
  border-color: var(--copper);
  background: var(--copper);
}
.layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 24px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 10px 24px 24px;
}
.list-card {
  position: sticky;
  top: 154px;
  width: auto;
  max-height: calc(100vh - 178px);
  overflow: auto;
  padding: 14px;
  gap: 8px;
  scrollbar-width: thin;
}
.editor {
  width: 100%;
  min-width: 0;
  max-width: 1000px;
  padding: clamp(20px, 3vw, 34px);
  gap: 18px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.16);
}
.editor h2 {
  margin: 0 0 6px;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: 0.02em;
}
.editor label { font-size: 0.86rem; }
.editor input,
.editor textarea,
.editor select {
  min-height: 44px;
  border-color: rgba(196, 154, 126, 0.2);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.editor input:focus,
.editor textarea:focus,
.editor select:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(196, 154, 126, 0.12);
}
.editor textarea { min-height: 116px; line-height: 1.55; }
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 10px;
}
.list-heading div { display: grid; gap: 2px; }
.list-heading strong { font-size: 0.95rem; }
.list-heading span,
.person small,
.entry small {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}
.btn.compact { padding: 7px 10px; font-size: 0.78rem; }
.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: stretch;
}
.person,
.entry {
  width: 100%;
  grid-template-columns: 52px minmax(0, 1fr) 8px;
  padding: 7px;
  color: var(--text);
  background: rgba(13, 23, 40, 0.34);
}
.person:hover,
.entry:hover { background: rgba(196, 154, 126, 0.08); }
.person.active,
.entry.active {
  border-color: var(--copper);
  background: rgba(196, 154, 126, 0.1);
}
.person > span,
.entry > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.person strong,
.entry strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}
.person img,
.entry img { width: 52px; height: 52px; }
.status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #65c48d;
}
.status.off { background: #b86767; }
.list-order { display: grid; gap: 4px; }
.list-order button {
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 28px;
  padding: 0;
  color: var(--muted);
  border: 1px solid rgba(196, 154, 126, 0.16);
  border-radius: 7px;
  background: rgba(13, 23, 40, 0.5);
}
.list-order button:hover { color: var(--text); border-color: var(--copper); }
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.check-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px 14px;
  color: var(--text);
  border: 1px solid rgba(196, 154, 126, 0.2);
  border-radius: 10px;
  background: rgba(13, 23, 40, 0.36);
}
.check-option input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--copper);
  box-shadow: none;
}
.check-option span { display: grid; gap: 3px; }
.check-option strong { font-size: 0.88rem; }
.check-option small { color: var(--muted); font-size: 0.75rem; }
.editor > .thumb {
  width: 100px;
  height: 120px;
  border: 1px solid var(--line);
}
.danger-zone {
  justify-content: flex-end;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid rgba(196, 154, 126, 0.12);
}
.gallery { gap: 12px; }
.gallery img {
  width: 132px;
  height: 92px;
  border: 1px solid var(--line);
}
.gallery button {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
}
input[type="file"]::file-selector-button {
  margin: -10px 12px -10px -12px;
  padding: 10px 14px;
  color: #1a120e;
  font-weight: 700;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--copper);
  cursor: pointer;
}
@media (max-width: 900px) {
  .topbar { position: static; }
  .tabs { position: static; }
  .layout { grid-template-columns: 1fr; }
  .list-card { position: static; max-height: none; }
}
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar .actions { width: 100%; }
  .topbar .actions > * { flex: 1; text-align: center; }
  .tabs { overflow-x: auto; padding-inline: 14px !important; }
  .layout { padding-inline: 14px; }
  .row, .option-grid { grid-template-columns: 1fr; }
  .editor { padding: 18px; }
}

/* Lead inbox */
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  padding: 0 6px;
  color: #1a120e;
  font-size: 0.7rem;
  border-radius: 999px;
  background: var(--copper);
}
.tabs button.active .tab-count { background: #0d1728; color: var(--text); }
.tab-count.empty { opacity: 0.5; }
.lead-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 8px;
  padding-bottom: 4px;
}
.lead-tools input,
.lead-tools select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.78rem;
}
.lead-list { display: grid; gap: 7px; }
.lead-entry {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px;
  color: var(--text);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(13, 23, 40, 0.34);
}
.lead-entry:hover { background: rgba(196, 154, 126, 0.08); }
.lead-entry.active {
  border-color: var(--copper);
  background: rgba(196, 154, 126, 0.1);
}
.lead-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #1a120e;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50%;
  background: linear-gradient(145deg, #d6ad91, #a9795d);
}
.lead-summary {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.lead-summary strong,
.lead-summary small,
.lead-summary time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead-summary strong { font-size: 0.84rem; }
.lead-summary small,
.lead-summary time { color: var(--muted); font-size: 0.7rem; }
.lead-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 4px 7px;
  color: #dbe7f9;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 700;
  border: 1px solid rgba(157, 183, 219, 0.35);
  border-radius: 999px;
  background: rgba(81, 119, 171, 0.18);
}
.lead-status.contacted {
  color: #f0dcb4;
  border-color: rgba(211, 171, 95, 0.4);
  background: rgba(173, 124, 42, 0.18);
}
.lead-status.qualified {
  color: #ccebd8;
  border-color: rgba(101, 196, 141, 0.4);
  background: rgba(60, 143, 95, 0.18);
}
.lead-status.closed {
  color: #cfced3;
  border-color: rgba(151, 149, 158, 0.35);
  background: rgba(111, 110, 117, 0.16);
}
.lead-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(196, 154, 126, 0.14);
}
.lead-head h2 { margin: 4px 0; }
.lead-head p { margin: 0; }
.eyebrow {
  color: var(--copper);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lead-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lead-contact-grid > * {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 13px 14px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(196, 154, 126, 0.16);
  border-radius: 10px;
  background: rgba(13, 23, 40, 0.32);
}
.lead-contact-grid > a:hover { border-color: var(--copper); }
.lead-contact-grid span { color: var(--muted); font-size: 0.72rem; }
.lead-contact-grid strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}
.lead-actions {
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid rgba(196, 154, 126, 0.14);
}
.empty-state,
.empty-editor {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 40px 16px;
  color: var(--muted);
  text-align: center;
}
.empty-state span { font-size: 0.75rem; }
.empty-editor { min-height: 360px; }
.empty-editor > span { color: var(--copper); font-size: 2.5rem; }
.empty-editor h2,
.empty-editor p { margin: 0; }
@media (max-width: 620px) {
  .lead-tools,
  .lead-contact-grid { grid-template-columns: 1fr; }
  .lead-entry { grid-template-columns: 42px minmax(0, 1fr); }
  .lead-entry .lead-status { grid-column: 2; }
}
