:root {
  --bg: #f7f4ef;
  --bg-2: #efe6d7;
  --ink: #1f1b16;
  --ink-soft: #62584a;
  --panel: rgba(255, 250, 241, 0.83);
  --line: rgba(48, 37, 24, 0.14);
  --accent: #e85d04;
  --accent-2: #2a9d8f;
  --alert: #d62828;
  --shadow: 0 18px 44px rgba(23, 17, 10, 0.13);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, #fff3d6 0%, rgba(255, 243, 214, 0) 40%),
    radial-gradient(circle at 84% 15%, #ffddb6 0%, rgba(255, 221, 182, 0) 37%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  min-height: 100vh;
  line-height: 1.35;
}

.bg-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(28px);
  opacity: 0.5;
  z-index: -1;
}

.orb-a {
  width: 260px;
  height: 260px;
  background: rgba(232, 93, 4, 0.22);
  top: -70px;
  right: -40px;
}

.orb-b {
  width: 320px;
  height: 320px;
  background: rgba(42, 157, 143, 0.16);
  bottom: -120px;
  left: -80px;
}

.app {
  width: min(1120px, 92vw);
  margin: 40px auto 60px;
  display: grid;
  gap: 18px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px 30px;
  border-radius: calc(var(--radius-lg) + 6px);
  background:
    linear-gradient(125deg, rgba(255, 216, 160, 0.68), rgba(255, 152, 102, 0.52), rgba(42, 157, 143, 0.48), rgba(233, 136, 65, 0.58));
  background-size: 280% 280%;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  animation: heroGradientShift 14s ease-in-out infinite;
  border: 1px solid rgba(76, 54, 28, 0.16);
  box-shadow: var(--shadow);
}

.hero.reveal {
  animation: rise 620ms ease both, heroGradientShift 14s ease-in-out infinite;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -35%;
  background:
    radial-gradient(circle at 20% 35%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 75% 70%, rgba(255, 237, 210, 0.35), rgba(255, 237, 210, 0) 50%);
  animation: heroGlowDrift 18s linear infinite;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0;
  font-size: 0.88rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  animation: heroTextDrift 14s ease-in-out infinite;
}

.hero h1 {
  margin: 10px 0 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.85rem, 2.2vw + 1rem, 3.05rem);
  line-height: 1.06;
  display: inline-block;
  color: #2f261c;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background-image: linear-gradient(90deg, #1f6b61 0%, #c95f15 28%, #5a2a13 52%, #1f6b61 76%, #c95f15 100%);
    background-size: 360% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: heroTextGradientShift 7.5s linear infinite;
  }
}

.hero-copy {
  margin: 0;
  max-width: 70ch;
  color: #4f4436;
  animation: heroTextDrift 14s ease-in-out infinite;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
}

.split {
  align-items: flex-end;
}

h3 {
  margin: 0;
  font-size: 1.04rem;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: #544b40;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(84, 67, 44, 0.25);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  padding: 9px 10px;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 42%, white);
  outline-offset: 2px;
}

.activity-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.btn {
  border: 1px solid rgba(64, 44, 20, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.92);
}

.btn-primary {
  background: linear-gradient(130deg, var(--accent), #ef7e38);
  color: #fff;
  border-color: rgba(108, 49, 11, 0.7);
}

.btn-primary:hover {
  box-shadow: 0 7px 16px rgba(189, 87, 23, 0.3);
  background: linear-gradient(130deg, #d85d13, #e87029);
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 10px;
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(72, 52, 24, 0.16);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.55);
}

.activity-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.activity-meta {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 8px;
  font-size: 0.82rem;
}

.btn-danger {
  color: #fff;
  border-color: #8f1414;
  background: linear-gradient(130deg, #d62828, #ab1f1f);
}

.empty-message {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-style: italic;
}

.checkin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.checkin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.checkin-table th,
.checkin-table td {
  text-align: left;
  padding: 10px 9px;
  border-bottom: 1px solid rgba(85, 66, 41, 0.14);
}

.checkin-table th {
  font-size: 0.84rem;
  color: #5e5246;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checkin-table td input {
  width: 100%;
  min-width: 120px;
}

.range-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(83, 64, 40, 0.2);
  background: rgba(255, 255, 255, 0.5);
}

.range-btn {
  border-radius: 999px;
  border: 0;
  padding: 6px 12px;
  background: transparent;
  color: #5f5346;
  cursor: pointer;
  font-weight: 700;
}

.range-btn.active {
  color: #fff;
  background: linear-gradient(130deg, #2a9d8f, #208174);
}

.metrics {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metric-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(74, 54, 30, 0.14);
  background: rgba(255, 255, 255, 0.6);
  padding: 10px;
}

.metric-card .label {
  font-size: 0.82rem;
  color: #6a5a47;
  margin-bottom: 6px;
}

.metric-card .value {
  font-weight: 700;
  font-size: 1.2rem;
}

.chart-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chart-card {
  border-radius: var(--radius-md);
  border: 1px solid rgba(75, 55, 31, 0.14);
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
}

.chart-wrap {
  position: relative;
  height: 280px;
  max-height: 280px;
  overflow: hidden;
}

.chart-card canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #5f5345;
}

.insight {
  margin-top: 12px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(84, 64, 40, 0.26);
  background: rgba(253, 244, 230, 0.65);
  padding: 11px;
  color: #4f4234;
}

.toolbar-inline {
  display: flex;
  gap: 10px;
}

.data-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-import {
  display: inline-flex;
  align-items: center;
}

.small-note {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.reveal {
  animation: rise 620ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroGradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes heroGlowDrift {
  0% {
    transform: translate3d(-3%, -2%, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(4%, 3%, 0) rotate(10deg);
  }
  100% {
    transform: translate3d(-3%, -2%, 0) rotate(0deg);
  }
}

@keyframes heroTextGradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes heroTextDrift {
  0% {
    transform: translateX(4px);
  }
  50% {
    transform: translateX(-4px);
  }
  100% {
    transform: translateX(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero,
  .hero::before,
  .hero .eyebrow,
  .hero h1,
  .hero .hero-copy {
    animation: none;
  }
}

@media (max-width: 980px) {
  .activity-form {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app {
    width: min(94vw, 1120px);
    margin-top: 22px;
  }

  .hero,
  .panel {
    padding: 16px;
  }

  .activity-form {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .activity-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .row-actions {
    justify-content: flex-start;
  }
}
