:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #15233b;
  --muted: #5e6c84;
  --accent: #1f6feb;
  --danger: #b62324;
  --border: #d0d7e2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #e7f1ff 0%, var(--bg) 45%);
}

.container {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(15, 35, 95, 0.08);
}

.hidden {
  display: none;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

label {
  display: block;
  font-size: 0.95rem;
  margin: 0.5rem 0;
}

input,
select,
button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border: none;
}

button.ghost {
  background: #eef3fb;
  color: var(--text);
  border: 1px solid var(--border);
}

.actions {
  display: flex;
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.actions.align-end {
  align-items: end;
}

.msg {
  min-height: 1.25rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  margin: 0;
}

.alert {
  color: var(--danger);
  border: 1px solid #f3b6b8;
  background: #fff1f2;
  padding: 0.7rem;
  border-radius: 10px;
}

.kpi-grid {
  margin-bottom: 0.8rem;
}

.kpi-card {
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 10px;
  padding: 0.9rem;
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.kpi-card strong {
  font-size: 1.4rem;
}

.chart-header {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.period-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.period-label select {
  width: auto;
  min-width: 130px;
}

canvas {
  max-height: 280px;
}

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

  .actions {
    flex-direction: column;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .period-label {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .period-label select {
    width: 100%;
  }
}
