/* ── Base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  min-height: 100vh;
}
body.login-body { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0a1628 0%,#1a2f4a 100%); }

/* ── Layout ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 230px;
  background: #0a1628;
  display: flex; flex-direction: column;
  z-index: 100; transition: transform .25s;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 18px 18px;
  color: #c9a84c;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand i { font-size: 20px; }
.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: rgba(255,255,255,.65); font-size: 13.5px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: all .18s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item i { width: 16px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(201,168,76,.15); color: #c9a84c; }
.nav-item.sub { padding-left: 24px; font-size: 13px; }
.nav-divider {
  padding: 10px 12px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  border-top: 1px solid rgba(255,255,255,.07); margin-top: 6px;
}
.sidebar-foot { padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.07); }

.main-wrap { margin-left: 230px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: #6b7280; margin-right: 14px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: #6b7280; display: flex; align-items: center; gap: 6px; }
.page-body { padding: 24px; flex: 1; }

/* ── Page Header ───────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #0a1628; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.page-header h1 i { color: #c9a84c; }
.page-sub { font-size: 13px; color: #6b7280; margin-top: 3px; display: flex; align-items: center; gap: 8px; }
.breadcrumb { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #6b7280; text-decoration: none; margin-bottom: 4px; }
.breadcrumb:hover { color: #c9a84c; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; background: #fafafa; }
.card-head h3 { font-size: 14px; font-weight: 600; color: #0a1628; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h3 i { color: #c9a84c; }
.card-body { padding: 20px; }

/* ── Stats ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px 20px; display: flex; align-items: center; gap: 16px; border-top: 3px solid #c9a84c; }
.stat-icon { font-size: 24px; opacity: .8; }
.stat-val  { font-size: 26px; font-weight: 700; color: #0a1628; line-height: 1; }
.stat-lbl  { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #6b7280; margin-top: 3px; }
.stat-sub  { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid #e5e7eb; background: #fff; color: #1f2937;
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: all .18s; line-height: 1.4; font-family: inherit;
}
.btn:hover        { border-color: #c9a84c; background: #fffbee; color: #0a1628; }
.btn.primary      { background: #0a1628; color: #fff; border-color: #0a1628; }
.btn.primary:hover{ background: #0f1f38; }
.btn.accent       { background: linear-gradient(135deg,#c9a84c,#e8c878); color: #0a1628; border: none; font-weight: 600; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.danger       { color: #dc2626; border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm           { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.active       { background: #0a1628; color: #fff; border-color: #0a1628; }
.btn:disabled     { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.full         { width: 100%; justify-content: center; }

.icon-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 5px 7px; border-radius: 6px; color: #6b7280; line-height: 1; transition: all .15s; }
.icon-btn:hover { background: #f3f4f6; color: #1f2937; }
.icon-btn.danger:hover { background: #fee2e2; color: #dc2626; }

/* ── Toggle ────────────────────────────────────────────────────────────── */
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-sl { position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; cursor: pointer; transition: .2s; }
.toggle-sl::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-sl { background: #c9a84c; }
.toggle input:checked + .toggle-sl::before { transform: translateX(16px); }

/* ── Fields ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: #6b7280; letter-spacing: .8px; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid #e5e7eb; border-radius: 8px;
  font-family: inherit; font-size: 14px; color: #1f2937;
  outline: none; transition: border-color .18s; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #c9a84c; box-shadow: 0 0 0 3px rgba(201,168,76,.15); }
.field textarea { resize: vertical; min-height: 80px; }
.hint { font-size: 12px; color: #9ca3af; line-height: 1.5; display: flex; align-items: flex-start; gap: 5px; }
.hint i { margin-top: 2px; flex-shrink: 0; }

/* ── Grid helpers ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.toolbar { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 13px; }
.search-wrap input { padding-left: 32px; width: 220px; border: 1.5px solid #e5e7eb; border-radius: 8px; padding-top: 8px; padding-bottom: 8px; font-family: inherit; font-size: 13px; outline: none; transition: border-color .18s; }
.search-wrap input:focus { border-color: #c9a84c; }
.date-inp { border: 1.5px solid #e5e7eb; border-radius: 8px; padding: 7px 10px; font-family: inherit; font-size: 13px; outline: none; width: 130px; cursor: pointer; }
.date-inp:focus { border-color: #c9a84c; }
.form-select { border: 1.5px solid #e5e7eb; border-radius: 8px; padding: 7px 12px; font-size: 13px; outline: none; background: #fff; font-family: inherit; }

/* ── Table ─────────────────────────────────────────────────────────────── */
.table-wrap { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden; }
.table-head { padding: 14px 18px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; }
.table-head h3 { font-size: 15px; font-weight: 600; color: #0a1628; margin: 0; }
.data-tbl { width: 100%; border-collapse: collapse; }
.data-tbl thead tr { background: #f9fafb; }
.data-tbl th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #6b7280; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
.data-tbl td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.data-tbl tr:last-child td { border-bottom: none; }
.data-tbl tbody tr:hover td { background: #fafafa; }
.td-sm { font-size: 12px !important; }
.td-md { color: #6b7280; }
.empty-row { text-align: center; padding: 40px !important; color: #9ca3af; font-size: 14px; }
.empty-row i { margin-right: 6px; }
#leads-body td strong{ text-transform: capitalize;}

/* ── New lead highlight ────────────────────────────────────────────────── */
.row-new { background: linear-gradient(90deg,rgba(5,150,105,.05),transparent) !important; }
.row-new td { border-left: 3px solid #059669; }
.row-new td:not(:first-child) { border-left: none; }
.row-new td:first-child { border-left: 3px solid #059669; }

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.blue  { background: #dbeafe; color: #1e40af; }
.badge.gold  { background: #fef3c7; color: #92400e; }
.badge.gray  { background: #f3f4f6; color: #6b7280; }
.badge.green { background: #d1fae5; color: #065f46; }
.badge.red   { background: #fee2e2; color: #991b1b; }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid #e5e7eb; }
.pager-info { font-size: 13px; color: #6b7280; }
.pager-btns { display: flex; gap: 4px; }
.pg-btn { padding: 5px 10px; border: 1.5px solid #e5e7eb; border-radius: 7px; background: #fff; font-size: 13px; cursor: pointer; transition: all .18s; font-family: inherit; }
.pg-btn:hover:not(:disabled) { border-color: #c9a84c; background: #fffbee; }
.pg-btn.active { background: #0a1628; color: #fff; border-color: #0a1628; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; background: #0a1628; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px; z-index: 99999; transform: translateY(60px); opacity: 0; transition: all .3s; box-shadow: 0 6px 24px rgba(0,0,0,.2); pointer-events: none; display: flex; align-items: center; gap: 8px; }
#toast.show { transform: translateY(0); opacity: 1; }
#toast.ok  { background: #059669; }
#toast.err { background: #dc2626; }
#toast.warn{ background: #f59e0b; }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(10,22,40,.55); z-index: 100000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; animation: modalUp .22s ease both; }
@keyframes modalUp { from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)} }
.modal-head { padding: 20px 22px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 18px; font-weight: 600; color: #0a1628; display: flex; align-items: center; gap: 8px;text-transform: capitalize; }
.modal-head h3 i { color: #c9a84c; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #6b7280; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: #f3f4f6; color: #1f2937; }
.modal-body { padding: 18px 22px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; justify-content: flex-end; }

/* ── Alert ─────────────────────────────────────────────────────────────── */
.alert { border-radius: 9px; padding: 11px 15px; font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert.ok  { background: #d1fae5; border: 1px solid #6ee7b7; color: #065f46; }
.alert.err { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }

/* ── Color row ─────────────────────────────────────────────────────────── */
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type=color] { width: 50px; height: 42px; border: 1.5px solid #e5e7eb; border-radius: 8px; padding: 3px; cursor: pointer; background: #fff; }
.hex-out { font-size: 13px; color: #6b7280; font-family: monospace; }
.color-pick { cursor: pointer; }

/* ── Upload ────────────────────────────────────────────────────────────── */
.upload-label { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1.5px dashed #c9a84c; border-radius: 8px; cursor: pointer; font-size: 13px; color: #c9a84c; font-weight: 500; transition: all .18s; }
.upload-label:hover { background: #fffbee; }
.upload-label input[type=file] { display: none; }

/* ── Forms grid ────────────────────────────────────────────────────────── */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(320px,1fr)); gap: 18px; }
.form-card { background: #fff; border: 1.5px solid #e5e7eb; border-radius: 16px; overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.form-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); border-color: #c9a84c; }
.form-card-head { background: linear-gradient(135deg,#0a1628,#1a2f4a); padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.form-card-name { color: #c9a84c; font-family: 'Playfair Display',Georgia,serif; font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.shortcode-tag { font-size: 11px; color: rgba(255,255,255,.4); font-family: monospace; }
.form-card-body { padding: 16px 20px; }
.form-stats { display: flex; gap: 16px; margin-bottom: 14px; align-items: center; }
.form-stat-num { font-size: 22px; font-weight: 700; color: #0a1628; line-height: 1; }
.form-stat-lbl { font-size: 11px; color: #6b7280; margin-top: 2px; }
.form-actions, .form-actions2 { display: flex; gap: 6px; flex-wrap: wrap; }
.form-actions2 { margin-top: 8px; padding-top: 8px; border-top: 1px solid #f3f4f6; }
.empty-state { text-align: center; padding: 60px 20px; background: #fff; border-radius: 16px; border: 1.5px dashed #e5e7eb; }
.empty-state h3 { color: #0a1628; margin-bottom: 8px; font-size: 18px; }
.empty-state p  { color: #6b7280; margin-bottom: 20px; font-size: 14px; }

/* ── Builder ───────────────────────────────────────────────────────────── */
.builder-grid { display: grid; grid-template-columns: 1fr 290px; gap: 22px; align-items: start; }
.builder-sidebar .card { position: sticky; top: 80px; }
.step-card { background: #fff; border: 1.5px solid #e5e7eb; border-radius: 12px; overflow: hidden; margin-bottom: 8px; transition: box-shadow .2s; }
.step-card.inactive { opacity: .55; }
.step-card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; user-select: none; background: #fafafa; border-bottom: 1px solid transparent; }
.step-card-head:hover { background: #f5f5f5; }
.step-card.open .step-card-head { border-bottom-color: #e5e7eb; background: #fff; }
.drag-handle { cursor: grab; color: #9ca3af; font-size: 15px; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg,#c9a84c,#e8c878); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #0a1628; flex-shrink: 0; }
.step-meta { flex: 1; min-width: 0; }
.step-meta h4 { font-size: 14px; font-weight: 500; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.step-meta span { font-size: 11px; color: #6b7280; }
.step-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.step-body { display: none; padding: 16px; }
.step-card.open .step-body { display: block; }
.opts-section { margin-bottom: 14px; }
.opts-header { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #6b7280; margin-bottom: 8px; }
.opts-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; min-height: 6px; }
.opt-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #f9fafb; border: 1.5px solid #e5e7eb; border-radius: 8px; transition: border-color .18s; }
.opt-row:hover { border-color: #c9a84c; }
.opt-row.inactive { opacity: .5; }
.opt-drag { cursor: grab; color: #9ca3af; font-size: 13px; }
.opt-label-inp { flex: 1; border: 1.5px solid #e5e7eb; border-radius: 6px; padding: 5px 8px; font-family: inherit; font-size: 13px; outline: none; transition: border-color .18s; }
.opt-label-inp:focus { border-color: #c9a84c; }
.add-opt-row { display: flex; align-items: center; gap: 8px; }
.type-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.type-pill { padding: 5px 12px; border: 1.5px solid #e5e7eb; border-radius: 999px; font-size: 12px; cursor: pointer; transition: all .18s; display: inline-flex; align-items: center; gap: 5px; font-family: inherit; background: #fff; color: #6b7280; }
.type-pill:hover, .type-pill.sel { border-color: #c9a84c; background: #fffbee; color: #0a1628; font-weight: 500; }

/* ── Icon picker ───────────────────────────────────────────────────────── */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(44px,1fr)); gap: 4px; max-height: 380px; overflow-y: auto; }
.icon-cell { border: 1.5px solid #e5e7eb; border-radius: 7px; padding: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; color: #4b5563; transition: all .15s; background: #fff; }
.icon-cell:hover { border-color: #c9a84c; background: #fffbee; color: #c9a84c; }
.icon-tab-btn { padding: 4px 12px; border: 1.5px solid #e5e7eb; border-radius: 999px; font-size: 12px; cursor: pointer; background: #fff; color: #6b7280; font-family: inherit; transition: all .15s; }
.icon-tab-btn:hover, .icon-tab-btn.active { border-color: #c9a84c; background: #fffbee; color: #0a1628; font-weight: 600; }
#icon-search { border: 1.5px solid #e5e7eb; border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: 14px; outline: none; transition: border-color .18s; }
#icon-search:focus { border-color: #c9a84c; }

/* ── Settings tabs ─────────────────────────────────────────────────────── */
.settings-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; }
.tab-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; background: #fff; color: #6b7280; font-family: inherit; transition: all .18s; }
.tab-btn:hover { border-color: #c9a84c; background: #fffbee; color: #0a1628; }
.tab-btn.active { background: #0a1628; color: #fff; border-color: #0a1628; }
.tab-btn.active i { color: #c9a84c; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-box { background: #fff; border-radius: 20px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-family: 'Playfair Display',Georgia,serif; font-size: 22px; color: #0a1628; margin: 10px 0 4px; }
.login-logo p  { font-size: 13px; color: #6b7280; }
.login-logo img{width: 50px;}
/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .settings-row { grid-template-columns: 1fr; }
  .builder-grid { grid-template-columns: 1fr; }
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .grid-2       { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .forms-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { justify-content: flex-start; }
  .page-header { flex-direction: column; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-body  { padding: 14px; }
}
