/* CutBox web: a calm, dense file manager in the CutBox black-and-white system.
   Tokens mirror site/public/styles.css. Display: Bricolage Grotesque · UI: Geist · Data: JetBrains Mono */
:root {
  --bg: #ffffff;
  --bg-2: #f5f5f5;
  --bg-3: #ebebeb;
  --line: #e5e5e5;
  --line-2: #cfcfcf;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --accent: #0a0a0a;
  --accent-ink: #ffffff;
  --inv-muted: #a8a8a8;
  --shadow: rgba(10,10,10,.08);
  --placeholder: #a3a3a3;
  --scrim: rgba(255,255,255,.82);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --chevron-inv: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='square'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E");
  --logo-filter: none;
  color-scheme: light;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --halftone: radial-gradient(circle at center, var(--text) 1.1px, transparent 1.6px);
  --hatch: repeating-linear-gradient(135deg, var(--text) 0 1px, transparent 1px 7px);
  --gridlines: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  --rule: 1.5px solid var(--text);
  --top: 60px;
  --side: 264px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --bg-2: #141414; --bg-3: #1f1f1f; --line: #262626; --line-2: #3a3a3a;
    --text: #f5f5f5; --muted: #9a9a9a; --accent: #f5f5f5; --accent-ink: #0a0a0a; --inv-muted: #5c5c5c;
    --shadow: rgba(245,245,245,.08); --placeholder: #5c5c5c; --scrim: rgba(10,10,10,.82);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --chevron-inv: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='3.5' stroke-linecap='square'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E");
    --logo-filter: invert(1); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --bg-2: #141414; --bg-3: #1f1f1f; --line: #262626; --line-2: #3a3a3a;
  --text: #f5f5f5; --muted: #9a9a9a; --accent: #f5f5f5; --accent-ink: #0a0a0a; --inv-muted: #5c5c5c;
  --shadow: rgba(245,245,245,.08); --placeholder: #5c5c5c; --scrim: rgba(10,10,10,.82);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --chevron-inv: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='3.5' stroke-linecap='square'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E");
  --logo-filter: invert(1); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
::selection { background: var(--text); color: var(--bg); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border: var(--rule); border-radius: 0;
  background: var(--bg); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
  white-space: nowrap; transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
.btn:hover { background: var(--bg-2); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--line-2); }
.btn-primary:hover { background: var(--accent); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--text); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--text); }
.btn-danger { background: var(--bg); border-style: dashed; }
.btn-danger.solid { background: var(--accent); color: var(--accent-ink); border-style: solid; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--text); }
.btn-lg { min-height: 50px; padding: 0 20px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.icon-btn { width: 38px; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }

input[type=text], input[type=email], input[type=search], select {
  min-height: 40px; padding: 0 12px; border: var(--rule); border-radius: 0; background: var(--bg);
  appearance: none; -webkit-appearance: none; width: 100%;
}
input::placeholder { color: var(--placeholder); }
input:focus, select:focus { outline: 0; box-shadow: 3px 3px 0 var(--text); }
select { background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; cursor: pointer; }

.kicker { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.marks {
  --m: 12px; --t: 1.5px; --c: var(--text);
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--m) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--t) var(--m) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--m) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--t) var(--m) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--m) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--m) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--m) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--m) no-repeat;
}

/* ---------- Sign-in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden; }
.signin::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background-image: var(--gridlines); background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  animation: pan 30s linear infinite;
}
.signin::after {
  content: ""; position: absolute; right: -10%; bottom: -15%; width: 60%; height: 70%; z-index: -1;
  background-image: var(--halftone); background-size: 9px 9px; opacity: .35;
  -webkit-mask-image: radial-gradient(circle at 70% 70%, #000, transparent 62%); mask-image: radial-gradient(circle at 70% 70%, #000, transparent 62%);
}
@keyframes pan { to { background-position: 40px 40px; } }
.signin-card { width: min(420px, 100%); background: var(--bg); padding: 34px 28px 28px; border: var(--rule); box-shadow: 8px 8px 0 var(--shadow); }
.signin-card .logo { margin-bottom: 26px; }
.signin-card h1 { font: 800 clamp(34px, 8vw, 44px)/.95 var(--display); letter-spacing: -.045em; margin: 0 0 12px; }
.signin-card h1 em { font-style: normal; background: var(--text); color: var(--bg); padding: 0 .08em; }
.signin-card p { margin: 0 0 24px; color: var(--muted); }
.signin-stack { display: grid; gap: 12px; }
.or { display: flex; align-items: center; gap: 12px; font: 600 11px/1 var(--mono); color: var(--muted); letter-spacing: .1em; }
.or::before, .or::after { content: ""; flex: 1; height: 1.5px; background: var(--line-2); }
.gsi-slot { min-height: 44px; display: flex; justify-content: center; }
.btn-apple { display: flex; align-items: center; justify-content: center; gap: 10px; width: 320px; max-width: 100%; margin: 0 auto; background: var(--text); color: var(--bg); border-color: var(--text); text-decoration: none; }
.btn-apple:hover { opacity: .9; }
.signin-foot { margin-top: 22px; font: 500 11.5px/1.5 var(--mono); color: var(--muted); }
.signin-card p.signin-foot { margin-bottom: 0; }
.legal { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.legal a { font: 600 11.5px/1.6 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.legal a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Shell ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; font: 800 19px/1 var(--display); letter-spacing: -.04em; text-decoration: none; }
.logo img { width: 26px; height: 26px; filter: var(--logo-filter); }
.app { height: 100%; display: grid; grid-template-rows: var(--top) 1fr; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: var(--rule);
  background: var(--bg); position: relative; z-index: 20;
}
.topbar .search { flex: 1; max-width: 560px; position: relative; margin-left: 12px; }
.topbar .search input { padding-left: 38px; background: var(--bg-2); border-color: var(--bg-2); }
.topbar .search input:focus { background: var(--bg); border-color: var(--text); }
.topbar .search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.account { position: relative; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 800 15px/1 var(--display); border: 0; cursor: pointer; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--bg); border: var(--rule);
  box-shadow: 5px 5px 0 var(--shadow); padding: 6px; z-index: 40; animation: pop .14s ease;
}
.dropdown .who { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown .who b { display: block; }
.dropdown .who span { font: 500 12px var(--mono); color: var(--muted); word-break: break-all; }
.dropdown button, .dropdown a { display: flex; color: var(--text); text-decoration: none; font-size: 14.5px; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; background: none; border: 0; text-align: left; cursor: pointer; }
.dropdown button:hover, .dropdown a:hover, .dropdown [role=menuitem]:focus-visible { background: var(--bg-2); }
.dropdown [role=menuitem]:focus-visible { outline-offset: -2px; }
.dropdown [role=menuitem] svg { width: 16px; height: 16px; flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

.body { display: grid; grid-template-columns: var(--side) 1fr; min-height: 0; }
.sidebar { border-right: var(--rule); overflow-y: auto; display: flex; flex-direction: column; background: var(--bg); }
.nav { padding: 14px 10px 6px; display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; min-height: 36px;
  border: 1.5px solid transparent; background: none; text-align: left; cursor: pointer; font-size: 14px; text-decoration: none;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--bg-2); }
.nav-item.active { background: var(--accent); color: var(--accent-ink); }
.nav-item.drop-hover, .tile.drop-hover, .row.drop-hover { outline: 2px dashed var(--text); outline-offset: -3px; background: var(--bg-2); color: var(--text); }
.nav-item .count { margin-left: auto; font: 500 11px var(--mono); opacity: .7; }
.nav-sep { height: 1.5px; background: var(--line); margin: 8px 10px; }
.tree { padding: 0 10px; }
.tree-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 14px; border-left: 1px dashed var(--line-2); margin-left: 17px; }
.tree-row { display: flex; align-items: center; }
.tree-row .twist { width: 22px; height: 30px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--muted); flex: none; }
.tree-row .twist svg { width: 12px; height: 12px; transition: transform .15s; }
.tree-row .twist.open svg { transform: rotate(90deg); }
.tree-row .twist.none { visibility: hidden; }
.tree-row .nav-item { min-height: 30px; padding: 4px 8px; font-size: 13.5px; }
.tree-row .nav-item span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.storage { margin-top: auto; padding: 16px; border-top: var(--rule); display: grid; gap: 10px; }
.storage .line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.storage b { font: 700 13px var(--mono); }
.meter { height: 10px; border: var(--rule); position: relative; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--text); width: var(--w, 0%); transition: width .8s cubic-bezier(.5,0,.2,1); }
.meter::after { content: ""; position: absolute; inset: 0; left: var(--w, 0%); background-image: var(--hatch); opacity: .22; transition: left .8s cubic-bezier(.5,0,.2,1); }
.meter.full i { background-image: repeating-linear-gradient(135deg, var(--text) 0 4px, var(--bg) 4px 7px); background-size: 20px 20px; animation: march 1s linear infinite; }
@keyframes march { to { background-position: 10px 0; } }
.wallet-mini { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border: 1.5px dashed var(--line-2); }
.wallet-mini b { font: 700 15px var(--mono); }
.wallet-mini span { display: block; font: 500 11px var(--mono); color: var(--muted); }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.main-head { padding: 16px 20px 0; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 34px; }
.crumbs button { background: none; border: 0; cursor: pointer; padding: 2px 4px; font: 800 22px/1.1 var(--display); letter-spacing: -.035em; }
.crumbs button.dim { color: var(--muted); font-weight: 700; }
.crumbs button:hover { text-decoration: underline; text-underline-offset: 4px; }
.crumbs .sep { font: 500 18px var(--mono); color: var(--line-2); }
.crumbs h1 { margin: 0; font: 800 22px/1.1 var(--display); letter-spacing: -.035em; padding: 2px 4px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-bottom: 1.5px solid var(--line); }
.toolbar .grow { flex: 1; }
.toolbar select { width: auto; min-height: 38px; font-size: 13.5px; }
.seg { display: inline-flex; border: var(--rule); }
.seg button { width: 36px; height: 35px; display: grid; place-items: center; background: var(--bg); border: 0; cursor: pointer; }
.seg button + button { border-left: var(--rule); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg svg { width: 16px; height: 16px; }
.selbar { background: var(--accent); color: var(--accent-ink); border-bottom-color: var(--accent); animation: slide-down .16s ease; }
.selbar .btn { background: transparent; color: var(--accent-ink); border-color: var(--accent-ink); box-shadow: none; }
.selbar .btn:hover { background: var(--accent-ink); color: var(--accent); }
.selbar .count { font: 700 13px var(--mono); margin-right: 6px; }
@keyframes slide-down { from { transform: translateY(-6px); opacity: 0; } }
.upload-menu { position: relative; }
.upload-menu .dropdown { left: 0; right: auto; }

.content { flex: 1; overflow-y: auto; padding: 18px 20px 120px; }
.section-label { margin: 2px 0 10px; display: flex; align-items: center; gap: 10px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; margin-bottom: 26px; }
.tile {
  position: relative; border: 1.5px solid var(--line-2); background: var(--bg); cursor: default; user-select: none;
  display: flex; flex-direction: column; transition: border-color .12s, transform .12s, box-shadow .12s; outline: none;
}
.tile:hover { border-color: var(--text); }
.tile:focus-visible { box-shadow: 4px 4px 0 var(--text); border-color: var(--text); }
.tile.selected { border-color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--bg-2); position: relative; overflow: hidden; display: grid; place-items: center; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); opacity: 0; transition: opacity .3s, filter .3s; }
.tile .thumb img.loaded { opacity: 1; }
.tile:hover .thumb img, .tile.selected .thumb img { filter: none; }
.glyph { font: 800 15px/1 var(--mono); letter-spacing: .04em; border: var(--rule); padding: 8px 9px; background: var(--bg); position: relative; z-index: 1; }
.thumb.k-video { background-image: var(--hatch); background-size: 10px 10px; background-color: var(--bg-2); }
.thumb.k-video::before, .thumb.k-video::after { content: ""; position: absolute; left: 0; right: 0; height: 6px; background: repeating-linear-gradient(90deg, transparent 0 6px, var(--text) 6px 13px, transparent 13px 19px); opacity: .5; }
.thumb.k-video::before { top: 5px; } .thumb.k-video::after { bottom: 5px; }
.thumb.k-image { background-image: var(--halftone); background-size: 8px 8px; }
.thumb.k-folder { background: var(--bg); }
.thumb .play { position: absolute; z-index: 2; width: 34px; height: 34px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.thumb .play svg { width: 14px; height: 14px; }
.tile .meta { padding: 9px 10px 10px; border-top: 1.5px solid var(--line); min-width: 0; }
.tile .name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .sub { font: 500 11px/1.5 var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* file versions: "3 versions" badge; the versions list in its dialog */
.vbadge { display: inline-block; margin-top: 4px; padding: 1px 6px; border: 1.5px solid var(--text); background: var(--bg); color: var(--text); font: 600 10px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .06em; cursor: pointer; white-space: nowrap; }
.vbadge:hover { background: var(--text); color: var(--bg); }
.list .nm .vbadge { margin: 0 0 0 8px; flex: none; }
.versions { display: grid; border: var(--rule); }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.vrow:last-child { border-bottom: 0; }
.vrow > div { display: grid; gap: 2px; min-width: 0; }
.tile .check {
  position: absolute; top: 8px; left: 8px; z-index: 3; width: 22px; height: 22px; border: var(--rule); background: var(--bg);
  display: grid; place-items: center; opacity: 0; transition: opacity .12s; cursor: pointer; padding: 0;
}
.tile:hover .check, .tile.selected .check, .has-selection .tile .check { opacity: 1; }
.tile.selected .check, .row.selected .check { background: var(--accent) var(--check) center / 14px no-repeat; }
.tile.folder .thumb svg.folder-ico { width: 54px; height: 54px; }
.tile.folder .meta { border-top-style: dashed; }

/* List */
.list { border: var(--rule); margin-bottom: 26px; }
.row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 96px 120px 150px; align-items: center; gap: 10px;
  padding: 0 12px; min-height: 44px; border-bottom: 1px solid var(--line); user-select: none; outline: none;
}
.row:last-child { border-bottom: 0; }
.row.head { min-height: 36px; background: var(--bg-2); font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: var(--rule); }
.row.head button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-align: left; }
.row.head button.on { color: var(--text); }
.row:not(.head):hover { background: var(--bg-2); }
.row:focus-visible { box-shadow: inset 3px 0 0 var(--text); background: var(--bg-2); }
.row.selected { background: var(--bg-3); box-shadow: inset 3px 0 0 var(--text); }
.row .check { width: 20px; height: 20px; border: var(--rule); background: var(--bg); padding: 0; cursor: pointer; }
.row .nm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .nm .g { font: 700 9.5px/1 var(--mono); border: 1.5px solid var(--text); padding: 4px 4px; width: 38px; text-align: center; flex: none; }
.row .nm .g.f { border-style: dashed; }
.row .nm .g.pic { padding: 0; height: 28px; overflow: hidden; background: var(--bg-2); }
.row .nm .g.pic img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1); opacity: 0; transition: opacity .3s, filter .3s; }
.row .nm .g.pic img.loaded { opacity: 1; }
.row:hover .g.pic img, .row.selected .g.pic img { filter: none; }
.row .nm span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.row .c { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Empty + skeleton */
.empty { display: grid; place-items: center; text-align: center; padding: 60px 16px; }
.empty .art { width: 150px; height: 110px; margin: 0 auto 22px; position: relative; padding: 14px; }
.empty .art div { width: 100%; height: 100%; background-image: var(--hatch); opacity: .25; animation: march 2.4s linear infinite; background-size: 20px 20px; }
.empty h2 { font: 800 26px/1.05 var(--display); letter-spacing: -.04em; margin: 0 0 8px; }
.empty p { margin: 0 0 20px; color: var(--muted); max-width: 30em; }
.skel { background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tile.sk { border-color: var(--line); }
.tile.sk .thumb { background: none; }
.tile.sk .meta i { display: block; height: 10px; margin: 3px 0 6px; }
.load-more { display: flex; justify-content: center; padding: 10px 0 30px; }

/* ---------- Wallet page ---------- */
.wallet { max-width: 1000px; }
.wallet h2 { font: 800 clamp(26px, 5vw, 38px)/1 var(--display); letter-spacing: -.045em; margin: 0 0 6px; }
.wallet h2 em { font-style: normal; background: var(--text); color: var(--bg); padding: 0 .08em; }
.wallet .lede { color: var(--muted); margin: 0 0 22px; max-width: 40em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--rule); margin-bottom: 28px; }
.stats > div { padding: 16px; border-right: var(--rule); }
.stats > div:last-child { border-right: 0; }
.stats b { display: block; font: 800 clamp(22px, 4vw, 30px)/1 var(--mono); letter-spacing: -.04em; }
.stats span { display: block; margin-top: 8px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats .inv { background: var(--accent); color: var(--accent-ink); }
.stats .inv span { color: var(--inv-muted); }
.block { margin-bottom: 30px; }
.block > .kicker { margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.block > .kicker::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.topups { display: flex; flex-wrap: wrap; gap: 10px; }
.topups .btn { min-width: 96px; font-family: var(--mono); font-size: 16px; min-height: 48px; }
.ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border: var(--rule); }
.rung { position: relative; padding: 14px 12px; min-height: 130px; border-right: var(--rule); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.rung:last-child { border-right: 0; }
.rung::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--h); background-image: var(--hatch); opacity: .14; animation: level 1s cubic-bezier(.5,0,.2,1) both; }
@keyframes level { from { height: 0; } }
.rung > * { position: relative; }
.rung .gb { font: 800 24px/1 var(--mono); letter-spacing: -.05em; }
.rung .gb small { font-size: 12px; letter-spacing: 0; margin-left: 2px; }
.rung .pr { font: 700 15px/1 var(--display); margin-top: 8px; }
.rung .pr small { font: 500 11px var(--sans); color: var(--muted); }
.rung.current { background: var(--accent); color: var(--accent-ink); }
.rung.current::before { display: none; }
.rung.current .pr small { color: var(--inv-muted); }
.rung .you { position: absolute; top: 10px; left: 12px; font: 700 10px/1 var(--mono); letter-spacing: .08em; border: 1.5px solid currentColor; padding: 4px 5px; }
@media (max-width: 760px) { .ladder { grid-template-columns: repeat(2, 1fr); } .rung { border-bottom: var(--rule); } .rung:nth-child(2n) { border-right: 0; } }
.addon { border: var(--rule); padding: 20px; display: grid; gap: 16px; grid-template-columns: 1fr auto; align-items: start; position: relative; }
.addon::before { content: ""; position: absolute; top: 0; right: 0; width: 90px; height: 90px; background-image: var(--halftone); background-size: 7px 7px; opacity: .25; pointer-events: none; }
.addon h3 { font: 800 22px/1.1 var(--display); letter-spacing: -.035em; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag { font: 700 10.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; border: var(--rule); padding: 5px 6px; }
.tag.solid { background: var(--accent); color: var(--accent-ink); }
.tag.dash { border-style: dashed; }
.addon ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.addon li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; color: var(--muted); font-size: 14px; }
.addon li::before { content: ""; width: 8px; height: 8px; border: 1.5px solid var(--text); margin-top: 6px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; background: none; border: 0; padding: 0; font: 600 13px var(--mono); }
.switch .track { width: 46px; height: 26px; border: var(--rule); position: relative; background: var(--bg); transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; background: var(--text); transition: transform .2s cubic-bezier(.5,1.6,.4,1), background .2s; }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .track::after { transform: translateX(20px); background: var(--accent-ink); }
.note { font: 500 12px/1.5 var(--mono); color: var(--muted); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding: 12px 14px; border: 1.5px dashed var(--line-2); }
.setting > div { display: grid; gap: 4px; min-width: 0; }
.setting b { font: 700 15px var(--sans); }
.cur-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.seg.cur { flex-wrap: wrap; }
.seg.cur button { width: auto; padding: 0 12px; font: 600 13px var(--mono); white-space: nowrap; }
.seg.cur select { min-height: 35px; border: 0; border-left: var(--rule); font: 600 13px var(--mono); width: auto; }
.seg.cur select:focus { box-shadow: none; outline: 2px solid var(--text); outline-offset: -4px; }
.seg.cur select.on { background-color: var(--accent); color: var(--accent-ink); background-image: var(--chevron-inv); }
.seg.cur select option { background: var(--bg); color: var(--text); }
.cur-note { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--text); background: var(--bg-2); font: 500 12.5px/1.5 var(--mono); }
.ladder.approx .pr { font-size: 13.5px; }

/* ---------- Upload panel ---------- */
.uploads {
  position: fixed; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); z-index: 30;
  background: var(--bg); border: var(--rule); box-shadow: 6px 6px 0 var(--shadow); animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.uploads header { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; background: var(--accent); color: var(--accent-ink); }
.uploads header b { font: 700 13px var(--display); flex: 1; }
.uploads header .mono { font-size: 11.5px; opacity: .8; }
.uploads header button { background: none; border: 0; color: inherit; width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer; }
.uploads header button svg { width: 16px; height: 16px; }
.uploads .overall { height: 4px; background: var(--bg-3); position: relative; }
.uploads .overall i { position: absolute; inset: 0 auto 0 0; background: var(--text); width: var(--w, 0%); transition: width .3s; }
.uploads ul { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.uploads li { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.uploads li:last-child { border-bottom: 0; }
.uploads li .n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .s { grid-column: 1; font: 500 11px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .bar { grid-column: 1 / -1; height: 5px; border: 1px solid var(--text); position: relative; overflow: hidden; }
.uploads li .bar i { position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: var(--text); transition: width .25s; }
.uploads li.hashing .bar i { background-image: var(--hatch); background-color: transparent; background-size: 10px 10px; animation: march .8s linear infinite; }
.uploads li.done .bar, .uploads li.error .bar, .uploads li.cancelled .bar { display: none; }
.uploads li .x { grid-row: 1 / 3; grid-column: 2; width: 28px; height: 28px; border: 1.5px solid var(--line-2); background: var(--bg); display: grid; place-items: center; cursor: pointer; }
.uploads li .x svg { width: 12px; height: 12px; }
.uploads li .st { grid-row: 1 / 3; grid-column: 2; font: 700 10px var(--mono); letter-spacing: .06em; padding: 4px 5px; border: 1.5px solid var(--text); }
.uploads li.done .st { background: var(--accent); color: var(--accent-ink); }
.uploads li.error .st, .uploads li.cancelled .st { border-style: dashed; }
.uploads.collapsed ul, .uploads.collapsed .overall { display: none; }

/* ---------- Drop overlay ---------- */
.drop {
  position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; pointer-events: none;
  animation: fade .12s ease;
}
.drop .box { width: min(520px, calc(100vw - 32px)); padding: 46px 24px; text-align: center; background: var(--bg); border: 2px dashed var(--text); }
.drop .box.marks { --m: 22px; animation: breathe 1.4s ease-in-out infinite; }
@property --m { syntax: "<length>"; inherits: false; initial-value: 12px; }
@keyframes breathe { 50% { --m: 34px; } }
.drop h2 { font: 800 30px/1 var(--display); letter-spacing: -.04em; margin: 0 0 8px; }
.drop p { margin: 0; color: var(--muted); font: 500 13px var(--mono); }
@keyframes fade { from { opacity: 0; } }

/* ---------- Dialogs ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: grid; place-items: center; padding: 16px; animation: fade .14s ease; }
.dialog { width: min(460px, 100%); background: var(--bg); border: var(--rule); box-shadow: 8px 8px 0 var(--shadow); animation: pop .16s ease; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.dialog header { padding: 18px 20px 0; }
.dialog h2 { font: 800 24px/1.05 var(--display); letter-spacing: -.04em; margin: 0; }
.dialog .db { padding: 12px 20px 4px; overflow-y: auto; }
.dialog .db p { margin: 0 0 12px; color: var(--muted); }
.dialog footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 20px 20px; }
.dialog label.f { display: grid; gap: 6px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.dialog label.f input { text-transform: none; letter-spacing: 0; font: 500 15px var(--sans); }
.picker { border: var(--rule); max-height: 260px; overflow-y: auto; }
.picker button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg); text-align: left; cursor: pointer; font-size: 14px; }
.picker button:last-child { border-bottom: 0; }
.picker button:hover { background: var(--bg-2); }
.picker button.on { background: var(--accent); color: var(--accent-ink); }
.picker button svg { width: 15px; height: 15px; flex: none; }
.dialog .big { font: 800 40px/1 var(--mono); letter-spacing: -.05em; margin: 4px 0 10px; }
/* ---------- Account ---------- */
.account-page { max-width: 760px; }
.account-page h2 { margin-bottom: 22px; }
.facts { margin: 0; border: var(--rule); }
.facts > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { font: 600 11px/1.9 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.facts dd.mono { font: 600 14px var(--mono); }
.inline-link { font: 600 12px var(--mono); color: var(--text); text-underline-offset: 3px; }
.account-page .setting:first-of-type { margin-top: 0; }
.account-page .setting .note { max-width: 46em; }
.ledger { list-style: none; margin: 0; padding: 0; border: var(--rule); }
.ledger li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.ledger li:last-child { border-bottom: 0; }
.ledger .lt { display: grid; gap: 2px; min-width: 0; }
.ledger .lt b { font-weight: 600; }
.ledger .lt > span { font: 500 11.5px var(--mono); color: var(--muted); }
.ledger .la { font: 700 15px var(--mono); white-space: nowrap; }
.ledger li.in .la { background: var(--text); color: var(--bg); padding: 2px 6px; }
.legal-row { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; }
.legal-row a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-underline-offset: 3px; }
.legal-row a svg { width: 14px; height: 14px; }
.danger-zone .setting { border-color: var(--text); }
.danger-note { border: 1.5px dashed var(--text); padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; background: #0a0a0a; color: #f5f5f5; display: grid; grid-template-rows: auto 1fr auto; animation: fade .15s ease; }
.lightbox header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1.5px solid #262626; }
.lightbox header .t { flex: 1; min-width: 0; }
.lightbox header .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox header .t span { font: 500 11.5px var(--mono); color: #9a9a9a; }
.lightbox .btn { background: transparent; color: #f5f5f5; border-color: #f5f5f5; box-shadow: none; }
.lightbox .btn:hover { background: #f5f5f5; color: #0a0a0a; }
.lightbox .stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 16px 64px; overflow: hidden; }
.lightbox .stage img, .lightbox .stage video { max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); object-fit: contain; display: block; }
.lightbox .stage iframe { height: calc(100vh - 150px); height: calc(100dvh - 150px); }
.lightbox .stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.lightbox .nav-arrow { position: absolute; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border: 1.5px solid #f5f5f5; background: #0a0a0a; color: #f5f5f5; display: grid; place-items: center; cursor: pointer; }
.lightbox .nav-arrow:hover { background: #f5f5f5; color: #0a0a0a; }
.lightbox .nav-arrow svg { width: 18px; height: 18px; }
.lightbox .prev { left: 12px; } .lightbox .next { right: 12px; }
.lightbox .card { text-align: center; padding: 30px; border: 1.5px dashed #5c5c5c; }
.lightbox .card .glyph { background: #0a0a0a; border-color: #f5f5f5; color: #f5f5f5; display: inline-block; font-size: 22px; margin-bottom: 16px; }
.lightbox footer { padding: 10px 16px; border-top: 1.5px solid #262626; font: 500 11.5px var(--mono); color: #9a9a9a; text-align: center; }
.spinner { width: 34px; height: 34px; border: 2px solid #3a3a3a; border-top-color: #f5f5f5; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toasts / banners ---------- */
.toasts { position: fixed; left: 50%; translate: -50% 0; bottom: 18px; z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: calc(100vw - 32px); }
.toast { pointer-events: auto; background: var(--accent); color: var(--accent-ink); padding: 11px 14px; font-size: 14px; font-weight: 550; box-shadow: 4px 4px 0 var(--line-2); max-width: 520px; display: flex; gap: 12px; align-items: center; animation: rise .2s ease; }
.toast.err { background: var(--bg); color: var(--text); border: 1.5px dashed var(--text); box-shadow: 4px 4px 0 var(--shadow); }
.toast.err::before { content: "!"; font: 800 14px var(--mono); }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 700; padding: 0; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: var(--bg); border-bottom: 1.5px dashed var(--text); text-align: center; padding: 8px 16px; font: 600 12px var(--mono); }

/* ---------- Add to Home Screen hint (iPhone Safari) ---------- */
.a2hs {
  position: fixed; left: 50%; translate: -50% 0; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 80;
  width: min(440px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px;
  background-color: var(--bg); border: var(--rule); box-shadow: 5px 5px 0 var(--shadow); animation: rise .2s ease;
}
.a2hs img { width: 40px; height: 40px; flex: none; }
.a2hs p { margin: 0; flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; }
.a2hs p > b { display: block; }
.a2hs p span { color: var(--muted); }
.a2hs p span b { color: var(--text); font-weight: 600; }
.a2hs .ico { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --side: 280px; }
  .body { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); z-index: 25; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 8px 0 0 var(--shadow); }
  .sidebar.open { transform: none; }
  .side-scrim { position: fixed; inset: var(--top) 0 0 0; z-index: 24; background: var(--scrim); }
  .topbar .search { margin-left: 0; }
  .topbar .logo .word { display: none; }
  .row { grid-template-columns: 30px minmax(0, 1fr) 80px; }
  .row .c.d, .row .c.w { display: none; }
}
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .main-head { padding: 14px 16px 0; }
  .toolbar { padding: 12px 16px; }
  .content { padding: 14px 16px 120px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .toolbar .lbl { display: none; }
  .toolbar .btn { padding: 0 11px; }
  .stats { grid-template-columns: 1fr; }
  .stats > div { border-right: 0; border-bottom: var(--rule); }
  .stats > div:last-child { border-bottom: 0; }
  .addon { grid-template-columns: 1fr; }
  .setting { flex-direction: column; align-items: stretch; }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
  .ledger li { padding: 10px 12px; }
  .lightbox .stage { padding: 12px; }
  .lightbox .nav-arrow { top: auto; bottom: 12px; translate: 0 0; }
  .crumbs button, .crumbs h1 { font-size: 19px; }
  .uploads { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
