:root {
  color-scheme: light;
  --ink: #1f1e1c;
  --muted: #6b645d;
  --paper: #fff9f0;
  --panel: #ffffff;
  --line: #ded6c9;
  --accent: #0f4c5c;
  --accent-strong: #e07a5f;
  --accent-soft: #f4e2d3;
  --shadow: 0 20px 45px rgba(31, 30, 28, 0.12);
}

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

body {
  margin: 0;
  font-family: "Avenir Next", "Futura", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fdf7ef 0%, #f1efe7 45%, #e6f0ef 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(15, 76, 92, 0.06), transparent 40%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0, rgba(0, 0, 0, 0.03) 1px, transparent 1px, transparent 18px);
  pointer-events: none;
  z-index: -1;
}

.app {
  max-width: 1200px;
  margin: 40px auto 60px;
  padding: 0 20px 40px;
}

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

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.75rem;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.1rem);
}

.subtitle {
  margin: 8px 0 0;
  max-width: 520px;
  color: var(--muted);
}

.badge {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: lift 0.6s ease both;
}

.panel h2 {
  font-size: 1.05rem;
  margin: 0 0 2px;
}

.toggle {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="search"],
input[type="date"],
select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.95rem;
  color: var(--ink);
}

input[type="search"]:focus,
input[type="date"]:focus,
select:focus {
  outline: 2px solid rgba(15, 76, 92, 0.2);
  border-color: var(--accent);
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.list {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 10px;
}

.list-item:hover {
  background: var(--accent-soft);
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.actions button {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.date-grid {
  display: grid;
  gap: 12px;
}

.date-display {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 4px;
}

.chart-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-wrap {
  background: #fff;
  border-radius: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 360px;
  animation: lift 0.7s ease both;
}

canvas {
  width: 100%;
  height: 100%;
}

.status {
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--paper);
  border: 1px dashed var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.status.error {
  border-color: #b3261e;
  color: #b3261e;
}

.totals {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.totals div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
}

.hidden {
  display: none;
}

.error-panel {
  max-width: 760px;
  margin: 60px auto;
  padding: 18px 22px;
  border-radius: 18px;
  background: #fff1f0;
  border: 1px solid #f5c2c0;
  color: #8c1d18;
  font-weight: 600;
}

.panel:nth-child(2) {
  animation-delay: 0.05s;
}

.panel:nth-child(3) {
  animation-delay: 0.1s;
}

.panel:nth-child(4) {
  animation-delay: 0.15s;
}

.panel:nth-child(5) {
  animation-delay: 0.2s;
}

.panel:nth-child(6) {
  animation-delay: 0.25s;
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 880px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
