/* vibetime — dashboard */

.topbar .wrap { gap: 20px; }
.topbar #ranges { margin-left: auto; }
.topbar .right { margin-left: auto; }
.topbar #ranges:not([hidden]) + .right { margin-left: 0; }
#ranges .rs { display: none; }
#app { padding-top: 28px; padding-bottom: 40px; min-height: calc(100vh - 160px); }

/* ------------------------------------------------------------------ gate */
.gate { max-width: 440px; margin: 9vh auto 0; padding: 40px 32px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; overflow: hidden; }
.gate::before { content: ""; position: absolute; left: 50%; top: -160px; width: 420px; height: 280px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, var(--glow), transparent); filter: blur(30px); pointer-events: none; }
.gate > * { position: relative; }
.gate .logo { width: 52px; height: 52px; border-radius: 14px; overflow: hidden; margin-bottom: 8px; box-shadow: 0 12px 36px -10px var(--glow); animation: float 5s ease-in-out infinite; }
.gate .logo .hands { transform-origin: 16px 17.2px; animation: tick 12s linear infinite; }
@keyframes float { 50% { transform: translateY(-5px); } }
@keyframes tick { to { transform: rotate(360deg); } }
.gate .h2 { font-size: 30px; }
.gate p { margin: 0; font-size: 14.5px; }
.gate form { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.field { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--fill); border: 1px solid var(--line-2); transition: border-color .2s, box-shadow .2s, background .2s; }
.field:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--card); }
.field .i { color: var(--text-3); }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font: 14px var(--mono); }
.field input::placeholder { color: var(--text-3); font-family: var(--font); }
.gate .btn-primary { height: 44px; }
.gate .err { min-height: 20px; color: var(--red); font-size: 13.5px; }
.gate .hint { font-size: 12.5px; color: var(--text-3); }
.gate .hint code { font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--fill-2); color: var(--text-2); }
.shake { animation: shake .5s var(--ease); }
@keyframes shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } }

/* ------------------------------------------------------------------ head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { margin-bottom: 12px; color: var(--text-3); }
.page-head .eyebrow .i { width: 13px; height: 13px; }
.page-head h1 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: clamp(34px, 5vw, 52px); font-weight: 620; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.page-head h1 .u { font-size: .5em; }
.page-head h1 .per { font-size: .42em; font-weight: 500; letter-spacing: -.02em; color: var(--text-3); }
.page-head .delta { font-size: 13.5px; letter-spacing: 0; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); align-self: center; }
.page-head .delta.down { background: color-mix(in srgb, var(--red) 10%, transparent); }
.status { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-3); height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--fill); }
.status.on { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.status .dot { background: var(--text-3); }

/* ------------------------------------------------------------------ grid & cards */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
.c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.panel { padding: 20px; min-width: 0; display: flex; flex-direction: column; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-h h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 14.5px; font-weight: 580; letter-spacing: -.01em; }
.panel-h h2 .i { color: var(--text-3); width: 15px; height: 15px; }
.panel-h .aside { font-size: 12.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.panel-h .aside .i { width: 14px; height: 14px; }
.empty { display: grid; place-items: center; gap: 8px; min-height: 120px; color: var(--text-3); font-size: 13.5px; text-align: center; }
.empty .i { width: 22px; height: 22px; opacity: .7; }

/* ------------------------------------------------------------------ KPI */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kpi .k { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.kpi .k .ico { width: 26px; height: 26px; border-radius: 8px; color: var(--accent); }
.kpi .k .ico .i { width: 14px; height: 14px; }
.kpi .k .tag { margin-left: auto; font: 11.5px var(--mono); color: var(--text-3); }
.kpi .v .u { font-size: .6em; }
.kpi .v { font-size: 32px; font-weight: 620; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 4px; }
.kpi .s { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s .i { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 5px; color: var(--accent); }
.kpi .s b { color: var(--text-2); font-weight: 550; }
.goal-bar { position: relative; height: 6px; border-radius: 6px; background: var(--fill-2); overflow: hidden; margin-top: 2px; }
.goal-bar i { position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent-3)); transition: width 1.4s var(--ease); }
.goal-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .45), transparent); transform: translateX(-100%); animation: sheen 2.6s var(--ease) 1.2s infinite; }
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
.goal-bar.done i { box-shadow: 0 0 14px var(--glow); }
.kpi.click { cursor: pointer; transition: border-color .2s, transform .3s var(--spring); }
.kpi.click:hover { border-color: var(--line-2); }
.kpi.click:active { transform: scale(.985); }
.flame.on .i { color: #fb923c; animation: flick 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flick { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08, .95) rotate(-3deg); } 60% { transform: scale(.96, 1.06) rotate(2deg); } }

/* ------------------------------------------------------------------ bar chart */
.chart { --pl: 40px; --pb: 26px; position: relative; flex: 1 0 250px; min-height: 250px; }
.chart.sm { flex: 1 0 190px; min-height: 190px; }
.chart .gl, .chart .avg { position: absolute; left: var(--pl); right: 0; bottom: calc(var(--pb) + var(--y) * (100% - var(--pb)) / 100); height: 0; border-top: 1px solid var(--line); }
.chart .gl span { position: absolute; right: calc(100% + 10px); top: -8px; font: 11px/1 var(--mono); color: var(--text-3); white-space: nowrap; }
.chart .avg { border-top: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); z-index: 2; pointer-events: none; opacity: 0; animation: fade .6s var(--ease) .9s forwards; }
.chart .avg span { position: absolute; right: 0; bottom: 4px; font-size: 11.5px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); padding: 3px 6px; border-radius: 5px; background: color-mix(in srgb, var(--card) 80%, transparent); }
@keyframes fade { to { opacity: 1; } }
.bars { position: absolute; left: var(--pl); right: 0; top: 0; bottom: var(--pb); display: flex; align-items: flex-end; justify-content: center; gap: var(--gap, 6px); }
.bars .b { position: relative; flex: 1 1 0; max-width: 56px; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bars .b::before { content: ""; position: absolute; inset: 0 -2px; border-radius: 6px; background: var(--fill); opacity: 0; transition: opacity .2s; }
.bars .b:hover::before { opacity: 1; }
.bars .b i { position: relative; width: 100%; height: var(--h); min-height: var(--min, 0); border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 62%, transparent); transform-origin: bottom; animation: grow .9s var(--ease) both; animation-delay: var(--d, 0ms); transition: background .2s, filter .2s; }
.bars .b:hover i { background: var(--accent); }
.bars .b.hl i { background: linear-gradient(180deg, var(--accent-3), var(--accent)); box-shadow: 0 0 22px -6px var(--glow); }
.bars .b.z i { background: var(--fill-2); }
@keyframes grow { from { transform: scaleY(0); } }
.xl { position: absolute; left: var(--pl); right: 0; bottom: 0; height: 18px; display: flex; justify-content: center; gap: var(--gap, 6px); }
.xl span { flex: 1 1 0; max-width: 56px; text-align: center; font: 11px/18px var(--mono); color: var(--text-3); white-space: nowrap; overflow: visible; display: flex; justify-content: center; }
.xl span.hl { color: var(--accent); }

/* ------------------------------------------------------------------ tokens */
.tk-big { display: flex; align-items: baseline; gap: 8px; font-size: 34px; font-weight: 620; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.tk-big small { font-size: 13px; font-weight: 450; letter-spacing: 0; color: var(--text-3); }
.stack { display: flex; height: 12px; gap: 3px; margin: 18px 0 16px; }
.stack i { min-width: 3px; border-radius: 4px; transform: scaleX(0); transform-origin: left; animation: grow-x 1s var(--ease) forwards; animation-delay: var(--d, 0ms); }
@keyframes grow-x { to { transform: none; } }
.c-in { background: var(--accent); } .c-out { background: var(--teal); } .c-rs { background: var(--sky); } .c-cr { background: color-mix(in srgb, var(--text) 18%, transparent); } .c-cw { background: var(--amber); }
.legend { display: grid; gap: 9px; }
.legend .r { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; font-size: 13px; }
.legend .r > i { width: 10px; height: 10px; border-radius: 3px; }
.legend .r .n { color: var(--text-2); }
.legend .r .vv { font-size: 13px; font-weight: 520; font-variant-numeric: tabular-nums; }
.legend .r .p { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-3); text-align: right; }
.minis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.mini { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--fill); }
.mini span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.mini span .i { width: 13px; height: 13px; }
.mini b { font-size: 17px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ heatmap */
.heat-wrap { display: flex; gap: 22px; align-items: stretch; }
.heat-scroll { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.heat { --c: 12px; display: grid; grid-template-columns: 22px auto; gap: 6px 8px; width: max-content; margin-left: auto; }
.heat .months { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: var(--c); gap: 3px; height: 14px; font: 10.5px/14px var(--mono); color: var(--text-3); }
.heat .months span { white-space: nowrap; }
.heat .wd { display: grid; grid-template-rows: repeat(7, var(--c)); gap: 3px; font: 10px/var(--c) var(--mono); color: var(--text-3); }
.heat .cells { display: grid; grid-template-rows: repeat(7, var(--c)); grid-auto-flow: column; grid-auto-columns: var(--c); gap: 3px; }
.heat .cells i { border-radius: 3px; background: var(--fill-2); animation: pop .5s var(--spring) both; animation-delay: var(--d, 0ms); transition: transform .2s var(--spring), outline-color .2s; outline: 1px solid transparent; outline-offset: 1px; }
.heat .cells i.e { visibility: hidden; }
.heat .cells i:hover { transform: scale(1.35); outline-color: var(--text-3); }
.heat .cells i[data-l="1"] { background: color-mix(in srgb, var(--accent) 24%, var(--fill-2)); }
.heat .cells i[data-l="2"] { background: color-mix(in srgb, var(--accent) 46%, var(--fill-2)); }
.heat .cells i[data-l="3"] { background: color-mix(in srgb, var(--accent) 72%, var(--fill-2)); }
.heat .cells i[data-l="4"] { background: var(--accent); }
.heat .cells i.today { outline-color: var(--accent); }
@keyframes pop { from { opacity: 0; transform: scale(.3); } }
.heat-legend { grid-column: 2; display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 11.5px; color: var(--text-3); }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--fill-2); }
.heat-legend i:nth-of-type(2) { background: color-mix(in srgb, var(--accent) 24%, var(--fill-2)); }
.heat-legend i:nth-of-type(3) { background: color-mix(in srgb, var(--accent) 46%, var(--fill-2)); }
.heat-legend i:nth-of-type(4) { background: color-mix(in srgb, var(--accent) 72%, var(--fill-2)); }
.heat-legend i:nth-of-type(5) { background: var(--accent); }
.heat-legend span { margin: 0 4px; }
.heat-stats { flex: none; width: 200px; display: grid; gap: 4px; align-content: center; padding-left: 22px; border-left: 1px solid var(--line); }
.heat-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 13px; color: var(--text-3); }
.heat-stats b { color: var(--text); font-weight: 580; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------------ persona */
.persona { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; color: var(--text-2); background: var(--fill); border: 1px solid var(--line); }
.persona .i { width: 13px; height: 13px; color: var(--accent); }

/* ------------------------------------------------------------------ lists */
.list { display: grid; gap: 4px; }
.li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 46px; align-items: center; gap: 12px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; transition: background .2s; animation: li-in .6s var(--ease) both; animation-delay: var(--d, 0ms); }
.li:hover { background: var(--fill); }
.li:hover .ico { color: var(--accent); border-color: var(--accent-line); }
.li .ico { transition: color .2s, border-color .2s; }
.li .ico .i { width: 14px; height: 14px; }
.lt { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; }
.lt .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt .v { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.lb { height: 4px; margin-top: 7px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.lb i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--accent); opacity: .8; transform: scaleX(0); transform-origin: left; animation: grow-x 1.1s var(--ease) forwards; animation-delay: calc(var(--d, 0ms) + 120ms); }
.li:nth-child(n+2) .lb i { opacity: .55; }
.li .pc { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-3); text-align: right; }
@keyframes li-in { from { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------------ split */
.split-bar { display: flex; height: 34px; gap: 3px; border-radius: 10px; overflow: hidden; }
.split-bar i { display: grid; place-items: center; min-width: 4px; font: 11.5px var(--mono); color: var(--accent-ink); transform: scaleX(0); transform-origin: left; animation: grow-x 1s var(--ease) forwards; animation-delay: var(--d, 0ms); }
.split-bar i:first-child { border-radius: 10px 3px 3px 10px; } .split-bar i:last-child { border-radius: 3px 10px 10px 3px; } .split-bar i:only-child { border-radius: 10px; }
.split-bar i.s1 { background: var(--accent); } .split-bar i.s2 { background: var(--teal); } .split-bar i.s3 { background: var(--sky); } .split-bar i.s4 { background: color-mix(in srgb, var(--text) 22%, transparent); color: var(--text); }
.split-leg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.split-leg div { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--fill); min-width: 0; }
.split-leg .sw { width: 8px; height: 26px; border-radius: 3px; flex: none; }
.split-leg .sw.s1 { background: var(--accent); } .split-leg .sw.s2 { background: var(--teal); } .split-leg .sw.s3 { background: var(--sky); } .split-leg .sw.s4 { background: color-mix(in srgb, var(--text) 22%, transparent); }
.split-leg p { margin: 0; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-3); }
.split-leg b { font-size: 14px; color: var(--text); font-weight: 580; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub-h { margin: 22px 0 10px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }

/* ------------------------------------------------------------------ sessions */
.ses { display: grid; }
.se { display: grid; grid-template-columns: 32px minmax(0, 1fr) 72px 92px 104px; align-items: center; gap: 14px; padding: 11px 10px; margin: 0 -10px; border-radius: 10px; transition: background .2s; animation: li-in .6s var(--ease) both; animation-delay: var(--d, 0ms); }
.se + .se { box-shadow: 0 -1px 0 var(--line); }
.se:hover { background: var(--fill); }
.se .ico { width: 32px; height: 32px; border-radius: 9px; }
.se .t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.se .t b { font-size: 14px; font-weight: 520; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.se .t span { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.se .d { font-size: 13.5px; font-weight: 520; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.se .tk { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-3); white-space: nowrap; display: inline-flex; justify-content: flex-end; align-items: center; gap: 5px; }
.se .tk .i { width: 13px; height: 13px; }
.se .a { font-size: 12.5px; color: var(--text-3); text-align: right; white-space: nowrap; }
.se .a.live { color: var(--accent); display: inline-flex; justify-content: flex-end; align-items: center; gap: 7px; }
.se .a.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--glow); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } }

/* ------------------------------------------------------------------ skeleton */
.sk { position: relative; overflow: hidden; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--fill-2) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; border-radius: 6px; background: var(--fill-2); }

/* view transition on range switch */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .c3 { grid-column: span 6; }
  .c8, .c4, .c7, .c5 { grid-column: span 12; }
  .heat-stats { display: none; }
  .heat-mob { display: grid !important; }
}
@media (max-width: 760px) {
  .topbar .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
  .topbar .right { margin-left: auto; }
  #ranges { order: 3; width: 100%; margin-left: 0 !important; }
  #ranges button { flex: 1; justify-content: center; padding: 0 6px; }
  #ranges .rl { display: none; } #ranges .rs { display: inline; }
  .c6 { grid-column: span 12; }
  .se { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .se .tk, .se .a { display: none; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 14px; }
  .grid { gap: 10px; }
  .c3 { grid-column: span 6; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 24px; }
  .kpi .k .tag { display: none; }
  .panel { padding: 16px; }
  .chart { --pl: 32px; height: 210px; }
  .bars, .xl { --gap: 3px; }
  .split-leg { grid-template-columns: minmax(0, 1fr); }
  .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.heat-mob { display: none; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 16px; }
.heat-mob div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: var(--fill); font-size: 12px; color: var(--text-3); }
.heat-mob b { font-size: 15px; color: var(--text); font-weight: 580; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .bars .b i, .stack i, .lb i, .split-bar i, .heat .cells i, .li, .se { animation: none !important; transform: none; }
  .chart .avg { opacity: 1; animation: none; }
}
