* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
}

.dashboard-layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 256px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e4e4e7;
}

.sidebar-logo {
  padding: 24px;
}

.sidebar-logo a {
  font-size: 1.25rem;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #52525b;
  font-size: 0.95rem;
  transition: background-color 0.2s, color 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: #f4f4f5;
  color: #333;
}

.nav-item.active {
  background: #f4f4f5;
  color: #333;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Main content */
.main-content {
  flex: 1;
  overflow-y: auto;
}

.content-area {
  padding: 48px;
  max-width: 800px;
}

/* Overview */
.overview-greeting {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 16px;
}

.overview-text {
  color: #666;
  margin-bottom: 32px;
  line-height: 1.8;
}

.product-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.product-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.product-link:hover {
  background: #f4f4f5;
}

/* Settings */
.settings-section {
  border-bottom: 1px solid #f4f4f5;
  padding: 16px 0;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-label {
  font-weight: 500;
  color: #27272a;
}

.settings-detail {
  font-size: 0.875rem;
  color: #71717a;
  margin-top: 4px;
}

.settings-detail a {
  color: #2563eb;
  text-decoration: none;
}

.settings-detail a:hover {
  color: #1d4ed8;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-free {
  background: #f4f4f5;
  color: #71717a;
}

.badge-active {
  background: #f0fdf4;
  color: #166534;
  font-size: 0.95rem;
  font-weight: 400;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
  border: none;
  white-space: nowrap;
}

.settings-btn-secondary {
  color: #52525b;
  background: #f4f4f5;
}

.settings-btn-secondary:hover {
  background: #e4e4e7;
}

.settings-btn-primary {
  color: #fff;
  background: #1d1d1d;
}

.settings-btn-primary:hover {
  background: #333;
}

.logged-in-as {
  font-size: 0.875rem;
  color: #71717a;
  padding-bottom: 12px;
  border-bottom: 1px solid #f4f4f5;
  margin-bottom: 8px;
}

.logged-in-as span {
  font-weight: 500;
  color: #27272a;
}

/* Loading */
.loading-spinner {
  color: #71717a;
  font-size: 0.875rem;
}

/* Licenses */
.license-section {
  border-bottom: 1px solid #f4f4f5;
  padding: 24px 0;
}

.license-section:last-child {
  border-bottom: none;
}

.license-section h2 {
  font-size: 1rem;
  font-weight: 500;
  color: #27272a;
  margin-bottom: 16px;
}

.license-subtitle {
  color: #71717a;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 16px;
  padding-left: 20px;
}

.license-subtitle li {
  margin-bottom: 4px;
}

.license-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.license-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.875rem;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
}

.license-input:focus {
  border-color: #a1a1aa;
}

.license-list {
  list-style: none;
  margin-top: 12px;
}

.license-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fafafa;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: #333;
}

.license-list li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.license-list button {
  background: none;
  border: none;
  color: #a1a1aa;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
  line-height: 1;
}

.license-list button:hover {
  color: #ef4444;
}

.license-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 4px;
}

.license-domain-note {
  color: #71717a;
  font-size: 0.75rem;
}

.analytics-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.analytics-title-block {
  flex: 1;
}

.analytics-title-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.analytics-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.analytics-controls-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.analytics-section {
  margin-bottom: 28px;
}

.analytics-section:last-child {
  margin-bottom: 0;
}

.analytics-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.analytics-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #18181b;
  margin-bottom: 4px;
}

.analytics-section-copy {
  color: #71717a;
  font-size: 0.875rem;
}

.analytics-section-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Chart card */
.chart-card {
  background: #fafafa;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e4e4e7;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

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

.chart-card-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #71717a;
  margin-bottom: 4px;
}

.chart-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #18181b;
  margin-bottom: 8px;
}

.chart-canvas-shell {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
}

.summary-chart-canvas-shell {
  height: 280px;
}

.summary-chart-canvas-shell canvas {
  width: 100% !important;
  height: 100% !important;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.analytics-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Chart stats */
.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.chart-stat {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  padding: 10px 14px;
}

.chart-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #18181b;
}

.chart-stat-label {
  font-size: 0.75rem;
  color: #71717a;
}

/* Hidden */
.hidden {
  display: none;
}

/* Mobile */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid #e4e4e7;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
}

.mobile-header a {
  font-size: 1.25rem;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

.mobile-menu-btn {
  padding: 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
}

.mobile-menu-btn:hover {
  background: #f4f4f5;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    padding-top: 57px;
  }

  .content-area {
    padding: 24px 16px;
  }

  .analytics-page-header,
  .analytics-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .analytics-controls,
  .analytics-section-actions {
    align-items: stretch;
  }

  .analytics-controls-row,
  .analytics-section-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1100px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}
