/* ═══════════════════════════════════════════════════════════════
   JIM HQ — Design System
   Mobile-first → Tablet (768px) → Desktop (1200px)
═══════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input  { font: inherit; }
a      { color: inherit; text-decoration: none; }

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:         #0a0c14;
  --bg2:        #0f1219;
  --surface:    #131724;
  --surface2:   #191e2f;
  --surface3:   #1e2438;
  --glass:      rgba(19,23,36,0.85);

  /* Borders */
  --border:     #1d2235;
  --border2:    #242a3e;
  --border3:    #2d3452;

  /* Text */
  --text:       #eaecf5;
  --text2:      #8e97c0;
  --text3:      #50597a;
  --text4:      #363d5a;

  /* Accent palette */
  --blue:       #4a9eff;
  --blue-soft:  #3b8de8;
  --blue-dim:   rgba(74,158,255,0.12);
  --blue-glow:  rgba(74,158,255,0.06);

  --gold:       #f0b429;
  --gold-dim:   rgba(240,180,41,0.12);

  --green:      #22c55e;
  --green-soft: #16a34a;
  --green-dim:  rgba(34,197,94,0.12);
  --green-glow: rgba(34,197,94,0.06);

  --amber:      #f59e0b;
  --amber-dim:  rgba(245,158,11,0.12);

  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,0.12);

  --purple:     #a78bfa;
  --purple-dim: rgba(167,139,250,0.12);

  --teal:       #2dd4bf;
  --teal-dim:   rgba(45,212,191,0.12);

  /* Layout */
  --sidebar-w:     242px;
  --sidebar-w-lg:  264px;
  --header-h:      56px;
  --bottom-nav-h:  68px;
  --content-max:   1100px;

  /* Shape */
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Motion */
  --ease:      cubic-bezier(0.16,1,0.3,1);
  --ease-in:   cubic-bezier(0.4,0,1,1);
  --ease-out:  cubic-bezier(0,0,0.2,1);
  --dur-fast:  120ms;
  --dur:       220ms;
  --dur-slow:  380ms;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow:    0 4px 16px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
}

/* ── Base ───────────────────────────────────────────────────── */
html {
  height: 100%;
  font-size: 16px;
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}


/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════════════ */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 32px 24px env(safe-area-inset-bottom, 0);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(74,158,255,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(167,139,250,0.06) 0%, transparent 60%),
    var(--bg);
}

.login-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 380px;
  animation: loginFade var(--dur-slow) var(--ease) both;
}

@keyframes loginFade {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.login-icon {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(74,158,255,0.3));
}

.login-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.8px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text3);
  letter-spacing: 0.3px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding-left: 2px;
}

.login-input {
  width: 100%;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 17px;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.login-input::placeholder { letter-spacing: 0; color: var(--text4); font-size: 14px; }
.login-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
.login-input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
  animation: shake 0.45s var(--ease);
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-10px); }
  40%     { transform: translateX(8px); }
  60%     { transform: translateX(-6px); }
  80%     { transform: translateX(4px); }
}

.login-error {
  font-size: 13px;
  color: var(--red);
  text-align: center;
  min-height: 18px;
  padding: 0 4px;
}

.login-footer {
  font-size: 12px;
  color: var(--text4);
  letter-spacing: 0.3px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
  transition: opacity var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur);
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(74,158,255,0.3);
}
.btn-primary:hover { opacity: 0.9; box-shadow: 0 6px 20px rgba(74,158,255,0.4); }

.btn-full  { width: 100%; }
.btn-sm    { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-green {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 14px rgba(34,197,94,0.25);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Icon button ─────────────────────────────────────────────── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: none;
  border: none;
  color: var(--text2);
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.icon-btn:hover  { background: var(--surface2); color: var(--text); }
.icon-btn:active { background: var(--surface3); }


/* ═══════════════════════════════════════════════════════════════
   APP SHELL — MOBILE (default, < 768px)
═══════════════════════════════════════════════════════════════ */

#app {
  display: flex;
  flex-direction: column;
  height: 100svh;
  overflow: hidden;
}

/* Hide sidebar / show mobile chrome on mobile */
#sidebar      { display: none; }
#mobile-header { display: flex; }

#main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Mobile header ───────────────────────────────────────────── */
#mobile-header {
  height: var(--header-h);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px 0 4px;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

.mobile-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mobile-header-icon  { font-size: 18px; line-height: 1; }
.mobile-header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ── Pull-to-refresh ─────────────────────────────────────────── */
#ptr-bar {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height var(--dur) var(--ease);
  background: var(--bg2);
  flex-shrink: 0;
}

#ptr-bar.visible { height: 48px; }

.ptr-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text3);
  font-size: 13px;
}

.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Scrollable content ──────────────────────────────────────── */
#content-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px calc(var(--bottom-nav-h) + 20px + env(safe-area-inset-bottom, 0));
  overscroll-behavior-y: contain;
}

/* ── Bottom nav ─────────────────────────────────────────────── */
#bottom-nav {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--border);
  height: var(--bottom-nav-h);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative;
  z-index: 50;
}

#bottom-nav::-webkit-scrollbar { display: none; }

.bottom-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 68px;
  padding: 8px 10px 4px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: color var(--dur-fast);
  white-space: nowrap;
}

.bottom-tab.active  { color: var(--blue); }
.bottom-tab:active  { opacity: 0.7; }

.bottom-tab-icon {
  font-size: 20px;
  line-height: 1;
  transition: transform var(--dur) var(--ease);
}
.bottom-tab.active .bottom-tab-icon { transform: translateY(-2px); }

/* ── Drawer overlay ─────────────────────────────────────────── */
#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  transition: opacity var(--dur) var(--ease);
}

#drawer-overlay.visible { opacity: 1; }
#drawer-overlay.hidden  { opacity: 0; pointer-events: none; }

/* ── Mobile drawer ───────────────────────────────────────────── */
#mobile-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(280px, 85vw);
  background: var(--surface);
  border-right: 1px solid var(--border2);
  z-index: 210;
  display: flex;
  flex-direction: column;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  transform: translateX(-100%);
  transition: transform var(--dur-slow) var(--ease);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

#mobile-drawer.open { transform: translateX(0); }
#mobile-drawer.hidden { display: flex; } /* keep in DOM, use transform */

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 24px;
}

.drawer-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.drawer-sub   { font-size: 12px; color: var(--text3); margin-top: 2px; }

.drawer-nav {
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text2);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition: background var(--dur-fast), color var(--dur-fast);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.drawer-item-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.drawer-item-text { flex: 1; }

.drawer-item.active {
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 600;
}

.drawer-item:active:not(.active) { background: var(--surface2); }


/* ═══════════════════════════════════════════════════════════════
   APP SHELL — TABLET (≥ 768px)
═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {

  #app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 100svh;
    overflow: hidden;
  }

  /* Show sidebar, hide mobile chrome */
  #sidebar        { display: flex; }
  #mobile-header  { display: none; }
  #bottom-nav     { display: none; }
  #drawer-overlay { display: none; }
  #mobile-drawer  { display: none; }

  #main-wrap {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #content-scroll {
    padding: 24px 20px 32px;
  }

  /* 2-column card grid on tablet */
  .card-grid-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: start;
  }

  .card-span-full { grid-column: 1 / -1; }

}

/* ═══════════════════════════════════════════════════════════════
   APP SHELL — DESKTOP (≥ 1200px)
═══════════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {

  #app {
    grid-template-columns: var(--sidebar-w-lg) 1fr;
  }

  #content-scroll {
    padding: 32px 36px 40px;
  }

  /* 3-column card grid on desktop */
  .card-grid-inner {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

}


/* ═══════════════════════════════════════════════════════════════
   SIDEBAR (tablet / desktop)
═══════════════════════════════════════════════════════════════ */

#sidebar {
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100svh;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(74,158,255,0.3));
}

.brand-name {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
  letter-spacing: 0.2px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0 16px 12px;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border3) transparent;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border3); border-radius: 2px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.1px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.sidebar-item-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }

.sidebar-item-text { flex: 1; }

.sidebar-item-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-item:hover:not(.active) {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

/* Revenue item gets a green accent when active */
.sidebar-item[data-section="revenue"].active {
  background: var(--green-dim);
  color: var(--green);
}
.sidebar-item[data-section="revenue"].active::before {
  background: var(--green);
}

.sidebar-spacer { flex: 1; min-height: 16px; }

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green  { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse-green 2.5s ease-in-out infinite; }
.dot-amber  { background: var(--amber); }
.dot-red    { background: var(--red); }
.dot-grey   { background: var(--text4); }

@keyframes pulse-green {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.5; }
}

.status-label { font-size: 12px; color: var(--text3); }

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  text-align: left;
  width: 100%;
}

.sidebar-btn:hover { background: var(--surface2); color: var(--text); }
.sidebar-btn-dim   { color: var(--text3); }
.sidebar-btn-dim:hover { color: var(--red); background: var(--red-dim); }


/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* Hide page header on mobile (mobile-header handles it) */
@media (max-width: 767px) {
  .page-header { display: none; }
}

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

.page-header-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(74,158,255,0.2));
}

.page-header-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text);
}

@media (min-width: 1200px) {
  .page-header-title { font-size: 30px; }
}

.page-header-desc {
  font-size: 13px;
  color: var(--text3);
  margin-top: 3px;
}

.page-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.last-updated {
  font-size: 12px;
  color: var(--text4);
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════
   NOTIFICATION BAR
═══════════════════════════════════════════════════════════════ */

#notif-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: var(--blue-dim);
  border: 1px solid rgba(74,158,255,0.2);
  border-radius: var(--radius);
  animation: fadeSlideDown var(--dur) var(--ease);
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-icon { font-size: 20px; flex-shrink: 0; }

.notif-text {
  flex: 1;
  min-width: 0;
}
.notif-text strong { display: block; font-size: 14px; font-weight: 700; }
.notif-text span   { font-size: 12px; color: var(--text2); }

.notif-dismiss {
  color: var(--text3);
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════
   CARD GRID & CARDS
═══════════════════════════════════════════════════════════════ */

#card-grid {
  animation: contentFade var(--dur) var(--ease) both;
}

@keyframes contentFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* On mobile, cards stack vertically */
.card-grid-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

/* ── Individual card ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur), box-shadow var(--dur);
}

.card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow);
}

.card-inner { padding: 18px 20px; }

@media (min-width: 768px)  { .card-inner { padding: 20px 22px; } }
@media (min-width: 1200px) { .card-inner { padding: 22px 24px; } }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-header-left { flex: 1; min-width: 0; }

.card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  line-height: 1.3;
}

@media (min-width: 768px)  { .card-title { font-size: 16px; } }
@media (min-width: 1200px) { .card-title { font-size: 17px; } }

.card-meta {
  font-size: 11px;
  color: var(--text4);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 12px -0px;
}

.card-body {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Truncation on mobile, full on larger */
@media (max-width: 767px) {
  .card-body.truncate {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (min-width: 768px) {
  .card-body.truncate {
    -webkit-line-clamp: 8;
  }
}

@media (min-width: 1200px) {
  .card-body.truncate { -webkit-line-clamp: unset; }
}

/* ── Card accent strip ───────────────────────────────────────── */
.card.accent-blue   { border-top: 3px solid var(--blue); }
.card.accent-green  { border-top: 3px solid var(--green); }
.card.accent-gold   { border-top: 3px solid var(--gold); }
.card.accent-amber  { border-top: 3px solid var(--amber); }
.card.accent-purple { border-top: 3px solid var(--purple); }
.card.accent-teal   { border-top: 3px solid var(--teal); }

/* ── Span controls ───────────────────────────────────────────── */
@media (min-width: 768px) {
  .card-span-2    { grid-column: span 2; }
  .card-span-full { grid-column: 1 / -1; }
}


/* ═══════════════════════════════════════════════════════════════
   BADGES & PILLS
═══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-amber  { background: var(--amber-dim);  color: var(--amber); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-gold   { background: var(--gold-dim);   color: var(--gold); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }
.badge-teal   { background: var(--teal-dim);   color: var(--teal); }
.badge-grey   { background: var(--surface2);   color: var(--text3); }

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}


/* ═══════════════════════════════════════════════════════════════
   LOADING & EMPTY STATES
═══════════════════════════════════════════════════════════════ */

.loading-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text3);
  font-size: 14px;
  grid-column: 1 / -1;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 24px;
  grid-column: 1 / -1;
}

.empty-icon  { font-size: 44px; margin-bottom: 16px; opacity: 0.6; }
.empty-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.empty-desc  { font-size: 14px; color: var(--text3); max-width: 280px; line-height: 1.6; }


/* ═══════════════════════════════════════════════════════════════
   REVENUE SECTION — SPECIAL STYLING
═══════════════════════════════════════════════════════════════ */

/* Hero stat row */
.rev-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 480px) { .rev-stats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .rev-stats { grid-template-columns: repeat(4, 1fr); gap: 12px; } }

.rev-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.rev-stat:hover { border-color: var(--green); box-shadow: 0 0 0 1px var(--green-dim); }

.rev-stat-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--green);
  line-height: 1;
  margin-bottom: 6px;
}

@media (min-width: 768px) { .rev-stat-value { font-size: 26px; } }

.rev-stat-value.dim { color: var(--text3); }
.rev-stat-value.gold { color: var(--gold); }

.rev-stat-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Pipeline funnel */
.rev-pipeline {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 18px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.rev-pipeline::-webkit-scrollbar { display: none; }

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 72px;
  text-align: center;
}

.pipeline-bubble {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text3);
  transition: all var(--dur) var(--ease);
  position: relative;
}

.pipeline-bubble.has-data {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
  box-shadow: 0 0 0 4px var(--green-glow);
}

.pipeline-stage-label { font-size: 11px; color: var(--text3); font-weight: 600; letter-spacing: 0.2px; }
.pipeline-stage-sub   { font-size: 10px; color: var(--text4); }

.pipeline-arrow {
  color: var(--border3);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: -16px;
}

/* Builds list */
.builds-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.build-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.build-item:last-child { border-bottom: none; }

.build-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }

.build-info { flex: 1; min-width: 0; }
.build-name { font-size: 14px; font-weight: 600; color: var(--text); }
.build-desc { font-size: 12px; color: var(--text3); margin-top: 1px; }

.build-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

.build-status.building { background: var(--blue-dim);  color: var(--blue);  }
.build-status.live     { background: var(--green-dim); color: var(--green); }
.build-status.planned  { background: var(--surface2);  color: var(--text3); }
.build-status.paused   { background: var(--amber-dim); color: var(--amber); }

.build-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-green 2s ease-in-out infinite;
}
.build-status.live .build-status-dot { animation-play-state: running; }
.build-status:not(.live) .build-status-dot { animation: none; }

/* Opportunities */
.opp-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.opp-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.opp-item:last-child { border-bottom: none; }

.opp-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 6px;
  flex-shrink: 0;
}

.opp-info  { flex: 1; min-width: 0; }
.opp-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.opp-meta  { font-size: 12px; color: var(--text3); margin-top: 2px; }
.opp-value { font-size: 13px; font-weight: 700; color: var(--green); flex-shrink: 0; margin-top: 2px; }

/* Revenue card override — green tint */
.card.rev-hero {
  background: linear-gradient(135deg, rgba(34,197,94,0.06) 0%, var(--surface) 50%);
  border-color: rgba(34,197,94,0.2);
}

/* Upward trajectory graphic */
.rev-trajectory {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 32px;
  padding: 0 4px;
}

.traj-bar {
  flex: 1;
  background: var(--green-dim);
  border-radius: 3px 3px 0 0;
  border-bottom: 2px solid var(--green);
  transition: height var(--dur-slow) var(--ease);
  min-height: 4px;
}

.traj-bar.current { background: var(--green); opacity: 0.8; }

/* MRR target card */
.mrr-targets {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mrr-target-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mrr-target-label { flex: 1; font-size: 13px; color: var(--text2); }
.mrr-target-value { font-size: 14px; font-weight: 700; color: var(--text); }
.mrr-target-arr   { font-size: 12px; color: var(--text3); }

.progress-track {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 1s var(--ease);
}

.progress-fill.gold   { background: var(--gold); }
.progress-fill.purple { background: var(--purple); }


/* ═══════════════════════════════════════════════════════════════
   UTILITY
═══════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

.text-green  { color: var(--green) !important; }
.text-gold   { color: var(--gold) !important; }
.text-amber  { color: var(--amber) !important; }
.text-red    { color: var(--red) !important; }
.text-blue   { color: var(--blue) !important; }
.text-muted  { color: var(--text3) !important; }

.fw-700  { font-weight: 700; }
.fw-800  { font-weight: 800; }
.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mb-8    { margin-bottom: 8px; }
.mb-16   { margin-bottom: 16px; }

/* ── Toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 100px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity var(--dur), transform var(--dur) var(--ease);
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 768px) {
  #toast { bottom: 24px; }
}

/* ── Section transition ──────────────────────────────────────── */
.section-fade-in {
  animation: contentFade var(--dur) var(--ease) both;
}
