:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-sheet: #ffffff;
  --label: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #a1a1a6;
  --blue: #3a6ea5;
  --blue-soft: rgba(58, 110, 165, 0.1);
  --green: #3d7a57;
  --green-soft: rgba(61, 122, 87, 0.12);
  --orange: #9a7040;
  --orange-soft: rgba(154, 112, 64, 0.14);
  --red: #a33b32;
  --red-soft: rgba(163, 59, 50, 0.1);
  --fill: rgba(60, 60, 67, 0.08);
  --fill-strong: rgba(60, 60, 67, 0.14);
  --separator: rgba(60, 60, 67, 0.18);
  --hairline: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 16px rgba(0, 0, 0, 0.05);
  --tone-stone: linear-gradient(165deg, #f7f4ef 0%, #ddd4c8 100%);
  --tone-slate: linear-gradient(165deg, #f2f4f5 0%, #cfd6db 100%);
  --tone-sage: linear-gradient(165deg, #f3f5f1 0%, #d0d6cc 100%);
  --tone-ink: linear-gradient(165deg, #f4f4f4 0%, #d8d8d8 100%);
  --radius: 16px;
  --tab-h: 78px;
  --sidebar: 200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-sheet: #1c1c1e;
    --label: #f5f5f7;
    --secondary: #98989d;
    --tertiary: #6e6e73;
    --blue: #6ea3d8;
    --blue-soft: rgba(110, 163, 216, 0.16);
    --green: #63b583;
    --green-soft: rgba(99, 181, 131, 0.16);
    --orange: #d8a45f;
    --orange-soft: rgba(216, 164, 95, 0.16);
    --red: #e0736a;
    --red-soft: rgba(224, 115, 106, 0.16);
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.32);
    --separator: rgba(84, 84, 88, 0.6);
    --hairline: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.35);
    --tone-stone: linear-gradient(165deg, #3a352c 0%, #221f1a 100%);
    --tone-slate: linear-gradient(165deg, #2c3438 0%, #1a1f22 100%);
    --tone-sage: linear-gradient(165deg, #2f342c 0%, #1c1f19 100%);
    --tone-ink: linear-gradient(165deg, #302f31 0%, #19181a 100%);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-sheet: #1c1c1e;
  --label: #f5f5f7;
  --secondary: #98989d;
  --tertiary: #6e6e73;
  --blue: #6ea3d8;
  --blue-soft: rgba(110, 163, 216, 0.16);
  --green: #63b583;
  --green-soft: rgba(99, 181, 131, 0.16);
  --orange: #d8a45f;
  --orange-soft: rgba(216, 164, 95, 0.16);
  --red: #e0736a;
  --red-soft: rgba(224, 115, 106, 0.16);
  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.32);
  --separator: rgba(84, 84, 88, 0.6);
  --hairline: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.35);
  --tone-stone: linear-gradient(165deg, #3a352c 0%, #221f1a 100%);
  --tone-slate: linear-gradient(165deg, #2c3438 0%, #1a1f22 100%);
  --tone-sage: linear-gradient(165deg, #2f342c 0%, #1c1f19 100%);
  --tone-ink: linear-gradient(165deg, #302f31 0%, #19181a 100%);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.016em;
  overflow-x: hidden;
}

body {
  padding: env(safe-area-inset-top) 0 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--blue);
  text-decoration: none;
}

.app-meta,
a.app-meta,
.app-row a {
  color: inherit;
}

.app {
  min-height: 100dvh;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #7a8690;
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.35);
  position: relative;
  flex: none;
}

.brand-mark::after {
  content: "W";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.sidebar {
  display: none;
}

.stage {
  min-width: 0;
}

.view {
  max-width: 980px;
  min-width: 0;
  margin: 0 auto;
  padding: 8px max(20px, env(safe-area-inset-right)) calc(var(--tab-h) + 16px)
    max(20px, env(safe-area-inset-left));
  overflow-x: hidden;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 12px;
}

.page-head .date {
  margin: 0 0 2px;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.large-title {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.avatar {
  display: none;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--fill);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 4px 0 18px;
  color: var(--secondary);
}

.search-field svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.search-field input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 15px;
  color: var(--label);
}

.search-field input::placeholder {
  color: var(--secondary);
}

.bento {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-auto-rows: 72px;
  gap: 12px;
  margin-bottom: 8px;
}

.tile {
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  padding: 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  color: var(--label);
  cursor: pointer;
  text-decoration: none;
}

.tile.wide {
  grid-column: 1 / -1;
  grid-row: span 2;
}

.tile.tall {
  grid-row: span 4;
}

.tile.square {
  grid-row: span 2;
}

.tile.banner {
  grid-column: 1 / -1;
  grid-row: span 1;
  min-height: 0;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  justify-content: flex-start;
}

.tile h2 {
  margin: 5px 0 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.tile p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--secondary);
  max-width: 36ch;
}

.kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary);
}

.tone-stone {
  background: var(--tone-stone);
}

.tone-slate {
  background: var(--tone-slate);
}

.tone-sage {
  background: var(--tone-sage);
}

.tone-ink {
  background: var(--tone-ink);
}

.tile-app {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}

.tile-app .get {
  margin-left: auto;
  flex: none;
}

.tile.banner .tile-app {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}

.tile-app .app-meta {
  flex: 1;
}

.section {
  margin: 28px 0 8px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.section-head a {
  font-size: 14px;
  font-weight: 400;
}

.app-list {
  background: transparent;
}

.app-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  color: inherit;
}

.app-row + .app-row {
  border-top: 0.5px solid var(--separator);
}

.rank {
  width: 22px;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 18px;
  text-align: center;
}

.app-row.ranked {
  grid-template-columns: 20px 52px minmax(0, 1fr) max-content;
}

.app-icon,
.cert-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.04em;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0.5px 0 rgba(255, 255, 255, 0.28);
}

.app-icon.lg {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  font-size: 32px;
}

.app-icon img,
.cert-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-icon img.bleed {
  transform: scale(1.22);
}

.cert-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: #7a8690;
}

.cert-icon.csr {
  background: #8a8490;
}

.cert-icon.expired {
  background: linear-gradient(180deg, #8e8e93, #636366);
}

.cert-icon svg,
.app-icon svg,
.row svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  display: block;
}

.row-body,
.app-meta {
  min-width: 0;
  overflow: hidden;
}

.row-title,
.app-name {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.016em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-name {
  font-weight: 600;
}

.row-sub,
.app-sub {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.get {
  position: relative;
  min-width: 58px;
  height: 24px;
  padding: 0 10px;
  border-radius: 980px;
  border: 0;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.get::after {
  content: "";
  position: absolute;
  inset: -10px;
}

.get.solid {
  background: var(--blue);
  color: #fff;
}

.pill {
  font-size: 12px;
  font-weight: 600;
  border-radius: 980px;
  padding: 4px 8px;
  background: var(--fill);
  color: var(--secondary);
}

.pill.valid {
  background: var(--green-soft);
  color: #248a3d;
}

.pill.expiring {
  background: var(--orange-soft);
  color: #9a6700;
}

.pill.expired {
  background: var(--red-soft);
  color: var(--red);
}

.empty {
  padding: 36px 8px 12px;
  text-align: center;
}

.empty h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.empty p {
  margin: 8px auto 0;
  max-width: 340px;
  color: var(--secondary);
  font-size: 15px;
}

.product {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 8px 0 18px;
}

.product h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.product .get {
  margin-top: 12px;
}

.grouped {
  background: var(--bg-elevated);
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  font-size: 15px;
}

.kv + .kv {
  border-top: 0.5px solid var(--separator);
}

.kv span {
  color: var(--secondary);
}

.kv b {
  font-weight: 400;
  text-align: right;
  word-break: break-all;
}

.actions {
  display: grid;
  gap: 10px;
  margin: 16px 0 8px;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 980px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-secondary {
  background: var(--fill);
  color: var(--label);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.hint {
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 0 20px;
}

.steps {
  counter-reset: step;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  color: var(--secondary);
  font-size: 15px;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  color: var(--secondary);
  padding-left: 4px;
}

.field input,
.field select {
  width: 100%;
  border: 0;
  background: var(--fill);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
}

.choice-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.choice {
  text-align: left;
  border: 1.5px solid transparent;
  background: var(--fill);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
}

.choice.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.choice b {
  display: block;
  margin-bottom: 4px;
}

.choice span {
  color: var(--secondary);
  font-size: 13px;
}

.drop {
  border: 1.5px dashed color-mix(in srgb, var(--tertiary) 70%, transparent);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  color: var(--secondary);
  background: color-mix(in srgb, var(--fill) 60%, transparent);
  margin-bottom: 12px;
  cursor: pointer;
}

.drop.over,
.drop.has-file {
  border-style: solid;
  border-color: var(--blue);
  color: var(--label);
}

.drop input {
  display: none;
}

.password-row {
  display: flex;
  gap: 8px;
}

.password-row input {
  flex: 1;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  max-height: min(92dvh, 860px);
  background: var(--bg-sheet);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  isolation: isolate;
  animation: rise 0.38s var(--ease);
}

.sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: 99px;
  background: var(--fill-strong);
  margin: 8px auto 0;
}

.sheet-head {
  display: grid;
  grid-template-columns: minmax(56px, 88px) 1fr minmax(56px, 88px);
  align-items: center;
  padding: 6px 8px 10px;
  border-bottom: 0.5px solid var(--hairline);
}

.sheet-head h2 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  padding: 8px;
  font-weight: 500;
}

.sheet-body {
  overflow: auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg-sheet);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tab-h) - 12px + env(safe-area-inset-bottom));
  padding: 6px max(2px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
    max(2px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--hairline);
  z-index: 20;
}

.tabbar a,
.sidebar-nav a {
  color: var(--tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 500;
  min-width: 0;
}

.tabbar a.active,
.sidebar-nav a.active {
  color: var(--blue);
}

.tabbar svg,
.sidebar-nav svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.suggest {
  display: grid;
}

.suggest a {
  padding: 12px 0;
  color: var(--blue);
  border-top: 0.5px solid var(--separator);
  font-size: 15px;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 8px);
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  z-index: 50;
  max-width: min(90vw, 420px);
}

.muted {
  color: var(--secondary);
  font-size: 15px;
}

@keyframes rise {
  from {
    transform: translate(-50%, 28px);
  }
  to {
    transform: translate(-50%, 0);
  }
}

@media (max-width: 700px) {
  .bento {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 64px;
  }

  .tile.tall {
    grid-row: span 3;
  }
}

@media (max-width: 380px) {
  .view {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .large-title {
    font-size: 22px;
  }

  .bento {
    gap: 8px;
    grid-auto-rows: 56px;
  }

  .tile {
    padding: 12px;
  }

  .product {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .app-icon.lg {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .sheet-head {
    grid-template-columns: minmax(48px, 72px) 1fr minmax(48px, 72px);
  }
}

@media (max-width: 420px) and (orientation: landscape) {
  .tabbar {
    height: calc(58px + env(safe-area-inset-bottom));
  }

  .view {
    padding-bottom: calc(58px + 16px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: 22px 14px;
    border-right: 0.5px solid var(--hairline);
    background: color-mix(in srgb, var(--bg) 92%, var(--bg-elevated));
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--label);
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.03em;
    padding: 4px 10px 22px;
  }

  .sidebar-nav {
    display: grid;
    gap: 4px;
  }

  .sidebar-nav a {
    flex-direction: row;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 15px;
    color: var(--label);
  }

  .sidebar-nav a.active {
    background: var(--fill);
    color: var(--blue);
  }

  .tabbar {
    display: none;
  }

  .view {
    padding: 18px 36px 64px;
  }

  .sheet {
    top: 8vh;
    bottom: auto;
    border-radius: 18px;
    max-height: 84dvh;
  }

  .sheet-handle {
    display: none;
  }

  .toast {
    bottom: 28px;
  }
}
