/* ============================================================
   Secure Capture — Web app (cloud dashboard)
   ============================================================ */

html, body { min-height: 100%; width: 100%; }
body { overflow-x: hidden; }
body.modal-open { overflow: hidden; }
#app { min-height: 100vh; min-height: 100dvh; width: 100%; }

/* background atmosphere fixed behind everything */
.app-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(1100px 700px at 82% -8%, rgba(47,128,255,0.12), transparent 60%),
              radial-gradient(900px 700px at 8% 108%, rgba(18,201,138,0.07), transparent 60%),
              linear-gradient(160deg, #0a0c11 0%, #07080a 55%, #0a0a0d 100%); }
.app-bg .orb { position: absolute; border-radius: 50%; filter: blur(90px); }

/* ============================================================
   LOGIN
   ============================================================ */
.auth { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.auth-card { width: 100%; max-width: 430px; padding: clamp(28px, 5vw, 44px); border-radius: var(--r-xl); }
.auth-logo { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 30px; }
.auth-logo img { width: 64px; height: 64px; animation: logo-pulse 3.4s var(--ease) infinite; filter: drop-shadow(0 8px 18px rgba(72,198,183,.45)); }
.auth-logo h1 { font-size: 28px; margin: 18px 0 6px; }
.auth-logo p { font-size: 15px; color: var(--t2); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--t2); }
.auth-foot a { color: var(--blue-bright); font-weight: 600; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--t3); font-size: 13px; margin: 6px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.auth-error { font-size: 13.5px; color: #ff7a7e; line-height: 1.45; margin: 0; }
.auth-switch { text-align: center; margin: 10px 0 0; font-size: 14px; }
.link-btn { background: none; border: none; padding: 0; color: var(--blue-bright); font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }
#appleSignIn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   SHELL — sidebar + main
   ============================================================ */
.shell { display: none; align-items: flex-start; min-height: 100dvh; width: 100%; }
.shell.show { display: flex; }

.sidebar { width: 256px; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 22px 16px;
  border-right: 1px solid var(--hairline); background: rgba(10,11,14,0.5); backdrop-filter: blur(20px);
  position: sticky; top: 0; height: 100vh; height: 100dvh; }
.sidebar .wordmark { padding: 6px 8px 22px; }
.side-link { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: var(--r-md);
  color: var(--t2); font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s, color .2s; }
.side-link svg { width: 21px; height: 21px; }
.side-link:hover { background: var(--glass-2); color: var(--t1); }
.side-link.on { background: var(--glass-2); color: var(--t1); box-shadow: var(--edge-light); }
.side-link.on svg { color: var(--blue-bright); }
.side-spacer { flex: 1; }
.side-storage { padding: 16px; border-radius: var(--r-lg); margin-bottom: 10px; }
.side-storage .ss-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 9px; }
.side-storage .ss-top b { color: var(--t1); font-weight: 600; }
.side-account { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: var(--r-md); cursor: pointer; transition: background .2s; }
.side-account:hover { background: var(--glass-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--font-round); font-weight: 800; color: #fff; background: linear-gradient(180deg, var(--blue-bright), var(--blue)); }
.side-account .sa-name { font-size: 14px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account .sa-plan { font-size: 12px; color: var(--t3); }

.meter { height: 9px; border-radius: 6px; background: rgba(255,255,255,0.08); overflow: hidden; position: relative; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright)); box-shadow: 0 0 14px rgba(47,128,255,0.55); transition: width .6s var(--ease); }
.meter.warn > i { background: linear-gradient(90deg, var(--amber), #ffc35a); box-shadow: 0 0 14px rgba(245,166,35,0.5); }

/* main */
.main { flex: 1; min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px clamp(20px, 4vw, 40px);
  border-bottom: 1px solid var(--hairline); }
.topbar h1 { font-size: clamp(22px, 3vw, 30px); }
.topbar .tb-actions { display: flex; align-items: center; gap: 10px; }
.content { flex: 1; min-width: 0; width: 100%; padding: clamp(20px, 4vw, 38px); overflow-x: hidden; }

.page { width: 100%; max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--t2); font-size: 15px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; }

/* mobile header / tabbar (hidden on desktop) */
.m-top, .m-tabs { display: none; }

/* ============================================================
   LIBRARY
   ============================================================ */
.lib-toolbar { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 20px; scrollbar-width: none; }
.lib-toolbar::-webkit-scrollbar { display: none; }
.lib-chip { flex: none; cursor: pointer; transition: all .2s var(--ease); }
.lib-chip.on { color: #fff; border-color: var(--hairline-2); background: var(--glass-2); }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.cell .cell-vid-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.cell { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  border: 1px solid var(--hairline); box-shadow: var(--edge-light); transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.cell:hover { transform: translateY(-3px); box-shadow: var(--edge-light), var(--sh-soft); }
.cell .cell-grad { position: absolute; inset: 0; }
.cell .cell-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.22), transparent 38%, transparent 64%, rgba(0,0,0,.4)); }
.cell .cell-badge { position: absolute; top: 9px; left: 9px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.cell .cell-badge svg { width: 17px; height: 17px; }
.cell .cell-type { position: absolute; left: 9px; bottom: 9px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.45); backdrop-filter: blur(8px); }
.cell .cell-type svg { width: 13px; height: 13px; color: #fff; }
.cell .cell-dur { position: absolute; right: 9px; bottom: 9px; font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  padding: 3px 7px; border-radius: 8px; background: rgba(0,0,0,.5); }
.cell .cell-check { position: absolute; top: 9px; right: 9px; width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center;
  background: rgba(8,9,12,.5); border: 1.5px solid #fff; }
.cell.sel .cell-check { display: grid; background: var(--blue); border-color: var(--blue); }
.cell.sel .cell-check svg { width: 14px; height: 14px; color: #fff; }
.cell.selectable { cursor: pointer; }
.cell.selectable:hover { transform: none; }

.empty { text-align: center; padding: 70px 20px; color: var(--t3); }
.empty .empty-ic { width: 70px; height: 70px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--hairline); }
.empty .empty-ic svg { width: 32px; height: 32px; color: var(--t3); }
.empty h3 { font-size: 19px; color: var(--t1); margin-bottom: 6px; }

/* selection action bar */
.selbar { position: sticky; bottom: 0; display: none; align-items: center; gap: 12px; margin-top: 20px;
  padding: 14px 18px; border-radius: var(--r-lg); }
.selbar.show { display: flex; }
.selbar .sel-count { font-weight: 600; font-size: 15px; }
.selbar .sel-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   CARDS / SETTINGS
   ============================================================ */
.card { border-radius: var(--r-lg); padding: clamp(18px, 3vw, 26px); }
.card + .card { margin-top: 18px; }
.set-group { margin-bottom: 26px; }
.set-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--t3); margin: 0 0 12px 4px; }
.set-note { font-size: 13px; color: var(--t3); margin: 10px 4px 0; line-height: 1.5; }
.list { border-radius: var(--r-lg); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; position: relative; }
.list-row + .list-row::before { content: ""; position: absolute; left: 56px; right: 0; top: 0; height: 1px; background: var(--hairline); }
.list-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; box-shadow: var(--sh-soft); }
.list-ic svg { width: 17px; height: 17px; color: #fff; }
.list-row .lr-title { font-size: 15.5px; font-weight: 500; }
.list-row .lr-sub { font-size: 13px; color: var(--t3); margin-top: 1px; }
.list-row .lr-title { min-width: 0; }
.list-row .lr-val { margin-left: auto; min-width: 0; max-width: 58%; color: var(--t3); font-size: 15px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.list-row .lr-val > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-val svg { width: 16px; height: 16px; }
.list-row.tap { cursor: pointer; transition: background .2s; }
.list-row.tap:hover { background: var(--glass-2); }
.contact-row { min-width: 0; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-sub { font-size: 13px; color: var(--t3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toggle { width: 50px; height: 30px; border-radius: var(--r-pill); background: var(--g-600); position: relative; transition: background .25s var(--ease); flex: none; cursor: pointer; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.4); transition: transform .28s var(--ease); }
.toggle.on { background: linear-gradient(180deg, var(--emerald-br), var(--emerald)); }
.toggle.on::after { transform: translateX(20px); }

/* plan card in settings */
.plan-status { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.plan-status .ps-badge { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, rgba(47,128,255,.25), rgba(47,128,255,.08)); border: 1px solid rgba(47,128,255,.3); }
.plan-status .ps-badge svg { width: 28px; height: 28px; color: var(--blue-bright); }

/* ============================================================
   MODALS (detail / upload / share / generic)
   ============================================================ */
.scrim { position: fixed; inset: 0; z-index: 90; background: rgba(4,5,7,0.66); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px; opacity: 0; overflow-y: auto; overscroll-behavior: contain; transition: opacity .28s var(--ease); }
.scrim.show { display: flex; opacity: 1; }
.modal { width: 100%; max-width: 520px; min-height: 0; border-radius: var(--r-xl); overflow: hidden; max-height: 90vh; display: flex; flex-direction: column;
  transform: translateY(16px) scale(.98); transition: transform .3s var(--ease); }
.scrim.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--hairline); }
.modal-head, .modal-foot { flex: none; }
.modal-head h2 { min-width: 0; font-size: 20px; overflow-wrap: anywhere; }
.modal-body { min-height: 0; padding: 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--hairline); display: flex; gap: 12px; }
.modal-foot .btn { min-width: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none;
  background: var(--glass-2); border: 1px solid var(--hairline); box-shadow: var(--edge-light); color: var(--t1); transition: background .2s; }
.icon-btn:hover { background: var(--glass-hi); }
.icon-btn svg { width: 19px; height: 19px; }

/* detail modal */
.detail-modal { max-width: 880px; max-height: min(90vh, 900px); }
.detail-preview { position: relative; flex: none; aspect-ratio: 16/10; overflow: hidden; background-position: center; background-size: cover; }
.detail-preview::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.46), transparent 26%, transparent 72%, rgba(0,0,0,.42)); }
.detail-preview .dp-grad { position: absolute; inset: 0; }
.detail-preview .dp-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.4), transparent 30%, transparent 64%, rgba(0,0,0,.5)); }
.detail-preview .dp-play { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 16px; }
.detail-preview video[data-player], .detail-preview img[data-photo] { width: 100%; height: 100%; max-width: none !important; max-height: none !important; border-radius: 0 !important; object-fit: contain; background: #000; }
.detail-preview .dp-play .pl { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(0,0,0,.4); border: 1px solid var(--hairline-2); backdrop-filter: blur(10px); box-shadow: var(--edge-light); transition: transform .2s; }
.detail-preview .dp-play .pl:hover { transform: scale(1.06); }
.detail-preview .dp-play .pl svg { width: 30px; height: 30px; color: #fff; margin-left: 4px; }
.detail-preview .dp-top { position: absolute; top: 16px; left: 16px; right: 16px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.detail-preview .dp-top > * { pointer-events: auto; }
.detail-info { min-height: 0; padding: 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.protect-callout { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--r-lg); margin-bottom: 18px; }
.protect-callout > div { min-width: 0; }
.protect-callout h4 { font-family: var(--font-round); font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.protect-callout p { font-size: 13.5px; color: var(--t2); line-height: 1.4; }
.ring { width: 64px; height: 64px; position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-lbl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .ring-lbl b { font-family: var(--font-round); font-size: 15px; font-weight: 800; line-height: 1; }
.ring .ring-lbl small { font-size: 8.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--t3); margin-top: 2px; }
.detail-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.det-act { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 6px; border-radius: var(--r-md); cursor: pointer;
  min-width: 0; min-height: 74px; text-align: center; background: var(--glass-2); border: 1px solid var(--hairline); color: var(--t1); font-size: 12.5px; font-weight: 600; transition: background .2s, transform .15s; }
.det-act:hover { background: var(--glass-hi); }
.det-act:active { transform: scale(.96); }
.det-act svg { width: 22px; height: 22px; }
.det-act.danger { color: #ff7a7e; }
.det-act.warn { color: var(--amber); }

.meta-list { display: flex; flex-direction: column; }
.meta-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 14.5px; }
.meta-row + .meta-row { border-top: 1px solid var(--hairline); }
.meta-row .mk { color: var(--t3); }
.meta-row .mv { min-width: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }

/* upload */
.dropzone { border: 1.5px dashed var(--hairline-2); border-radius: var(--r-lg); padding: 40px 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; background: rgba(255,255,255,0.02); }
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: rgba(47,128,255,0.06); }
.dropzone .dz-ic { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(47,128,255,.22), rgba(47,128,255,.06)); border: 1px solid rgba(47,128,255,.3); }
.dropzone .dz-ic svg { width: 30px; height: 30px; color: var(--blue-bright); }
.dropzone h3 { font-size: 18px; margin-bottom: 6px; }
.dropzone p { font-size: 14px; color: var(--t2); }
.seg { display: flex; padding: 4px; gap: 3px; border-radius: var(--r-pill); background: rgba(0,0,0,.3); border: 1px solid var(--hairline); }
.seg button { flex: 1; border: none; background: transparent; color: var(--t2); font-family: var(--font); font-weight: 700; font-size: 12.5px;
  letter-spacing: .03em; padding: 10px 4px; border-radius: var(--r-pill); cursor: pointer; transition: all .22s var(--ease); white-space: nowrap; }
.seg button.on { background: #fff; color: #000; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.upload-staged { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md); }
.upload-staged > div { min-width: 0; }
.upload-staged .us-thumb-wrap { width: 52px; height: 52px; border-radius: 10px; flex: none; overflow: hidden; background: rgba(255,255,255,.06); }
.upload-staged .us-thumb { width: 52px; height: 52px; border-radius: 10px; flex: none; object-fit: cover; display: block; background: rgba(255,255,255,.06); }
.upload-staged .us-thumb-wrap .us-thumb { width: 100%; height: 100%; border-radius: 0; }
.up-progress { height: 8px; border-radius: 5px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 14px; }
.up-progress > i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--blue), var(--blue-bright)); transition: width .3s linear; }

/* toast */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 11px; padding: 13px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500;
  background: rgba(20,22,28,0.92); backdrop-filter: blur(20px); border: 1px solid var(--hairline-2); box-shadow: var(--sh-pop);
  animation: toast-in .35s var(--ease); }
.toast span { min-width: 0; overflow-wrap: anywhere; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: var(--emerald-br); }
.toast.info svg { color: var(--blue-bright); }
.toast.warn svg { color: var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

.mount { animation: mount-in .4s var(--ease); }
@keyframes mount-in { from { transform: translateY(8px); } to { transform: none; } }

/* ------------------------------------------------------------
   Robust glass inside the scrolling content: backdrop-filter
   inside overflow:auto containers flickers/fails to composite on
   some browsers, so use solid translucent fills there instead.
   Fixed chrome (sidebar, modals, nav, toasts, login) keeps blur.
   ------------------------------------------------------------ */
.content .glass, .content .glass-2, .content .glass-thin,
.content .chip, .content .cell-type, .content .seg,
.content .icon-btn, .content .dropzone, .content .toggle,
.protect-callout, .det-act, .meta-list {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.content .glass { background: rgba(255,255,255,0.05); }
.content .glass-2 { background: rgba(255,255,255,0.045); }
.content .chip { background: rgba(255,255,255,0.05); }
.content .cell-type { background: rgba(0,0,0,0.5); }

/* ============================================================
   Responsive
   ============================================================ */

/* ---------- TABLET/MOBILE (≤ 860px) ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .m-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; border-bottom: 1px solid var(--hairline);
    position: sticky; top: 0; z-index: 30; background: rgba(8,9,12,0.8); backdrop-filter: blur(20px); }
  .m-top .wordmark { min-width: 0; }
  .m-top .wordmark img { width: 26px; }
  .m-top .wordmark .wm-text { font-size: 18px; }
  .topbar { padding: 16px 18px; }
  .topbar h1 { font-size: 22px; }
  .m-tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(10,11,14,0.86); backdrop-filter: blur(30px) saturate(160%); border-top: 1px solid var(--hairline); }
  .m-tab { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; color: var(--t3); cursor: pointer; }
  .m-tab svg { width: 23px; height: 23px; }
  .m-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 600; }
  .m-tab.on { color: var(--blue-bright); }
  .content { padding: 18px; }

  /* Auth card */
  .auth { padding: 18px; }
  .auth-card { padding: clamp(24px, 4vw, 36px); max-width: 420px; }

  /* Modals */
  .scrim { padding: 12px; align-items: flex-end; }
  .modal { max-width: 100%; max-height: calc(100dvh - 24px); border-radius: var(--r-xl); }
  .detail-modal { height: min(92dvh, 820px); max-width: 100%; max-height: calc(100dvh - 24px); }
  .modal-head { padding: 18px 18px; }
  .modal-head h2 { font-size: 18px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 14px 18px; }

  /* Detail modal specific */
  .detail-preview { aspect-ratio: 16/9; flex: none; }
  .detail-preview .dp-play { padding: 52px 12px 12px; }
  .detail-info { padding: 18px; overflow-y: auto; flex: 1; min-height: 0; }
  .detail-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .det-act { min-height: 66px; font-size: 11.5px; padding: 12px 4px; }
  .det-act svg { width: 20px; height: 20px; }
  .meta-row { font-size: 13.5px; padding: 11px 0; }

  /* Protect callout */
  .protect-callout { padding: 14px; gap: 14px; }
  .protect-callout h4 { font-size: 15px; }
  .protect-callout p { font-size: 13px; }
  .ring { width: 56px; height: 56px; }

  /* Selection bar */
  .selbar { padding: 12px 14px; border-radius: var(--r-md); flex-wrap: wrap; }
  .selbar .sel-actions { flex-wrap: wrap; gap: 8px; }

  /* Plan status in settings */
  .plan-status { gap: 14px; }
  .plan-status .ps-badge { width: 48px; height: 48px; border-radius: 14px; }

  /* Upload */
  .dropzone { padding: 32px 18px; }
  .dropzone h3 { font-size: 16px; }

  /* Toast position above tab bar */
  .toasts { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); width: min(480px, calc(100vw - 28px)); }

  /* Page head wraps */
  .page-head { gap: 12px; }
}

/* ---------- SMALL MOBILE (≤ 520px) ---------- */
@media (max-width: 520px) {
  .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail-actions { grid-template-columns: repeat(2, 1fr); }
  .modal-foot { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }

  /* Auth */
  .auth { padding: 14px; }
  .auth-card { padding: 22px 18px; border-radius: var(--r-lg); }
  .auth-logo img { width: 52px; height: 52px; }
  .auth-logo h1 { font-size: 24px; margin-top: 14px; }
  .auth-logo p { font-size: 14px; }

  /* Modals */
  .scrim { padding: 0; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; }
  .detail-modal { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .modal-head { padding: 16px 16px; }
  .modal-head h2 { font-size: 17px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px 20px; gap: 10px; }

  /* Detail modal */
  .detail-preview { aspect-ratio: 16/9; }
  .detail-preview .dp-top { top: max(12px, env(safe-area-inset-top, 0px)); left: 12px; right: 12px; }
  .detail-preview .dp-play { padding: 54px 10px 10px; }
  .detail-info { padding: 16px; }
  .detail-actions { gap: 8px; }
  .det-act { padding: 10px 4px; font-size: 11px; gap: 5px; }
  .det-act svg { width: 18px; height: 18px; }
  .protect-callout { flex-direction: row; align-items: flex-start; text-align: left; gap: 12px; }
  .ring { width: 52px; height: 52px; margin: 0; }
  .ring .ring-lbl b { font-size: 14px; }

  /* Content area */
  .content { padding: 14px; }

  /* Page head */
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-actions { display: flex; gap: 8px; }
  .page-actions .btn { flex: 1; font-size: 14px; height: 42px; padding: 0 14px; }

  /* Storage card */
  .card { padding: 16px; }

  /* Selection bar */
  .selbar { flex-direction: column; gap: 10px; align-items: stretch; }
  .selbar .sel-count { text-align: center; }
  .selbar .sel-actions { margin-left: 0; justify-content: center; flex-wrap: wrap; }

  /* Upload */
  .dropzone { padding: 28px 14px; }
  .dropzone .dz-ic { width: 52px; height: 52px; border-radius: 15px; }
  .dropzone .dz-ic svg { width: 24px; height: 24px; }
  .dropzone h3 { font-size: 15px; }
  .dropzone p { font-size: 13px; }

  /* Settings */
  .list-row { padding: 14px 14px; gap: 12px; }
  .list-row .lr-title { font-size: 14.5px; }
  .list-row .lr-val { max-width: 52%; font-size: 13px; }
  .list-ic { width: 30px; height: 30px; border-radius: 8px; }

  .set-label { font-size: 11px; margin-bottom: 10px; }

  /* Plan status */
  .plan-status { flex-direction: column; text-align: center; }
  .plan-status .ps-badge { margin: 0 auto; }

  /* Share link modal */
  .sl-expiry-row { gap: 6px; }
  .sl-chip { padding: 7px 12px; font-size: 12.5px; }
  .sl-link-box { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .sl-link-box .btn { width: 100%; }
  .sl-url { font-size: 12px; }
  .sl-info { font-size: 12px; }

  /* Segmented control */
  .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: var(--r-md); }
  .seg button { font-size: 11.5px; padding: 8px 4px; }

  /* Toast */
  .toasts { bottom: 76px; max-width: calc(100vw - 32px); }
  .toast { font-size: 13px; padding: 11px 14px; }

  /* Upload staged */
  .upload-staged { padding: 12px; gap: 10px; }
  .upload-staged .us-thumb, .upload-staged .us-thumb-wrap { width: 44px; height: 44px; }
}

/* ---------- VERY SMALL (≤ 380px) ---------- */
@media (max-width: 380px) {
  .content { padding: 12px; }
  .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cell .cell-dur { font-size: 10px; padding: 2px 5px; border-radius: 6px; }
  .cell .cell-type { width: 22px; height: 22px; left: 6px; bottom: 6px; }
  .cell .cell-badge { top: 6px; left: 6px; }
  .cell .cell-badge svg { width: 14px; height: 14px; }

  .auth-card { padding: 18px 14px; }
  .auth-logo img { width: 44px; height: 44px; }
  .auth-logo h1 { font-size: 22px; }

  .modal-body { padding: 14px; }
  .modal-head { padding: 14px; }
  .modal-foot { padding: 10px 14px 18px; }
  .detail-preview .dp-play { padding: 52px 8px 8px; }

  .m-tabs { padding: 7px 8px calc(9px + env(safe-area-inset-bottom, 0px)); }
  .m-tab svg { width: 21px; height: 21px; }
  .m-tab span { font-size: 9.5px; }

  .page-actions .btn { font-size: 13px; height: 40px; }

  /* Detail actions single column on tiny screens */
  .detail-actions { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Share link modal
   ============================================================ */
.sl-expiry-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sl-chip {
  padding: 8px 16px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: transparent; border: 1px solid var(--hairline-2); color: var(--t3);
  transition: background .15s, color .15s, border-color .15s;
}
.sl-chip.on {
  background: rgba(47,128,255,0.15); border-color: rgba(47,128,255,0.5); color: var(--blue-bright);
}
.sl-chip:hover:not(.on) { background: rgba(255,255,255,0.06); color: var(--t2); }

.sl-link-box {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--hairline-2);
  background: rgba(255,255,255,0.04);
}
.sl-url {
  flex: 1; min-width: 0; font-size: 13px; word-break: break-all;
  color: var(--t2); user-select: text;
}
.sl-info {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 13px; color: var(--t3); line-height: 1.55; margin-top: 14px;
}

/* Password row inside share modal */
.sl-pw-row {
  position: relative; display: flex; align-items: center; min-width: 0; margin-top: 8px;
}
.sl-pw-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--t3); pointer-events: none; display: flex; align-items: center;
}
.sl-pw-input { flex: 1; min-width: 0; padding-left: 44px !important; padding-right: 48px !important; }
.sl-pw-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 8px; cursor: pointer;
  color: var(--t3); display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.sl-pw-eye:hover { color: var(--t2); background: rgba(255,255,255,0.06); }

@media (min-width: 980px) and (min-height: 720px) {
  .detail-modal {
    max-width: min(1180px, calc(100vw - 48px));
    max-height: min(86vh, 820px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  }
  .detail-preview {
    height: 100%;
    min-height: 520px;
    aspect-ratio: auto;
  }
  .detail-info {
    height: 100%;
    border-left: 1px solid var(--hairline);
  }
  .detail-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
