/* Base, page frame, header, pinned tabs, pinned main-action bar, states */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-strong);
  font-family: var(--font-family);
  font-size: var(--fs-16);
  line-height: var(--lh-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: normal;
  padding-bottom: var(--bar-space);
}
body.has-sheet { overflow: hidden; }
body.has-sheet .mainbar { visibility: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-off); }
.sr-only {
  position: absolute; width: var(--hairline); height: var(--hairline); margin: 0; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.noscript { padding: var(--space-16); }

.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: max(var(--page-margin), env(safe-area-inset-left, 0px)) max(var(--page-margin), env(safe-area-inset-right, 0px));
}

/* ---- header: one compact row ---- */
.app-header { background: var(--surface-card); }
.app-header__inner {
  display: flex; align-items: center; gap: var(--space-8);
  padding-block: var(--space-12);
  padding-top: calc(var(--space-12) + env(safe-area-inset-top, 0px));
}
.app-header__titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--gap-group); }
.app-title { font-size: var(--fs-16); font-weight: var(--weight-heavy); line-height: var(--lh-tight); overflow-wrap: anywhere; }
.app-user { font-size: var(--fs-12); color: var(--text-muted); overflow-wrap: anywhere; }

/* ---- tabs pin at the top once reached ---- */
.tabs-strip {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface-card);
  box-shadow: 0 var(--hairline) 0 var(--line);
}
.tabs-strip__inner { display: flex; align-items: center; gap: var(--space-16); min-height: var(--tab-h); }
.tabs { display: flex; flex: 1 1 auto; min-width: 0; }
.tab {
  position: relative; flex: 1 1 0; min-height: var(--tab-h);
  padding: 0 var(--space-8); border: 0; background: none;
  font-size: var(--fs-16); font-weight: var(--weight-medium); color: var(--text-muted);
  overflow-wrap: anywhere;
}
.tab[aria-selected="true"] { color: var(--text-strong); font-weight: var(--weight-heavy); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--space-8); right: var(--space-8); bottom: 0;
  height: var(--edge-w); border-radius: var(--radius-full) var(--radius-full) 0 0;
  background: var(--accent);
}

/* ---- the screen's main action: pinned bar on phone, strip end on computer ---- */
.mainbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--surface-card);
  box-shadow: 0 calc(var(--hairline) * -1) 0 var(--line);
  padding: var(--space-12) max(var(--page-margin), env(safe-area-inset-right, 0px)) calc(var(--space-12) + env(safe-area-inset-bottom, 0px)) max(var(--page-margin), env(safe-area-inset-left, 0px));
}
.mainbar .btn { flex: 1 1 auto; }

.content { padding-block: var(--gap-sections) 0; }
.screen { display: flex; flex-direction: column; gap: var(--gap-sections); outline: none; }
#notices:not(:empty) { margin-bottom: var(--gap-sections); }

@media (min-width: 1024px) {
  .tabs { flex: 0 1 auto; }
  .tab { flex: 0 0 auto; padding: 0 var(--space-16); }
  .tab[aria-selected="true"]::after { left: var(--space-16); right: var(--space-16); }
  .tabs-strip__inner { justify-content: space-between; }
  .mainbar {
    position: static; z-index: auto; display: flex; background: none; box-shadow: none; padding: 0;
  }
  .mainbar .btn { flex: 0 0 auto; }
  body.has-sheet .mainbar { visibility: hidden; }
}

/* ---- notice (offline) ---- */
.notice {
  display: flex; flex-direction: column; gap: var(--gap-items); align-items: flex-start;
  padding: var(--card-pad); border-radius: var(--radius-16);
  background: var(--soon-bg); color: var(--soon-fg);
}
.notice p { font-size: var(--fs-14); overflow-wrap: anywhere; }
@media (min-width: 1024px) {
  .notice { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---- skeleton rows shaped like the real rows ---- */
.skel { background: var(--surface-sunken); border-radius: var(--radius-8); }
.skel--title { height: var(--space-24); width: 70%; }
.skel--line { height: var(--space-16); width: 50%; }
.skel--pill { height: var(--space-24); width: 30%; border-radius: var(--radius-full); }
.skel--tile { height: var(--target-min); width: 100%; }
.skel-card { display: flex; flex-direction: column; gap: var(--gap-items); }
.skel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap-items); }
@media (prefers-reduced-motion: no-preference) {
  .skel { animation: pulse var(--ms-spin) ease-in-out infinite alternate; }
}
@keyframes pulse { from { opacity: 1; } to { opacity: 0.5; } }

/* ---- toast: top, leaves by itself ---- */
.toast-host {
  position: fixed; left: 0; right: 0; top: 0; z-index: 90; pointer-events: none;
  display: flex; justify-content: center;
  padding: calc(var(--space-8) + env(safe-area-inset-top, 0px)) var(--space-16) 0;
}
.toast {
  max-width: var(--panel-w); padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-12); background: var(--toast-bg); color: var(--toast-fg);
  box-shadow: var(--shadow-raised); font-size: var(--fs-14); font-weight: var(--weight-medium);
  overflow-wrap: anywhere; opacity: 0; transform: translateY(-100%);
  transition: opacity var(--ms-base) var(--ease-out), transform var(--ms-base) var(--ease-out);
}
.toast.is-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---- signed-out screen ---- */
.signedout {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: var(--page-margin);
}
.signedout__card {
  width: 100%; max-width: var(--panel-w); display: flex; flex-direction: column; gap: var(--gap-fields);
  padding: var(--space-24); border-radius: var(--radius-16);
  background: var(--surface-card); box-shadow: var(--shadow-card);
}
.signedout__title { font-size: var(--fs-24); font-weight: var(--weight-heavy); line-height: var(--lh-tight); }
.signedout__text { font-size: var(--fs-16); color: var(--text-muted); }
.signedout__text--alert { color: var(--alert-fg); }
