/* The PETTY app. Tokens, type, buttons, header, the device and the paper all come from ../css/styles.css.
   This file adds what an app needs: the wallet, addresses, tables, the stepper, the plan receipt, the dialog.
   One depth strategy: hairlines for structure, paper for anything that is a record, the device for the state. */

.app { min-height: calc(100vh - 57px - 66px); padding-block: clamp(28px, 5vw, 64px) clamp(56px, 8vw, 112px); background: linear-gradient(var(--floor), var(--floor-3) 320px); outline: none; }
.app .h { margin-top: 14px; }
h1.h { font-size: clamp(1.75rem, 1.1rem + 2vw, 2.75rem); }
.app .lede { margin-top: 14px; max-width: 36rem; }
.app .lede .addr { font-size: .9375rem; }
.app .fact { margin-top: 12px; max-width: 36rem; }
.app .status { cursor: default; }
.actions--left { justify-content: flex-start; margin-top: 24px; }
.eyebrowless { font: 700 1rem/1.3 var(--sans); font-stretch: 112%; }
.nb { white-space: nowrap; }
.nav a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: .45em; text-decoration-thickness: 2px; }

/* header: the network is always in sight, next to the wallet */
.net { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); font: 500 .8125rem/1 var(--mono); white-space: nowrap; cursor: pointer; }
.net:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
/* mainnet is where the app opens: the accent, not a warning. Testnet is the practice network: a hollow dot. */
.net.is-main { box-shadow: inset 0 0 0 1.5px var(--accent); }
.net.is-test i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--soft); }
.net i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--line-2); }
.acct { display: flex; }
.acct__chip { display: inline-flex; align-items: stretch; min-height: 36px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line-2); overflow: hidden; }
.acct__a, .acct__x { border: 0; background: transparent; cursor: pointer; padding: 0 12px; }
.acct__a { font: 500 .8125rem/1 var(--mono); padding-left: 14px; }
.acct__x { font: 600 .8125rem/1 var(--sans); border-left: 1px solid var(--line); color: var(--ink-2); }
.acct__a:hover, .acct__x:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.acct__a:focus-visible, .acct__x:focus-visible { outline-offset: -3px; border-radius: 999px; }
@media (pointer: coarse) { .net, .acct__chip { min-height: 44px; } }
@media (max-width: 619px) { .net { padding: 0 10px; } .acct__x { padding: 0 10px; } .tools { gap: 4px; } }
@media (max-width: 419px) { .acct__x { font-size: 0; padding: 0 12px; } .acct__x::before { content: "Off"; font-size: .8125rem; } }

/* an address: short, with a way to copy it and a way to check it somewhere that is not this site */
.addr { display: inline-flex; align-items: baseline; gap: 2px; font: 500 .875rem/1.5 var(--mono); white-space: nowrap; }
.addr__t { color: var(--ink); margin-right: 4px; }
.addr__b { border: 0; background: transparent; cursor: pointer; padding: 2px 5px; border-radius: 4px; font: 400 .75rem/1.4 var(--mono); color: var(--soft); text-decoration: underline; text-underline-offset: .2em; }
.addr__b:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
@media (pointer: coarse) { .addr__b { padding: 10px 8px; } }

/* the safe: the unit on the left shows the state, the pane on the right says what to do about it */
.app__two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 6vw, 88px); align-items: start; }
.unit { position: sticky; top: 88px; }
.slot--unit { perspective: 12000px; perspective-origin: 50% calc(100% + 4200px); max-width: 32rem; margin: 0 auto clamp(40px, 6vw, 72px); }
.unit__cap { text-align: center; margin-top: 4px; }
.pane { min-width: 0; }
@media (max-width: 899px) {
  .app__two { grid-template-columns: 1fr; }
  .unit { position: static; }
  .slot--unit { max-width: 22rem; }
}

/* data: rows that load, fail or are empty each say so */
.tbl { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: .9375rem; }
.tbl th { text-align: left; font: 500 .75rem/1.4 var(--mono); color: var(--soft); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .num { text-align: right; font: 500 .9375rem/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.tbl th.num { font-weight: 500; }
.tbl__go { text-align: right; padding-right: 0; width: 1%; white-space: nowrap; }
@media (max-width: 619px) {
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tbl tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl td { border: 0; padding: 0; } .tbl td:nth-child(2) { color: var(--soft); font: 400 .8125rem/1.5 var(--mono); grid-column: 1; } .tbl td.num { grid-column: 2; grid-row: 1; } .tbl__go { grid-column: 1 / -1; text-align: left; width: auto; margin-top: 6px; }
}
.rows { margin-top: 24px; border-top: 1px solid var(--line-2); }
.rows--wait i { display: block; height: 44px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 7%, transparent), transparent) 0 0 / 40% 100% no-repeat; }
@media (prefers-reduced-motion: no-preference) { .rows--wait i { animation: wait 1.2s ease-in-out infinite; } .rows--wait i:nth-child(3) { animation-delay: .12s; } .rows--wait i:nth-child(4) { animation-delay: .24s; } }
@keyframes wait { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.empty { display: grid; gap: 6px; justify-items: start; margin-top: 24px; padding: 16px 0 18px; border-block: 1px solid var(--line-2); font-size: .9375rem; color: var(--ink-2); max-width: 36rem; }
.empty b { color: var(--ink); }
.empty .btn { margin-top: 8px; }
.empty--bad b { color: var(--caught); }

/* the demo safe */
.demo-tag { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.demo-tag .fact { margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.seg button, .seg--radio span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); font: 600 .875rem/1 var(--mono); cursor: pointer; }
.seg button[aria-pressed="true"], .seg--radio input:checked + span { background: var(--ink); color: var(--floor); box-shadow: none; }
.seg--radio { margin-top: 8px; } .seg--radio span { font-family: var(--sans); }
.seg--radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg--radio input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.bag--app { margin-top: 22px; height: 22px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px clamp(24px, 4vw, 56px); margin-top: 36px; }
@media (max-width: 619px) { .duo { grid-template-columns: 1fr; gap: 28px; } }
.kv { margin-top: 10px; border-top: 1px solid var(--line-2); }
.kv > div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9375rem; }
.kv dt { font: 400 .8125rem/1.7 var(--mono); color: var(--soft); }
.kv dd { min-width: 0; }
.meter { height: 8px; margin-top: 12px; background: var(--bag-fill); }
.meter i { display: block; height: 100%; background: var(--ink); }
.feed { margin-top: 40px; }
.feed__list { margin-top: 10px; border-top: 1px solid var(--line-2); font: 400 .8125rem/1.5 var(--mono); }
.feed__list li { display: grid; grid-template-columns: 5.5rem minmax(0, 9rem) minmax(0, 1fr) 2rem; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.feed__t, .feed__w { color: var(--soft); }
.feed__r { color: var(--ink); font-weight: 500; }
.feed__list .is-no .feed__r { color: var(--caught); }
.feed__list .is-no .feed__r::before { content: "\00d7\00a0"; }
.feed__x { text-align: right; }
.feed .btn { margin-top: 14px; }
@media (max-width: 619px) { .feed__list li { grid-template-columns: 5.5rem 1fr 2rem; } .feed__w { display: none; } }

/* setup */
.wiz { display: grid; gap: clamp(20px, 3vw, 36px); }
.stepper { display: flex; gap: 0; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.stepper li { flex: none; }
.stepper button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px 0 0; margin-right: 18px; border: 0; background: transparent; cursor: pointer; font: 600 .9375rem/1 var(--sans); color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stepper b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); font: 500 .8125rem/1 var(--mono); }
.stepper button[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.stepper button[aria-current] b { background: var(--ink); color: var(--floor); box-shadow: none; }
.stepper button:disabled { color: var(--soft); cursor: default; }
.wiz__two { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 6vw, 88px); align-items: start; }
.wiz__step { min-width: 0; max-width: 40rem; }
.wiz__step .h { outline: none; margin-top: 0; }
.wiz__plan { position: sticky; top: 88px; }
.wiz__go { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
@media (max-width: 899px) { .wiz__two { grid-template-columns: 1fr; } .wiz__plan { position: static; order: 2; } }
fieldset.field { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
.field legend { margin-bottom: 0; }
.field input[type="text"] { font-size: 1rem; }
.field input[aria-invalid="true"] { border-color: var(--caught); }
.field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.msg.is-error { margin-top: 8px; min-height: 0; font-size: .875rem; }
.note { margin-top: 20px; font-size: .9375rem; color: var(--ink-2); max-width: 36rem; padding-left: 12px; border-left: 2px solid var(--line-2); }
.picked { margin-top: 16px; padding: 12px 14px; border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--line-2); display: inline-block; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pick button { display: inline-flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 6px; border: 0; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); font: 500 .8125rem/44px var(--mono); cursor: pointer; }
.pick em { font-style: normal; color: var(--soft); }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--floor); box-shadow: none; } .pick button[aria-pressed="true"] em { color: inherit; opacity: .8; }
.with-btn { display: flex; gap: 8px; align-items: center; } .with-btn input { flex: 1; } .with-btn .btn { margin-top: 6px; min-height: 48px; white-space: nowrap; }
.checks { margin-top: 14px; border-top: 1px solid var(--line-2); font: 400 .8125rem/1.5 var(--mono); }
.checks li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks span { color: var(--soft); } .checks b { font-weight: 500; text-align: right; }
.checks .is-bad b { color: var(--caught); } .checks .is-bad b::before { content: "\00d7\00a0"; }
.limit-set { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 20px 28px; align-items: start; margin-top: 22px; }
.limit-set .field { margin-top: 0; }
.slot--dial { border-radius: 14px; overflow: hidden; }
@media (max-width: 519px) { .limit-set { grid-template-columns: 1fr; } .slot--dial { max-width: 13rem; } }
.dry { display: grid; gap: 4px; margin-top: 24px; padding: 14px 16px; border-left: 3px solid var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); font-size: .9375rem; color: var(--ink-2); max-width: 40rem; }
.dry b { color: var(--ink); }

/* the plan prints on the same paper as the evidence */
.slip-wrap { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .16)) drop-shadow(0 14px 16px rgba(0, 0, 0, .18)); max-width: 26rem; }
.slip { padding: 20px 18px 30px; -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 16px 100%; mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 16px 100%; }
.slip .tape__ln span:last-child { text-align: right; overflow-wrap: anywhere; min-width: 0; font-weight: 700; }
.slip .tape__ln span:first-child { color: var(--paper-soft); flex: none; }
.slip__sub span:last-child { font-weight: 400; }
.wiz__step .slip-wrap { margin-top: 24px; max-width: 40rem; }
.slip--full { padding: 24px 22px 34px; }

/* the wallet chooser */
.dlg { width: min(26rem, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px; background: var(--card); color: var(--ink); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5), 0 0 0 1px var(--line); }
.dlg::backdrop { background: rgba(10, 10, 10, .5); }
.dlg__in { padding: 20px 20px 18px; }
.dlg__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg__top .h { font-size: 1.375rem; margin: 0; }
.dlg__x { border: 0; background: transparent; cursor: pointer; min-height: 44px; padding: 0 6px; font: 600 .875rem/1 var(--sans); text-decoration: underline; text-underline-offset: .2em; }
.dlg__lede { margin-top: 6px; font-size: .9375rem; color: var(--ink-2); }
.dlg .fact { margin-top: 14px; } .dlg .fact.is-warn { color: var(--caught); font-weight: 500; }
.dlg .empty { margin-top: 16px; }
.wl { margin-top: 16px; border-top: 1px solid var(--line-2); }
.wl__b { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; font: 600 1rem/1 var(--sans); }
.wl__b img, .wl__i { width: 28px; height: 28px; border-radius: 7px; } .wl__i { background: var(--bag-fill); display: block; }
.wl__b em { font: 400 .75rem/1 var(--mono); font-style: normal; color: var(--soft); }
.wl__b:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.wl__b:disabled { cursor: default; opacity: .7; }

.toasts { position: fixed; left: 50%; bottom: 20px; translate: -50% 0; z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 28rem); }
.toast { margin: 0; padding: 10px 14px 9px; border-radius: 8px; background: var(--ink); color: var(--floor); font: 500 .8125rem/1.4 var(--mono); text-align: center; box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .6); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 240ms var(--ease-out); } .toast.is-out { opacity: 0; translate: 0 6px; transition: opacity 240ms ease-out, translate 240ms ease-out; }
  .is-fresh :is(.pane, .wiz__step) > * { animation: rise 420ms var(--ease-out) both; }
  .is-fresh :is(.pane, .wiz__step) > :nth-child(2) { animation-delay: 40ms; } .is-fresh :is(.pane, .wiz__step) > :nth-child(3) { animation-delay: 80ms; } .is-fresh :is(.pane, .wiz__step) > :nth-child(n + 4) { animation-delay: 120ms; }
}
.toast.is-out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.foot ul a[href^="#"] { text-decoration: none; }

/* ---------- the working app: networks, live safes, signing ---------- */
.status--test { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line-2); }      /* outlined, so the green one reads as the real thing */
.fact.is-warn, .dlg .fact.is-warn { color: var(--caught); font-weight: 500; }
.you { font: 500 .75rem/1 var(--mono); font-style: normal; padding: 3px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.dry--warn { border-left-color: var(--caught); }
.dry--warn b { color: var(--caught); }
/* open a safe by address, and the ones this browser remembers */
.open { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line-2); max-width: 36rem; }
.open .with-btn { margin-top: 10px; }
.open input[type="text"], .dlg input[type="text"] { width: 100%; min-height: 48px; padding: 0 12px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--card); font: 500 1rem/1 var(--mono); }
.open input::placeholder, .dlg input::placeholder { color: var(--soft); opacity: 1; }
.open input:focus-visible, .dlg input[type="text"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.open .with-btn .btn { margin-top: 0; }
.mine { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font: 500 .875rem/1.5 var(--mono); }
.mine li { display: inline-flex; align-items: baseline; gap: 4px; }
/* what this wallet can do with the safe: one thing open at a time */
.acts { margin-top: 32px; border-top: 1px solid var(--line-2); }
.act { border-bottom: 1px solid var(--line); }
.act summary { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; list-style: none; font-weight: 700; }
.act summary::-webkit-details-marker { display: none; }
.act summary::after { content: "+"; font: 500 1.125rem/1 var(--mono); }
.act[open] summary::after { content: "\2212"; }
.act summary em { margin-left: auto; font: 400 .75rem/1 var(--mono); font-style: normal; color: var(--soft); }
.act form { padding: 0 0 22px; max-width: 34rem; }
.act .field:first-child { margin-top: 4px; }
.act form > .btn, .act form > .actions { margin-top: 18px; }
.feed__list--live li { grid-template-columns: 10.5rem minmax(0, 1fr) 2rem; }
.sure { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; max-width: 40rem; font-size: .9375rem; cursor: pointer; }
.sure input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); }
.sure input[aria-invalid="true"] { outline: 2px solid var(--caught); outline-offset: 2px; }
/* the signing dialog is a receipt and one decision */
.dlg--tx { width: min(34rem, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.dlg--tx .slip-wrap { max-width: none; margin-top: 14px; }
.dlg--tx .slip { font-size: .75rem; }
.dlg--tx .rows { margin-top: 16px; }
.dlg .actions { margin-top: 18px; }
.dlg .field { margin-top: 14px; } .dlg fieldset.field { margin-top: 12px; }
.dlg .msg.is-error:empty { display: none; }
.logs { margin-top: 12px; font: 400 .75rem/1.5 var(--mono); }
.logs summary { cursor: pointer; text-decoration: underline; text-underline-offset: .2em; min-height: 32px; }
.logs pre { margin: 8px 0 0; padding: 10px; max-height: 12rem; overflow: auto; background: color-mix(in srgb, var(--ink) 6%, transparent); white-space: pre-wrap; overflow-wrap: anywhere; }
/* the badge page */
.badge-page { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 6vw, 88px); align-items: center; }
.badge-page .printer { --fade: 0px; }
.badge-page .printer__feed { -webkit-mask-image: none; mask-image: none; }
.plate--still { cursor: default; }
@media (max-width: 899px) { .badge-page { grid-template-columns: 1fr; } .badge-page .printer { order: 2; margin-inline: 16px; } }
