/* ============================================================ */
/*  CLAUDE.USAGE · soft-brutalist dark dashboard                  */
/*  dominant: warm charcoal  · accents: lime / coral / violet     */
/*  display: Bricolage Grotesque  ·  mono: JetBrains Mono         */
/* ============================================================ */

:root {
  /* palette */
  --bg:            #141311;
  --bg-soft:       #191714;
  --bg-card:       #1e1c19;
  --bg-elev:       #25221e;
  --border:        #2e2a25;
  --border-strong: #3f3a33;
  --border-accent: #55493b;

  --text:        #f4eede;
  --text-dim:    #a39a8e;
  --text-faint:  #6e6862;

  --lime:   #d9ff3d;
  --coral:  #ff6b5c;
  --violet: #b896ff;
  --mint:   #7aeec8;
  --amber:  #ffb547;
  --cream:  #f4eede;

  /* typography */
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* metrics */
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02) inset,
                 0 14px 36px -20px rgba(0, 0, 0, 0.6);
}

/* ----------  reset / base  ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  /* warm radial glow anchored bottom-left, feels hand-made not template-y */
  background:
    radial-gradient(1100px 700px at 100% -10%,
      rgba(217, 255, 61, 0.06), transparent 60%),
    radial-gradient(900px 700px at -10% 110%,
      rgba(255, 107, 92, 0.07), transparent 55%),
    var(--bg);
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-elev);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--cream);
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* ----------  noise grain overlay (SVG feTurbulence data URL)  ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* accents */
.accent-lime   { color: var(--lime); }
.accent-coral  { color: var(--coral); }
.accent-violet { color: var(--violet); }
.accent-mint   { color: var(--mint); }

/* ============================================================ */
/*                        UPLOAD SCREEN                           */
/* ============================================================ */
.upload-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  position: relative;
  z-index: 2;
}

.upload-frame {
  width: min(720px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 36px 32px;
  position: relative;
  box-shadow: var(--shadow-card);
  animation: rise 0.6s var(--ease) both;
}

/* corner bracket flourishes — soft brutalist signature */
.upload-frame::before,
.upload-frame::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--lime);
}
.upload-frame::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: var(--radius-lg);
}
.upload-frame::after {
  bottom: -1px;
  right: -1px;
  border-left: 0;
  border-top: 0;
  border-bottom-right-radius: var(--radius-lg);
}

.upload-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
}
.tag--muted { opacity: 0.7; }

.upload-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(44px, 7vw, 84px);
  letter-spacing: -0.04em;
  line-height: 0.95;
  font-variation-settings: 'wdth' 75, 'opsz' 96;
  margin-bottom: 14px;
}

.upload-sub {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 42ch;
  margin-bottom: 22px;
}

.dropzone {
  display: block;
  cursor: pointer;
  border: 1.5px dashed var(--border-accent);
  border-radius: var(--radius);
  padding: 34px 24px;
  background: linear-gradient(180deg, rgba(217, 255, 61, 0.02), transparent);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.dropzone:hover,
.dropzone.is-hover {
  border-color: var(--lime);
  background: linear-gradient(180deg, rgba(217, 255, 61, 0.08), rgba(217, 255, 61, 0.02));
  transform: translateY(-1px);
}

.dropzone.is-drag {
  border-color: var(--lime);
  background: linear-gradient(180deg, rgba(217, 255, 61, 0.12), rgba(217, 255, 61, 0.03));
  transform: scale(1.01);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--lime);
  margin-bottom: 4px;
}

.dropzone-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone-hint {
  color: var(--text-dim);
  font-size: 14px;
}

.dropzone-path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
}

.upload-error {
  margin-top: 14px;
  min-height: 22px;
  color: var(--coral);
  font-family: var(--mono);
  font-size: 13px;
}

.upload-foot {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.foot-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.foot-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.foot-value {
  font-size: 13.5px;
  color: var(--text-dim);
}

/* ============================================================ */
/*                           DASHBOARD                            */
/* ============================================================ */
.dashboard {
  position: relative;
  z-index: 2;
  padding: 28px clamp(20px, 4vw, 56px) 64px;
  max-width: 1480px;
  margin: 0 auto;
  animation: rise 0.55s var(--ease) both;
}

.dash-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variation-settings: 'wdth' 85, 'opsz' 18;
}

.dash-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 18px rgba(217, 255, 61, 0.6);
}

.dash-subtitle {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--bg-card);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-ghost {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.btn-ghost:hover {
  color: var(--cream);
  border-color: var(--text-dim);
  background: var(--bg-soft);
}

.btn-ghost--danger:hover {
  color: var(--coral);
  border-color: var(--coral);
}

/* ----------  Date filter bar  ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  animation: rise 0.55s var(--ease) both;
  animation-delay: 40ms;
}

.filter-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.date-input {
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 10px;
  color: var(--cream);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color-scheme: dark; /* dark native date picker where supported */
  transition: border-color 0.15s var(--ease);
}

.date-input:hover  { border-color: var(--text-dim); }
.date-input:focus  { outline: none; border-color: var(--lime); }
.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
  opacity: 0.7;
}
.date-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.filter-arrow {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 13px;
}

.filter-presets {
  display: flex;
  gap: 4px;
}

.preset-btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.preset-btn:hover {
  color: var(--cream);
  border-color: var(--text-dim);
}

.preset-btn.is-active {
  color: var(--bg);
  background: var(--lime);
  border-color: var(--lime);
  font-weight: 500;
}

.filter-note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.filter-note strong {
  color: var(--lime);
  font-weight: 500;
}

/* Lifetime-only badge shown on KPI cards when a filter is active */
.kpi-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-soft);
  opacity: 0.8;
  pointer-events: none;
}

/* ----------  KPI grid  ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.kpi {
  --accent: var(--lime);
  grid-column: span 3;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
  animation: rise 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.kpi::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, var(--accent), transparent 60%);
  opacity: 0.08;
  pointer-events: none;
}

.kpi:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.kpi--hero { grid-column: span 3; }
.kpi--wide { grid-column: span 6; }
.kpi--full { grid-column: span 12; }

.kpi-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.kpi-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--cream);
  font-variation-settings: 'wdth' 75, 'opsz' 72;
  margin: 14px 0 8px;
  word-break: break-word;
}

.kpi-value--md { font-size: 44px; font-variation-settings: 'wdth' 80, 'opsz' 60; }
.kpi-value--sm { font-size: 26px; font-variation-settings: 'wdth' 90, 'opsz' 32; line-height: 1.1; }
.kpi-value--mono { font-family: var(--mono); font-weight: 500; letter-spacing: 0; }

.kpi-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

/* ----------  Charts grid  ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.chart-card {
  grid-column: span 6;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 22px 14px;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  position: relative; /* anchors .kpi-badge (absolute positioning) */
  transition: border-color 0.2s var(--ease);
  animation: rise 0.65s var(--ease) both;
}

.chart-card:hover { border-color: var(--border-accent); }

.chart-card--wide { grid-column: span 12; }

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

.chart-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variation-settings: 'wdth' 85, 'opsz' 24;
  color: var(--cream);
}

.chart-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.chart {
  flex: 1;
  min-height: 280px;
  width: 100%;
}

.chart--short { min-height: 220px; }
.chart--polar { min-height: 300px; }
.chart--calendar { min-height: 260px; }

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.chart-year-switch {
  display: flex;
  gap: 4px;
}

.year-btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.year-btn:hover { color: var(--cream); border-color: var(--text-dim); }
.year-btn.is-active {
  color: var(--bg);
  background: var(--cream);
  border-color: var(--cream);
}

/* ----------  Insights strip  ---------- */
.insights {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.insight {
  --accent: var(--lime);
  grid-column: span 4;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  animation: rise 0.6s var(--ease) both;
}

.insight::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.insight-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.insight-text {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
  font-variation-settings: 'wdth' 85, 'opsz' 20;
  color: var(--cream);
}

.insight-text em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
}

.insight--wide { grid-column: span 6; }
.insight--narrow { grid-column: span 3; }

/* ============================================================ */
/*   ALL-TIME ZONE                                                */
/*   Visually distinct from the filterable dashboard so the       */
/*   temporal scope reads at a glance.                            */
/* ============================================================ */
.lifetime {
  position: relative;
  margin: 40px -22px 28px;
  padding: 8px 22px 28px;
  border-radius: var(--radius-lg);
  /* warm tint + diagonal stripe so the zone is immediately distinct */
  background:
    repeating-linear-gradient(
      135deg,
      transparent 0 14px,
      rgba(255, 181, 71, 0.025) 14px 15px
    ),
    linear-gradient(180deg,
      rgba(255, 181, 71, 0.04),
      rgba(255, 181, 71, 0.015) 60%,
      transparent
    );
}

/* Banner — big amber ∞ + "ALL TIME" headline */
.lifetime-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 22px;
  border: 1.5px solid var(--amber);
  border-radius: var(--radius);
  background: var(--bg-soft);
  position: relative;
  overflow: hidden;
}

/* Faint amber radial glow in the corner */
.lifetime-banner::after {
  content: '';
  position: absolute;
  top: -100px;
  right: -60px;
  width: 260px;
  height: 220px;
  background: radial-gradient(circle, var(--amber), transparent 60%);
  opacity: 0.08;
  pointer-events: none;
}

.lifetime-mark {
  font-family: var(--display);
  font-size: 72px;
  font-weight: 700;
  line-height: 0.75;
  color: var(--amber);
  font-variation-settings: 'wdth' 85, 'opsz' 96;
  letter-spacing: -0.04em;
  text-shadow: 0 0 28px rgba(255, 181, 71, 0.4);
}

.lifetime-banner-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 1;
}

.lifetime-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--cream);
  font-variation-settings: 'wdth' 85, 'opsz' 30;
  line-height: 1;
}

.lifetime-caption {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.lifetime-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--amber), transparent 90%);
  margin-left: 10px;
  opacity: 0.6;
}

/* Lifetime cards — amber/cream accent palette, corner ∞, hover amber */
.kpi--life,
.chart-card--life {
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(255, 181, 71, 0.035), rgba(255, 181, 71, 0.01) 40%),
    var(--bg-card);
  position: relative;
}

.kpi--life:hover,
.chart-card--life:hover {
  border-color: var(--amber);
}

/* Corner ∞ glyph — permanent reminder that scope is lifetime */
.kpi-life-mark {
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--amber);
  font-variation-settings: 'wdth' 100, 'opsz' 24;
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}

.chart-card--life .kpi-life-mark {
  font-size: 20px;
  top: 14px;
  right: 18px;
}

/* Lifetime insight cards get a corner ∞ glyph. The existing .insight::before
   is the accent side stripe, so we use ::after for the mark. */
#insights-life .insight {
  background:
    linear-gradient(180deg, rgba(255, 181, 71, 0.035), rgba(255, 181, 71, 0.01) 40%),
    var(--bg-card);
}

#insights-life .insight::after {
  content: '∞';
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--display);
  font-size: 20px;
  color: var(--amber);
  font-weight: 700;
  opacity: 0.55;
  line-height: 1;
  pointer-events: none;
}

/* Responsive: tighten the banner on small screens */
@media (max-width: 720px) {
  .lifetime {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .lifetime-banner {
    padding: 14px 16px;
    gap: 12px;
  }
  .lifetime-mark { font-size: 56px; }
  .lifetime-title { font-size: 22px; letter-spacing: 0.18em; }
  .lifetime-rule { display: none; }
}

/* ----------  Footer  ---------- */
.dash-foot {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.foot-mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* ============================================================ */
/*                         animations                             */
/* ============================================================ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-lime {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 255, 61, 0.35); }
  50%      { box-shadow: 0 0 0 8px rgba(217, 255, 61, 0); }
}

/* ============================================================ */
/*                        responsive                              */
/* ============================================================ */
@media (max-width: 1100px) {
  .kpi                    { grid-column: span 4; }
  .kpi--hero              { grid-column: span 6; }
  .kpi--wide              { grid-column: span 12; }
  .kpi--full              { grid-column: span 12; }
  .chart-card             { grid-column: span 12; }
  .insight                { grid-column: span 6; }
  .insight--wide          { grid-column: span 12; }
  .insight--narrow        { grid-column: span 6; }
}

@media (max-width: 720px) {
  .upload-frame           { padding: 28px 22px; }
  .upload-title           { font-size: 48px; }
  .upload-foot            { grid-template-columns: 1fr; }
  .filter-bar             { padding: 10px 12px; gap: 8px; }
  .filter-note            { margin-left: 0; width: 100%; }
  .dash-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-subtitle          { text-align: left; }
  .dash-meta              { flex-wrap: wrap; }
  .kpi                    { grid-column: span 6; }
  .kpi--hero, .kpi--wide, .kpi--full { grid-column: span 12; }
  .kpi-value              { font-size: 44px; }
  .kpi-value--md          { font-size: 34px; }
  .insight                { grid-column: span 12; }
  .insight--wide, .insight--narrow { grid-column: span 12; }
}
