@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700;800&display=swap');

:root {
  --orange: #f26522;
  --orange-dark: #c8541a;
  --taupe: #9c867a;
  --taupe-dark: #817065;
  --blue-light: #bfccd3;
  --purple: #852882;
  --purple-dark: #701b6e;
  --sky: #89d0f4;
  --steel: #70aecc;
  --slate: #47555b;
  --google: #4285F4;
  --meta: #1877F2;
  --linkedin: #0A66C2;
  --bg: #f0f3f5;
  --card: #ffffff;
  --border: #e2e8ec;
  --text-primary: #2b3438;
  --text-secondary: #6b7c83;
  --text-light: #9aabb2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(71, 85, 91, 0.08), 0 4px 16px rgba(71, 85, 91, 0.07);
  --font: 'Proxima Nova', 'Nunito Sans', -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
}

/* ── LOGIN OVERLAY ── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-box {
  background: white;
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.login-logo {
  display: block;
  height: 40px;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 12px;
  color: var(--text-light);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 28px;
}

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  margin-bottom: 14px;
  box-sizing: border-box;
  transition: border-color 0.15s;
  outline: none;
  background: white;
  color: var(--text-primary);
}

.login-input::placeholder { color: var(--text-light); }

.login-input:focus {
  border-color: var(--orange);
}

.login-btn {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}

.login-btn:hover { background: var(--orange-dark); }
.login-btn:disabled { background: #ccc; cursor: not-allowed; }

.login-error {
  font-size: 12px;
  color: #b91c1c;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
}

.login-new-password { display: none; }

header {
  background: var(--slate);
  padding: 0 32px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 64px;
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--orange), var(--orange-dark));
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
}

.logo-img {
  height: 36px;
  width: auto;
  display: block;
}

.logo-sub {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
}

.header-pill strong {
  display: block;
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.roi-badge {
  background: var(--orange);
  color: white;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
}

.roi-badge .roi-num {
  font-size: 22px;
  font-weight: 800;
  display: block;
  letter-spacing: -0.5px;
  margin-top: 3px;
}

/* ── TOOLBAR ── */
.toolbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.platform-toggle {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.platform-toggle button {
  padding: 6px 16px;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.platform-toggle button.active {
  background: var(--card);
  color: var(--slate);
  box-shadow: 0 1px 4px rgba(71, 85, 91, 0.14);
}

.platform-toggle button.google.active {
  color: var(--google);
}

.platform-toggle button.meta.active {
  color: var(--meta);
}

.platform-toggle button.linkedin.active {
  color: var(--linkedin);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.period-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.period-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

.data-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff8f2;
  border: 1px solid #fddbb4;
  color: #a3540e;
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
}

.data-chip::before {
  content: '●';
  font-size: 7px;
  color: var(--orange);
}

.data-chip.live {
  background: #f0faf5;
  border-color: #a8dfc0;
  color: #157a45;
}

.data-chip.live::before {
  color: #1f9e56;
}

.data-chip.error {
  background: #fff0f0;
  border-color: #f5b8b8;
  color: #b91c1c;
}

.data-chip.error::before {
  color: #ef4444;
}

/* ── MAIN ── */
main {
  padding: 24px 32px 40px;
  max-width: 1320px;
  margin: 0 auto;
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
  margin-bottom: 12px;
  margin-top: 24px;
}

.section-label:first-child {
  margin-top: 0;
}

/* ── KPI GRID ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(71, 85, 91, 0.12);
}

.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-color, var(--orange));
  opacity: 0.65;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-bottom: 11px;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.kpi-value {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-delta {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #1f9e56;
}

.kpi-delta span {
  color: var(--text-light);
  font-weight: 400;
}

.kpi-card.featured {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
  border-color: transparent;
}

.kpi-card.featured .kpi-label {
  color: rgba(255, 255, 255, 0.7);
}

.kpi-card.featured .kpi-value {
  color: white;
}

.kpi-card.featured .kpi-delta {
  color: rgba(255, 255, 255, 0.85);
}

.kpi-card.featured .kpi-delta span {
  color: rgba(255, 255, 255, 0.6);
}

.kpi-card.featured::after {
  display: none;
}

.kpi-card.featured .kpi-icon {
  background: rgba(255, 255, 255, 0.18);
}

/* ── CHARTS ── */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
}

.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  margin-bottom: 18px;
}

/* ── PLATFORM SPLIT ── */
.platform-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.platform-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.platform-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.platform-badge {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: white;
}

.platform-badge.google {
  background: var(--google);
}

.pill.linkedin {
  background: #e8f0fb;
  color: #0A66C2;
}

.pill-dot.linkedin {
  background: #0A66C2;
}

.platform-badge.linkedin {
  background: #0A66C2;
}

.platform-badge.meta {
  background: var(--meta);
}

.platform-name {
  font-size: 14px;
  font-weight: 700;
}

.platform-spend {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
}

.platform-spend strong {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 700;
}

.platform-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  margin-bottom: 3px;
}

.stat-value {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.stat-value.orange {
  color: var(--orange);
}

.stat-value.purple {
  color: var(--purple);
}

.stat-value.google {
  color: var(--google);
}

.stat-value.meta {
  color: var(--meta);
}

.stat-value.green {
  color: #1f9e56;
}

/* ── TABLE ── */
.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.table-head-row {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-title {
  font-size: 13px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f7f9fa;
  padding: 9px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafbfc;
}

tbody td {
  padding: 12px 16px;
  vertical-align: middle;
}

.campaign-name {
  font-weight: 600;
}

.campaign-type {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.pill.google {
  background: #eaf0fe;
  color: var(--google);
}

.pill.meta {
  background: #e8f0fe;
  color: var(--meta);
}

.pill-dot.google {
  background: var(--google);
}

.pill-dot.meta {
  background: var(--meta);
}

.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.status.active {
  background: #e6f7ef;
  color: #157a45;
}

.status.paused {
  background: #fff8e6;
  color: #9a6500;
}

.status.ended {
  background: #f1f3f5;
  color: #6b7c83;
}

.roi-val {
  font-weight: 800;
  font-size: 14px;
}

.roi-val.high {
  color: #1f9e56;
}

.roi-val.mid {
  color: var(--orange);
}

.roi-val.low {
  color: var(--steel);
}

/* ── SKELETON ── */
.skel {
  display: inline-block;
  background: linear-gradient(90deg, #e8ecef 25%, #f4f6f7 50%, #e8ecef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  color: transparent;
  user-select: none;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ── INSIGHTS PANEL ── */
.insights-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.insights-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.insights-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.insights-btn {
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.insights-btn:hover { background: var(--orange-dark); }
.insights-btn:disabled { background: #ccc; cursor: not-allowed; }

.insights-body {
  padding: 24px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  min-height: 80px;
}

.insights-body h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin: 20px 0 8px;
}

.insights-body h2:first-child { margin-top: 0; }

.insights-body p { margin-bottom: 10px; }

.insights-body ul {
  margin: 6px 0 10px 18px;
}

.insights-body li { margin-bottom: 4px; }

.insights-placeholder {
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: 20px 32px;
  font-size: 11px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  font-weight: 800;
  color: var(--slate);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.footer-dot {
  color: var(--orange);
}

/* ── VIEW SWITCHER ── */
.view-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  align-self: center;
  margin-left: 8px;
}

.view-switch button {
  padding: 6px 18px;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.15s;
}

.view-switch button:hover {
  color: rgba(255, 255, 255, 0.85);
}

.view-switch button.active {
  background: #ffffff;
  color: var(--slate);
}

/* ── ASK VIEW ── */
.ask-wrap {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
}

.ask-intro {
  padding: 24px 0 8px;
}

.ask-intro-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.ask-intro-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.ask-suggestions button {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.ask-suggestions button:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.ask-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0;
}

.ask-msg {
  display: flex;
  gap: 10px;
  max-width: 100%;
}

.ask-msg.user {
  justify-content: flex-end;
}

.ask-bubble {
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 78%;
}

.ask-msg.user .ask-bubble {
  background: var(--slate);
  color: #fff;
}

.ask-msg.assistant .ask-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.ask-msg.assistant .ask-bubble p { margin-bottom: 8px; }
.ask-msg.assistant .ask-bubble p:last-child { margin-bottom: 0; }
.ask-msg.assistant .ask-bubble ul { margin: 6px 0 8px 18px; }
.ask-msg.assistant .ask-bubble li { margin-bottom: 3px; }
.ask-msg.assistant .ask-bubble strong { font-weight: 700; }

.ask-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ask-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.ask-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-light);
  animation: askblink 1.4s infinite both;
}

.ask-typing span:nth-child(2) { animation-delay: 0.2s; }
.ask-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes askblink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.ask-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  position: sticky;
  bottom: 0;
  background: var(--bg);
}

.ask-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--card);
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.ask-input:focus { border-color: var(--orange); }
.ask-input::placeholder { color: var(--text-light); }

.ask-send {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 0 22px;
  height: 44px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.ask-send:hover { background: var(--orange-dark); }
.ask-send:disabled { background: #ccc; cursor: not-allowed; }

.ask-disclaimer {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  padding-bottom: 16px;
}
