:root {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.15);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --white: #f8fafc;
  --border: rgba(148, 163, 184, 0.2);

  /* Font size variables for consistency */
  --font-size-xs: 0.8rem; /* 12.8px */
  --font-size-sm: 0.85rem; /* 13.6px */
  --font-size-base: 0.9rem; /* 14.4px */
  --font-size-md: 0.95rem; /* 15.2px */
  --font-size-lg: 1rem; /* 16px */
  --font-size-xl: 1.25rem; /* 20px */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.not-found {
  display: block;
  min-height: 100vh;
  background: var(--bg);
}

.hero {
  background: radial-gradient(
      circle at top left,
      rgba(15, 23, 42, 0.6),
      transparent
    ),
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.45), transparent),
    var(--bg-alt);
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.hero__content {
  width: 92vw;
  max-width: none;
  margin: 0 auto;
  text-align: center;
  padding: 0;
}

h1,
h2 {
  margin: 0 0 0.5rem;
  color: var(--white);
  letter-spacing: 0.04em;
}

.hero p {
  margin: 0 auto 1.5rem;
  max-width: 680px;
  line-height: 1.6;
  color: var(--muted);
}

.link-home {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.link-home:hover {
  text-decoration: underline;
}

.fab-upload {
  position: fixed;
  right: clamp(1rem, 4vw, 2.5rem);
  bottom: clamp(1rem, 4vw, 2.5rem);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 2.4rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 22px 35px -18px rgba(249, 115, 22, 0.65);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 20;
}

.fab-upload:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 42px -18px rgba(249, 115, 22, 0.8);
}

.fab-upload.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

.fab-upload.is-disabled:hover {
  transform: none;
}

.fab-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: inherit;
}

.fab-upload__icon {
  transform: translateY(-2px);
}

.progress-card h3,
.chart-card h3 {
  margin: 0;
  color: var(--white);
  letter-spacing: 0.04em;
  font-size: var(--font-size-xl); /* Zorg voor consistente font size */
  line-height: 1.2; /* Zorg voor consistente line height */
}

.progress-card__subtitle,
.chart-card__header p {
  margin: 0.3rem 0 0; /* Consistente margin */
  color: var(--muted);
  font-size: var(--font-size-md);
  line-height: 1.3; /* Zorg voor consistente line height */
}

.progress-card__summary {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-md);
}

.progress-card__meta,
#footerUpdated {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-xs);
}

.progress-circle {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-circle__background {
  fill: none;
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 12;
}

.progress-circle__value {
  fill: none;
  stroke: var(--accent);
  stroke: url(#progressGradient);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.progress-circle__content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.progress-circle__percent {
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
}

.progress-circle__count {
  font-size: var(--font-size-md);
  color: var(--muted);
}

.chart-card__header {
  margin-bottom: 0.5rem; /* Minimale margin */
  min-height: 70px; /* Verminderd voor compactere layout */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.chart-card__header h2 {
  margin: 0;
  color: var(--white);
}

.chart-divider {
  margin: 0.5rem 0 0.75rem;
  border: none;
  border-top: 1px solid var(--border);
}

.chart-subtext {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-md);
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
  white-space: normal;
}

.chart-subtext__value {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}

.chart-subtext__tail {
  white-space: normal;
}

/* Layout containers */
.dashboard {
  flex: 1;
  width: 92vw;
  margin: -1.25rem auto 2rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-button {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.6);
  color: var(--muted);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 500;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
}

.filter-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -16px rgba(249, 115, 22, 0.45);
}

.filter-button.is-active {
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
  border-color: transparent;
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 18px 30px -18px rgba(249, 115, 22, 0.75);
}

.custom-range-dialog::backdrop {
  background: rgba(15, 23, 42, 0.8);
}

.custom-range-dialog {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), transparent 45%),
    rgba(15, 23, 42, 0.97);
  color: var(--white);
  padding: clamp(1.5rem, 4vw, 2rem);
  width: min(440px, 92vw);
  box-shadow: 0 30px 90px -40px rgba(15, 23, 42, 0.9);
}

.custom-range-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.custom-range-form h3 {
  margin: 0;
  font-size: 1.25rem;
  text-align: center;
}

.custom-range-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.custom-range-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 160px;
  font-size: var(--font-size-sm);
  color: var(--muted);
}

.custom-range-fields label input[type='date'] {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  color: var(--white);
  padding: 0.45rem 0.65rem;
  font-family: inherit;
  font-size: var(--font-size-base);
}

.custom-range-fields label input[type='date']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.custom-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.custom-range-actions button {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
  color: var(--muted);
  font-family: inherit;
  font-size: var(--font-size-base);
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.custom-range-actions button.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--white);
  box-shadow: 0 12px 24px -16px rgba(249, 115, 22, 0.65);
}

.custom-range-actions button:hover,
.custom-range-actions button:focus-visible {
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -16px rgba(148, 163, 184, 0.45);
  outline: none;
}

.custom-range-actions button.primary:hover,
.custom-range-actions button.primary:focus-visible {
  box-shadow: 0 16px 32px -16px rgba(249, 115, 22, 0.75);
}

.filter-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.chart-grid {
  display: contents;
}

.table-and-progress {
  display: contents;
}

.dinner-card {
  grid-column: auto;
}

/* .right-card styling wordt via grid layout gehandeld */

.bottom-grid {
  display: contents;
}

/* bottom-grid flattened via display: contents */

.hour-table-wrapper {
  overflow-x: auto;
}

.hour-table {
  width: 100%;
  border-collapse: collapse;
}

.hour-table th,
.hour-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.hour-table tr.hour-top td {
  color: var(--accent);
  font-weight: 700;
}

.hour-drilldown-dialog .custom-range-form {
  gap: 0.75rem;
}

.chart-card,
.progress-card,
.stat-card {
  height: 100%;
}

.dashboard-summary {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-md);
}

@media (min-width: 960px) {
  .dashboard {
    width: 80vw;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
  .hero__content {
    width: 80vw;
    padding: 0;
  }
}

/* Progress card header voor consistente uitlijning */
.progress-card__header {
  min-height: 70px; /* Zelfde hoogte als chart-card__header */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-bottom: 0.5rem; /* Minimale margin */
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bar-chart__row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 3fr) auto;
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
}

.bar-chart__label {
  font-weight: 500;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-chart__track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  min-width: 0;
}

.bar-chart__bar {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transition: none;
}

.bar-chart__value {
  font-variant-numeric: tabular-nums;
  color: var(--white);
  font-weight: 600;
}

.stat-card__body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.stat-card__value-wrapper {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}

.stat-card__value {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}

.stat-card__unit {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.stat-card__meter {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.stat-card__meter-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #fb923c);
  width: 0%;
  transition: width 0.3s ease;
}

.chart-empty {
  margin: 0.75rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--font-size-md);
}

.chart-forecast {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: var(--font-size-base);
}

.table-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

#summary {
  font-size: var(--font-size-md);
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--accent-soft);
  color: var(--white);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
}

tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

tbody tr:last-child {
  border-bottom: none;
}

td {
  padding: 0.7rem 1rem;
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(148, 163, 184, 0.08);
}

.footer {
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer-upload {
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 1.5rem;
  width: 100%;
  display: inline-flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  transition: color 0.2s ease;
}

.footer-upload:hover,
.footer-upload:focus-visible {
  color: var(--white);
  outline: none;
}

code {
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: var(--font-size-sm);
  color: var(--accent);
}

/* Full-width layout uses 2 equal columns on desktop; single column on mobile */

@media (max-width: 720px) {
  .chart-card__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-chart__row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .bar-chart {
    gap: 0.5rem;
  }

  /* Widgets op mobiel: natuurlijke hoogte, geen max-height */
  .chart-card,
  .progress-card,
  .stat-card {
    max-height: none !important;
    padding: 0.375rem 0.5rem 0.0625rem 0.5rem; /* Verklein onderste padding verder voor mobiel */
  }

  /* Verkoop per week widget specifieke aanpassingen */
  .chart-card .chart-card__header {
    margin-bottom: 0.125rem; /* Verklein ruimte tussen titel en chart verder */
  }

  .chart-card .chart-container {
    margin-bottom: 0; /* Geen onderste marge van chart */
  }

  /* SVG chart specifieke aanpassingen voor mobiel */
  .chart-card svg {
    margin-bottom: 0; /* Geen marge onder SVG */
  }

  /* Weekly chart specifieke aanpassingen voor mobiel */
  .weekly-chart {
    height: 300px !important; /* Verhoog hoogte verder voor betere leesbaarheid op mobiel */
    margin-top: 0.125rem; /* Minimale marge boven chart */
    margin-bottom: 0; /* Geen marge onder chart */
  }

  /* SVG responsive maken voor mobiel */
  .weekly-chart-svg {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    display: block;
  }
}
.chart-card,
.progress-card,
.stat-card {
  background: var(--bg-alt);
  border-radius: 24px;
  padding: clamp(
    0.75rem,
    1.5vw,
    1.25rem
  ); /* Verder verminderd voor minder witruimte */
  box-shadow: 0 30px 60px -35px rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: min(
    600px,
    80vh
  ); /* Responsive maximale hoogte van widgets - overschreven op mobiel */
}

.progress-card {
  gap: 0.25rem; /* Minimale gap voor compacte layout */
  align-items: center;
  text-align: center;
}
.footer-upload.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.weekly-chart {
  width: 100%;
  height: 320px; /* Verminderd voor betere proporties */
  display: flex;
  align-items: flex-start; /* Uitlijnen aan de bovenkant */
  justify-content: center;
  overflow: visible; /* Zorg dat labels niet worden afgeknipt */
  margin-top: 0; /* Geen extra margin aan de bovenkant */
  margin-bottom: 0; /* Geen marge onderaan */
}

.weekly-chart-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: visible; /* Zorg dat labels niet worden afgeknipt */
}

/* Week breakdown popup styling */
.week-breakdown-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.week-breakdown-dialog[open] {
  display: flex;
}

.week-breakdown-dialog:not([open]) {
  display: none;
}

.week-breakdown-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.week-breakdown-content {
  display: flex;
  flex-direction: column;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
}

.week-breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1.5rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
  min-height: 5rem;
  flex-shrink: 0;
}

.week-breakdown-header h3 {
  margin: 0;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.6;
  display: block;
  width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: visible;
}

.close-button {
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button:hover {
  background: #f1f5f9;
  color: #475569;
}

.week-breakdown-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.week-breakdown-chart {
  margin-bottom: 1.5rem;
  height: 200px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.week-breakdown-table {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.week-breakdown-table table {
  width: 100%;
  border-collapse: collapse;
}

.week-breakdown-table th,
.week-breakdown-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.week-breakdown-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-breakdown-table td {
  color: #4b5563;
  font-size: 0.875rem;
}

.week-breakdown-table tr:last-child td {
  border-bottom: none;
}

.week-breakdown-table tr:hover {
  background: #f8fafc;
}

/* Mobile responsiveness voor popup */
@media (max-width: 768px) {
  .week-breakdown-content {
    width: 95%;
    max-height: 95vh;
  }

  .week-breakdown-header {
    padding: 1.25rem 1rem 1rem 1rem;
    min-height: 4rem;
  }

  .week-breakdown-body {
    padding: 1rem;
  }

  .week-breakdown-chart {
    height: 150px;
    margin-bottom: 1rem;
  }

  .week-breakdown-table th,
  .week-breakdown-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}
