:root {
  --background: #f5f6f8;
  --surface: #ffffff;
  --text: #1f2937;
  --btn-border: #d1d5db;
  --line-red: #0055a4;
  --michelin-yellow: #ffd100;
}

html.dark-theme {
  --background: #0f172a;
  --surface: #111827;
  --text: #e5e7eb;
  --btn-border: #334155;
  --line-red: #0055a4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--background);
  color: var(--text);
}

.top-header {
  min-height: 70px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--line-red);
  border-bottom: none;
}

.brand-separator {
  height: 6px;
  background: var(--michelin-yellow);
}

.brand-logo {
  height: 62px;
  width: auto;
  display: block;
}

.theme-toggle {
  border: none;
  background: transparent;
  color: #ffffff;
  border-radius: 8px;
  width: 52px;
  height: 52px;
  margin-right: 68px;
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.red-line {
  border-top: none;
  background: var(--line-red);
  border-bottom: none;
}

.insights-strip {
  background: var(--michelin-yellow);
  position: relative;
}

.insights-strip-line {
  height: 6px;
}

.insights-toggle {
  width: 44px;
  height: 44px;
  position: absolute;
  top: 0;
  right: 18px;
  transform: translateY(-44%);
  border: none;
  background: #1f2937;
  color: #ffffff;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

.insights-toggle:hover {
  background: #111827;
}

.insights-toggle svg {
  width: 22px;
  height: 22px;
  transition: transform 0.45s ease;
}

.insights-toggle.is-open {
  background: #0b1220;
}

.insights-toggle.is-open svg {
  transform: rotate(180deg);
}

.insights-panel {
  background: var(--surface);
  border-top: 0;
  border-bottom: 0;
  padding: 0 18px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform-origin: top center;
  transform: perspective(900px) rotateX(-82deg) translateY(-10px);
  transition:
    max-height 0.58s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.34s ease,
    transform 0.58s cubic-bezier(0.23, 1, 0.32, 1),
    padding 0.42s ease,
    border-color 0.28s ease;
}

.insights-strip.is-open .insights-panel {
  border-top: 1px solid rgba(0, 0, 0, 0.14);
  border-bottom: 1px solid var(--btn-border);
  padding: 14px 18px 18px;
  max-height: 900px;
  opacity: 1;
  transform: perspective(900px) rotateX(0deg) translateY(0);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.insight-card {
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px;
  min-height: 280px;
}

.insight-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.insight-card canvas {
  width: 100% !important;
  height: 230px !important;
}

.menu-row {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.menu-btn {
  border: none;
  background: transparent;
  color: #ffffff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.menu-btn:hover,
.menu-btn-active {
  background: transparent;
}

.user-menu {
  margin-left: auto;
  margin-right: 68px;
  position: relative;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 16px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
}

.user-icon {
  display: inline-flex;
}

.user-icon svg {
  width: 24px;
  height: 24px;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 8px;
  display: none;
  z-index: 50;
}

.user-dropdown.open {
  display: block;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
}

.logout-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

html.dark-theme .logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .insights-grid {
    grid-template-columns: 1fr;
  }

  .menu-row {
    flex-wrap: wrap;
  }

  .user-menu {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    justify-content: flex-end;
  }
}

