:root {
  --canvas: #f3f2ec;
  --canvas-deep: #e9e8df;
  --paper: #fbfbf8;
  --paper-strong: #ffffff;
  --ink: #18192b;
  --ink-soft: #616276;
  --ink-faint: #9696a3;
  --line: #deded6;
  --line-soft: #e9e9e2;
  --night: #18192d;
  --night-soft: #242642;
  --lime: #c9f36f;
  --lime-deep: #93bf38;
  --violet: #766ff2;
  --violet-soft: #eceafe;
  --danger: #a84052;
  --danger-bg: #fbecef;
  --shadow: 0 18px 55px rgba(33, 35, 56, 0.07);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 2%, rgba(201, 243, 111, 0.14), transparent 24rem),
    var(--canvas);
}

button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(118, 111, 242, 0.38);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  border-radius: 7px;
  background: var(--lime);
  box-shadow: 0 4px 14px rgba(147, 191, 56, 0.22);
}

.brand-mark span {
  width: 10px;
  height: 10px;
  border: 3px solid var(--night);
  border-radius: 3px;
}

.brand-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
}

.brand-section {
  padding-left: 10px;
  margin-left: 2px;
  color: var(--ink-soft);
  border-left: 1px solid var(--line);
  font-weight: 550;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--violet);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Authentication */

.auth-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background:
    linear-gradient(140deg, rgba(255,255,255,0.04), transparent 48%),
    var(--night);
  color: #fff;
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.19;
  background-image: radial-gradient(rgba(255,255,255,0.32) 0.7px, transparent 0.7px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

.auth-orbit {
  position: absolute;
  border: 1px solid rgba(201, 243, 111, 0.14);
  border-radius: 50%;
}

.auth-orbit-one { width: 580px; height: 580px; right: -180px; top: -240px; }
.auth-orbit-two { width: 400px; height: 400px; left: -170px; bottom: -190px; }

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  padding: 42px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 28px;
  background: rgba(35, 37, 65, 0.72);
  box-shadow: 0 40px 100px rgba(0,0,0,0.28);
  backdrop-filter: blur(22px);
}

.auth-card .brand-lockup { margin-bottom: 58px; font-size: 18px; }
.auth-card .eyebrow { color: var(--lime); }

.auth-card h1 {
  max-width: 390px;
  margin: 0;
  font-size: clamp(38px, 7vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.auth-copy {
  margin: 22px 0 28px;
  color: rgba(255,255,255,0.68);
  font-size: 15px;
  line-height: 1.65;
}

.auth-form label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.74);
  font-size: 12px;
  font-weight: 650;
}

.token-field { position: relative; }

.token-field input {
  width: 100%;
  height: 52px;
  padding: 0 70px 0 15px;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgba(9,10,24,0.35);
}

.token-field input::placeholder { color: rgba(255,255,255,0.34); }

.reveal-button {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 38px;
  padding: 0 10px;
  color: rgba(255,255,255,0.62);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.primary-button, .secondary-button, .quiet-button, .apply-button {
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 17px;
  background: var(--lime);
  color: var(--night);
  box-shadow: 0 10px 28px rgba(201, 243, 111, 0.15);
}

.primary-button:hover { background: #d3f78a; }
.primary-button:disabled { opacity: 0.56; cursor: wait; }
.auth-submit { width: 100%; margin-top: 14px; }

.form-error {
  margin: 10px 0 0;
  color: #ffb1bd;
  font-size: 13px;
}

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  padding-top: 21px;
  color: rgba(255,255,255,0.48);
  border-top: 1px solid rgba(255,255,255,0.09);
  font-size: 12px;
  line-height: 1.55;
}

.mini-shield { color: var(--lime); font-size: 18px; line-height: 1; }

/* Dashboard frame */

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid rgba(216,216,207,0.82);
  background: rgba(243,242,236,0.86);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: min(100% - 44px, 1320px);
  min-height: 68px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.live-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #71b73b;
  box-shadow: 0 0 0 4px rgba(113,183,59,0.12);
}

.live-status.is-loading span { background: var(--violet); animation: pulse 1s infinite alternate; }
.live-status.is-error span { background: var(--danger); }

@keyframes pulse { to { opacity: 0.35; } }

.quiet-button {
  padding: 9px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
}

.quiet-button:hover { border-color: var(--line); background: rgba(255,255,255,0.55); color: var(--ink); }
.refresh-glyph { display: inline-block; margin-right: 4px; }
.is-refreshing .refresh-glyph { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dashboard {
  width: min(100% - 44px, 1320px);
  margin: 0 auto;
  padding: 28px 0 56px;
}

.range-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(251,251,248,0.72);
  box-shadow: 0 6px 24px rgba(31,32,49,0.035);
}

.preset-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--canvas-deep);
}

.preset-button, .tab-button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 680;
}

.preset-button { min-height: 32px; padding: 0 12px; border-radius: 8px; }
.preset-button:hover { color: var(--ink); }
.preset-button.is-active { background: var(--paper-strong); color: var(--ink); box-shadow: 0 2px 8px rgba(30,30,50,0.08); }

.range-fields { display: flex; align-items: flex-end; gap: 8px; }

.range-fields label { display: grid; gap: 4px; }
.range-fields label > span { color: var(--ink-faint); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.range-fields input, .range-fields select {
  height: 34px;
  max-width: 145px;
  padding: 0 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  font-size: 12px;
}

.range-fields select { min-width: 138px; max-width: 190px; }
.date-separator { align-self: center; margin-top: 13px; color: var(--ink-faint); }

.apply-button {
  height: 34px;
  padding: 0 12px;
  background: var(--night);
  color: #fff;
  font-size: 11px;
}

.device-field { margin-left: 6px; }

.report-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 43px 2px 22px;
}

.report-heading h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.range-caption { margin: 9px 0 0; color: var(--ink-soft); font-size: 13px; }

.day-navigation { display: flex; gap: 6px; }
.day-navigation button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
}
.day-navigation button:hover:not(:disabled) { background: #fff; border-color: #c8c8be; }
.day-navigation button:disabled { opacity: 0.35; cursor: default; }

.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #efcbd2;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}
.error-banner strong { display: block; margin-bottom: 2px; }
.error-banner button { border: 0; background: transparent; color: inherit; font-weight: 750; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stat-card {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  padding: 21px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 7px 30px rgba(36,37,54,0.035);
}

.accent-card { background: var(--night); border-color: var(--night); color: #fff; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 680; }
.accent-card .stat-label { color: rgba(255,255,255,0.64); }
.stat-icon { color: var(--lime); }
.stat-icon.muted { color: var(--violet); }
.stat-value { margin-top: auto; font-size: clamp(28px, 3vw, 37px); letter-spacing: -0.045em; line-height: 1; }
.stat-detail { margin-top: 9px; overflow: hidden; color: var(--ink-faint); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.accent-card .stat-detail { color: rgba(255,255,255,0.42); }

.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 25px 8px;
}

.panel-heading h2 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }
.panel-subtitle { margin: 6px 0 0; color: var(--ink-faint); font-size: 12px; }

.timeline-panel { min-height: 380px; margin-bottom: 14px; overflow: hidden; }
.chart-legend { display: flex; align-items: center; gap: 18px; color: var(--ink-faint); font-size: 11px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 8px; height: 8px; border-radius: 3px; }
.active-swatch { background: var(--violet); }

.chart-scroll {
  min-height: 294px;
  overflow-x: auto;
  padding: 4px 20px 14px;
  scrollbar-width: thin;
  scrollbar-color: #cccbd0 transparent;
}

.timeline-svg { display: block; width: 100%; min-width: 720px; height: 286px; overflow: visible; }
.chart-grid-line { stroke: #e7e6e0; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis-label { fill: #9a99a5; font-size: 10px; font-family: inherit; }
.chart-bar { fill: var(--violet); opacity: 0.9; }
.chart-bar:hover { fill: #5d56e8; opacity: 1; }

.two-column-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.usage-panel, .insight-panel { min-height: 440px; }
.usage-heading { padding-bottom: 17px; }

.tab-list {
  display: flex;
  gap: 4px;
  margin: 0 25px 5px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line-soft);
}

.tab-button { padding: 7px 11px; border-radius: 8px; }
.tab-button.is-active { background: var(--violet-soft); color: #4f49c9; }

.usage-list { padding: 5px 25px 22px; }

.usage-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(100px, 1fr) 70px;
  align-items: center;
  gap: 14px;
  min-height: 49px;
  border-bottom: 1px solid var(--line-soft);
}
.usage-row:last-child { border-bottom: 0; }
.usage-name { min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 680; }
.usage-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 3px; background: var(--violet); }
.usage-dot.tone-1 { background: #e58b5e; }
.usage-dot.tone-2 { background: #5eac92; }
.usage-dot.tone-3 { background: #d3af43; }
.usage-dot.tone-4 { background: #8d76bd; }
.usage-dot.tone-5 { background: #6e98c8; }
.usage-time { text-align: right; color: var(--ink-soft); font-size: 11px; font-variant-numeric: tabular-nums; }

.usage-progress {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: var(--canvas-deep);
  appearance: none;
}
.usage-progress::-webkit-progress-bar { background: var(--canvas-deep); border-radius: 99px; }
.usage-progress::-webkit-progress-value { background: var(--violet); border-radius: 99px; }
.usage-progress::-moz-progress-bar { background: var(--violet); border-radius: 99px; }

.insight-panel { background: linear-gradient(160deg, #fbfbf8 40%, #f1f0fa); }
.insight-hero { margin: 13px 25px 19px; padding: 21px; border-radius: 16px; background: var(--night); color: #fff; }
.insight-label { display: block; color: rgba(255,255,255,0.5); font-size: 10px; font-weight: 720; letter-spacing: 0.08em; text-transform: uppercase; }
.insight-hero strong { display: block; overflow: hidden; margin: 18px 0 5px; font-size: 24px; letter-spacing: -0.04em; text-overflow: ellipsis; white-space: nowrap; }
.insight-hero > span:last-child { color: var(--lime); font-size: 12px; }
.insight-list { margin: 0 25px; }
.insight-list div { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.insight-list div:last-child { border-bottom: 0; }
.insight-list dt { color: var(--ink-soft); }
.insight-list dd { margin: 0; font-weight: 720; text-align: right; }

.activity-panel { overflow: hidden; }
.activity-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }

.search-field {
  width: min(280px, 42vw);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-faint);
}
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-field input::placeholder { color: var(--ink-faint); }

.activity-list { padding: 0 25px; }
.activity-day-label { padding: 20px 0 8px; color: var(--ink-faint); font-size: 10px; font-weight: 760; letter-spacing: 0.1em; text-transform: uppercase; }

.activity-row {
  display: grid;
  grid-template-columns: 62px minmax(210px, 1.7fr) minmax(140px, 1fr) 92px 80px;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  border-bottom: 1px solid var(--line-soft);
}

.activity-clock { color: var(--ink-soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.activity-app { min-width: 0; display: flex; align-items: center; gap: 12px; }
.app-glyph { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: #eceafe; color: #554fd0; font-size: 10px; font-weight: 800; letter-spacing: 0.02em; }
.app-glyph.tone-1 { background: #f9e9df; color: #b45d32; }
.app-glyph.tone-2 { background: #e0f1eb; color: #3d806a; }
.app-glyph.tone-3 { background: #f6efd5; color: #94751f; }
.app-glyph.tone-4 { background: #eee7f5; color: #75549a; }
.app-glyph.tone-5 { background: #e3edf7; color: #4c77a2; }
.app-copy { min-width: 0; }
.app-copy strong, .activity-context strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.app-copy span, .activity-context span { display: block; overflow: hidden; margin-top: 4px; color: var(--ink-faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-context .activity-domain { color: var(--violet); font-size: 10px; font-weight: 720; }
.activity-context { min-width: 0; }
.activity-duration { text-align: right; font-size: 11px; font-weight: 720; font-variant-numeric: tabular-nums; }
.device-pill { justify-self: end; max-width: 80px; overflow: hidden; padding: 5px 8px; border-radius: 99px; background: var(--canvas-deep); color: var(--ink-soft); font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.load-more-row { display: flex; justify-content: center; padding: 18px; }
.secondary-button { padding: 10px 15px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-size: 11px; }
.secondary-button:hover { color: var(--ink); border-color: #c3c3b9; }

.empty-state { min-height: 220px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--ink-faint); }
.empty-state > span { margin-bottom: 8px; color: var(--violet); font-size: 28px; }
.empty-state strong { color: var(--ink); font-size: 13px; }
.empty-state p { margin: 6px 0 0; font-size: 11px; }
.empty-state.compact { min-height: 220px; }

.site-footer {
  width: min(100% - 44px, 1320px);
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: auto;
  padding: 0 0 34px;
  color: var(--ink-faint);
  font-size: 10px;
}
.site-footer span + span::before { content: "·"; margin-right: 20px; }

.app-shell.is-loading .stat-value,
.app-shell.is-loading .range-caption {
  border-radius: 5px;
  color: transparent;
  background: linear-gradient(90deg, #e8e7e1 25%, #f4f3ee 50%, #e8e7e1 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.app-shell.is-loading .accent-card .stat-value { background: linear-gradient(90deg, #30324e 25%, #404260 50%, #30324e 75%); background-size: 200% 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1000px) {
  .range-panel { align-items: stretch; flex-direction: column; gap: 10px; }
  .range-fields { flex-wrap: wrap; }
  .device-field { margin-left: auto; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column-grid { grid-template-columns: 1fr; }
  .activity-row { grid-template-columns: 55px minmax(180px, 1.6fr) minmax(120px, 1fr) 80px; }
  .activity-row .device-pill { display: none; }
}

@media (max-width: 680px) {
  .header-inner, .dashboard, .site-footer { width: min(100% - 24px, 1320px); }
  .header-inner { min-height: 60px; }
  .brand-section, .live-status { display: none; }
  .quiet-button { padding: 8px; }
  .dashboard { padding-top: 14px; }
  .range-panel { padding: 10px; }
  .preset-row { overflow-x: auto; }
  .preset-button { flex: 1; white-space: nowrap; }
  .range-fields { display: grid; grid-template-columns: 1fr auto 1fr auto; }
  .range-fields input { max-width: none; width: 100%; }
  .device-field { grid-column: 1 / -1; margin: 2px 0 0; }
  .range-fields select { max-width: none; width: 100%; }
  .report-heading { margin-top: 29px; }
  .report-heading h1 { font-size: 34px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 132px; padding: 16px; }
  .stat-value { font-size: 27px; }
  .panel { border-radius: 18px; }
  .panel-heading { padding: 20px 18px 8px; }
  .chart-legend > span:first-child { display: none; }
  .usage-list, .insight-list, .activity-list { padding-left: 18px; padding-right: 18px; }
  .tab-list { margin-left: 18px; margin-right: 18px; }
  .insight-hero { margin-left: 18px; margin-right: 18px; }
  .activity-heading { align-items: flex-start; flex-direction: column; }
  .search-field { width: 100%; }
  .activity-row { grid-template-columns: 48px minmax(130px, 1fr) 65px; gap: 10px; }
  .activity-row .activity-context, .activity-row .device-pill { display: none; }
  .usage-row { grid-template-columns: minmax(100px, 1fr) 80px 58px; gap: 8px; }
  .site-footer { align-items: center; flex-direction: column; gap: 5px; text-align: center; }
  .site-footer span + span::before { content: none; }
  .auth-card { padding: 28px 23px; }
  .auth-card .brand-lockup { margin-bottom: 44px; }
}
