/* Glide: tabs whose underline stretches from one tab to the next. */

.glide {
  box-sizing: border-box;
  width: min(1040px, 100%);
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--gl-surface);
  border-radius: var(--gl-radius);
  box-shadow: var(--gl-shadow);
  font-family: var(--gl-font);
  font-size: 14px;
  color: var(--gl-ink);
}

.glide__head {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 32px 0;
}

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

.glide__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.glide__meta { font-size: 13px; color: var(--gl-muted); }

/* The tab row scrolls sideways on narrow screens. */
.glide__scroller {
  overflow-x: auto;
  scrollbar-width: none;
  margin: -4px -32px 0;
  padding: 4px 32px 0; /* room for the focus ring */
}

.glide__scroller::-webkit-scrollbar { display: none; }

.glide__tabs {
  position: relative;
  display: flex;
  gap: 36px;
  width: max-content;
  min-width: 100%;
  border-bottom: 1px solid var(--gl-line);
}

.glide__tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--gl-muted);
  font: inherit;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
}

.glide__tab[aria-selected="true"] { color: var(--gl-ink); font-weight: 600; }

/* Reserves the bold width so tabs do not shift when one becomes selected. */
.glide__sizer {
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 600;
}

.glide__tab:focus-visible {
  outline: 2px solid var(--gl-focus);
  outline-offset: 2px;
}

/* The underline. Its left and right edges move on their own, so it stretches. */
.glide__line,
.glide__trail {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 100%;
  height: var(--gl-line-height);
  border-radius: var(--gl-line-height);
  background: var(--gl-accent);
  pointer-events: none;
}

.glide--ready .glide__line {
  transition:
    left var(--gl-duration) var(--gl-ease) var(--gl-left-delay, 0ms),
    right var(--gl-duration) var(--gl-ease) var(--gl-right-delay, 0ms);
}

/* The edge in the direction of travel leads; the other follows --gl-lag later. */
.glide[data-direction="right"] { --gl-left-delay: var(--gl-lag); }
.glide[data-direction="left"] { --gl-right-delay: var(--gl-lag); }

.glide--still .glide__line { transition: none; }

/* A faint copy stays under the tab that was left, and fades. */
.glide__trail { opacity: 0; }
.glide__trail--fade { animation: glide-trail var(--gl-duration) linear both; }

@keyframes glide-trail {
  from { opacity: 0.18; }
  to { opacity: 0; }
}

/* Panels share one grid cell, so with reduced motion the old one can fade out over the new one. */
.glide__panels { display: grid; }

.glide__panel {
  grid-area: 1 / 1;
  min-width: 0;
  padding: 26px 32px 32px;
}

.glide__panel:focus-visible {
  outline: 2px solid var(--gl-focus);
  outline-offset: -6px;
  border-radius: var(--gl-radius);
}

.glide__panel--entering {
  animation:
    glide-fade-in var(--gl-fade) linear both,
    glide-rise var(--gl-duration) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.glide__panel--leaving {
  animation: glide-fade-out var(--gl-fade) linear both;
  pointer-events: none;
}

@keyframes glide-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes glide-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes glide-rise { from { transform: translateY(var(--gl-rise)); } to { transform: none; } }

/* Reduced motion: the underline jumps and the panels only cross-fade. */
@media (prefers-reduced-motion: reduce) {
  .glide--ready .glide__line { transition: none; }
  .glide__trail { display: none; }
  .glide__panel--entering { animation: glide-fade-in var(--gl-fade) linear both; }
}

/* Panel content (the demo's settings pages). */
.glide__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.glide__stack { display: flex; flex-direction: column; gap: 16px; }

.glide__box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--gl-line);
  border-radius: var(--gl-inner-radius);
}

.glide__row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.glide__pair { display: flex; flex-direction: column; gap: 4px; }
.glide__heading { margin: 0; font-size: 14px; font-weight: 600; }
.glide__label { color: var(--gl-muted); }
.glide__big { font-size: 22px; font-weight: 700; }
.glide__mono { font-family: var(--gl-mono); }
.glide__text { margin: 0; color: var(--gl-muted); }

.glide__button {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--gl-ink);
  border-radius: var(--gl-button-radius);
  background: transparent;
  color: var(--gl-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.glide__action {
  align-self: flex-start;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--gl-accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.glide__button:focus-visible,
.glide__action:focus-visible {
  outline: 2px solid var(--gl-focus);
  outline-offset: 2px;
}

.glide__invoices {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px 24px;
  align-items: center;
  margin: 0;
}

.glide__invoices .glide__action { font-weight: 400; }

.glide__card {
  box-sizing: border-box;
  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border-radius: 12px;
  background: var(--gl-card-bg);
  color: var(--gl-card-ink);
}

.glide__card-label { font-size: 12px; color: var(--gl-card-muted); }
.glide__card-number { font-family: var(--gl-mono); font-size: 18px; letter-spacing: 0.1em; }

.glide__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.glide__stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }

.glide__list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.glide__list > li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--gl-line);
}

.glide__list > li:first-child { border-top: 0; padding-top: 0; }

.glide__list--meters > li { display: grid; gap: 8px; }

.glide__meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gl-line);
}

.glide__meter > span { display: block; height: 100%; border-radius: inherit; background: var(--gl-accent); }

@container (max-width: 720px) {
  .glide__head { padding: 22px 20px 0; }
  .glide__scroller { margin: -4px -20px 0; padding: 4px 20px 0; }
  .glide__tabs { gap: 24px; }
  .glide__panel { padding: 22px 20px 24px; }
  .glide__grid { grid-template-columns: minmax(0, 1fr); }
}
