/* Ledgerly, from sign in to the dashboard: one app window on a warm page. The sign in card sits in its middle; on
   Sign in a surface of its own (.shell) takes the card's place and flies to the avatar's slot, while the dashboard
   (.app) composes under it. The window is a size container: everything inside is laid out on its own width. */
:root {
  --page: #eeebe4;          /* the page */
  --win: #f8f7f3;           /* the app window */
  --card: #ffffff;          /* the cards and tiles */
  --ink: #17160f;           /* the words and the button */
  --muted: #7a776d;         /* the small words */
  --faint: #b3afa4;         /* the faintest words and the grid labels */
  --line: rgba(23, 22, 15, 0.085); /* the hairlines */
  --accent: #1f7a58;        /* the accent: the avatar, the line of the chart, the active page */
  --accent-soft: rgba(31, 122, 88, 0.1); /* the accent as a wash */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

p,
h1,
h2 {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: min(3vw, 3vh, 24px);
  overflow: hidden;
}

/* ---------------------------------------------------------------- the window */
.win {
  position: relative;
  width: min(94vw, 880px);
  height: min(92vh, 560px);
  border-radius: 18px;
  background: var(--win);
  box-shadow:
    0 0 0 1px rgba(23, 22, 15, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(40, 32, 10, 0.04),
    0 30px 70px -36px rgba(40, 32, 10, 0.32);
  overflow: hidden;
  container: win / size;
}

/* a faint grain of light on the window, top left */
.win::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.7), transparent 60%);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the sign in card */
.login {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 3;
  padding: 12px;
}

.login.is-gone {
  visibility: hidden;
  pointer-events: none;
}

.card {
  position: relative;
  width: min(330px, 100%);
  margin: 0;
  border-radius: 18px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(23, 22, 15, 0.07),
    0 1px 2px rgba(40, 32, 10, 0.05),
    0 18px 40px -20px rgba(40, 32, 10, 0.28);
}

.card__in {
  display: grid;
  gap: 12px;
  padding: clamp(16px, 6cqh, 26px) clamp(16px, 5cqw, 26px);
}

.card__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.mark {
  width: 20px;
  height: 20px;
  flex: none;
}

.mark rect {
  fill: var(--accent);
}

.mark path {
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__title {
  margin-top: 4px;
  font-size: clamp(18px, 5.4cqh, 22px);
  font-weight: 620;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.card__sub {
  margin-top: -6px;
  font-size: 12.5px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 5px;
}

.field__label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--muted);
}

.field__link {
  color: var(--accent);
  font-weight: 560;
}

.field__box {
  display: flex;
  align-items: center;
  height: clamp(34px, 10cqh, 40px);
  padding: 0 12px;
  border-radius: 10px;
  background: #fbfaf8;
  box-shadow: inset 0 0 0 1px rgba(23, 22, 15, 0.1), inset 0 1px 2px rgba(23, 22, 15, 0.04);
  font-size: 13.5px;
  font-weight: 480;
}

.field__box--pass {
  gap: 5px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.go {
  position: relative;
  margin-top: 4px;
  height: clamp(36px, 10.5cqh, 42px);
  border-radius: 11px;
}

/* the face moves for GSAP (the press), the button keeps the hover in CSS */
.go__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(23, 22, 15, 0.2), 0 8px 18px -10px rgba(23, 22, 15, 0.5);
  overflow: hidden;
}

.go__words,
.go__busy {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.go__busy {
  opacity: 0;
}

.spin {
  width: 14px;
  height: 14px;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.spin__track {
  stroke: rgba(255, 255, 255, 0.22);
}

.spin__arc {
  stroke: #fff;
}

@media (hover: hover) {
  .go:hover .go__face {
    background: #2a2920;
  }
}

.go:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- the surface that flies */
.shell {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  visibility: hidden;
  pointer-events: none;
  background: var(--card);
  overflow: hidden;
}

.shell__face {
  color: #fff;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.02em;
  opacity: 0;
}

/* ---------------------------------------------------------------- the dashboard */
.app {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 184px 1fr;
}

.app.is-off {
  pointer-events: none;
}

.side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.side__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.nav {
  position: relative;
  display: grid;
  gap: 2px;
}

.nav__hover {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 34px;
  border-radius: 9px;
  background: rgba(23, 22, 15, 0.05);
  opacity: 0;
  pointer-events: none;
}

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 520;
  color: var(--muted);
  transition: color 0.25s;
}

.nav__item svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav__item.is-on {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

@media (hover: hover) {
  .nav__item:hover {
    color: var(--ink);
  }

  .nav__item.is-on:hover {
    color: var(--accent);
  }
}

.main {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: clamp(10px, 3.2cqh, 18px);
  padding: clamp(12px, 3.6cqh, 22px) clamp(12px, 3cqw, 26px);
  min-width: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top__date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.top__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top__search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  width: 168px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px;
  color: var(--faint);
}

.top__search svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.who {
  position: relative;
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 0 rgba(31, 122, 88, 0);
  transition: box-shadow 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.avatar__face {
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.02em;
}

@media (hover: hover) {
  .avatar:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 4px var(--accent-soft);
  }
}

.avatar[aria-expanded='true'] {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 4px var(--accent-soft);
}

.avatar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 8;
  width: 200px;
  padding: 6px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 0 0 1px rgba(23, 22, 15, 0.08), 0 2px 4px rgba(40, 32, 10, 0.05), 0 18px 36px -18px rgba(40, 32, 10, 0.35);
  visibility: hidden;
  opacity: 0;
}

.menu__who {
  display: grid;
  gap: 2px;
  padding: 8px 10px 9px;
}

.menu__name {
  font-size: 13px;
  font-weight: 600;
}

.menu__mail {
  font-size: 11.5px;
  color: var(--muted);
}

.menu__rule {
  display: block;
  height: 1px;
  margin: 2px 4px 4px;
  background: var(--line);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 520;
  color: var(--ink);
  text-align: left;
  transition: background-color 0.2s;
}

.menu__item svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3), color 0.2s;
}

@media (hover: hover) {
  .menu__item:hover {
    background: rgba(23, 22, 15, 0.045);
  }

  .menu__item--out:hover svg {
    color: var(--ink);
    transform: translateX(2px);
  }
}

.hello__line {
  font-size: clamp(18px, min(4.4cqw, 7cqh), 32px);
  font-weight: 600;
  font-stretch: 104%;
  letter-spacing: -0.025em;
  line-height: 1.1;
  white-space: nowrap;
}

.hello__line .ch {
  display: inline-block;
  white-space: pre;
}

.hello__sub {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.6cqw, 14px);
}

/* the tile moves for GSAP; its hover lift is on the face of it in CSS */
.tile {
  position: relative;
  display: grid;
  gap: 6px;
  padding: clamp(10px, 2.8cqh, 16px) clamp(10px, 1.8cqw, 16px);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 0 0 1px rgba(23, 22, 15, 0.07), 0 1px 2px rgba(40, 32, 10, 0.04);
  transition: box-shadow 0.35s, translate 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.25);
  min-width: 0;
}

.tile__label {
  font-size: 11.5px;
  font-weight: 540;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile__value {
  font-size: clamp(16px, min(3cqw, 5.4cqh), 25px);
  font-weight: 620;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.tile__note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  background: rgba(23, 22, 15, 0.05);
  color: var(--muted);
  font-weight: 580;
  font-variant-numeric: tabular-nums;
}

.chip--up {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (hover: hover) {
  .tile:hover {
    translate: 0 -2px;
    box-shadow: 0 0 0 1px rgba(23, 22, 15, 0.1), 0 2px 4px rgba(40, 32, 10, 0.05), 0 14px 26px -16px rgba(40, 32, 10, 0.3);
  }
}

.chart {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(10px, 2.8cqh, 16px) clamp(10px, 1.8cqw, 18px);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 0 0 1px rgba(23, 22, 15, 0.07), 0 1px 2px rgba(40, 32, 10, 0.04);
}

.chart__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chart__title {
  font-size: 12.5px;
  font-weight: 600;
}

.chart__range {
  font-size: 11px;
  color: var(--faint);
}

.chart__plot {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
}

.chart__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart__grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.stop-a {
  stop-color: var(--accent);
  stop-opacity: 0.16;
}

.stop-b {
  stop-color: var(--accent);
  stop-opacity: 0;
}

.chart__line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__cursor {
  stroke: rgba(23, 22, 15, 0.18);
  stroke-width: 1;
  opacity: 0;
}

.chart__point {
  fill: var(--card);
  stroke: var(--accent);
  stroke-width: 1.8;
  opacity: 0;
}

.tip {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  gap: 1px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 10.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 8px 18px -10px rgba(23, 22, 15, 0.6);
}

.tip span {
  color: rgba(255, 255, 255, 0.6);
}

.tip b {
  font-size: 12px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- a narrow window (the phone) */
@container win (max-width: 620px) {
  .app {
    grid-template-columns: 50px 1fr;
  }

  .side {
    padding: 14px 7px;
    align-items: center;
  }

  .side__brand {
    padding: 0;
  }

  .side__name,
  .nav__item span {
    display: none;
  }

  .nav__item {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .nav__hover {
    width: 36px;
  }

  .top__search {
    display: none;
  }

  .tile__note span + span {
    display: none;
  }

  .tile__label {
    font-size: 10.5px;
  }

  .tile__value {
    font-size: clamp(14px, 4.4cqw, 20px);
  }

  .hello__line {
    font-size: clamp(18px, 6.4cqw, 26px);
  }
}

@container win (max-height: 430px) {
  .hello__sub {
    display: none;
  }

  .card__sub {
    display: none;
  }

  .card__in {
    gap: 10px;
  }
}

.tile-slot {
  min-width: 0;
  display: grid;
}

.chart__tick {
  fill: var(--faint);
  font-size: 10px;
  font-weight: 500;
  text-anchor: end;
  font-variant-numeric: tabular-nums;
}
