/* =====================================================================
   Haritha Dashboard — consolidated stylesheet
   Unified card system: ALL cards (top 4 + 8 agency cards) use .ov-card.
   Card head is its own shaded zone, distinct from the body.
   Hero now uses single circular logos (left.png / right.png).
   ===================================================================== */

/* ---------- Theme tokens ---------- */
:root,
[data-theme="dark"] {
  --primary-bg:     #1A202C;
  --secondary-bg:   #2D3748;
  --accent-bg:      #4A5568;
  --card-bg:        rgba(45, 55, 72, 0.6);
  --card-bg-solid:  #2D3748;

  --text-primary:   #F7FAFC;
  --text-secondary: #CBD5E0;
  --text-muted:     #A0AEC0;
  --text-inverse:   #1A202C;

  --brand-primary:  #EB9534;
  --brand-glow:     rgba(235, 149, 52, 0.25);

  --success:        #38A169;
  --info:           #3182CE;
  --warning:        #DD6B20;
  --error:          #E53E3E;

  --border-light:   rgba(255, 255, 255, 0.08);
  --border-medium:  rgba(255, 255, 255, 0.16);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.40);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="light"] {
  --primary-bg:     #F7FAFC;
  --secondary-bg:   #EDF2F7;
  --accent-bg:      #E2E8F0;
  --card-bg:        #FFFFFF;
  --card-bg-solid:  #FFFFFF;

  --text-primary:   #1A202C;
  --text-secondary: #4A5568;
  --text-muted:     #718096;
  --text-inverse:   #FFFFFF;

  --border-light:   rgba(0, 0, 0, 0.08);
  --border-medium:  rgba(0, 0, 0, 0.14);
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--primary-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- Layout shell ---------- */
.public-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--primary-bg);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  padding: clamp(0.75rem, 2vw, 1.5rem);
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.layout-footer {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}
.footer-sep { opacity: 0.4; }

/* ---------- Hero ---------- */
.hero-section {
  background: linear-gradient(135deg, var(--secondary-bg) 0%, var(--accent-bg) 100%);
  padding: clamp(0.75rem, 2vh, 1.25rem) clamp(1rem, 2vw, 1rem);
  border-bottom: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.4rem, 1vw, 0.75rem);
  max-width: 1600px;
  margin: 0 auto;
}

/* Single circular logo on each side of the hero title. Sized to match the
   hero content area's natural height so it visually fills the strip. */
.hero-logo {
  flex: 0 0 auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}
.hero-logo:hover { transform: scale(1.05); }

.hero-logo--circular {
  height: clamp(48px, 7.5vh, 60px);
  width:  clamp(48px, 7.5vh, 60px);
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);   /* peeks through any transparency */
}

.hero-title-section { flex: 1 1 auto; text-align: center; min-width: 0; }
.hero-title {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.7rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.hero-subtitle {
  margin: 0.2rem 0 0;
  font-size: clamp(0.72rem, 1.2vw, 0.9rem);
  color: var(--text-secondary);
  font-weight: 500;
}

/* ---------- "Overall Project Overview" banner ----------
   Same shell as .agency-header for visual uniformity. */
.overview-banner {
  background: linear-gradient(135deg, var(--secondary-bg), var(--accent-bg));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  min-height: clamp(45px, 4.7vw, 57px);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.4rem, 0.9vw, 0.65rem) clamp(1rem, 2vw, 2rem);
}
.overview-banner__title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  font-weight: 700;
  color: var(--brand-primary);
  text-shadow: 0 1px 8px var(--brand-glow);
  letter-spacing: 0.005em;
  line-height: 1.25;
}

/* ---------- Overall Project Overview section ---------- */
.overview-section {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 1.6vw, 1.25rem);
  margin-top: clamp(0.25rem, 0.6vw, 0.5rem);
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.1vw, 1rem);
}

/* =====================================================================
   Unified card system
   ===================================================================== */

.ov-card {
  background: var(--card-bg-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: clamp(135px, 14vw, 170px);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.ov-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

/* Shaded title strip — uniform height across all cards regardless of
   how many lines the title wraps to. */
.ov-card__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
  min-height: clamp(58px, 5vw, 72px);
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border-medium);
  padding: clamp(0.6rem, 1vw, 0.85rem) clamp(0.85rem, 1.4vw, 1.15rem);
}

.ov-card__icon {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  line-height: 1.2;
  flex: 0 0 auto;
}

.ov-card__titles {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ov-card__title {
  margin: 0;
  font-size: clamp(0.9rem, 1.3vw, 1.1rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ov-card__subtitle {
  margin: 0;
  font-size: clamp(0.7rem, 0.95vw, 0.78rem);
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ov-card__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: clamp(0.65rem, 0.9vw, 0.78rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ov-card__badge--orange { background: var(--brand-primary); }
.ov-card__badge--green  { background: var(--success, #38A169); }
.ov-card__badge--red    { background: var(--error, #E53E3E); }
.ov-card__badge--blue   { background: var(--info, #3182CE); }

/* ---- Card body ---- */
.ov-card__body {
  flex: 1;
  display: flex;
  min-width: 0;
  padding: clamp(0.85rem, 1.4vw, 1.15rem) clamp(0.85rem, 1.4vw, 1.15rem);
}

/* ---- Layout: stacked → vertical, each row inline (value | label) ---- */
.ov-card--stacked .ov-card__body {
  flex-direction: column;
  justify-content: center;
  gap: clamp(0.5rem, 1vw, 0.85rem);
}
.ov-card--stacked .ov-card__stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}
.ov-card--stacked .ov-card__stat-label {
  text-align: right;
  flex: 0 1 auto;
  white-space: nowrap;
}
.ov-card--stacked .ov-card__stat-value {
  flex: 1 1 auto;
  min-width: 0;
}
.ov-card--stacked .ov-card__divider {
  display: block;
  height: 1px;
  background: var(--border-light);
  margin: 0;
}

/* ---- Layout: horizontal → side-by-side, vertical dividers ---- */
.ov-card--horizontal .ov-card__body {
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(0.4rem, 1vw, 0.85rem);
}
.ov-card--horizontal .ov-card__stat {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.25rem;
}
.ov-card--horizontal .ov-card__divider {
  display: block;
  width: 1px;
  align-self: stretch;
  background: var(--border-light);
  flex: 0 0 1px;
}
.ov-card--horizontal .ov-card__stat-value {
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
}

/* ---- Layout: grid_2x2 → 4 stats in a 2×2 with cross-hair separators ---- */
.ov-card--grid_2x2 .ov-card__body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 0.55rem 1rem;
}
.ov-card--grid_2x2 .ov-card__body::before,
.ov-card--grid_2x2 .ov-card__body::after {
  content: "";
  position: absolute;
  background: var(--border-light);
  pointer-events: none;
}
.ov-card--grid_2x2 .ov-card__body::before {
  left: 0; right: 0; top: 50%; height: 1px;
  transform: translateY(-50%);
}
.ov-card--grid_2x2 .ov-card__body::after {
  top: 0; bottom: 0; left: 50%; width: 1px;
  transform: translateX(-50%);
}
.ov-card--grid_2x2 .ov-card__stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  min-width: 0;
}
.ov-card--grid_2x2 .ov-card__stat-label {
  text-align: right;
  white-space: nowrap;
  font-size: clamp(0.6rem, 0.78vw, 0.7rem);
}
.ov-card--grid_2x2 .ov-card__divider { display: none; }

/* ---- Layout: featured ---- */
.ov-card--featured .ov-card__body {
  flex-direction: column;
  gap: 0.6rem;
  justify-content: flex-start;
}
.ov-card__primary {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.ov-card__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ov-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.32rem 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: clamp(0.78rem, 1vw, 0.88rem);
}
.ov-card__row:last-child { border-bottom: none; }
.ov-card__row-label { color: var(--text-secondary); }
.ov-card__row-value {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- Layout: list ---- */
.ov-card--list .ov-card__body {
  flex-direction: column;
  gap: 0.25rem;
}
.ov-card__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}
.ov-card__list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  font-size: clamp(0.78rem, 1vw, 0.86rem);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ov-card__list-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-medium);
}
.ov-card__list-label {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ov-card__list-value {
  color: var(--text-secondary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.ov-card__empty {
  margin: auto 0;
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ---- Stat numbers (defaults + size auto-fit) ---- */
.ov-card__stat-value {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.ov-card__stat-value.is-lg { font-size: clamp(2rem,    3.8vw, 3rem);   }
.ov-card__stat-value.is-md { font-size: clamp(1.65rem, 3vw,   2.4rem); }
.ov-card__stat-value.is-sm { font-size: clamp(1.3rem,  2.4vw, 1.9rem); }
.ov-card__stat-value.is-xs { font-size: clamp(1.05rem, 1.9vw, 1.5rem); }

.ov-card__stat-label {
  font-size: clamp(0.65rem, 0.85vw, 0.74rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ---------- Agency rotating header ---------- */
.agency-header {
  position: relative;
  background: linear-gradient(135deg, var(--secondary-bg), var(--accent-bg));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: grid;
  grid-template-areas: "stack";
  min-height: clamp(45px, 4.7vw, 57px);
  box-shadow: var(--shadow-sm);
}

.agency-header__slide {
  grid-area: stack;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.agency-header__slide.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.agency-header__inner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  text-align: center;
  padding: clamp(0.4rem, 0.9vw, 0.65rem) clamp(2.6rem, 4.5vw, 3.5rem);
  max-width: 100%;
}

.agency-header__name,
.agency-header__meta {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  line-height: 1.25;
  letter-spacing: 0.005em;
}

.agency-header__name {
  font-weight: 700;
  color: var(--brand-primary);
  text-shadow: 0 1px 8px var(--brand-glow);
}

.agency-header__meta {
  font-weight: 600;
  color: var(--text-secondary);
}

.agency-header__sep {
  color: var(--brand-primary);
  opacity: 0.55;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  line-height: 1.25;
}

.agency-header__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(26px, 2.6vw, 32px);
  height: clamp(26px, 2.6vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-medium);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.agency-header__nav:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  transform: translateY(-50%) scale(1.05);
}
.agency-header__nav:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.agency-header__nav--prev { left: clamp(0.4rem, 0.8vw, 0.7rem); }
.agency-header__nav--next { right: clamp(0.4rem, 0.8vw, 0.7rem); }

/* ---------- Main cards stage ---------- */
.main-cards-stage {
  position: relative;
  display: grid;
  grid-template-areas: "stack";
}

.agency-slide {
  grid-area: stack;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.agency-slide.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.main-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: clamp(0.6rem, 1vw, 1rem);
}

/* =====================================================================
   Responsive breakpoints
   ===================================================================== */

@media (min-width: 1200px) {
  .main-cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1199px) {
  .overview-cards  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .main-cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .overview-cards  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .hero-content {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
  .hero-title-section { order: -1; flex: 1 1 100%; }

  .overview-cards  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .main-content { padding: 0.6rem; gap: 0.7rem; }

  .hero-section { padding: 0.6rem 0.75rem; }
  .hero-logo--circular {
    height: clamp(40px, 7vh, 48px);
    width:  clamp(40px, 7vh, 48px);
  }

  .overview-banner { min-height: 44px; padding: 0.4rem 1rem; }
  .overview-banner__title { font-size: 0.88rem; }

  .overview-cards  { grid-template-columns: 1fr; gap: 0.55rem; }
  .main-cards-grid { grid-template-columns: 1fr; gap: 0.55rem; }

  .ov-card { min-height: 120px; }
  .ov-card__head { padding: 0.55rem 0.85rem; min-height: 52px; }
  .ov-card__body { padding: 0.75rem 0.85rem; }
  .ov-card__stat-value { font-size: 1.7rem; }
  .ov-card__title { font-size: 0.95rem; }
  .ov-card__primary { font-size: 1.55rem; }

  .agency-header__name,
  .agency-header__meta,
  .agency-header__sep { font-size: 0.88rem; }
  .agency-header { min-height: 44px; }
  .agency-header__inner { padding: 0.4rem 2.4rem; gap: 0.4rem; }
  .agency-header__nav { width: 26px; height: 26px; font-size: 1rem; }
}

@media (max-width: 360px) {
  .overview-cards { grid-template-columns: 1fr; }
  .hero-title { font-size: 1rem; }
  .hero-subtitle { display: none; }

  .ov-card--horizontal .ov-card__body {
    flex-wrap: wrap;
    gap: 0.5rem 0.25rem;
  }
  .ov-card--horizontal .ov-card__stat { flex: 1 1 calc(50% - 0.5rem); }
  .ov-card--horizontal .ov-card__divider { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body { background: white; color: black; }
  .agency-header__nav { display: none; }
  .agency-slide { opacity: 1 !important; transform: none !important; }
  .ov-card { box-shadow: none; break-inside: avoid; }
}
/* ---------- Hover-to-reveal login bar ---------- */
.top-login-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  padding: 0 24px;
  background: var(--secondary-bg);
  border-bottom: 1px solid var(--border-medium);
  box-shadow: var(--shadow-md);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transform: translateY(-100%);            /* fully hidden by default */
  transition: transform 0.25s ease;
}

/* Invisible 16px hover-detection strip pinned to the top of the viewport.
   It hugs the banner's bottom edge — when the banner is hidden above
   the viewport, this strip lands exactly at the top of the screen. */
.top-login-bar::before {
  content: "";
  position: absolute;
  top: 100%; left: 0; right: 0;
  height: 16px;
}

.top-login-bar:hover,
.top-login-bar:focus-within {
  transform: translateY(0);
}

.top-login-bar__btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.top-login-bar__btn:hover {
  background: #d4831e;
  transform: translateY(-1px);
}