:root {
  --bg-page: radial-gradient(110% 100% at 0% 0%, #eef0ff 0%, #e8ebf5 45%, #d9dde8 100%);
  --hero-grad: linear-gradient(140deg, #05092f 2%, #081d80 48%, #5f25d2 100%);
  --card-grad: linear-gradient(145deg, #4c2ed8 0%, #6f43ff 70%, #8b6fff 100%);
  --text-main: #202228;
  --text-soft: #737988;
  --surface: #f4f5f8;
  --white: #ffffff;
  --accent: #8f44ff;
  --mint: #65d6c9;
  --line: #e4e7f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg-page);
  color: var(--text-main);
  font-family: "Outfit", sans-serif;
  padding: 18px;
}

h1,
h2,
h3,
strong {
  font-family: "Sora", sans-serif;
}

.app-shell {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 0;
}

.dashboard {
  position: relative;
  background: var(--surface);
  border-radius: 30px;
  box-shadow: 0 34px 62px rgba(18, 20, 52, 0.17);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.detail-view {
  display: none;
}

.dashboard.detail-open .home-view {
  display: none;
}

.dashboard.detail-open .detail-view {
  display: block;
}

.dashboard::before,
.dashboard::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.dashboard::before {
  width: 260px;
  height: 260px;
  top: -120px;
  right: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 70%);
}

.dashboard::after {
  width: 420px;
  height: 420px;
  bottom: -220px;
  left: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(67, 109, 255, 0.08) 0%, rgba(67, 109, 255, 0) 70%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  color: var(--white);
  background: var(--hero-grad);
  position: relative;
  z-index: 1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(130deg, #00d8ff 0%, #98ffd4 100%);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12);
}

.brand strong {
  font-size: 1rem;
}

.header-nav {
  display: flex;
  gap: 6px;
}

.tab {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.tab:hover,
.tab.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.14);
}

.action-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.avatar {
  border: 0;
  background: transparent;
  color: var(--white);
  font: inherit;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  opacity: 0.92;
  cursor: pointer;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(130deg, #ffd08c 0%, #f29f4e 100%);
  color: #3b2512;
  font-size: 0.62rem;
  font-weight: 700;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  padding: 18px 22px 26px;
  background: var(--hero-grad);
  color: var(--white);
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  position: relative;
  z-index: 1;
}

.welcome-block {
  color: var(--white);
  align-self: center;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 2.2rem;
  letter-spacing: -0.4px;
}

.subline {
  margin: 0;
  color: #c7cffd;
  font-size: 0.95rem;
}

.revenue-card {
  background: var(--card-grad);
  border-radius: 20px;
  padding: 16px;
  color: var(--white);
  box-shadow: 0 14px 26px rgba(8, 5, 46, 0.25);
}

.amount {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 8px;
  font-weight: 700;
}

.label-row,
.range-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
}

.label-row {
  opacity: 0.9;
  margin-bottom: 6px;
}

.progress-track {
  height: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.35);
}

.actual,
.upside {
  height: 100%;
  float: left;
}

.actual {
  width: 41%;
  background: #35a2ff;
}

.upside {
  width: 22%;
  background: var(--mint);
}

.range-row {
  margin-top: 6px;
  font-weight: 600;
}

.metrics {
  margin: -18px 22px 0;
  background: var(--white);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px 8px;
  box-shadow: 0 14px 30px rgba(20, 20, 35, 0.11);
  position: relative;
  z-index: 2;
}

.metrics article {
  text-align: center;
}

.metrics strong {
  display: block;
  font-size: 1.02rem;
  color: #1779cb;
}

.metrics span {
  font-size: 0.72rem;
  color: var(--text-soft);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  padding: 20px 22px 26px;
  position: relative;
  z-index: 1;
}

#field-plan {
  grid-column: 1 / -1;
}

.content-section {
  min-width: 0;
}

.content-section h2 {
  margin: 6px 0 10px;
  font-size: 1.58rem;
  letter-spacing: -0.3px;
}

.content-section h2 small {
  font-size: 0.76rem;
  color: #fff;
  background: #8168df;
  border-radius: 999px;
  padding: 1px 6px;
  vertical-align: middle;
}

.opportunity-list,
.activity-cards {
  display: grid;
  gap: 10px;
}

.tile {
  background: var(--white);
  border-radius: 16px;
  padding: 13px;
  box-shadow: 0 12px 22px rgba(15, 17, 34, 0.07);
}

.opportunity-list .tile {
  cursor: pointer;
}

.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.biz-meta {
  display: grid;
  gap: 4px;
  flex: 1;
}

.pill {
  font-size: 0.58rem;
  color: var(--white);
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  background: #1aa16c;
}

.biz-name {
  margin: 0;
  font-size: 1.08rem;
}

.biz-kpi {
  margin: 0;
  color: #18a05f;
  font-size: 0.88rem;
  font-weight: 600;
}

.tile .desc {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #5f2cd2;
  background: #f0ebff;
  font-size: 1rem;
}

.menu-dot {
  color: #9497a2;
  font-size: 1.2rem;
  letter-spacing: 1px;
}

.side-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.side-block {
  background: transparent;
}

.quick-note {
  background: linear-gradient(150deg, #10195f 0%, #2936a4 45%, #6f43ff 100%);
  color: var(--white);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 14px 26px rgba(22, 28, 88, 0.3);
}

.quick-note h2 {
  margin-top: 0;
  color: var(--white);
}

.quick-note p {
  margin: 0 0 10px;
  color: #d5dcff;
  font-size: 0.9rem;
  line-height: 1.45;
}

.section-note {
  margin: -4px 0 10px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.map-card,
.location-card {
  background: var(--white);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 12px 20px rgba(15, 17, 34, 0.07);
}

.map-card {
  text-align: center;
}

.map-title {
  text-align: right;
  font-size: 1.2rem;
  font-family: "Sora", sans-serif;
  margin-bottom: 6px;
}

.map-card img {
  width: min(95%, 290px);
  margin: 0 auto;
  display: block;
}

.map-card p {
  margin: 8px 0 2px;
  font-size: 0.95rem;
}

.location-card {
  margin-top: 10px;
}

.location-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.location-top h3 {
  margin: 0;
  font-size: 1.35rem;
}

.location-top p,
.nearby span {
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.nearby {
  text-align: right;
}

.nearby strong {
  display: block;
  font-size: 1.65rem;
}

.hint {
  margin: 10px 0;
  color: #5c6174;
  font-size: 0.9rem;
}

.map-btn {
  width: 100%;
  border: 1px solid #cbcbd7;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  background: #fafafd;
  cursor: pointer;
}

.quick-note .map-btn {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-item .icon-mark {
  width: 30px;
  height: 30px;
  font-size: 0.86rem;
}

.activity-item small {
  display: block;
  color: #848899;
  font-size: 0.74rem;
}

.activity-item strong {
  font-size: 0.96rem;
}

.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(145deg, #ff7f1d 0%, #ff5d00 100%);
  color: var(--white);
  font-size: 1.2rem;
  box-shadow: 0 12px 20px rgba(255, 93, 0, 0.32);
  cursor: pointer;
  z-index: 10;
}

.detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  background: var(--hero-grad);
  color: var(--white);
}

.back-link {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 0.95rem;
  padding: 4px 0;
  cursor: pointer;
}

.detail-body {
  padding: 14px 22px 32px;
}

.detail-title {
  font-size: 1.9rem;
  margin: 2px 0 12px;
  letter-spacing: -0.3px;
}

.advertiser-card,
.prediction-card,
.signal-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 12px 20px rgba(16, 18, 34, 0.07);
}

.advertiser-card.is-loading,
.prediction-card.is-loading,
.signal-list.is-loading .signal-card {
  position: relative;
  overflow: hidden;
}

.advertiser-card.is-loading::after,
.prediction-card.is-loading::after,
.signal-list.is-loading .signal-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(240, 244, 255, 0.7) 45%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-100%);
  animation: shimmer 1.2s linear infinite;
}

.advertiser-card {
  position: relative;
  padding: 14px;
  margin-bottom: 12px;
}

.advertiser-main {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.advertiser-main h3 {
  margin: 0;
  font-size: 1.18rem;
}

.advertiser-main p {
  margin: 3px 0 0;
  color: #5f6271;
  font-size: 0.83rem;
}

.advertiser-main .industry {
  color: var(--accent);
  font-weight: 600;
}

.budget-tag {
  position: absolute;
  right: 14px;
  top: -12px;
  border-radius: 10px;
  padding: 8px 10px;
  background: #ecefff;
  color: #4f36c8;
  font-family: "Sora", sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}

.action-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.action-primary {
  background: #5535d9;
  color: var(--white);
  border-color: #5535d9;
}

.prediction-card {
  padding: 14px;
  margin-bottom: 12px;
}

.prediction-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.prediction-head h3 {
  margin: 0;
  font-size: 1.45rem;
}

.score-tag {
  background: #ecefff;
  border-radius: 10px;
  padding: 6px 9px;
  display: grid;
  justify-items: center;
  line-height: 1;
}

.score-tag strong {
  color: #4f36c8;
  font-size: 2rem;
}

.score-tag span {
  font-size: 0.54rem;
  color: #7680b8;
  letter-spacing: 0.3px;
}

.prediction-card p {
  margin: 0;
  color: #4f5364;
  font-size: 1rem;
}

.signals-section h2 {
  font-size: 1.5rem;
  margin: 4px 0 10px;
}

.signal-list {
  display: grid;
  gap: 10px;
}

.signal-card {
  padding: 14px;
}

.loading-line {
  height: 10px;
  border-radius: 999px;
  background: #e6e9f2;
  margin: 0 0 9px;
}

.loading-line.wide {
  width: 78%;
}

.loading-line.short {
  width: 40%;
  margin-bottom: 12px;
}

.loading-track {
  height: 7px;
  border-radius: 999px;
  background: #d8deec;
}

.signal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.signal-title {
  margin: 0;
  font-size: 1.08rem;
}

.severity {
  font-size: 0.78rem;
  font-weight: 700;
}

.severity.high {
  color: #1ca36b;
}

.severity.medium {
  color: #ffa600;
}

.severity.low {
  color: #ff4e4e;
}

.signal-desc {
  margin: 5px 0 10px;
  color: #696d7d;
  font-size: 0.86rem;
  line-height: 1.35;
}

.confidence-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  color: #4f5364;
  font-size: 0.82rem;
}

.confidence-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #d9dde8;
  overflow: hidden;
}

.confidence-bar {
  height: 100%;
  background: linear-gradient(90deg, #3a79ea 0%, #2d75eb 100%);
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes riseFade {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero,
.metrics,
.workspace-grid > * {
  animation: riseFade 420ms ease both;
}

.metrics {
  animation-delay: 80ms;
}

.workspace-grid > :nth-child(1) {
  animation-delay: 130ms;
}

.workspace-grid > :nth-child(2) {
  animation-delay: 180ms;
}

.workspace-grid > :nth-child(3) {
  animation-delay: 220ms;
}

.bottom-nav {
  display: none;
}

@media (max-width: 980px) {
  body {
    padding: 0;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .dashboard {
    border-radius: 0;
    min-height: 100vh;
  }

  .detail-body {
    padding: 12px 16px 94px;
  }

  .detail-topbar {
    padding: 13px 16px;
  }

  .detail-title {
    font-size: 1.75rem;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "nav nav";
    row-gap: 10px;
  }

  .brand {
    grid-area: brand;
  }

  .header-nav {
    grid-area: nav;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 3px;
  }

  .header-nav::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .action-right {
    grid-area: actions;
  }

  .hero {
    grid-template-columns: 1fr;
    border-radius: 0 0 22px 22px;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    padding-top: 18px;
  }

  .side-column {
    order: 2;
  }

  #field-plan {
    order: 3;
    margin-bottom: 86px;
    grid-column: auto;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 8px 6px 10px;
    backdrop-filter: blur(8px);
    z-index: 11;
  }

  .bottom-nav .tab {
    color: #9a9bab;
    background: transparent;
    font-size: 0.8rem;
    padding: 8px 0;
  }

  .bottom-nav .tab.active {
    color: var(--accent);
    font-weight: 700;
  }

  .chat-fab {
    right: 16px;
    bottom: 76px;
    width: 50px;
    height: 50px;
  }
}
