/* =====================================================================
   LUXORA CRM — Admin design system
   Aesthetic: modern SaaS CRM in the same fashion palette as the website
   ===================================================================== */

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #241b30;
  --ink-soft: #5f566e;
  --muted: #8b8199;
  --line: #e9e2d8;
  --plum: #7d4a68;
  --plum-deep: #5e3247;
  --plum-soft: #f3e2e6;
  --gold: #b8922e;
  --gold-soft: #f0e3c0;
  --teal: #2e7d6b;
  --teal-soft: #e2efeb;
  --blue: #4f6db2;
  --blue-soft: #e7ecf7;
  --red: #b24f4f;
  --red-soft: #f7e5e5;
  --shadow: 0 6px 18px rgba(52, 32, 46, .07);
  --shadow-lg: 0 18px 44px rgba(52, 32, 46, .13);
  --radius: 16px;
  --font: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

/* ---------------- layout ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  background: linear-gradient(180deg, #2c1830 0%, var(--plum-deep) 100%);
  color: #d9bccb; display: flex; flex-direction: column;
  transition: transform .25s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--gold-soft);
  color: var(--plum-deep); display: grid; place-items: center;
  font-family: var(--font-display); font-style: italic; font-size: 20px;
}
.sidebar-brand b { color: #fff; font-size: 15.5px; display: block; }
.sidebar-brand small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.sidebar-nav .sec {
  font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.38); margin: 18px 10px 6px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9.5px 12px;
  border-radius: 11px; font-size: 14px; font-weight: 600; margin-bottom: 2px;
  color: #e3ccd6; transition: all .16s;
}
.sidebar-nav a .ico { width: 20px; text-align: center; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: var(--gold); color: #2c1830; }
.sidebar-nav a.active .ico { opacity: 1; }
.sidebar-nav a .pill {
  margin-left: auto; background: rgba(255,255,255,.16); border-radius: 999px;
  font-size: 11px; font-weight: 800; padding: 2px 8px; min-width: 22px; text-align: center;
}
.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .ava { width: 36px; height: 36px; border-radius: 50%; background: var(--gold-soft); color: var(--plum-deep); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.sidebar-user b { color: #fff; font-size: 13.5px; display: block; }
.sidebar-user small { font-size: 11px; opacity: .6; text-transform: capitalize; }
.sidebar-user .out { margin-left: auto; color: #e3ccd6; font-size: 17px; opacity: .7; }
.sidebar-user .out:hover { opacity: 1; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246,243,238,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 14px 28px;
}
.topbar h1 { font-size: 19px; }
.topbar .crumb { font-size: 12px; color: var(--muted); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.content { padding: 26px 28px 60px; flex: 1; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink); }

/* ---------------- cards / kpis ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px 0; }
.card-head h3 { font-size: 15.5px; }
.card-head .hint { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after { content: ''; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; border-radius: 50%; background: var(--plum-soft); opacity: .5; }
.kpi .k-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.kpi .k-value { font-size: 27px; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.kpi .k-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.kpi .k-ico { position: absolute; right: 16px; top: 16px; font-size: 21px; z-index: 1; }
.kpi.k-plum::after { background: var(--plum-soft); }
.kpi.k-gold::after { background: var(--gold-soft); }
.kpi.k-teal::after { background: var(--teal-soft); }
.kpi.k-blue::after { background: var(--blue-soft); }
.kpi.k-red::after  { background: var(--red-soft); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-31 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-13 { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; }
.mb { margin-bottom: 18px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9.5px 18px; border-radius: 11px; border: 1.5px solid transparent;
  font-family: var(--font); font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: all .16s; white-space: nowrap;
}
.btn-primary { background: var(--plum-deep); color: #fff; }
.btn-primary:hover { background: var(--plum); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--plum); color: var(--plum-deep); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--plum-soft); color: var(--plum-deep); }
.btn-wa { background: #1faa53; color: #fff; }
.btn-wa:hover { background: #179046; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #f0d4d4; }
.btn-sm { padding: 6.5px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- badges / tags ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 800; padding: 3.5px 10px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-plum  { background: var(--plum-soft); color: var(--plum-deep); }
.badge-gold  { background: var(--gold-soft); color: #7a5c14; }
.badge-teal  { background: var(--teal-soft); color: var(--teal); }
.badge-blue  { background: var(--blue-soft); color: var(--blue); }
.badge-red   { background: var(--red-soft); color: var(--red); }
.badge-gray  { background: #eee9e1; color: var(--ink-soft); }
.tag {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; color: #fff; margin: 2px 3px 2px 0;
}

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 800; padding: 12px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1ece3; vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #faf6f0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions a, .table .actions button { margin-left: 6px; }

/* ---------------- forms ---------------- */
label.form-label { display: block; font-size: 12.5px; font-weight: 700; margin: 0 0 6px; color: var(--ink-soft); }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 9.5px 13px; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: var(--font); font-size: 14px; background: #fbf9f5; color: var(--ink); transition: border .15s;
}
.form-control:focus { outline: none; border-color: var(--plum); background: #fff; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.search-input { min-width: 220px; }

/* ---------------- filters ---------------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.filter-bar .form-control { width: auto; min-width: 140px; }
.filter-bar label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------- customer rows / avatars ---------------- */
.cust-cell { display: flex; align-items: center; gap: 11px; }
.ava {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0;
}
.ava-lg { width: 62px; height: 62px; font-size: 22px; border-radius: 20px; }
.cust-cell b { display: block; font-size: 14px; }
.cust-cell small { color: var(--muted); font-size: 12px; }

/* ---------------- timeline ---------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item::before {
  content: ''; position: absolute; left: -24px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 3px solid var(--plum);
}
.tl-item.tl-purchase::before { border-color: var(--teal); }
.tl-item.tl-campaign::before { border-color: var(--gold); }
.tl-item.tl-enquiry::before { border-color: var(--blue); }
.tl-item.tl-note::before { border-color: #b9a8d0; }
.tl-item.tl-call::before, .tl-item.tl-whatsapp::before { border-color: #1faa53; }
.tl-item.tl-followup::before { border-color: #d9832e; }
.tl-time { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tl-title { font-weight: 700; font-size: 14px; margin: 2px 0; }
.tl-details { color: var(--ink-soft); font-size: 13px; }

/* ---------------- misc ---------------- */
.stat-line { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-size: 14.5px; }
.progress { height: 7px; background: #efe9df; border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--plum); border-radius: 99px; }
.progress i.gold { background: var(--gold); }
.progress i.teal { background: var(--teal); }

.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-state .ico { font-size: 38px; margin-bottom: 8px; }
.empty-state b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 3px; }

.alert {
  display: flex; gap: 11px; align-items: flex-start;
  border-radius: 12px; padding: 12px 15px; margin: 0 0 16px; font-size: 13.5px;
  border: 1px solid transparent;
}
.alert-icon { font-weight: 800; }
.alert-success { background: #e7f3ec; color: #1e6b46; border-color: #bfe0cd; }
.alert-error   { background: #f9e7e7; color: #8a3b3b; border-color: #e5c3c3; }
.alert-warning { background: #fdf3e2; color: #8a6414; border-color: #ecd9ac; }
.alert-info    { background: #e7eef9; color: #2e4f8a; border-color: #c3d5ec; }
.alert-close { margin-left: auto; background: none; border: 0; font-size: 17px; cursor: pointer; color: inherit; opacity: .6; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.page-btn {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: #fff; border: 1.5px solid var(--line); color: var(--ink-soft);
}
.page-btn:hover { border-color: var(--plum); color: var(--plum-deep); }
.page-btn.active { background: var(--plum-deep); border-color: var(--plum-deep); color: #fff; }
.page-ellipsis { align-self: center; color: var(--muted); }

.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(36, 27, 48, .5); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 18px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--bg); border-radius: 20px; width: 100%; max-width: 640px;
  max-height: 92vh; overflow: auto; padding: 24px; position: relative;
  box-shadow: var(--shadow-lg); animation: modalIn .2s ease;
}
.modal-card.modal-lg { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 12px; right: 14px; width: 32px; height: 32px;
  border-radius: 50%; border: 0; background: var(--plum-soft); font-size: 18px;
  cursor: pointer; color: var(--plum-deep);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 999px; border: 1.5px solid var(--line); background: #fff;
  font-size: 12px; font-weight: 700; color: var(--ink-soft); cursor: pointer; transition: all .14s;
}
.chip:hover { border-color: var(--plum); color: var(--plum-deep); }
.chip-active { background: var(--plum-deep); border-color: var(--plum-deep); color: #fff; }

.action-tile {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  transition: all .16s; margin-bottom: 10px;
}
.action-tile:hover { border-color: var(--plum); transform: translateX(3px); }
.action-tile .at-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.action-tile b { display: block; font-size: 13.5px; }
.action-tile small { color: var(--muted); font-size: 12px; }
.action-tile .at-right { margin-left: auto; color: var(--muted); }

.campaign-wa-card {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 16px;
  display: flex; gap: 13px; align-items: center; background: #fff; margin-bottom: 10px;
}
.campaign-wa-card.sent { background: #f2f8f4; border-color: #cfe5d8; }
.campaign-wa-card .cw-ava { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.campaign-wa-card b { display: block; font-size: 14px; }
.campaign-wa-card small { color: var(--muted); font-size: 12.5px; display: block; }
.campaign-wa-card .cw-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }

.mini-chart { display: flex; align-items: flex-end; gap: 5px; height: 110px; padding-top: 8px; }
.mini-chart .bar { flex: 1; background: var(--plum); border-radius: 6px 6px 0 0; min-height: 4px; opacity: .85; position: relative; }
.mini-chart .bar:hover { opacity: 1; }
.mini-chart .bar span { display: none; }
.mini-chart-x { display: flex; gap: 5px; margin-top: 6px; }
.mini-chart-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); font-weight: 700; }

.hbar-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 9px; font-size: 13px; }
.hbar-row .hb-label { font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .hb-track { height: 9px; background: #efe9df; border-radius: 99px; overflow: hidden; }
.hbar-row .hb-fill { height: 100%; background: var(--plum); border-radius: 99px; }
.hbar-row .hb-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* login page */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(140deg, #f6f3ee 60%, #f3e2e6 100%); }
.login-card { width: 100%; max-width: 420px; }
.login-card .card-pad { padding: 34px; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .brand-mark {
  width: 56px; height: 56px; border-radius: 18px; background: var(--plum-deep); color: var(--gold-soft);
  display: inline-grid; place-items: center; font-family: var(--font-display); font-style: italic; font-size: 28px;
}
.login-brand h1 { font-family: var(--font-display); font-weight: 500; font-size: 26px; margin-top: 14px; }
.login-brand p { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }

/* responsive */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-31, .grid-13 { grid-template-columns: 1fr; }
  .form-row-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 18px 14px 50px; }
  .topbar { padding: 12px 14px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .kpi .k-value { font-size: 23px; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .k-value { font-size: 20px; }
  .form-row-4 { grid-template-columns: 1fr; }
}
