/* =====================================================================
   Media, sharing and search components
   (audio player, 3×3 attachment grid, viewer, share dialog, search palette)
   ===================================================================== */

/* ------------------------------------------------------------ top-bar search button */
.search-btn { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 460px; height: 44px; padding: 0 12px 0 14px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--neu-bg, var(--surface)); box-shadow: var(--neu-inset, inset 0 0 0 1px var(--line)); color: var(--muted); font-size: 14.5px; text-align: left;
  transition: box-shadow .2s, color .2s; }
.search-btn span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-btn:hover { color: var(--ink); box-shadow: var(--neu-inset), 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--surface); box-shadow: var(--neu-raise-sm, 0 1px 0 var(--line)); color: var(--muted); }
@media (max-width: 860px) {
  .search-btn { flex: 0 0 auto; width: 42px; height: 42px; padding: 0; justify-content: center; box-shadow: var(--neu-raise-sm); order: 2; margin-left: auto; }
  .search-btn span, .search-btn kbd { display: none; }
  .topbar .spacer { display: none; }
}

/* ------------------------------------------------------------ search palette */
.search-ov { align-items: flex-start !important; padding-top: 9vh !important; }
.search-pal { width: 100%; max-width: 680px; border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; max-height: 78vh;
  background: var(--glass-strong); -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--glass-border); box-shadow: 0 40px 90px -30px rgba(14, 22, 46, .6), var(--glass-edge); animation: pop .25s var(--ease); }
.sp-input { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 20px; }
.sp-input > .icon { color: var(--accent); width: 22px; height: 22px; }
.sp-input input { flex: 1; border: 0; background: transparent; font-size: 18px !important; outline: none; color: var(--ink); min-width: 0; }
.sp-input input::-webkit-search-cancel-button { display: none; }
.sp-close { display: none; }
.sp-filters { padding: 0 16px 12px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.sp-filters .chip { flex: none; }
.sp-results { overflow-y: auto; padding: 8px; flex: 1; transition: opacity .2s; }
.sp-results.loading { opacity: .6; }
.sp-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sp-foot span { display: inline-flex; align-items: center; gap: 4px; }
.sr-group + .sr-group { margin-top: 6px; }
.sr-ghead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 4px; font-size: 12px; font-weight: 750; color: var(--muted); letter-spacing: .02em; }
.sr-more { font-size: 12.5px; font-weight: 650; color: var(--accent); background: none; border: 0; cursor: pointer; }
.sr-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; color: var(--ink); width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer; font: inherit; transition: background .15s, transform .2s var(--spring, ease); }
.sr-item:hover, .sr-item.on { background: color-mix(in srgb, var(--accent) 10%, var(--glass-strong)); text-decoration: none; }
.sr-item.on { box-shadow: inset 3px 0 0 var(--accent); }
.sr-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--accent-2))); box-shadow: 0 6px 12px -6px var(--g2, var(--accent)); flex: none; }
.sr-main { min-width: 0; }
.sr-title { font-weight: 650; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-snip { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-side { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
mark { background: color-mix(in srgb, #FFC35A 55%, transparent); color: inherit; border-radius: 3px; padding: 0; box-shadow: 0 0 0 1px color-mix(in srgb, #FFC35A 55%, transparent); }
.sr-empty, .sr-hint { display: grid; place-items: center; text-align: center; gap: 6px; padding: 34px 20px; color: var(--muted); }
.sr-empty p, .sr-hint p { margin: 0; color: var(--ink); font-weight: 650; }
.sr-hint .icon { color: var(--accent); width: 30px; height: 30px; }
.sr-all { display: flex; justify-content: center; align-items: center; gap: 4px; padding: 12px; font-weight: 650; }
.search-page .sr-item { padding: 12px; }
@media (max-width: 860px) {
  .search-ov { padding: 0 !important; }
  .search-pal { max-width: none; max-height: none; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .sp-input kbd, .sp-foot { display: none; }
  .sp-close { display: inline-grid; }
  .sr-item { grid-template-columns: auto 1fr; }
  .sr-side { grid-column: 2; }
}

/* ------------------------------------------------------------ media sections */
.media-sec + .media-sec { margin-top: 26px; }
.media-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.media-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.count-pill { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--neu-bg); box-shadow: var(--neu-inset-sm); color: var(--muted); }
.media-sub { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.rec-card { margin-bottom: 12px; }
.rec-card .recorder { padding: 14px; }
.ap-list { display: flex; flex-direction: column; gap: 10px; }
.media-sec .dropzone { margin-bottom: 14px; padding: 14px; font-size: 13.5px; }

/* ------------------------------------------------------------ audio player */
.aplayer { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 20px;
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-edge); }
.ap-play { width: 52px; height: 52px; border-radius: 50%; border: 0; flex: none; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #A88BFF, #6D4AE0); box-shadow: 0 10px 20px -8px #6D4AE0, inset 0 1px 0 rgba(255,255,255,.35), 0 3px 0 -1px #4B2FB8;
  transition: transform .2s var(--spring, ease); }
.ap-play:active { transform: translateY(2px) scale(.95); }
.ap-play .icon { width: 22px; height: 22px; fill: currentColor; }
.aplayer[data-state=playing] .ap-play { animation: apPulse 1.6s ease-in-out infinite; }
@keyframes apPulse { 50% { box-shadow: 0 10px 20px -8px #6D4AE0, 0 0 0 8px rgba(124, 77, 255, .15), inset 0 1px 0 rgba(255,255,255,.35); } }
.ap-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ap-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ap-title { font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.ap-time { font-family: var(--mono); font-size: 12.5px; color: var(--muted); flex: none; }
.ap-time b { color: var(--ink); font-weight: 500; }
.ap-wave { position: relative; height: 38px; display: flex; align-items: center; gap: 2px; cursor: pointer; touch-action: none; border-radius: 8px; padding: 0 2px; }
.ap-wave i { flex: 1; min-width: 2px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 35%, transparent); transition: height .4s var(--ease); }
.ap-progress { position: absolute; left: 0; top: 2px; bottom: 2px; width: 0; border-right: 2px solid #7C4DFF; pointer-events: none; transition: width .1s linear; }
.ap-wave i.on { background: linear-gradient(180deg, #A88BFF, #6D4AE0) !important; }
.ap-wave:focus-visible { outline: 2px solid var(--accent); }
.ap-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-meta { font-size: 12px; color: var(--muted); }
.ap-actions { display: flex; gap: 6px; }
.ap-btn { height: 32px; min-width: 32px; padding: 0 8px; border: 0; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2);
  background: var(--neu-bg); box-shadow: var(--neu-raise-sm); font-size: 12.5px; font-weight: 700; transition: transform .15s, box-shadow .15s; }
.ap-btn:hover { color: var(--accent); text-decoration: none; }
.ap-btn:active { box-shadow: var(--neu-inset-sm); transform: scale(.95); }
.ap-btn.danger:hover { color: var(--debit); }
.ap-speed { font-family: var(--mono); }
@media (max-width: 520px) {
  .aplayer { padding: 12px; gap: 10px; align-items: flex-start; }
  .ap-play { width: 46px; height: 46px; margin-top: 4px; }
  .ap-meta { width: 100%; }
}

/* ------------------------------------------------------------ attachment grid: 3 × 3 inch frames
   Each file is shown in a frame exactly 3in × 3in (288 CSS px; the CSS inch is 96 px, the same
   inch used when printing). The whole file is visible inside the frame, never cropped, and the
   original file is untouched. At most 3 frames per row, so a page of 9 is a 3 × 3 grid. */
.att-grid { --frame: 3in; --gap: 18px; display: grid; gap: var(--gap); justify-content: start;
  grid-template-columns: repeat(auto-fill, min(var(--frame), 100%)); max-width: calc(3 * var(--frame) + 2 * var(--gap)); }
.att-grid[hidden] { display: none; }
.att-pending { margin-bottom: var(--gap); }
.att-tile { margin: 0; width: 100%; border-radius: 20px; position: relative; display: flex; flex-direction: column;
  /* outline-style ring instead of a border, so the frame inside is exactly 3in wide */
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 0; box-shadow: 0 0 0 1px var(--glass-border), var(--glass-shadow), var(--glass-edge);
  transition: transform .3s var(--spring, ease), box-shadow .25s; animation: rise .45s var(--spring, ease) both; }
.att-tile:nth-child(2) { animation-delay: .03s; } .att-tile:nth-child(3) { animation-delay: .06s; } .att-tile:nth-child(n+4) { animation-delay: .09s; } .att-tile:nth-child(n+7) { animation-delay: .12s; }
@media (hover: hover) { .att-tile:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--glass-border), 0 22px 40px -18px rgba(30, 44, 88, .4), var(--glass-edge); } }

/* the 3-inch frame */
.att-frame { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; cursor: zoom-in; border-radius: 20px 20px 0 0; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--neu-bg)), var(--neu-bg)); }
.att-frame::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(20, 30, 60, .06); pointer-events: none; }
.att-frame:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.att-backdrop { position: absolute; inset: -24px; z-index: -1; background: var(--bg, none) center / cover no-repeat; filter: blur(24px) saturate(1.25); opacity: 0; transform: scale(1.1); transition: opacity .5s; }
.att-frame.ready .att-backdrop { opacity: .5; }
:root[data-theme="dark"] .att-frame.ready .att-backdrop { opacity: .35; }
.att-img { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); object-fit: contain; display: block; opacity: 0;
  filter: drop-shadow(0 10px 18px rgba(15, 25, 50, .28)); transition: opacity .35s, transform .5s var(--ease); }
.att-frame.ready .att-img { opacity: 1; }
.att-tile[data-kind=pdf] .att-img { inset: 16px 16px 10px; height: calc(100% - 26px); object-position: center top; }
@media (hover: hover) { .att-tile:hover .att-img { transform: scale(1.03); } }
.att-frame.loading::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.att-badge { position: absolute; left: 12px; bottom: 12px; z-index: 2; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; color: #fff; background: var(--fc); box-shadow: 0 4px 10px -4px var(--fc); }
.att-open { position: absolute; right: 12px; bottom: 12px; z-index: 2; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: rgba(10, 16, 34, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; }
.att-tile:hover .att-open, .att-frame:focus-visible .att-open { opacity: 1; }
@media (hover: none) { .att-open { opacity: .85; } }
.att-note { position: absolute; left: 14px; right: 50px; bottom: 14px; z-index: 2; font-size: 11.5px; text-align: center; color: var(--muted); }
.att-icon { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--fc);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--fc) 20%, transparent), transparent 68%); }
.att-icon .icon { width: 56px; height: 56px; }
.att-icon span { font-size: 12.5px; font-weight: 800; letter-spacing: .06em; padding: 3px 10px; border-radius: 8px; color: #fff; background: var(--fc); }
.att-icon.big .icon { width: 64px; height: 64px; }

/* actions: top-right corner so they never cover the file name or PDF badge */
.att-hover { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; gap: 6px; opacity: 0; transform: translateY(-4px); transition: all .25s var(--spring, ease); }
.att-tile:hover .att-hover, .att-tile:focus-within .att-hover { opacity: 1; transform: none; }
@media (hover: none) { .att-hover { opacity: 1; transform: none; } }
.att-act { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; border: 0; cursor: pointer; color: var(--ink);
  background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 14px -6px rgba(0,0,0,.35); }
.att-act:hover { color: var(--accent); text-decoration: none; }
.att-act.danger:hover { color: var(--debit); }
:root[data-theme="dark"] .att-act { background: rgba(24, 34, 62, .88); color: var(--ink); }

.att-tile figcaption { padding: 10px 14px 13px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.att-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta, .att-owner { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* upload progress tiles */
.att-tile.is-uploading { animation: rise .35s var(--spring, ease) both; }
.att-tile.is-uploading .att-frame { cursor: default; }
.att-progress { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; text-align: center;
  background: color-mix(in srgb, var(--neu-bg) 62%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); font-size: 13px; font-weight: 600; color: var(--ink); }
.att-ring { position: relative; width: 74px; height: 74px; }
.att-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.att-ring circle { fill: none; stroke: var(--line-strong); stroke-width: 3.2; }
.att-ring .bar { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .25s; }
.att-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 14px; }
.att-tile.is-done .att-ring .bar { stroke: var(--credit, #1D9B5A); }
.att-tile.is-failed .att-ring .bar, .att-tile.is-failed .att-ring b { stroke: var(--debit); color: var(--debit); }
.att-tile.is-failed .att-progress span { color: var(--debit); }
.att-tile.is-queued .att-ring .bar { stroke: var(--marigold, #F2A93B); }

.att-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; max-width: calc(9in + 36px); }
.att-pager .muted { font-size: 13px; }
.att-dots { display: flex; gap: 6px; }
.att-dots button { width: 9px; height: 9px; border-radius: 99px; border: 0; padding: 0; cursor: pointer; background: var(--line-strong); transition: all .3s var(--spring, ease); }
.att-dots button.on { width: 26px; background: var(--grad, var(--accent)); }
.att-empty { display: grid; place-items: center; gap: 6px; padding: 30px; color: var(--muted); border: 2px dashed var(--line-strong); border-radius: 18px; text-align: center; }
.att-empty p { margin: 0; }
.toast span { white-space: pre-line; }
@media (max-width: 640px) {
  /* phones: one 3-inch frame per row (two on wide phones in landscape), centred */
  .att-grid { --gap: 14px; justify-content: center; margin-inline: auto; }
  .att-pager { margin-inline: auto; }
  .att-owner { display: block; }
}

/* ------------------------------------------------------------ viewer */
html.viewer-open, html.viewer-open body { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-rows: auto 1fr auto; color: #fff;
  background: rgba(8, 12, 26, .92); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); animation: fade .2s ease; }
.v-bar { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px 18px; background: linear-gradient(180deg, rgba(0,0,0,.45), transparent); }
.v-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.v-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-title span { font-size: 12.5px; color: #A9B5CC; }
.v-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.v-btn { height: 40px; min-width: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); display: inline-grid; place-items: center;
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: background .15s, transform .15s; font-weight: 650; font-size: 13px; }
.v-btn:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.v-btn:active { transform: scale(.94); }
.v-btn.danger:hover { background: rgba(229, 41, 76, .5); }
.v-zoom { min-width: 64px; font-family: var(--mono); }
.v-sep { width: 1px; height: 24px; background: rgba(255,255,255,.15); margin: 0 4px; }
.v-stage { position: relative; overflow: hidden; display: grid; place-items: center; touch-action: none; }
.viewer[data-kind=pdf] .v-stage, .viewer[data-kind=other] .v-stage, .viewer[data-kind=audio] .v-stage { touch-action: pan-y pinch-zoom; }
.v-img { max-width: 92%; max-height: 92%; object-fit: contain; border-radius: 6px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); transition: transform .18s ease-out; user-select: none; cursor: zoom-in; }
.viewer.zoomed .v-img { cursor: grab; transition: none; }
.v-pdf { width: 100%; height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 12px 30px; -webkit-overflow-scrolling: touch; }
.v-page { background: #fff; border-radius: 4px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); max-width: none; }
.v-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.v-loading { margin-top: 30vh; color: #A9B5CC; }
.v-spin { position: absolute; inset: 0; margin: 0; display: grid; place-content: center; justify-items: center; gap: 12px; pointer-events: none; font-size: 13.5px; }
.v-spin span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-note { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 14px; border-radius: 14px; font-size: 13px; color: #E6EBF5; background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.v-other .v-note { position: static; transform: none; margin: 14px auto 0; }
.v-audio { width: min(640px, 92vw); color: var(--ink); }
.v-other { text-align: center; color: #D7DEEA; }
.v-other .att-icon { position: relative; inset: auto; height: 160px; background: none; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.v-nav:hover { background: rgba(255,255,255,.2); }
.v-nav.prev { left: 14px; } .v-nav.next { right: 14px; }
.v-strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); justify-content: center; scrollbar-width: none; }
.v-thumb { width: 54px; height: 54px; flex: none; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: rgba(255,255,255,.08); opacity: .6; transition: all .2s; }
.v-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v-thumb span { display: grid; place-items: center; height: 100%; font-size: 10.5px; font-weight: 800; color: #fff; background: var(--fc); }
.v-thumb.on { border-color: #fff; opacity: 1; transform: translateY(-2px); }
@media (max-width: 760px) {
  .v-bar { flex-wrap: wrap; padding-left: 12px; }
  .v-title { flex-basis: calc(100% - 60px); }
  .v-tools { width: 100%; justify-content: space-between; order: 2; }
  .v-tools .v-btn { flex: 1; min-width: 0; padding: 0; height: 38px; }
  .v-tools [data-v=close] { position: absolute; right: 12px; top: calc(10px + env(safe-area-inset-top)); flex: none; width: 40px; }
  .v-sep, [data-v=full] { display: none !important; }
  .v-nav { display: none; }
  .v-img { max-width: 100%; max-height: 100%; border-radius: 0; }
}

/* ------------------------------------------------------------ share dialog */
.share-dlg { display: flex; flex-direction: column; gap: 18px; }
.share-file-head { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--grad-soft); margin-bottom: 4px; }
.share-file-head > .icon { width: 22px; height: 22px; color: var(--accent); }
.share-file-head b { display: block; overflow-wrap: anywhere; }
.share-file-head .sf-thumb { width: 64px; height: 64px; flex: none; border-radius: 12px; object-fit: contain; background: #fff; box-shadow: 0 6px 16px -8px rgba(0,0,0,.4); }
.share-file-head span { font-size: 13px; }
.share-sec h4 { margin: 0 0 10px; font-size: 14px; }
.share-opts { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--neu-bg); box-shadow: var(--neu-inset-sm); }
.share-note { font-size: 13px; margin: 8px 0 0; }
.share-targets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.share-t { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 0; background: none; cursor: pointer; border-radius: 16px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); transition: transform .2s var(--spring, ease), background .2s; }
.share-t:hover { background: var(--neu-bg); transform: translateY(-2px); }
.share-t:active { transform: scale(.95); }
.st-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 10px 18px -8px var(--g2), inset 0 1px 0 rgba(255,255,255,.35); }
.st-ic .icon { width: 22px; height: 22px; }
.share-link-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.share-link-row input { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 13px !important; }
.share-qr svg { display: block; border-radius: 10px; box-shadow: var(--neu-raise-sm); }
.share-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.share-sep::before, .share-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.share-big { width: 100%; padding: 13px; }
.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--neu-bg); box-shadow: var(--neu-raise-sm); color: var(--ink); }
.link-item b { display: block; font-size: 13.5px; }
.link-item .muted { font-size: 12.5px; }
.li-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); color: #fff; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.check.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--neu-bg); box-shadow: var(--neu-raise-sm); }
.check.pick small { display: block; color: var(--muted); font-weight: 500; text-transform: capitalize; }
.check.pick .avatar { width: 30px; height: 30px; }
@media (max-width: 560px) {
  .share-targets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .link-item { grid-template-columns: auto 1fr; }
  .link-item .btn { grid-column: span 1; }
}

/* ------------------------------------------------------------ public share page */
.pub-wrap { max-width: 1040px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 18px 60px; }
.pub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.pub-head .brand-mark { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; }
.pub-head small { display: block; color: var(--muted); font-size: 12.5px; }
.pub-hero { padding: 24px; border-radius: 24px; color: #fff; margin-bottom: 18px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 30px 60px -30px var(--accent-2); }
.pub-hero h1 { margin: 6px 0; font-size: 28px; letter-spacing: -.03em; }
.pub-hero p { margin: 0; opacity: .9; white-space: pre-wrap; }
.pub-hero .chips .badge { background: rgba(255,255,255,.2) !important; color: #fff; }
.pub-lock { max-width: 380px; margin: 12vh auto; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 30px; }
.modal-foot { background: color-mix(in srgb, var(--neu-bg) 94%, transparent) !important; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); z-index: 2; }

/* ------------------------------------------------------------ install app */
.install-pill { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 13.5px; font-weight: 700; color: #fff; background: var(--grad, var(--accent));
  box-shadow: 0 10px 22px -12px var(--accent), inset 0 1px 0 rgba(255,255,255,.3); transition: transform .2s var(--spring, ease), box-shadow .2s; }
.install-pill[hidden] { display: none; }
.install-pill:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px var(--accent), inset 0 1px 0 rgba(255,255,255,.3); }
.install-pill:active { transform: scale(.96); }
.install-pill .icon { width: 16px; height: 16px; }
.install-pill.one-tap::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #7CF0C4; box-shadow: 0 0 0 3px rgba(124, 240, 196, .25); }
.install-pill .ip-short { display: none; }
@media (max-width: 860px) { .install-pill { height: 38px; padding: 0 12px; font-size: 13px; } .install-pill .ip-long { display: none; } .install-pill .ip-short { display: inline; } .install-pill.one-tap::after { display: none; } }
@media (max-width: 340px) { .install-pill .ip-short { display: none; } .install-pill { width: 38px; padding: 0; justify-content: center; } }
.nav .nav-install { margin-top: 6px; color: var(--accent); font-weight: 700; }
.install-login { border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); font-weight: 700; }

.install-perks { list-style: none; margin: 14px 0 4px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2, var(--ink)); }
.install-perks li { display: flex; gap: 8px; align-items: center; }
.install-perks .icon { color: var(--accent); flex: none; }
.install-note { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px; background: color-mix(in srgb, var(--credit, #1D9B5A) 10%, transparent); }
.install-note .icon { color: var(--credit, #1D9B5A); flex: none; margin-top: 2px; }
.install-share { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2, rgba(0,0,0,.03)); font-size: 13px; color: var(--muted); }
.install-share > span { display: inline-flex; gap: 6px; align-items: center; }
.ikey-dots { letter-spacing: 1px; font-size: 11px; padding: 2px 8px; }
.install-cta { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.install-card { max-width: 640px; }
.install-page .install-hero img { width: 72px; height: 72px; }
[data-show-me] { margin-top: 12px; }

/* "show me where": a bouncing pointer at the browser's own button */
.install-hint { position: fixed; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: auto; animation: fade .25s ease; }
.install-hint .hint-bubble { padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; color: #fff; background: var(--grad, var(--accent)); box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); white-space: nowrap; }
.install-hint .hint-arrow { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; background: var(--accent); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); animation: hintBounce 1s ease-in-out infinite; }
.install-hint .hint-arrow .icon { width: 24px; height: 24px; }
.hint-ios-share { left: 50%; transform: translateX(-50%); bottom: calc(8px + env(safe-area-inset-bottom)); }
.hint-ios-dots { right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); align-items: flex-end; }
.hint-android-menu { right: 8px; top: calc(8px + env(safe-area-inset-top)); flex-direction: column-reverse; align-items: flex-end; }
@keyframes hintBounce { 50% { transform: translateY(8px); } }
html.hinting .install-banner { opacity: 0; pointer-events: none; }
.hint-android-menu .hint-arrow { animation-name: hintBounceUp; }
@keyframes hintBounceUp { 50% { transform: translate(4px, -6px); } }

/* =====================================================================
   Receipts on account transactions (receipts.js)
   ===================================================================== */
/* optional picker on the transaction form */
.rcpt-picker { border: 1px dashed var(--line-strong); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); display: grid; gap: 10px; }
.rcpt-picker.has-files { border-style: solid; }
.rcpt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rcpt-title { font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
.rcpt-title .muted { font-weight: 500; font-size: 13px; }
.rcpt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rcpt-drop { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; border-radius: 10px; padding: 2px; transition: background .15s; }
.rcpt-drop.over { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.rcpt-picker.has-files .rcpt-drop { display: none; }
.rcpt-staged { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.rcpt-staged:empty { display: none; }
.rcpt-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.rcpt-chip-prev { flex: none; width: 52px; height: 52px; border-radius: 9px; overflow: hidden; border: 0; padding: 0; background: var(--surface-2); cursor: zoom-in; display: grid; place-items: center; }
.rcpt-chip-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcpt-chip-ic { display: grid; justify-items: center; gap: 1px; color: var(--fc, var(--muted)); }
.rcpt-chip-ic b { font-size: 9.5px; letter-spacing: .05em; }
.rcpt-chip-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.rcpt-chip-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rcpt-chip-txt .muted { font-size: 12px; }
.rcpt-chip .icon-btn { width: 32px; height: 32px; flex: none; }

/* camera dialog */
.modal.cam-modal { max-width: 760px; }
.cam-stage { position: relative; background: #0b0f1a; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.cam-video, .cam-still { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-video[hidden], .cam-still[hidden] { display: none; }
.cam-msg { position: absolute; inset: auto 16px 16px; margin: 0; padding: 10px 14px; border-radius: 10px; background: rgba(10, 16, 34, .72); color: #fff; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.cam-msg[hidden] { display: none; }
.cam-msg.err { inset: 50% 16px auto; transform: translateY(-50%); background: rgba(120, 20, 30, .85); align-items: flex-start; }
.cam-guide { position: absolute; inset: 9% 14%; border: 2px dashed rgba(255, 255, 255, .55); border-radius: 12px; pointer-events: none; }
.cam-guide[hidden] { display: none; }
.cam-tip { margin: 10px 2px 0; font-size: 13px; }
.cam-modal .modal-foot { flex-wrap: wrap; }
.cam-modal .modal-foot [hidden] { display: none; }

/* paperclip in the ledger */
.ledger th.c, .ledger td.c { text-align: center; width: 1%; }
.rcpt-pill { display: inline-flex; align-items: center; gap: 3px; border: 1px solid transparent; background: none; border-radius: 99px; padding: 4px 7px; color: var(--muted); cursor: pointer; opacity: .55; font-size: 12px; }
.rcpt-pill:hover, .rcpt-pill:focus-visible { opacity: 1; border-color: var(--line); color: var(--ink); }
.rcpt-pill.has { opacity: 1; color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.rcpt-pill b { font-weight: 750; }
.ledger tr.txn-hl td { background: color-mix(in srgb, var(--accent) 13%, transparent); animation: txnFlash 2.2s ease-out 1; }
@keyframes txnFlash { 0%, 40% { background: color-mix(in srgb, var(--accent) 28%, transparent); } }

/* receipts tab + per-entry dialog */
.rcpt-filters { flex-wrap: wrap; }
.rcpt-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rcpt-count { margin: -6px 0 12px; font-size: 13px; }
.rcpt-count:empty { display: none; }
.rcpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.rcpt-grid.compact { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.rcpt-card { display: flex; flex-direction: column; border-radius: 20px; background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); overflow: hidden; min-width: 0; }
.rcpt-card .att-tile { box-shadow: none; border-radius: 0; animation: none; background: transparent; }
.rcpt-card .att-tile:hover { transform: none; }
.rcpt-card .att-frame { border-radius: 0; }
.rcpt-card .att-tile figcaption { padding: 9px 14px 0; }
.rcpt-info { padding: 6px 14px 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.rcpt-info > * { min-width: 0; overflow-wrap: anywhere; }
.rcpt-amt { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; flex-wrap: wrap; }
.rcpt-type { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.rcpt-desc { margin: 0; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcpt-meta { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.rcpt-meta.muted { color: var(--muted); }
.rcpt-btns { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.rcpt-btns .btn:first-child { flex: 1; justify-content: center; }
.rcpt-btns .rc-short { display: none; }
.rcpt-btns .btn:first-child { min-width: 0; }
.rcpt-txn-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.rcpt-add { border-top: 1px solid var(--line); padding-top: 14px; }

@media (max-width: 600px) {
  .rcpt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rcpt-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rcpt-info { padding: 4px 10px 10px; }
  .rcpt-card .att-tile figcaption { padding: 8px 10px 0; }
  .rcpt-amt { font-size: 15px; }
  .rcpt-btns .btn:first-child { font-size: 12px; padding: 6px 6px; }
  .rcpt-btns .btn:first-child .icon { display: none; }
  .rcpt-btns .rc-long { display: none; }
  .rcpt-btns .rc-short { display: inline; }
  .rcpt-btns { gap: 2px; }
  .rcpt-meta { display: block; }
  .rcpt-meta .icon { vertical-align: -2px; }
  .rcpt-filters > * { flex: 1 1 140px; }
  .rcpt-actions { width: 100%; }
  .rcpt-actions .btn { flex: 1; justify-content: center; padding: 10px; }
  .rcpt-staged { grid-template-columns: 1fr; }
  .cam-stage { aspect-ratio: 3 / 4; }
  .cam-modal .modal-foot .btn { flex: 1 1 45%; justify-content: center; }
}
