/* ================================================================
   FINDESK — Dashboard & Component Redesign
   Vibrant metric cards, portfolio cards, panels, hero sections
   ================================================================ */

/* ── Root overrides ── */
body { background: #f1f5fb; color: #0f172a; }

/* ════════════════════════════════════════════════════════════════
   SIDEBAR overrides (work on top of app.css base)
   ════════════════════════════════════════════════════════════════ */
#sidebar {
  background: linear-gradient(175deg, #0f1829 0%, #101d35 60%, #0b1526 100%);
  box-shadow: 6px 0 40px rgba(0,0,0,.30);
}
main { margin-left: var(--sb-w, 255px); }

/* Coloured active indicator strip — yellow for all sections */
nav a.active::before,
nav a[aria-current="page"]::before {
  content: '';
  display: block;
  width: 3px; height: 60%;
  background: linear-gradient(180deg, #fde047, #eab308);
  border-radius: 2px;
  margin-right: -4px;
  margin-left: -7px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════════ */
header {
  background: rgba(255,255,255,.90) !important;
  border-bottom: 1px solid #e5eaf3 !important;
  box-shadow: 0 1px 0 rgba(15,23,42,.04), 0 2px 8px rgba(15,23,42,.04) !important;
}
.breadcrumb { font-size: .8rem; }
.breadcrumb strong { color: #1e293b; font-weight: 650; }

/* ════════════════════════════════════════════════════════════════
   HERO SECTION
   ════════════════════════════════════════════════════════════════ */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 0 28px;
  gap: 20px;
}
.eyebrow {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6366f1;
}
.hero h1, .welcome h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.04em;
  margin: 7px 0 0;
  color: #0f172a;
  line-height: 1.15;
}
.hero p, .welcome p {
  color: #64748b;
  margin: 5px 0 0;
  font-size: .875rem;
  line-height: 1.55;
}
.hero-actions { display: flex; gap: 8px; align-items: center; }
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #fff;
  text-decoration: none;
  padding: 0 18px;
  min-height: 40px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.ghost-button:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #0f172a;
  transform: none;
  box-shadow: 0 2px 4px rgba(15, 23, 42, .06);
}

.primary {
  background: #1d4ed8 !important;
  border: 1px solid #1e40af !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06) !important;
}
.primary:hover {
  background: #1e3a8a !important;
  border-color: #1e3a8a !important;
  box-shadow: 0 2px 4px rgba(15, 23, 42, .08) !important;
  transform: none !important;
}

/* ════════════════════════════════════════════════════════════════
   METRIC STAT CARDS
   ════════════════════════════════════════════════════════════════ */
.stats { gap: 14px; }

.metric {
  position: relative;
  padding: 19px 18px !important;
  border-radius: 13px !important;
  overflow: hidden;
  min-height: 118px;
  border: 1px solid rgba(226,232,240,.8) !important;
  transition: transform 160ms, box-shadow 160ms !important;
}
.metric:hover { transform: translateY(-3px) !important; box-shadow: 0 10px 28px rgba(15,23,42,.10) !important; }

/* Top colour strip */
.metric::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.metric.blue  { background: linear-gradient(160deg, #eff6ff 0%, #fff 100%); }
.metric.blue::after  { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.metric.purple{ background: linear-gradient(160deg, #f5f3ff 0%, #fff 100%); }
.metric.purple::after{ background: linear-gradient(90deg, #8b5cf6, #6366f1); }
.metric.green { background: linear-gradient(160deg, #d1fae5 0%, #fff 100%); }
.metric.green::after { background: linear-gradient(90deg, #047857, #065f46); }
.metric.amber { background: linear-gradient(160deg, #fffbeb 0%, #fff 100%); }
.metric.amber::after { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.metric.red   { background: linear-gradient(160deg, #fee2e2 0%, #fff 100%); }
.metric.red::after   { background: linear-gradient(90deg, #b91c1c, #991b1b); }

.metric small {
  font-size: .62rem !important;
  text-transform: uppercase;
  letter-spacing: .09em !important;
  font-weight: 750 !important;
  color: #64748b !important;
}
.metric strong {
  font-size: 1.25rem !important;
  font-weight: 750 !important;
  letter-spacing: -.04em !important;
  color: #0f172a;
  margin-top: 8px !important;
  display: block;
}
.metric span {
  display: block;
  font-size: .7rem;
  color: #94a3b8;
  margin-top: 4px;
}
.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .67rem;
  font-weight: 700;
  color: #065f46;
  background: #a7f3d0;
  border-radius: 999px;
  padding: 3px 8px;
}

/* ════════════════════════════════════════════════════════════════
   PANEL (data table cards)
   ════════════════════════════════════════════════════════════════ */
.panel {
  border-radius: 14px !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid #e5eaf2 !important;
  box-shadow: 0 2px 10px rgba(15,23,42,.06) !important;
  background: #fff !important;
}
.panel-head {
  padding: 18px 20px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #f1f4f9;
}
.panel-head h2 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.02em;
  color: #0f172a;
}
.panel-head p {
  margin: 3px 0 0;
  font-size: .75rem;
  color: #64748b;
}
.panel-head > a {
  font-size: .75rem;
  color: #4f46e5;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.panel-head > a:hover { text-decoration: underline; }

/* Table inside panels */
.panel table { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
.panel:not(.compact-panel) th { padding: 5px 10px !important; background: #fafbfe !important; letter-spacing: .03em; line-height: 1.2; }
.panel:not(.compact-panel) td { padding: 6px 10px !important; font-size: .85rem; }
.panel.compact-panel th { padding: 4px 7px !important; letter-spacing: .03em; line-height: 1.2; }
.panel.compact-panel td { padding: 4px 7px !important; }
.panel-head.tight { padding: 6px 10px !important; }
.panel-head.tight h2,
.panel-head.tight h3 { margin: 0; line-height: 1.2; }
.panel-head.tight p { margin: 2px 0 0; }
.panel td small { display: block; color: #94a3b8; font-size: .72rem; margin-top: 2px; }
tr:hover td { background: #fafcff; }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px #dcfce7;
}
.empty {
  text-align: center;
  color: #94a3b8;
  padding: 36px !important;
  font-size: .875rem;
}
.positive { color: #059669; font-weight: 600; }

/* Charts */
.charts article { min-height: 280px; }
.charts canvas { width: 100%; height: 240px; padding: 0 14px 14px; display: block; }
.chart-wrap { position: relative; min-height: 240px; padding: 0 14px 14px; }
.chart-empty {
  margin: 0; padding: 48px 16px; text-align: center; color: #64748b; font-size: 13px;
  border: 1px dashed #dbe3ef; border-radius: 10px; background: #f8fafc;
}

/* ════════════════════════════════════════════════════════════════
   WELCOME / PORTFOLIO SELECTION
   ════════════════════════════════════════════════════════════════ */
.welcome { padding: 24px 0 30px; max-width: 640px; }

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.portfolio-card {
  position: relative;
  min-height: 290px;
  border-radius: 18px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(23,37,84,.18);
  transition: transform 180ms, box-shadow 180ms;
}
.portfolio-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 44px rgba(23,37,84,.26);
}
/* Background blob */
.portfolio-card::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  right: -65px; top: -65px;
  background: rgba(255,255,255,.12);
  pointer-events: none;
}
.portfolio-card::before {
  content: '';
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  left: -40px; bottom: -40px;
  background: rgba(255,255,255,.07);
  pointer-events: none;
}
.portfolio-card.daily   { background: linear-gradient(145deg, #2563eb 0%, #312e81 100%); }
.portfolio-card.weekly  { background: linear-gradient(145deg, #7c3aed 0%, #4338ca 100%); }
.portfolio-card.monthly { background: linear-gradient(145deg, #0f766e 0%, #0c4a6e 100%); }

.portfolio-card .eyebrow { color: rgba(255,255,255,.70); font-size: .6rem; }
.portfolio-icon { font-size: 2.2rem; margin-bottom: 26px; }
.portfolio-card h2 { font-size: 1.3rem; margin: 6px 0; font-weight: 700; letter-spacing: -.03em; }
.portfolio-card p  { line-height: 1.55; color: rgba(255,255,255,.78); max-width: 240px; font-size: .85rem; }
.portfolio-card-actions {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.portfolio-card-link {
  font-size: .78rem;
  color: rgba(255,255,255,.88);
  text-decoration: none;
  transition: color 160ms;
}
.portfolio-card-link:hover { color: #fff; }
.portfolio-card-link i,
.portfolio-entry-btn i {
  font-style: normal;
  font-size: 1rem;
  margin-left: 4px;
}
.portfolio-entry-btn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #1e293b;
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(15,23,42,.16);
  transition: transform 160ms, box-shadow 160ms, background 160ms;
}
.portfolio-entry-btn:hover {
  transform: translateY(-1px);
  background: #fff;
  box-shadow: 0 10px 22px rgba(15,23,42,.22);
}

/* ════════════════════════════════════════════════════════════════
   CONTROL CENTRE — compact cards, large charts, light scroll OK
   ════════════════════════════════════════════════════════════════ */
body:has(.finance-hub) .page.compact-page {
  padding: 12px 16px 20px !important;
}
.finance-hub {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.finance-hub .finance-hub-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
  max-width: none;
  margin: 0;
}
.finance-hub .finance-hub-welcome-main {
  min-width: 0;
  flex: 1 1 280px;
}
.finance-hub .finance-hub-welcome h1 {
  margin: 4px 0 0;
  font-size: 1.35rem !important;
  line-height: 1.2;
}
.finance-hub .finance-hub-welcome p {
  margin: 4px 0 0;
  font-size: .82rem !important;
  color: #64748b;
  max-width: 520px;
}
.finance-hub .finance-hub-date-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.finance-hub .finance-hub-date-top label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  margin: 0;
}
.finance-hub .finance-hub-date-top input[type="date"] {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: .9rem;
}
.finance-hub .finance-hub-stats-head {
  padding: 8px 0 0;
  max-width: none;
  margin: 4px 0 0;
  border-top: 1px solid var(--line, #e2e8f0);
}
.finance-hub .finance-hub-stats-head h1 {
  margin: 2px 0 0;
  font-size: 1.15rem !important;
}
.finance-hub .eyebrow {
  font-size: .6rem !important;
  letter-spacing: .1em;
}
.finance-hub .license-status-card {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
}
.finance-hub .license-status-main h2 {
  font-size: .85rem !important;
  margin: 0 !important;
}
.finance-hub .license-status-main .eyebrow { display: none; }

/* Portfolio cards — larger, clearer presence */
.finance-hub .portfolio-grid {
  gap: 16px;
  margin: 0;
}
.finance-hub .portfolio-card {
  min-height: 168px;
  height: auto;
  padding: 30px 28px;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(23, 37, 84, .18);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px 18px;
}
.finance-hub .portfolio-card:hover { transform: translateY(-3px); }
.finance-hub .portfolio-card::after,
.finance-hub .portfolio-card::before { display: none; }
.finance-hub .portfolio-icon {
  font-size: 2.35rem;
  margin: 0;
}
.finance-hub .portfolio-card .eyebrow {
  font-size: .7rem !important;
  margin-bottom: 6px;
}
.finance-hub .portfolio-card h2 {
  font-size: 1.45rem !important;
  margin: 0 !important;
  font-weight: 750 !important;
}
.finance-hub .portfolio-card p { display: none; }
.finance-hub .portfolio-card-actions {
  margin: 0;
  padding: 0;
  gap: 14px;
}
.finance-hub .portfolio-card-link { font-size: .9rem !important; }
.finance-hub .portfolio-entry-btn {
  min-height: 42px;
  padding: 0 18px;
  font-size: .9rem !important;
  box-shadow: 0 8px 16px rgba(15, 23, 42, .16);
}

/* Daily collection report cards */
.finance-hub .finance-hub-report {
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 12px;
}
.finance-hub .finance-hub-report .panel-head {
  padding: 12px 16px 6px !important;
  margin: 0 !important;
  border: 0 !important;
}
.finance-hub .finance-hub-report .panel-head h2 {
  margin: 0 !important;
  font-size: 1.05rem !important;
}
.finance-hub .finance-hub-report .panel-head p {
  display: block;
  margin: 3px 0 0;
  font-size: .78rem !important;
  color: #64748b;
}
.finance-hub .pnl-grid {
  gap: 10px;
  padding: 10px 14px 14px !important;
}
.finance-hub .pnl-item {
  padding: 12px 14px;
  border-radius: 10px;
}
.finance-hub .pnl-item small { font-size: .68rem; }
.finance-hub .pnl-item strong { margin-top: 4px; font-size: 1.2rem; }

/* Global stats — all 7 in one row */
.finance-hub .stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.finance-hub .stats > div,
.finance-hub .stats .metric {
  grid-column: auto !important;
  padding: 10px 10px !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05) !important;
  transform: none !important;
  min-width: 0;
  min-height: 72px !important;
}
.finance-hub .stats > div:hover,
.finance-hub .stats .metric:hover { transform: none !important; }
.finance-hub .stats small,
.finance-hub .stats .metric small {
  font-size: .55rem !important;
  letter-spacing: .02em !important;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.finance-hub .stats strong,
.finance-hub .stats .metric strong {
  font-size: 1.05rem !important;
  margin-top: 4px !important;
  line-height: 1.15;
}
.finance-hub .stats span,
.finance-hub .stats .metric span {
  font-size: .62rem !important;
  margin-top: 2px !important;
  display: block;
  color: #64748b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.finance-hub .stats .profit-metric strong { font-size: 1.05rem !important; }

/* Large charts */
.finance-hub .finance-hub-charts {
  margin: 4px 0 0 !important;
  gap: 14px;
}
.finance-hub .finance-hub-charts article {
  min-height: 320px !important;
  padding: 14px 16px !important;
  border-radius: 12px;
  margin: 0;
}
.finance-hub .finance-hub-charts .panel-head {
  padding: 0 0 8px !important;
  margin: 0 !important;
  border: 0 !important;
}
.finance-hub .finance-hub-charts .panel-head h2 {
  margin: 0 !important;
  font-size: 1.05rem !important;
}
.finance-hub .finance-hub-charts .panel-head p {
  display: block;
  margin: 2px 0 0;
  font-size: .75rem !important;
  color: #64748b;
}
.finance-hub .finance-hub-charts .chart-wrap {
  min-height: 260px;
}
.finance-hub .finance-hub-charts canvas {
  width: 100% !important;
  height: 260px !important;
  max-height: none;
}
.finance-hub .trend-pill {
  font-size: .68rem;
  padding: 3px 8px;
}

@media (max-width: 1100px) {
  .finance-hub .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 900px) {
  .finance-hub .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .finance-hub .finance-hub-charts {
    grid-template-columns: 1fr;
  }
  .finance-hub .finance-hub-charts canvas {
    height: 220px !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  #sidebar { width: 240px; }
  main { margin-left: 240px; }
  .portfolio-grid { grid-template-columns: 1fr; }
  .finance-hub .portfolio-grid { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 768px) {
  main { margin-left: 0; }
  .page { padding: 16px 14px; }
  header { padding: 0 16px; }
  .user, .today { display: none; }
  .hero h1, .welcome h1 { font-size: 1.4rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
