:root {
  --navy: #0f1f3d;
  --navy-2: #16294e;
  --blue: #2d6cdf;
  --blue-dark: #1f56c2;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e3e7ef;
  --text: #1c2536;
  --text-muted: #6b7488;
  --green: #1a9e6b;
  --red: #d9455f;
  --amber: #c9860e;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top nav ---- */
.topnav {
  background: var(--navy);
  color: #cfd8ef;
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav .brand {
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
  margin-right: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.topnav .brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--blue);
  display: inline-block;
}
.topnav nav { display: flex; gap: 4px; flex: 1; }
.topnav nav a, .topnav nav .navdrop {
  color: #b9c3dd;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
}
.topnav nav a:hover, .topnav nav .navdrop:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.topnav nav a.active { background: rgba(45,108,223,0.25); color: #fff; }
.topnav .right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topnav .account-pill {
  background: rgba(255,255,255,0.08);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  color: #dbe2f5;
  display: flex; align-items: center; gap: 6px;
}
.topnav .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.navdrop-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,0.18);
  padding: 8px;
  min-width: 190px;
  margin-top: 4px;
}
.navdrop:hover .navdrop-menu, .navdrop-menu:hover { display: block; }
.navdrop-menu a {
  display: block;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
}
.navdrop-menu a:hover { background: var(--bg); text-decoration: none; }
.navdrop-menu .grp-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); padding: 6px 10px 2px; letter-spacing: 0.4px; }

.user-menu { position: relative; }
.user-menu-list {
  display: none;
  position: absolute;
  top: 40px; right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,0.18);
  padding: 6px;
  min-width: 170px;
  z-index: 50;
}
.user-menu.open .user-menu-list { display: block; }
.user-menu-list a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.user-menu-list a:hover { background: var(--bg); text-decoration: none; }

/* ---- Layout ---- */
.app-body { display: flex; min-height: calc(100vh - 54px); }
.sidebar {
  width: 190px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 18px 0;
  flex-shrink: 0;
}
.sidebar .grp { padding: 4px 18px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 14px; }
.sidebar .grp:first-child { margin-top: 0; }
.sidebar a {
  display: flex; align-items: center;
  padding: 9px 18px;
  color: var(--text);
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { color: var(--blue); background: #eaf1fd; border-left-color: var(--blue); font-weight: 600; }
.main { flex: 1; padding: 22px 26px; min-width: 0; }
.main.full { padding: 0; }

/* ---- Cards / panels ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.panel-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 18px; }
.page-sub { color: var(--text-muted); font-size: 13px; margin: -12px 0 18px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-card .label { color: var(--text-muted); font-size: 12.5px; margin-bottom: 8px; }
.kpi-card .value { font-size: 24px; font-weight: 700; }
.kpi-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-danger { color: var(--red); border-color: var(--red); background: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.data th {
  text-align: left; padding: 10px 14px; background: #f8f9fc;
  color: var(--text-muted); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfe; }
.empty-row td { text-align: center; color: var(--text-muted); padding: 40px 14px; white-space: normal; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-active { background: #e5f7ee; color: var(--green); }
.badge-active .dot { background: var(--green); }
.badge-paused { background: #f1f2f5; color: var(--text-muted); }
.badge-paused .dot { background: var(--text-muted); }
.badge-draft { background: #eef1f8; color: #5a6484; }
.badge-draft .dot { background: #5a6484; }
.badge-warn { background: #fdf1e3; color: var(--amber); }
.badge-warn .dot { background: var(--amber); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 10px 4px; margin-right: 22px; color: var(--text-muted); font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---- Toolbar / filters ---- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=url], input[type=password], select, textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,108,223,0.12); }
label.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.field .hint { color: var(--text-muted); font-size: 12px; margin-top: 5px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

/* ---- Segmented control ---- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--blue); color: #fff; }

/* ---- Objective cards ---- */
.obj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.obj-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; background: #fff; }
.obj-card:hover { border-color: #b7c6ef; }
.obj-card.selected { border-color: var(--blue); background: #f2f7ff; }
.obj-card .icon { width: 34px; height: 34px; border-radius: 8px; background: #eaf1fd; color: var(--blue); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 16px; }
.obj-card .name { font-weight: 700; margin-bottom: 4px; }
.obj-card .desc { font-size: 12px; color: var(--text-muted); }

/* ---- Wizard ---- */
.wizard { display: flex; gap: 22px; align-items: flex-start; }
.wizard-steps { width: 210px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 0; box-shadow: var(--shadow); }
.wizard-steps .step-group { padding: 8px 18px; font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.wizard-steps .step-num { width: 20px; height: 20px; border-radius: 50%; background: var(--border); color: var(--text-muted); font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wizard-steps .step-group.done .step-num { background: var(--green); color: #fff; }
.wizard-steps .step-group.current .step-num { background: var(--blue); color: #fff; }
.wizard-steps .substep { display: block; padding: 6px 18px 6px 46px; font-size: 13px; color: var(--text-muted); }
.wizard-steps .substep.current { color: var(--blue); font-weight: 600; }
.wizard-main { flex: 1; min-width: 0; }
.wizard-panel { display: flex; gap: 20px; align-items: flex-start; }
.wizard-form { flex: 1; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.wizard-preview { width: 260px; flex-shrink: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.section-title { font-size: 14px; font-weight: 700; margin: 26px 0 14px; }
.section-title:first-child { margin-top: 0; }
.wizard-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }

/* phone preview */
.phone-frame { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #f4f6fa; }
.phone-frame .status-bar { background: #fff; padding: 6px 10px; font-size: 10px; color: var(--text-muted); }
.creative-slot { border: 1px dashed var(--border); border-radius: 8px; text-align: center; padding: 26px 10px; color: var(--text-muted); font-size: 12.5px; cursor: pointer; background: #fafbfe; }
.creative-slot:hover { border-color: var(--blue); color: var(--blue); }
.ad-preview-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.12); margin: 10px; }
.ad-preview-card img { width: 100%; display: block; }
.ad-preview-card .ap-body { padding: 8px 10px; }
.ad-preview-card .ap-title { font-weight: 700; font-size: 12.5px; }
.ad-preview-card .ap-desc { font-size: 11px; color: var(--text-muted); }
.ad-preview-card .ap-cta { background: var(--blue); color: #fff; text-align: center; padding: 8px; font-size: 12px; font-weight: 700; }

/* ---- Multi-select audience picker ---- */
.dual-pane { display: flex; gap: 14px; }
.dual-pane .pane { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 10px; height: 220px; overflow-y: auto; }
.dual-pane .pane-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.dual-pane .row { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; font-size: 13px; border-bottom: 1px solid #f2f3f7; }
.dual-pane .row:last-child { border-bottom: none; }
.dual-pane .row a { font-size: 12px; }
.dual-pane .chip { display: inline-flex; align-items: center; gap: 6px; background: #eaf1fd; color: var(--blue-dark); padding: 4px 9px; border-radius: 20px; font-size: 12.5px; }
.dual-pane .chip button { border: none; background: none; color: var(--blue-dark); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }

/* ---- Modal (columns picker) ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,0.45); display: none; align-items: center; justify-content: center; z-index: 200; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 10px; width: 640px; max-width: 92vw; max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; }
.modal-head .x { cursor: pointer; color: var(--text-muted); font-size: 18px; }
.modal-body { padding: 16px 20px; overflow-y: auto; display: flex; gap: 16px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.col-pane { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.col-pane .cp-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.col-pane .cp-list { max-height: 320px; overflow-y: auto; }
.col-pane label { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 13px; cursor: pointer; }
.col-pane .cp-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 2px; font-size: 13px; }
.col-pane .cp-row .rm { cursor: pointer; color: var(--text-muted); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }

/* ---- Placeholder page ---- */
.placeholder-panel { text-align: center; padding: 70px 30px; color: var(--text-muted); }
.placeholder-panel h3 { color: var(--text); margin-bottom: 8px; }
.coming-badge { display: inline-block; background: #eaf1fd; color: var(--blue-dark); font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; margin-bottom: 14px; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f1f3d, #16294e 60%, #1c3563); }
.login-card { background: #fff; border-radius: 12px; padding: 36px 34px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card .brand { text-align: center; font-weight: 700; font-size: 20px; margin-bottom: 4px; color: var(--navy); }
.login-card .tagline { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 16px; }
.login-card input { width: 100%; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }
.login-error { background: #fdecec; color: var(--red); padding: 9px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.login-hint { margin-top: 18px; font-size: 11.5px; color: var(--text-muted); text-align: center; }

/* ---- Alerts ---- */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13.5px; margin-bottom: 16px; }
.alert-success { background: #e5f7ee; color: var(--green); }
.alert-error { background: #fdecec; color: var(--red); }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-row input { width: auto; }

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.small { font-size: 12px; }
.char-count { text-align: right; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .wizard { flex-direction: column; }
  .wizard-steps { width: 100%; }
  .wizard-panel { flex-direction: column; }
  .wizard-preview { width: 100%; }
}
