@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap");

:root {
  --font-display: "Sora", "Figtree", sans-serif;
  --font: "Figtree", "Sora", sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-ctl: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: calc(3.7rem + var(--safe-bottom));
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.35s;
}

/* Dark — deep slate, teal trust accent (not pure Apple black) */
html[data-theme="dark"],
html[data-theme="system"],
html.theme-dark {
  color-scheme: dark;
  --bg: #0c1118;
  --bg-elev: #151c24;
  --bg-soft: #1a232e;
  --bg-green: #12261d;
  --ink: #eef3f7;
  --muted: #8b97a5;
  --line: rgba(238, 243, 247, 0.09);
  --accent: #2ecf8a;
  --accent-blue: #2aa8b8;
  --accent-ink: #0a5f68;
  --danger: #ff6b5e;
  --tab-bg: rgba(18, 24, 32, 0.78);
  --badge-on-bg: rgba(46, 207, 138, 0.14);
  --badge-off-bg: rgba(255, 107, 94, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.28);
  --mesh-a: rgba(42, 168, 184, 0.14);
  --mesh-b: rgba(46, 207, 138, 0.08);
  --noise: rgba(255, 255, 255, 0.025);
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"],
  html.theme-system {
    color-scheme: light;
    --bg: #eef2f6;
    --bg-elev: rgba(255, 255, 255, 0.78);
    --bg-soft: #f7f9fb;
    --bg-green: #e5f6ee;
    --ink: #121820;
    --muted: #5c6978;
    --line: rgba(18, 24, 32, 0.08);
    --accent: #0f9f6e;
    --accent-blue: #0e7c8a;
    --accent-ink: #0a5f68;
    --danger: #e0483c;
    --tab-bg: rgba(255, 255, 255, 0.72);
    --badge-on-bg: rgba(15, 159, 110, 0.12);
    --badge-off-bg: rgba(224, 72, 60, 0.1);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 28px rgba(18, 24, 32, 0.06);
    --mesh-a: rgba(14, 124, 138, 0.1);
    --mesh-b: rgba(15, 159, 110, 0.07);
    --noise: rgba(18, 24, 32, 0.02);
  }
}

html[data-theme="light"],
html.theme-light {
  color-scheme: light;
  --bg: #eef2f6;
  --bg-elev: rgba(255, 255, 255, 0.78);
  --bg-soft: #f7f9fb;
  --bg-green: #e5f6ee;
  --ink: #121820;
  --muted: #5c6978;
  --line: rgba(18, 24, 32, 0.08);
  --accent: #0f9f6e;
  --accent-blue: #0e7c8a;
  --accent-ink: #0a5f68;
  --danger: #e0483c;
  --tab-bg: rgba(255, 255, 255, 0.72);
  --badge-on-bg: rgba(15, 159, 110, 0.12);
  --badge-off-bg: rgba(224, 72, 60, 0.1);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 28px rgba(18, 24, 32, 0.06);
  --mesh-a: rgba(14, 124, 138, 0.1);
  --mesh-b: rgba(15, 159, 110, 0.07);
  --noise: rgba(18, 24, 32, 0.02);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
}

body.app {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(980px 480px at 12% -8%, var(--mesh-a), transparent 58%),
    radial-gradient(820px 420px at 96% 8%, var(--mesh-b), transparent 52%),
    radial-gradient(640px 360px at 50% 110%, var(--mesh-a), transparent 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, #9bb4c4) 0%, var(--bg) 28%),
    var(--bg);
  background-attachment: fixed;
  padding-bottom: calc(var(--tab-h) + 1.1rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

body.app > *:not(.tabbar) { position: relative; z-index: 1; }

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem 0.15rem;
  animation: fade-in var(--dur) var(--ease-out) both;
}

.app-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.app-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  line-height: 0;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}


.app-logo-link:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.brand-home:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
  border-radius: 8px;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.72rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:active { transform: scale(0.97); }

.app-main {
  width: min(28rem, calc(100% - 1.6rem));
  margin: 0 auto;
  padding: 0.35rem 0 1rem;
  animation: rise 0.55s var(--ease-out) both;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.1;
  margin: 0.45rem 0 0.85rem;
}

.lede {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card.pad { padding: 1rem; }

.device-card {
  padding: 1rem 1rem 0.35rem;
  animation: rise 0.6s ease both;
}

.device-row {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.iphone-mock {
  width: 64px;
  height: 110px;
  border-radius: 12px;
  background: linear-gradient(160deg, #2a2a2e, #111);
  border: 2px solid #3a3a3c;
  padding: 6px 5px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.iphone-screen {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  /* Russian flag (white / blue / red) */
  background: linear-gradient(
    to bottom,
    #ffffff 0 33.333%,
    #0039a6 33.333% 66.666%,
    #d52b1e 66.666% 100%
  );
}

.iphone-mock.is-ipad {
  width: 78px;
  height: 102px;
  border-radius: 10px;
  padding: 5px 6px;
}

.iphone-mock.is-ipad .iphone-screen {
  border-radius: 5px;
}

.device-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.device-udid {
  margin: 0.25rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  word-break: break-all;
}

.udid-label { font-weight: 600; }

.bind-status {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bind-status.bind-on {
  color: var(--accent);
}

.bind-status.bind-off {
  color: var(--muted);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.badge-on {
  background: var(--badge-on-bg);
  color: var(--accent);
}

.badge-off {
  background: var(--badge-off-bg);
  color: var(--danger);
}

.badge-icon { font-size: 0.7rem; }

.link-btn {
  display: block;
  width: 100%;
  margin: 0.85rem 0 0.65rem;
  border: 0;
  background: transparent;
  color: var(--accent-blue);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.55rem;
}

.enroll-cta {
  padding: 0.25rem 0 0.9rem;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}

.enroll-text {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0.75rem 0 0.85rem;
}

.support-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin: 0.65rem 0 1.25rem;
  padding: 0.85rem 1rem;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: none;
  transition: background 0.18s ease, transform 0.15s var(--ease-out);
}
.support-btn::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  opacity: 0.7;
}

.support-btn:active { transform: scale(0.98); }
.support-icon { color: var(--accent-blue); }

.section { margin-bottom: 1.35rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.55rem 0.15rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.section-head .page-title {
  margin: 0;
}

.info-btn {
  border: 0;
  background: transparent;
  color: var(--accent-blue);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem;
}

.service-card {
  background: var(--bg-elev);
  overflow: hidden;
}
.service-card.cert-card,
.section .service-card:not(.cert-empty) {
  background: var(--bg-elev);
}

.card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-toggle.static { cursor: default; }

.tile {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}

.cert-tile {
  background:
    radial-gradient(circle at 70% 70%, #ffd60a 0 28%, transparent 30%),
    linear-gradient(145deg, #3a3a3c, #1c1c1e);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}



.card-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
}

.card-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.danger-text { color: var(--danger); }

.chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.card-toggle[aria-expanded="false"] .chevron {
  transform: rotate(-45deg);
}

.card-actions {
  display: flex;
  gap: 0.55rem;
  padding: 0 0.95rem 0.95rem;
}

.pill-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

html[data-theme="light"] .pill-btn,
html[data-theme="system"] .pill-btn {
  background: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .pill-btn {
    background: rgba(255, 255, 255, 0.08);
  }
}

.pill-btn.danger { color: var(--danger); }

.cert-empty {
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}

html[data-theme="light"] .cert-empty,
html.theme-light .cert-empty {
  box-shadow: var(--shadow);
}

.cert-lede {
  margin: 0;
  padding: 1rem 1.05rem 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  border-bottom: 1px solid var(--line);
}

.cert-form {
  display: grid;
  gap: 0;
  padding: 0.15rem 0 0;
}

.file-drop {
  position: relative;
  display: block;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.file-drop:last-of-type {
  border-bottom: 1px solid var(--line);
}

.file-drop-kicker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-drop-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 3.55rem;
  padding: 0.85rem 1.05rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  transition: background 0.18s ease;
}

.file-drop:hover .file-drop-panel,
.file-drop:focus-within .file-drop-panel {
  background: color-mix(in srgb, var(--accent-blue) 6%, transparent);
}

.file-drop.is-filled .file-drop-panel {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.file-drop-icon {
  display: none;
}

.file-drop-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.file-drop-cta {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.file-drop-name {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-drop-name:empty::before {
  content: attr(data-placeholder);
}

.file-drop-chip {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
  flex-shrink: 0;
}

.file-drop.is-filled .file-drop-chip {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.file-drop-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.cert-form .field-pass {
  margin: 0;
  padding: 0.85rem 1.05rem 0.35rem;
  border-bottom: 1px solid var(--line);
  gap: 0.45rem;
}

.cert-form .field-pass .field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.cert-form .field-pass input {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 0.75rem 0.85rem;
}

.cert-submit {
  width: calc(100% - 2.1rem);
  margin: 0.95rem 1.05rem 1.05rem;
  min-height: 2.9rem;
  font-size: 0.98rem;
  letter-spacing: -0.015em;
  box-shadow: none;
  border-radius: var(--radius-ctl);
}

.cert-submit:active {
  transform: scale(0.985);
}

.cert-empty .status {
  margin: 0 1.05rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .file-drop-panel,
  .cert-submit,
  .field input,
  .field-pass input {
    transition: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-ctl);
  padding: 0.88rem 1.2rem;
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), opacity 0.15s ease, filter 0.2s ease;
}

.btn:active { transform: scale(0.98); }

.btn.primary {
  background: var(--accent-blue);
  color: #fff;
  width: 100%;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-blue) 28%, transparent);
}

.btn.primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.status {
  margin-top: 0.75rem;
  color: var(--danger);
  font-size: 0.9rem;
}

.status.busy { color: var(--muted); }
.status.ok { color: var(--accent); }

.hint {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.hint.muted { opacity: 0.85; }
.back { color: var(--accent-blue); text-decoration: none; font-weight: 600; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.1rem;
  padding: 0.4rem 0.25rem calc(0.35rem + var(--safe-bottom));
  background: var(--tab-bg);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  z-index: 50;
  width: 100%;
  max-width: none;
  transform: none;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.55rem;
  font-weight: 600;
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  padding: 0.28rem 0.08rem;
  line-height: 1.15;
  cursor: pointer;
  border-radius: 14px;
  transition: color 0.2s ease, background 0.2s ease;
}

.tab-icon { font-size: 1.15rem; line-height: 1; }

.tab.active {
  color: var(--ink);
}

.tab.active .tab-icon {
  background: color-mix(in srgb, var(--accent-blue) 16%, transparent);
  color: var(--accent-blue);
  border-radius: 14px;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 14px;
  transition: background 0.2s var(--ease-out), color 0.2s ease;
}

.tab-icon svg {
  display: block;
  color: inherit;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.brand-mark-sm {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}


.help-list {
  padding-left: 1.2rem;
  line-height: 1.55;
  color: var(--ink);
}

.help-list li { margin-bottom: 0.7rem; }

.install-page .install-shell,
.help-page {
  padding-top: 1.5rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.meta { color: var(--muted); }

/* ——— Signer stages ——— */
.signer-info {
  padding: 1rem 1.05rem 0.95rem;
  margin-bottom: 0.85rem;
}

.signer-info-text {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}

.how-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(120, 120, 128, 0.22);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 0.85rem;
  border-radius: 12px;
  background: rgba(120, 120, 128, 0.18);
}

.seg-btn {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.5rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.seg-btn.active {
  background: rgba(120, 120, 128, 0.45);
  color: var(--ink);
}

.signer-action {
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.app-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: #161924;
  flex-shrink: 0;
  display: block;
}

.app-meta { flex: 1; min-width: 0; }

.app-name {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.app-ver {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.app-size {
  color: var(--muted);
  font-size: 0.88rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.btn-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-block + .btn-block { margin-top: 0.65rem; }
.btn-block:active { transform: scale(0.98); }
.btn-block:disabled { opacity: 0.55; cursor: wait; }

.btn-light {
  background: #ffffff;
  color: #111;
}

html[data-theme="light"] .btn-light,
html[data-theme="system"] .btn-light {
  background: #1c1c1e;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .btn-light {
    background: #ffffff;
    color: #111;
  }
}

.btn-muted {
  background: rgba(120, 120, 128, 0.28);
  color: var(--ink);
}

.btn-sign-muted {
  background: rgba(180, 180, 185, 0.55);
  color: #111;
  margin-top: 0.85rem;
}

.btn-premium {
  background: #ffd60a;
  color: #111;
  margin-top: 0.65rem;
}

.limit-line {
  text-align: center;
  margin: 0.35rem 0 0.25rem;
  color: var(--ink);
  font-size: 0.9rem;
}

.limit-accent { color: #ff9f0a; font-weight: 700; }

.upgrade-link {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--accent-blue);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: center;
  padding: 0.35rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.9rem 0.95rem;
  font: inherit;
  margin-bottom: 0.35rem;
}

html[data-theme="light"] .link-input,
html[data-theme="system"] .link-input {
  background: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .link-input {
    background: rgba(0, 0, 0, 0.28);
  }
}

.link-input::placeholder { color: var(--muted); }

.customize-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 0.1rem;
  cursor: pointer;
}

.customize-left {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.customize-toggle[aria-expanded="true"] .chev-ico {
  transform: rotate(180deg);
}

.chev-ico { transition: transform 0.2s ease; color: var(--muted); }

.customize-body { padding-bottom: 0.35rem; }

.customize-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0 0 0.75rem;
}

.customize-note a { color: var(--accent-blue); }

.customize-fields {
  background: rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

html[data-theme="light"] .customize-fields,
html[data-theme="system"] .customize-fields {
  background: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .customize-fields {
    background: rgba(0, 0, 0, 0.28);
  }
}

.cust-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 600;
}

.cust-row:last-child { border-bottom: 0; }

.cust-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cust-control {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.cust-input {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  padding: 0.2rem 0;
}

.cust-input::placeholder { color: var(--muted); font-weight: 400; }

.browse-btn {
  border: 0;
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  background: rgba(120, 120, 128, 0.35);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.browse-btn:disabled { opacity: 0.7; cursor: default; }

.ios-switch {
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.4);
  position: relative;
  cursor: not-allowed;
  flex-shrink: 0;
}

.ios-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.customize-warn {
  color: #ff9f0a;
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
  margin: 0 0 0.75rem;
}

.premium-gate {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.faster-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.25rem 0 0;
}

.wait-label {
  margin: 0.25rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.wait-status {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.progress-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.35);
  margin-bottom: 1.1rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: inherit;
  transition: width 0.25s ease;
}

html[data-theme="light"] .progress-fill,
html[data-theme="system"] .progress-fill {
  background: #1c1c1e;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .progress-fill {
    background: #fff;
  }
}

.back-circle { flex-shrink: 0; }

.ico { display: inline-block; vertical-align: -0.15em; color: currentColor; }

/* iOS-style install confirm */
.ios-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.ios-modal[hidden] { display: none; }

.ios-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ios-alert {
  position: relative;
  width: min(18.5rem, 100%);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(44, 44, 46, 0.92);
  color: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: rise 0.28s ease both;
}

.ios-alert-msg {
  margin: 0;
  padding: 1.15rem 1rem 1rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 500;
}

.ios-alert-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.ios-alert-btn {
  border: 0;
  background: transparent;
  color: var(--accent-blue);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  padding: 0.75rem;
  cursor: pointer;
}

.ios-alert-btn + .ios-alert-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.ios-alert-btn.confirm {
  font-weight: 600;
  color: #fff;
  background: color-mix(in srgb, var(--accent-blue) 85%, #000);
}

/* Standalone OTA install page */
body.page {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  min-height: 100vh;
}

.shell {
  width: min(28rem, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.install-page .install-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}

.install-page h1 {
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.install-page .actions {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 0;
}

.install-page .actions .btn {
  width: 100%;
  border-radius: 14px;
}

.install-page .btn.primary {
  background: #fff;
  color: #111;
}

.install-page .btn.ghost {
  background: rgba(120, 120, 128, 0.28);
  border: 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app-main, .device-card, .app-top { animation: none; }
  .btn, .support-btn, .chevron { transition: none; }
}

/* Apps catalog */
.apps-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.apps-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.apps-card .app-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  overflow: hidden;
  flex-shrink: 0;
  background: #161924;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}
.apps-card .app-icon-wrap .app-icon {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  display: block;
  background: transparent;
}
.apps-card-meta {
  flex: 1;
  min-width: 0;
}
.apps-card-meta .app-name {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
}
.apps-card-meta .app-ver {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.apps-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}
.apps-card-actions .btn {
  min-width: 5.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: none;
}
.apps-empty {
  color: var(--muted);
  margin: 1rem 0 0;
}
.apps-source-section {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.35rem;
}
.apps-source-heading {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.apps-source-apps {
  display: grid;
  gap: 0.75rem;
}

/* Sources */
.source-composer {
  display: grid;
  gap: 0.7rem;
  margin: 0.35rem 0 1.15rem;
  padding: 1rem 1.05rem 1.05rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.source-composer-field {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}
.source-composer-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}
.source-composer-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  padding: 0.85rem 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.source-composer-input::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}
.source-composer-input:focus {
  border-color: color-mix(in srgb, var(--accent-blue) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 18%, transparent);
  background: var(--bg-soft);
}
.source-composer-submit {
  width: 100%;
  margin: 0.1rem 0 0;
}
.source-composer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.source-composer-hint a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
}
.source-composer-hint code {
  font-size: 0.85em;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.source-composer .status {
  margin: 0;
}
.sources-list { display: grid; gap: 0.75rem; margin-top: 0.25rem; }
.source-card {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--bg-elev); border-radius: var(--radius);
  padding: 0.9rem 1rem; box-shadow: var(--shadow); cursor: pointer;
  border: 1px solid var(--line); width: 100%; text-align: left; color: inherit; font: inherit;
  transition: transform 0.15s var(--ease-out), border-color 0.2s ease;
}
.source-card:active { transform: scale(0.99); }
.source-card .app-icon { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; object-fit: cover; }
.source-card-meta { flex: 1; min-width: 0; }
.source-card-meta .app-name { margin: 0; font-weight: 600; }
.source-card-meta .app-ver { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.82rem; }
.source-card-badge {
  font-size: 0.72rem; color: var(--muted);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--line);
  padding: 0.2rem 0.45rem; border-radius: var(--radius-sm); flex-shrink: 0;
}
.source-browse-head { display: flex; gap: 0.75rem; align-items: center; margin: 0.75rem 0; }
.source-browse-title { margin: 0; font-size: 1.15rem; }
.source-search {
  width: 100%; box-sizing: border-box; border-radius: 12px; border: 0;
  background: var(--bg-elev); color: inherit; padding: 0.75rem 0.9rem;
  margin-bottom: 0.75rem; font: inherit;
}
.source-remove {
  border: 0; background: transparent; color: var(--muted); font-size: 0.8rem;
  padding: 0.25rem 0.4rem; cursor: pointer;
}
.source-card-actions {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; flex-shrink: 0;
}
#sources-browse .link-btn { margin-bottom: 0.25rem; }


.enroll-cta.is-reinstall .btn.primary {
  background: transparent;
  color: var(--accent-blue);
  box-shadow: none;
  border: 1px solid color-mix(in srgb, var(--accent-blue) 45%, transparent);
}

.enroll-cta.is-reinstall .btn.primary:active {
  transform: scale(0.985);
}


/* Account */
.account-user { padding: 0.95rem 1rem; margin-bottom: 1.15rem; }
.account-user-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.account-avatar {
  width: 52px; height: 52px; border-radius: 14px; object-fit: cover;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.account-user-meta { min-width: 0; flex: 1; }
.account-user-name {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: 1.08rem; letter-spacing: -0.03em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-user-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
  word-break: break-word;
}
.account-logout {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  padding: 0.38rem 0.72rem;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s var(--ease-out), opacity 0.15s ease;
}
.account-logout:hover {
  background: color-mix(in srgb, var(--danger) 22%, transparent);
}
.account-logout:active {
  transform: scale(0.96);
}
.account-device-head { margin: 0.25rem 0 0.65rem; }
.account-nav-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.65rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.2s ease;
}
.account-nav-row:last-of-type { margin-bottom: 1.15rem; }
#open-certificates.account-nav-row { margin-bottom: 1.15rem; }
.account-nav-row:active { transform: scale(0.99); }
.account-nav-copy { min-width: 0; flex: 1; display: grid; gap: 0.2rem; }
.account-nav-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}
.account-nav-sub {
  color: var(--muted);
  font-size: 0.84rem;
}
.account-nav-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.account-nav-count {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent-blue) 14%, transparent);
  color: var(--accent-blue);
}
.account-nav-chevron {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
}
.devices-back { margin: 0 0 0.35rem; }
.account-device-head .section-lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.devices-list-card { padding: 0.55rem; margin-bottom: 1.15rem; }
.devices-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.devices-list .devices-empty {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  display: block;
  padding: 0.55rem 0.35rem;
}
.device-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--ink) 5%, transparent);
}
.device-card-main {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}
.device-card-art {
  flex: 0 0 auto;
  width: 52px;
  height: 88px;
  display: grid;
  place-items: center;
}
.device-card-art.is-ipad {
  width: 58px;
  height: 78px;
}
.device-art-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 14px color-mix(in srgb, var(--ink) 16%, transparent));
}
.device-art-body { fill: var(--device-shell, #c9c4bc); }
.device-art-screen { fill: #111418; }
.device-art-island { fill: #0a0c0f; }
.device-art-cam { fill: color-mix(in srgb, var(--device-shell, #c9c4bc) 55%, #222); }
.device-card-art.is-white-titanium { --device-shell: #e8e6e1; }
.device-card-art.is-natural-titanium { --device-shell: #b7b1a7; }
.device-card-art.is-black-titanium,
.device-card-art.is-space-black,
.device-card-art.is-black,
.device-card-art.is-graphite { --device-shell: #3a3a3c; }
.device-card-art.is-desert { --device-shell: #c4a484; }
.device-card-art.is-ultramarine { --device-shell: #3b5bdb; }
.device-card-art.is-blue { --device-shell: #5b8def; }
.device-card-art.is-deep-purple { --device-shell: #5e4b6b; }
.device-card-art.is-space-gray { --device-shell: #8e8e93; }
.device-card-meta { min-width: 0; flex: 1; padding-top: 0.15rem; }
.device-card-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.device-card-specs,
.device-card-udid {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-word;
}
.device-card-udid {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.device-card-tag {
  display: inline-flex;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
}
.device-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.device-btn {
  flex: 0 0 auto;
  margin: 0;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  padding: 0.48rem 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s var(--ease-out), opacity 0.15s ease;
}
.device-btn:active { transform: scale(0.97); }
.device-btn:disabled { opacity: 0.55; cursor: default; }
.device-btn-delete {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}
.device-btn-delete:hover {
  background: color-mix(in srgb, var(--danger) 22%, transparent);
}
.device-btn-copy {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink);
  border: 1px solid var(--line);
}
.device-btn-copy:hover {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
}
.account-device-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  width: 100%;
}

/* Source guide */
.source-guide .guide-h2 {
  margin: 1.35rem 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.source-guide .guide-bullets {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink);
  line-height: 1.55;
}
.source-guide .guide-bullets li { margin-bottom: 0.45rem; }
.source-guide .guide-code {
  margin: 0.65rem 0 0;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 5%, var(--bg-elev));
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre;
}
.source-guide .guide-actions {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0 0.5rem;
}
.source-guide .guide-actions .btn { width: 100%; text-align: center; text-decoration: none; }

/* —— Certificates (multi + Web 3.0 form) —— */
.certs-list-card {
  padding: 0.45rem;
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--ink) 6%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.certs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.cert-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 4px);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.cert-row.is-primary {
  border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--line));
  background: color-mix(in srgb, var(--accent-blue) 8%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-blue) 12%, transparent);
}
.cert-row-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 0.2rem;
}
.cert-row-name {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cert-row-expires {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}
.cert-row-side {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.cert-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.42rem 0.7rem;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.cert-primary-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent-blue) 40%, var(--line));
  color: var(--accent-ink);
}
.cert-primary-btn:active:not(:disabled) {
  transform: scale(0.97);
}
.cert-primary-btn.is-on,
.cert-primary-btn:disabled.is-on {
  cursor: default;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-blue), color-mix(in srgb, var(--accent) 55%, var(--accent-blue)));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent-blue) 28%, transparent);
}
.cert-primary-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}
.cert-primary-btn.is-on .cert-primary-dot {
  opacity: 1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}
.cert-del-btn {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.cert-del-btn:hover {
  background: color-mix(in srgb, var(--danger, #e5484d) 14%, transparent);
  color: var(--danger, #e5484d);
}

.cert-form-card {
  padding: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  border-radius: var(--radius);
  box-shadow: 0 22px 48px color-mix(in srgb, var(--ink) 7%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}
.cert-form-card .cert-lede {
  margin: 0;
  padding: 1rem 1.05rem 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  border-bottom: 1px solid var(--line);
}
.cert-form-card .status {
  margin: 0 1.05rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .cert-row,
  .cert-primary-btn,
  .cert-del-btn {
    transition: none;
  }
}
