html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f3f5f8;
  color: #1a1f2b;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f172a, #1e293b);
}

.login-card {
  width: min(420px, 92vw);
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.login-logo {
  width: min(220px, 65vw);
  height: auto;
  display: block;
}

.ops-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  overflow-x: clip;
}

body.ops-sidebar-collapsed .ops-shell {
  grid-template-columns: 74px minmax(0, 1fr);
}

.ops-sidebar {
  background: #0f172a;
  color: #fff;
  padding: 16px 12px;
  transition: transform 0.25s ease;
  z-index: 30;
}

.ops-brand {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 1rem;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.ops-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ops-collapse-toggle {
  min-width: 34px;
  padding: 2px 6px;
  line-height: 1.1;
}

.ops-link {
  color: #e2e8f0;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ops-link-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.ops-link-icon:empty {
  display: none;
}

.ops-link-label {
  white-space: nowrap;
}

.ops-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body.ops-sidebar-collapsed .ops-brand {
  opacity: 0;
  width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.ops-sidebar-collapsed .ops-collapse-toggle {
  width: 100%;
}

body.ops-sidebar-collapsed .ops-link {
  justify-content: center;
  padding: 10px 8px;
  gap: 0;
}

body.ops-sidebar-collapsed .ops-link-label {
  display: none;
}

body.ops-sidebar-collapsed .ops-sidebar-refresh {
  padding: 8px 6px;
}

body.ops-sidebar-collapsed .ops-sidebar-refresh .form-check-label,
body.ops-sidebar-collapsed .ops-sidebar-refresh .ops-auto-refresh-status,
body.ops-sidebar-collapsed .ops-sidebar-refresh .ops-auto-refresh-updated {
  display: none;
}

body.ops-sidebar-collapsed .ops-sidebar-refresh .form-check {
  justify-content: center;
}

.ops-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.ops-header {
  min-height: 60px;
  background: #fff;
  border-bottom: 1px solid #dde4ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 8px;
}

.ops-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.ops-auto-refresh-meta {
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: #6b7280;
  white-space: nowrap;
}

.ops-auto-refresh-meta .form-check-input {
  margin-top: 0;
  transform: scale(0.9);
}

.ops-auto-refresh-status,
.ops-auto-refresh-updated {
  font-size: 0.68rem;
  line-height: 1.1;
}

.ops-sidebar-refresh {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
}

.ops-sidebar-refresh .form-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ops-sidebar-refresh .form-check-input {
  margin-top: 0;
  transform: scale(1.05);
}

.ops-sidebar-refresh .form-check-label {
  font-size: 0.84rem;
  font-weight: 600;
}

.ops-sidebar-refresh .ops-auto-refresh-status,
.ops-sidebar-refresh .ops-auto-refresh-updated {
  margin-top: 6px;
  font-size: 0.74rem;
  color: #cbd5e1;
}

.ops-content {
  padding: 16px;
}

.kpi-card {
  background: #fff;
  border: 1px solid #dde4ed;
  border-radius: 12px;
  padding: 12px;
}

.kpi-card-top {
  min-height: 108px;
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 0.82rem;
  color: #52627a;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 4px;
}

.kpi-meta {
  font-size: 0.74rem;
  line-height: 1.15;
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #52627a;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green {
  background: #16a34a;
}

.status-dot.yellow {
  background: #f59e0b;
}

.status-dot.red {
  background: #dc2626;
}

.roi-risk-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px #ffffff inset;
}

.roi-risk-dot-green {
  background: #00a63e;
  border: 1.5px solid #0b5d1e;
}

.roi-risk-dot-yellow {
  background: #ffb703;
  border: 1.5px solid #8a5a00;
}

.roi-risk-dot-red {
  background: #d90429;
  border: 1.5px solid #6a040f;
  animation: roiRiskRedPulse 1.15s ease-in-out infinite;
}

@keyframes roiRiskRedPulse {
  0% {
    box-shadow: 0 0 0 1px #ffffff inset, 0 0 0 0 rgba(217, 4, 41, 0.55);
  }
  70% {
    box-shadow: 0 0 0 1px #ffffff inset, 0 0 0 8px rgba(217, 4, 41, 0);
  }
  100% {
    box-shadow: 0 0 0 1px #ffffff inset, 0 0 0 0 rgba(217, 4, 41, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .roi-risk-dot-red {
    animation: none;
  }
}

.ops-actions-cell {
  min-width: 180px;
}

.ops-overlay {
  display: none;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
}

.ops-menu-toggle {
  display: none;
}

.ops-mobile-nav {
  display: none;
}

.ops-date-group .form-control,
.ops-date-group .flatpickr-input {
  background: #fff;
  border-color: #d7dde8;
  border-right: 0;
  font-weight: 500;
}

.ops-date-group .input-group-text {
  background: #fff;
  border-color: #d7dde8;
  color: #5b6475;
  cursor: pointer;
}

.ops-date-group .form-control:focus,
.ops-date-group .flatpickr-input:focus {
  box-shadow: none;
  border-color: #6ea8fe;
}

.ops-date-group .form-control:focus + .input-group-text,
.ops-date-group .flatpickr-input:focus + .input-group-text {
  border-color: #6ea8fe;
}

.flatpickr-calendar {
  border: 1px solid #d7dde8;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.14);
  z-index: 5000 !important;
}

.ops-fp-presets {
  min-width: 140px;
  border-right: 1px solid #e5e9f2;
  background: #f8fafc;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 140px;
}

.flatpickr-calendar.ops-fp-with-presets .flatpickr-innerContainer {
  display: flex;
  align-items: stretch;
}

.ops-fp-preset-btn {
  border: 0;
  background: transparent;
  color: #334155;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  padding: 6px 8px;
}

.ops-fp-preset-btn:hover {
  background: #e8eefc;
  color: #0d6efd;
}

.ga4-mini-trend {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-height: 56px;
}

.ga4-mini-trend-item {
  flex: 1 1 auto;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  opacity: 0.9;
}

#ga4RealtimeCard.ga4-up {
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18) inset;
}

#ga4RealtimeCard.ga4-down {
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.16) inset;
}

#ga4ActiveUsersValue {
  transition: transform 0.2s ease, color 0.2s ease;
}

#ga4ActiveUsersValue.ga4-value-up {
  animation: ga4ValueUpPulse 0.55s ease;
  color: #15803d;
}

#ga4ActiveUsersValue.ga4-value-down {
  animation: ga4ValueDownPulse 0.55s ease;
  color: #b91c1c;
}

@keyframes ga4ValueUpPulse {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-2px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes ga4ValueDownPulse {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(2px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

.tooltip.ops-tooltip-wide .tooltip-inner {
  max-width: 420px;
  text-align: left;
  line-height: 1.35;
  padding: 10px 12px;
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  body.ops-sidebar-collapsed .ops-shell {
    grid-template-columns: 1fr;
  }

  .ops-shell {
    grid-template-columns: 1fr;
  }

  .ops-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
  }

  .ops-menu-toggle {
    display: inline-block;
  }

  .ops-header {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .ops-content {
    padding: 12px;
    padding-bottom: 78px;
  }

  body.ops-menu-open .ops-sidebar {
    transform: translateX(0);
  }

  .ops-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
  }

  body.ops-menu-open .ops-overlay {
    display: block;
  }

  .table-responsive {
    font-size: 0.82rem;
  }

  .ops-actions-cell {
    min-width: 150px;
  }

  .ops-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 62px;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 40;
  }

  .ops-mobile-link {
    text-decoration: none;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 600;
    display: grid;
    place-items: center;
    letter-spacing: 0.2px;
  }

  .ops-mobile-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
  }

  .ops-fp-presets {
    min-width: 112px;
    padding: 6px;
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
