/* Courier app. Builds on the landing page's tokens, buttons and waybill. */
body.app {
  background:
    radial-gradient(50% 60% at 78% 40%, rgba(255, 150, 70, 0.09), transparent 70%),
    linear-gradient(90deg, #0A0B11, var(--bg) 60%) fixed;
  min-height: 100svh;
}
.mono-plain { font-family: var(--mono); letter-spacing: 0; text-transform: none; }
.muted { color: var(--muted); }
.fine { color: var(--dim); font-size: 14px; line-height: 1.55; margin: 18px 0 0; max-width: 460px; }
.notice { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(255, 180, 106, 0.08); color: var(--amber); font-size: 14px; max-width: 520px; }
.warn { color: var(--amber); }
.app-main { min-height: 100svh; padding: 132px var(--pad) 96px; outline: none; }
.noscript { padding: 140px var(--pad); color: var(--muted); }

/* ---------- nav ---------- */
.app .nav-links { display: flex; gap: 30px; }
.app-tabs a { position: relative; padding: 6px 0; }
.app-tabs a.is-on { color: var(--cream); }
.app-tabs a.is-on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--cream); }
.tab-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); margin-left: 4px; vertical-align: 2px; }
.tab-dot[hidden] { display: none; }
.wallet-area { position: relative; }
.wallet-chip { gap: 10px; }
.wallet-chip .mono-plain { font-size: 13px; }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: #7BD88F; box-shadow: 0 0 10px rgba(123, 216, 143, 0.6); }
.wallet-menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 250px; z-index: 60;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 14px; padding: 8px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
}
.wallet-menu[hidden] { display: none; }
.wm-addr { font-size: 11px; color: var(--dim); margin: 6px 10px 8px; word-break: break-all; }
.wallet-menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--cream);
  font: inherit; font-size: 14px; padding: 10px; border-radius: 9px; cursor: pointer;
}
.wallet-menu button:hover { background: rgba(243, 231, 211, 0.07); }

button.btn { border: 0; cursor: pointer; font-family: var(--sans); }
button.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }

/* ---------- send ---------- */
.send-view {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(40px, 6vw, 110px); align-items: start; max-width: 1320px; margin: 0 auto;
}
.send-side { padding-top: 28px; }
.send-side h1, .rcv-panel h1, .inbox-copy h1 { font-size: clamp(42px, 4.8vw, 76px); }
.send-side .muted, .inbox-copy .muted { margin: 24px 0 0; max-width: 440px; }
.side-notes { list-style: none; padding: 0; margin: 36px 0 0; display: flex; flex-wrap: wrap; gap: 10px; color: var(--dim); font-size: 11px; }
.side-notes li { border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 12px; }

.label-wrap { position: relative; width: 100%; max-width: 660px; justify-self: end; }
.form-label { transform: none; transition: transform 1.2s var(--ease); }
.form-label.locked { transform: rotate(-1.4deg); }
.waybill-wrap:hover .form-label { transform: none; }
.form-label .wb-head .mono { white-space: nowrap; }
.from-slot { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wb-input {
  width: 100%; min-width: 0; background: transparent; border: 0;
  border-bottom: 1.5px dashed rgba(23, 23, 28, 0.35); border-radius: 0;
  color: var(--ink); font-family: var(--mono); font-size: 17px; font-weight: 500;
  padding: 0 0 4px; outline: none; transition: border-color 0.2s;
}
.wb-input::placeholder { color: rgba(23, 23, 28, 0.32); }
.wb-input:focus { border-bottom: 1.5px solid var(--ink); }
.wb-input[readonly] { border-bottom-color: transparent; }
.wb-note.ok { color: #2E6A3E; }
.wb-note.err { color: #A2331C; text-transform: none; letter-spacing: 0.02em; font-size: 11px; }
.ink-link {
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.from-slot .ink-link { font-size: 17px; font-weight: 500; text-align: left; width: max-content; }
.ink-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 22px; margin-left: auto;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--cream);
  font: 500 15px var(--sans); letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.ink-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ink-btn:disabled { opacity: 0.32; cursor: default; }
.ink-btn[hidden], .sealed-at[hidden] { display: none; }
.sealed-at { margin-left: auto; text-align: right; font-size: 10px; line-height: 1.7; color: rgba(23, 23, 28, 0.62); }
.ink-btn:focus-visible, .ink-link:focus-visible, .wb-input:focus-visible { outline: 2px solid #B4562A; outline-offset: 3px; }

.wb-contents { padding-bottom: 18px; }
.drop {
  border: 1.5px dashed rgba(23, 23, 28, 0.32); border-radius: 4px; min-height: 132px;
  display: flex; flex-direction: column; justify-content: center; padding: 14px 16px;
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.drop:hover, .drop.over { background: rgba(23, 23, 28, 0.045); border-color: rgba(23, 23, 28, 0.6); }
.drop.has-files { cursor: default; border-style: solid; border-color: rgba(23, 23, 28, 0.18); }
.drop.has-files:hover { background: none; }
.locked .drop { border-color: transparent; padding-left: 0; padding-right: 0; min-height: 0; }
.drop-empty { display: flex; align-items: center; gap: 20px; }
.drop-empty img { width: 92px; flex: none; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.18)); transform: rotate(-6deg); }
.drop-empty b { display: block; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.drop-empty span { font-size: 14px; color: rgba(23, 23, 28, 0.62); }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 9px 0; border-bottom: 1px dotted rgba(23, 23, 28, 0.3);
}
.file-list li:last-child { border-bottom: 0; }
.f-name { font-weight: 500; font-size: 16px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-size { font-size: 10.5px; color: rgba(23, 23, 28, 0.6); }
.f-rm {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(23, 23, 28, 0.25); background: none;
  color: var(--ink); cursor: pointer; font-size: 15px; line-height: 1;
}
.f-rm:hover { background: var(--ink); color: var(--cream); }
.add-more { margin-top: 10px; font-size: 14px; align-self: flex-start; }
.f-save {
  font-size: 13px; font-weight: 500; color: var(--cream); background: var(--ink);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.form-label .wb-4 .wb-v { font-size: 20px; }

.app-stamp {
  position: absolute; width: 140px; right: -34px; top: -52px; z-index: 3; pointer-events: none;
  transform: rotate(14deg); filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.55));
}
.app-stamp[hidden] { display: none; }
.app-stamp.stamping { animation: stamp 0.9s var(--ease) both; }
@keyframes stamp {
  0% { transform: translate(30px, -40px) rotate(40deg) scale(1.9); opacity: 0; }
  55% { transform: rotate(10deg) scale(0.9); opacity: 1; }
  75% { transform: rotate(15deg) scale(1.03); }
  100% { transform: rotate(14deg) scale(1); }
}

/* tracking */
.track-title { font-size: clamp(40px, 4.4vw, 68px); }
.send-side > .muted { margin-top: 22px; }
.link-box {
  display: flex; align-items: center; gap: 8px; margin: 30px 0 0; max-width: 560px;
  padding: 7px 7px 7px 18px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line-2);
}
.link-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.timeline { list-style: none; padding: 0; margin: 40px 0 0; max-width: 460px; font-size: 11px; color: var(--dim); }
.timeline li { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.timeline i { width: 9px; height: 9px; flex: none; border: 1px solid var(--dim); transform: rotate(45deg); }
.timeline li.done { color: var(--cream); }
.timeline li.done i { background: var(--cream); border-color: var(--cream); }
.timeline li.now { color: var(--cream); }
.timeline li.now i { border-color: var(--amber); animation: blink 1.4s ease-in-out infinite; }
.timeline time { margin-left: auto; color: var(--dim); }
@keyframes blink { 50% { background: var(--amber); } }
.side-actions { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }

/* progress: the envelope travels along a dotted route */
.trip { margin: 34px 0 0; max-width: 560px; }
.trip-track {
  position: relative; height: 34px;
  background: radial-gradient(circle, rgba(243, 231, 211, 0.2) 1.6px, transparent 2.2px) 0 50% / 11px 11px repeat-x;
}
.trip-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: radial-gradient(circle, var(--cream) 2.2px, transparent 2.8px) 0 50% / 11px 11px repeat-x;
  transition: width 0.25s linear;
}
.trip-env {
  position: absolute; top: 50%; left: 0; width: 48px; transform: translate(-50%, -50%) rotate(-4deg);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); transition: left 0.25s linear;
}
.trip-meta { display: flex; gap: 18px; margin-top: 14px; font-size: 11px; color: var(--dim); }
.trip-meta .t-pct { color: var(--cream); }
.trip-meta .t-rate { margin-left: auto; }

/* ---------- receive ---------- */
.receive-view {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 110px); align-items: center; max-width: 1240px; margin: 0 auto; min-height: calc(100svh - 230px);
}
.rcv-visual { display: flex; justify-content: center; perspective: 1400px; }
.rcv-env {
  width: min(460px, 38vw); transform: rotateX(6deg) rotateY(-14deg) rotateZ(-5deg);
  animation: float 6s ease-in-out infinite; transition: opacity 0.6s, filter 0.6s;
  filter: drop-shadow(0 50px 50px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 80px rgba(255, 160, 80, 0.12));
}
.rcv-env.is-open { transform: rotateZ(-3deg); }
.rcv-env.is-dim { opacity: 0.45; filter: grayscale(0.5) drop-shadow(0 50px 50px rgba(0, 0, 0, 0.55)); }
.rcv-panel { max-width: 560px; }
.rcv-panel > .muted { margin: 22px 0 0; max-width: 470px; }
.rcv-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; align-items: center; }
.rcv-actions:empty { display: none; }

.waybill.mini { margin-top: 30px; transform: rotate(-0.8deg); padding: 14px 16px 6px; }
.waybill.mini .wb-v.addr { font-size: 15px; }
.waybill.mini .wb-row.last { border-bottom: 0; }
.waybill.mini .wb-v { font-size: 18px; }
.sealed-v { font-weight: 500; }
.file-list.out li { grid-template-columns: minmax(0, 1fr) auto auto; }

/* ---------- inbox ---------- */
.inbox-view {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(40px, 6vw, 110px); align-items: start; max-width: 1320px; margin: 0 auto;
}
.inbox-copy { padding-top: 28px; position: sticky; top: 120px; }
.inbox-status { margin-top: 32px; }
.inbox-state { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; margin: 0; }
.inbox-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.inbox-state.on { color: var(--cream); }
.inbox-state.on i, .inbox-state .pulse { background: #7BD88F; box-shadow: 0 0 0 0 rgba(123, 216, 143, 0.5); animation: pulse 2s infinite; }
.inbox-state.warn-t, .inbox-state.warn-t i { color: var(--amber); }
.inbox-state.warn-t i { background: var(--amber); }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(123, 216, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(123, 216, 143, 0); } }
.inbox-list { display: flex; flex-direction: column; gap: 22px; padding-top: 28px; }
.inbox-card { padding: 24px; border-radius: 20px; background: var(--bg-2); border: 1px solid var(--line); }
.inbox-card .rcv-title { font-size: 26px; }
.inbox-card .muted { margin: 10px 0 0; font-size: 15px; }
.inbox-card .waybill.mini { margin-top: 20px; }
.inbox-card .trip { margin-top: 22px; }
.inbox-card .rcv-actions { margin-top: 20px; }
.inbox-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center;
  min-height: 340px; border: 1px dashed var(--line-2); border-radius: 20px; padding: 40px;
}
.inbox-empty img { width: 150px; opacity: 0.35; filter: grayscale(0.4); transform: rotate(-5deg); }
.inbox-empty p { color: var(--dim); font-size: 11px; max-width: 300px; line-height: 1.8; margin: 0; }

/* ---------- sheet + toast ---------- */
.sheet {
  width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line-2); border-radius: 22px;
  background: var(--bg-3); color: var(--cream); padding: 0;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.9);
}
.sheet::backdrop { background: rgba(5, 5, 7, 0.6); backdrop-filter: blur(6px); }
.sheet-body { padding: 28px; }
.sheet .label { margin-bottom: 16px; }
.sheet h2 { font-size: 30px; }
.sheet .muted { font-size: 15px; margin: 14px 0 0; }
.wallet-list { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.wallet-opt {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: 14px;
  background: rgba(243, 231, 211, 0.04); border: 1px solid var(--line); color: var(--cream);
  font: 500 15px var(--sans); cursor: pointer; text-align: left; transition: background 0.2s, border-color 0.2s;
}
.wallet-opt:hover { background: rgba(243, 231, 211, 0.08); border-color: var(--line-2); }
.wallet-opt img, .wallet-blank { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.wallet-blank { background: rgba(243, 231, 211, 0.1); }
.wallet-opt span:nth-child(2) { flex: 1; }
.sheet-close { margin-top: 18px; background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 11px; padding: 6px 0; }
.sheet-close:hover { color: var(--cream); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 999px; background: var(--cream); color: #121014;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.4s var(--ease); max-width: calc(100vw - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .app .nav { padding-left: 18px; padding-right: 18px; }
  .app .nav-links { gap: 20px; font-size: 14px; }
  .app .brand-word { height: 17px; }
  .app-main { padding-top: 104px; }
  .send-view, .receive-view, .inbox-view { grid-template-columns: 1fr; gap: 48px; }
  .send-side, .inbox-copy { padding-top: 0; position: static; }
  .side-notes { display: none; }
  .label-wrap { justify-self: stretch; }
  .app-stamp { width: 92px; right: -6px; top: -40px; }
  .receive-view { min-height: 0; gap: 36px; }
  .rcv-env { width: min(300px, 70vw); }
  .rcv-visual { order: 0; }
}
@media (max-width: 560px) {
  .app .wallet-chip { padding: 0 12px; font-size: 13px; }
  .app .nav-links { gap: 16px; }
  .form-label .wb-head { padding-right: 70px; }
  .form-label .wb-foot { flex-direction: column; align-items: stretch; }
  .ink-btn { margin-left: 0; justify-content: center; }
  .sealed-at { margin-left: 0; text-align: left; }
  .drop-empty img { width: 64px; }
  .link-box { flex-wrap: wrap; border-radius: 16px; padding: 12px; }
  .link-text { flex-basis: 100%; padding: 0 4px 6px; }
  .trip-meta .t-bytes { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app-stamp.stamping { animation: none; }
}
