:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f4f9;
  --surface-3: #e9eef6;
  --accent: #0b57d0;
  --accent-soft: #d3e3fd;
  --accent-ink: #041e49;
  --text: #1f1f1f;
  --text-2: #444746;
  --text-3: #747775;
  --text-4: #a8abb0;
  --line: rgba(31, 31, 31, 0.08);
  --border: #e3e6ea;
  --good: #146c2e;
  --good-soft: #c4eed0;
  --bad: #c5221f;
  --bad-soft: #fce8e6;
  --blur-bg: rgba(248, 250, 253, 0.74);
  --blur-white: rgba(255, 255, 255, 0.76);
  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.08), 0 1px 3px 1px rgba(60, 64, 67, 0.05);
  --shadow-2: 0 8px 28px rgba(31, 31, 31, 0.12), 0 1px 3px rgba(31, 31, 31, 0.06);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --r-card: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --head-h: calc(58px + var(--safe-top));
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Google Sans Text', 'Google Sans', 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Google Sans Display', 'Google Sans', 'Segoe UI',
    Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.locked {
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  cursor: default;
}
b {
  font-weight: 600;
}
[hidden] {
  display: none !important;
}
.blur {
  background: var(--blur-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}

/* ---------- boot ---------- */
.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ---------- press feedback ---------- */
.pressable,
.row,
.pill,
.icon-btn,
.list-btn,
.opt {
  transition: transform 160ms var(--ease), background-color 180ms ease, opacity 160ms ease;
}
.pressable:active,
.row:active,
.pill:active,
.icon-btn:active,
.list-btn:active,
.opt:not(:disabled):active {
  transform: scale(0.975);
}

/* ---------- auth ---------- */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}
.auth-card {
  width: 100%;
  max-width: 400px;
  animation: rise 520ms var(--ease) both;
}
.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: block;
  margin: 0 0 20px;
  box-shadow: var(--shadow-1);
}
.auth h1 {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  font-weight: 700;
}
.auth p.lead {
  color: var(--text-2);
  margin: 0 0 28px;
}
.auth form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.auth-msg {
  min-height: 22px;
  font-size: 14px;
  color: var(--text-2);
  margin: 4px 2px 0;
}
.auth-msg.error {
  color: var(--bad);
}

/* ---------- inputs ---------- */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > span {
  font-size: 13px;
  color: var(--text-2);
  padding-left: 4px;
  font-weight: 500;
}
.input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--surface-2);
  outline: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(11, 87, 208, 0.12);
}
.input::placeholder {
  color: var(--text-4);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.grid-4 .input {
  padding: 0 10px;
}
.hint {
  font-size: 13px;
  color: var(--text-3);
  padding-left: 4px;
  margin: 0;
}

/* ---------- buttons ---------- */
.pill {
  height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-3);
  color: var(--text);
}
.pill.primary {
  background: var(--accent);
  color: #fff;
}
.pill.primary:disabled {
  opacity: 0.55;
}
.pill.danger {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill.block {
  width: 100%;
}
.pill svg {
  width: 18px;
  height: 18px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(31, 31, 31, 0.06);
  color: var(--text-2);
  flex: none;
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}

/* ---------- segmented control (sheets) ---------- */
.seg {
  --n: 2;
  --i: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  isolation: isolate;
}
.seg-thumb {
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--n));
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 340ms var(--ease);
}
.seg button {
  height: 36px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: color 200ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}
.seg button.on {
  color: var(--text);
  font-weight: 600;
}
.seg.lg button {
  height: 40px;
  font-size: 15px;
}

/* ---------- toggle ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: 14px;
}
.toggle-row small {
  display: block;
  color: var(--text-3);
  font-size: 13px;
}
.switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex: none;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d5d9df;
  transition: background-color 240ms var(--ease);
  pointer-events: none;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 300ms var(--ease);
}
.switch input:checked + span {
  background: var(--good);
}
.switch input:checked + span::after {
  transform: translateX(20px);
}

/* ---------- fixed top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding-top: var(--safe-top);
}
/* Fading header: white + max blur at the top, nothing at the bottom */
.fade-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% + 28px);
  pointer-events: none;
  z-index: -1;
}
.fade-bg::before,
.fade-bg::after {
  content: '';
  position: absolute;
  inset: 0;
}
.fade-bg::before {
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
}
.fade-bg::after {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.82) 45%, rgba(255, 255, 255, 0) 100%);
}
.topbar-inner {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  height: 58px;
  padding: 0 16px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hello {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent);
}

/* ---------- home ---------- */
.home {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--head-h) + 12px) 14px calc(120px + var(--safe-bottom));
}
.home.intro {
  animation: fade 360ms ease both;
}
.art-block {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--border);
  background-color: #fff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: clamp(190px, 28vh, 240px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  isolation: isolate;
  text-align: center;
}
.art-block::before {
  /* soft white wash in the middle so the number stays readable over the lines */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.55) 70%, rgba(255, 255, 255, 0.25));
}
.art-campus {
  background-image: url('/img/campus.webp');
}
.art-library {
  background-image: url('/img/library.webp');
}
.hero-value {
  font-family: var(--font-display);
  font-size: clamp(72px, 21vw, 104px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.hero-value.empty {
  opacity: 0.35;
}
.hero-max {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  padding: 26px 8px 10px;
  margin: 0;
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 13px 16px;
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  min-width: 0;
  overflow: hidden;
}
.home.intro .row {
  animation: rise 420ms var(--ease) both;
  animation-delay: calc(var(--d, 0) * 35ms);
}
.row.is-open {
  visibility: hidden;
}
.row-main {
  flex: 1;
  min-width: 0;
}
.ctitle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.ctitle .t {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.ctitle .ects {
  color: var(--text-3);
  font-weight: 500;
  flex: none;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  flex: none;
}
.row-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 4px;
  padding-left: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub .need {
  color: var(--c);
  font-weight: 600;
}
.row-side {
  flex: none;
  text-align: right;
  white-space: nowrap;
}
.marg {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.marg b {
  font-size: 15px;
  color: var(--text);
}
.gtxt {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--g, var(--text-2));
}
.row-side .gtxt {
  margin-top: 2px;
  display: block;
}
.empty-state {
  text-align: center;
  padding: 56px 24px 24px;
  color: var(--text-2);
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  margin: 0 0 6px;
}
.fab-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
.fab {
  pointer-events: auto;
  height: 54px;
  padding: 0 24px 0 20px;
  border-radius: 999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-ink);
  box-shadow: var(--shadow-2);
  border: 0.5px solid rgba(255, 255, 255, 0.7);
}
.fab svg {
  width: 20px;
  height: 20px;
}

/* ---------- full-screen pages (course + profile) ---------- */
.page {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.page-bg {
  position: absolute;
  inset: 0;
  background: var(--surface);
  will-change: clip-path;
}
.page-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding-top: var(--safe-top);
}
.page-head-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.page-head-inner {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  height: 58px;
  padding: 0 14px 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-head-inner .ctitle {
  flex: 1;
}
.page-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}
.page-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.page-content {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--head-h) + 14px) 14px calc(120px + var(--safe-bottom));
}
.panel {
  display: grid;
  gap: 12px;
}
.sub-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  padding: 10px 6px 0;
  margin: 0;
}

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card.pad {
  padding: 16px 18px;
}
.overview .big {
  font-family: var(--font-display);
  font-size: clamp(48px, 14vw, 64px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.overview .big small {
  font-size: 0.42em;
  letter-spacing: -0.01em;
  color: var(--text-3);
  font-weight: 600;
}
.overview .missed {
  color: var(--bad);
  font-weight: 600;
  font-size: 15px;
  margin-top: 8px;
}
.overview .missed.none {
  color: var(--good);
}
.overview .note {
  color: var(--text-3);
  font-size: 14px;
  margin-top: 8px;
}
.notice {
  font-size: 13.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 11px 14px;
}
.notice.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* list of options (Mål / Betyg) */
.opts {
  display: grid;
}
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  width: 100%;
  text-align: left;
  border-top: 1px solid var(--border);
  position: relative;
}
.opt:first-child {
  border-top: 0;
}
.opt .gtxt {
  flex: 1;
  font-size: 16px;
}
.opt .o-side {
  font-size: 13.5px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.opt .o-side.bad {
  color: var(--bad);
}
.opt .check {
  width: 20px;
  height: 20px;
  color: var(--g);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 200ms ease, transform 300ms var(--ease);
  flex: none;
}
.opt.on {
  background: color-mix(in srgb, var(--g) 10%, transparent);
}
.opt.on .check {
  opacity: 1;
  transform: none;
}
.opt:disabled {
  opacity: 0.45;
}
.opt.on:disabled {
  opacity: 1;
}

/* parts */
.part {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.part:first-child {
  border-top: 0;
}
.part .p-main {
  flex: 1;
  min-width: 0;
}
.part .p-name {
  font-weight: 600;
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.part .p-name span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.part .p-name svg {
  width: 14px;
  height: 14px;
  color: var(--text-4);
  flex: none;
}
.part .p-meta {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.p-main {
  text-align: left;
}
.p-score {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.p-score input {
  width: 64px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.p-score input::placeholder {
  color: var(--text-4);
  font-weight: 500;
}
.p-score input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.14);
}
.p-score input:disabled {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.p-score .of {
  color: var(--text-3);
  font-size: 15px;
  min-width: 38px;
}
.pf-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pf-btn.ok {
  background: var(--good-soft);
  color: var(--good);
}
.pf-btn.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.empty-line {
  font-size: 14px;
  color: var(--text-3);
  padding: 16px;
}
.list-btn {
  width: 100%;
  height: 50px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--accent);
}
.list-btn svg {
  width: 18px;
  height: 18px;
}

/* bottom tab bar */
.tabbar-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + var(--safe-bottom));
  display: flex;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
}
.tabbar {
  --i: 1;
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 104px);
  padding: 5px;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  isolation: isolate;
}
.tab-thumb {
  position: absolute;
  z-index: -1;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: 104px;
  border-radius: 999px;
  background: rgba(11, 87, 208, 0.12);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 380ms var(--ease);
}
.tab {
  height: 46px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 220ms ease, opacity 220ms ease;
}
.tab.on {
  color: var(--accent);
}
.tab svg {
  width: 14px;
  height: 14px;
}
.tab .lock {
  opacity: 0.55;
}
.opt .sugg {
  font-size: 12px;
  font-weight: 600;
  color: var(--g);
  background: color-mix(in srgb, var(--g) 12%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* profile */
.profile-card {
  padding: 16px 18px;
}
.profile-card .label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}
.profile-card .value {
  font-size: 17px;
  font-weight: 600;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved {
  font-size: 13px;
  color: var(--good);
  padding-left: 4px;
  min-height: 18px;
  transition: opacity 300ms ease;
}

/* ---------- sheets ---------- */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 26, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 40px - var(--safe-top));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 30px 30px 0 0;
  padding: 8px 20px calc(22px + var(--safe-bottom));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
}
@media (min-width: 640px) {
  .sheet-wrap {
    align-items: center;
  }
  .sheet {
    border-radius: 30px;
    padding-bottom: 22px;
  }
}
.grabber {
  width: 38px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  margin: 0 auto 10px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 16px;
  touch-action: none;
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sheet form,
.sheet .stack {
  display: grid;
  gap: 14px;
}
.sheet .actions {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
details.more summary {
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 4px;
}
details.more summary::-webkit-details-marker {
  display: none;
}
details.more[open] summary {
  margin-bottom: 10px;
}
.pick-list {
  display: grid;
  gap: 8px;
}
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  text-align: left;
  min-width: 0;
}
.pick .ctitle {
  flex: 1;
  font-size: 15.5px;
}
.pick svg {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  flex: none;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
  outline: 2px solid transparent;
  outline-offset: 1px;
  transition: outline-color 160ms ease, transform 160ms var(--ease);
}
.swatch.on {
  outline-color: var(--c);
}
.swatch:active {
  transform: scale(0.92);
}
.swatch-custom {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: conic-gradient(#d93025, #f9ab00, #188038, #12a4af, #1a73e8, #9334e6, #d01884, #d93025);
}
.swatch-custom input {
  position: absolute;
  inset: -6px;
  width: 46px;
  height: 46px;
  opacity: 0;
  cursor: pointer;
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  opacity: 0;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(31, 31, 31, 0.9);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  pointer-events: none;
  transition: opacity 240ms ease, transform 360ms var(--ease);
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

/* password with show/hide */
.pw {
  position: relative;
}
.pw .input {
  padding-right: 52px;
}
.pw .eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.pw .eye svg {
  width: 20px;
  height: 20px;
}
.pw-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}
.pw-row .pill {
  height: 52px;
}
