@font-face {
  font-family: Archivo; src: url(/archivo.woff2) format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}
:root {
  --bg: #000;
  --fg: #fff;
  --muted: #a3a3a3;
  --line: rgba(255, 255, 255, .12);
  --line-2: rgba(255, 255, 255, .26);
  --hover: rgba(255, 255, 255, .06);
  --red: #e5121f;      /* fills and strokes; white text on it passes AA */
  --red-text: #ff4d55; /* red text on black */
  --r-panel: 14px;
  --r-ctl: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--fg); overflow-x: hidden;
  font: 15px/1.55 Archivo, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.small-gap { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.meta { display: flex; gap: 4px 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.panel { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px; }
.display, .title, .brand, .stat-n, .ring .lbl b { font-stretch: 125%; }
.display { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; line-height: 1.1; text-wrap: balance; }
.h2 { font-size: 1.35rem; font-weight: 750; }

/* ---------- 3D sheet stack ---------- */
.sheets { --w: 76px; --gap: 7px; position: relative; width: var(--w); height: calc(var(--w) * 1.2); perspective: 600px; flex: none; }
.sheets.lg { --w: 116px; --gap: 11px; }
.sheets.sm { --w: 46px; --gap: 5px; }
.sheets i {
  position: absolute; inset: 0; border-radius: 3px; background: #262626;
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%);
  transform: rotateX(55deg) rotateZ(-38deg) translateZ(calc(var(--z) * var(--gap)));
  transition: transform .2s ease-out, opacity .2s ease-out;
}
.sheets i::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); clip-path: polygon(70% 0, 70% 24%, 100% 24%); }
.sheets i:nth-child(1) { --z: 0; }
.sheets i:nth-child(2) { --z: 1; background: #bdbdbd; }
.sheets i:nth-child(3) { --z: 2; background: var(--red); display: grid; place-items: center; }
.sheets svg { width: 52%; transform: rotate(38deg); fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dz:hover .sheets, .dz:focus-visible .sheets { --gap: 11px; }
.dz.over .sheets { --gap: 16px; }
.intro i { animation: drop .5s ease-out backwards; animation-delay: calc(var(--z) * 90ms); }
@keyframes drop { from { opacity: 0; transform: rotateX(55deg) rotateZ(-38deg) translateZ(90px); } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; border: 1px solid var(--fg); border-radius: var(--r-ctl);
  padding: .62em 1.1em; font: inherit; font-weight: 600; color: #000; background: var(--fg); cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background-color .15s ease-out, border-color .15s ease-out;
}
.btn:hover { background: #d4d4d4; border-color: #d4d4d4; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--hover); border-color: var(--fg); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #c40f1a; border-color: #c40f1a; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-ctl); border: 0;
  background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; flex: none;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.icon-btn:hover { color: var(--fg); background: var(--hover); }
.icon-btn.danger:hover { color: var(--red-text); background: rgba(229, 18, 31, .12); }
.ico { display: inline-grid; place-items: center; }
.ico svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.field { position: relative; display: block; }
.field input, .field select, .sel, .search input {
  width: 100%; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background-color: var(--bg);
  color: var(--fg); font: inherit; appearance: none; transition: border-color .15s ease-out;
}
.field input, .field select { padding: 1.35em .9em .45em; }
.field select, .sel {
  cursor: pointer; padding-right: 2.4em; background-repeat: no-repeat; background-position: right .8em center; background-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.sel { width: auto; padding: .6em 2.4em .6em .9em; }
.field span { position: absolute; left: .95em; top: .95em; color: var(--muted); pointer-events: none; transform-origin: left top; transition: transform .15s ease-out; }
.field input:focus + span, .field input:not(:placeholder-shown) + span, .field select + span { transform: translateY(-.6em) scale(.75); }
.field input:focus, .field select:focus, .sel:focus, .search input:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.search { position: relative; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding: .6em .9em .6em 2.4em; min-width: 200px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92em; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 34px; height: 20px; border-radius: 99px; background: #333; position: relative; flex: none; transition: background-color .15s ease-out; }
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #8a8a8a;
  transition: transform .15s ease-out, background-color .15s ease-out;
}
.switch input:checked + i { background: var(--fg); }
.switch input:checked + i::after { transform: translateX(14px); background: #000; }
.switch input:focus-visible + i { outline: 2px solid var(--fg); outline-offset: 2px; }
.badge { display: inline-flex; padding: 1px 8px; border-radius: 4px; font-size: .8em; font-weight: 600; border: 1px solid var(--line-2); color: var(--fg); }
.badge.off { color: var(--muted); border-style: dashed; }
.badge.admin { color: var(--red-text); border-color: currentColor; }
.tags { gap: 6px; justify-content: center; }

/* ---------- login ---------- */
.center { min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 36px; padding: 24px 16px; }
.login { width: min(360px, 100%); display: grid; gap: 14px; }
.title { font-size: 2.6rem; font-weight: 900; line-height: 1; }
.login .err { color: var(--red-text); min-height: 1.4em; font-size: .9em; }
.login .btn { padding: .8em; }
.unlocked .sheets i:nth-child(3) { transform: rotateX(55deg) rotateZ(-38deg) translateZ(150px); opacity: 0; transition-duration: .45s; }
.unlocked .login { opacity: 0; transition: opacity .3s .15s ease-out; }
.shake { animation: shake .3s; }
@keyframes shake { 25%, 75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }

/* ---------- shell ---------- */
.top {
  position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 32px; min-height: 60px; padding: 0 max(16px, calc((100% - 1200px) / 2));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; text-decoration: none; }
.logo svg { display: block; width: 20px; height: 24px; }
.logo .r { fill: var(--red); }
.logo .rs { stroke: var(--red); }
.nav { display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; align-self: stretch; }
.nav a { position: relative; display: flex; align-items: center; color: var(--muted); text-decoration: none; font-weight: 550; white-space: nowrap; transition: color .15s ease-out; }
.nav a:hover, .nav a.on { color: var(--fg); }
.nav a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--red); }
.who { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar {
  width: 32px; height: 32px; border-radius: var(--r-ctl); display: grid; place-items: center; flex: none;
  font-weight: 700; text-transform: uppercase; border: 1px solid var(--line-2);
}
main { width: min(1200px, calc(100% - 32px)); margin: 32px auto 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.view { animation: fade .2s ease-out; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { position: relative; padding: 0 0 10px; color: var(--muted); text-decoration: none; font-weight: 550; white-space: nowrap; transition: color .15s ease-out; }
.tabs a:hover, .tabs a.on { color: var(--fg); }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--fg); }

/* ---------- upload ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.hero > div { min-width: 0; }
.dz {
  position: relative; display: flex; align-items: center; gap: 32px; min-height: 220px; padding: 32px 40px; width: 100%; height: 100%;
  color: var(--fg); font: inherit; text-align: left; cursor: pointer; border: 1px dashed var(--line-2); border-radius: var(--r-panel); background: transparent;
  transition: background-color .15s ease-out, border-color .15s ease-out;
}
.dz:hover { background: var(--hover); }
.dz.over { background: rgba(229, 18, 31, .08); border: 1px solid var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.dz.off { cursor: not-allowed; }
.dz.off .sheets { opacity: .4; }
.dz-text { display: grid; gap: 8px; }
.usage { display: grid; justify-items: center; align-content: center; gap: 12px; text-align: center; }
.queue { display: grid; gap: 8px; }
.queue:empty { display: none; }
.qitem {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  animation: rise .2s ease-out; transition: opacity .2s ease-out, transform .2s ease-out;
}
.qitem.gone { opacity: 0; transform: translateX(16px); }
.qitem.bad { border-color: var(--red); }
.qitem.bad .meta span:last-child { color: var(--red-text); }
.qring { width: 36px; height: 36px; flex: none; }
.qring circle { fill: none; stroke-width: 3; }
.qring .track { stroke: rgba(255, 255, 255, .14); }
.qring .val { stroke: var(--red); transform: rotate(-90deg); transform-origin: 20px 20px; transition: stroke-dashoffset .2s linear; }
.qring .chk { fill: none; stroke: var(--fg); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
.qitem.ok .val { stroke: var(--fg); }
.qitem.ok .chk { animation: draw .3s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pct { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 3.5em; text-align: right; }

/* ---------- files ---------- */
.files { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.frow { display: flex; align-items: center; gap: 14px; padding: 12px 8px; border-bottom: 1px solid var(--line); transition: background-color .15s ease-out, opacity .2s ease-out, transform .2s ease-out; }
.frow:hover { background: var(--hover); }
.frow.removing { opacity: 0; transform: translateX(16px); }
.frow .name { font-weight: 600; }
.acts { display: flex; gap: 2px; }
.ficon {
  position: relative; width: 30px; height: 38px; flex: none; display: grid; place-items: end center; padding-bottom: 5px;
  background: #262626; border-radius: 2px; font-size: 9px; font-weight: 700; line-height: 1;
  clip-path: polygon(0 0, 66% 0, 100% 26%, 100% 100%, 0 100%);
}
.ficon::after { content: ""; position: absolute; inset: 0; background: #595959; clip-path: polygon(66% 0, 66% 26%, 100% 26%); }
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; text-align: center; }
.empty .sheets { margin-bottom: 8px; }
.files > .empty-li { list-style: none; }

/* ---------- rings, stats, chart ---------- */
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: rgba(255, 255, 255, .1); }
.ring .arc { transition: stroke-dasharray .9s ease-out; }
.ring .a1 { stroke: var(--red); }
.ring .a2 { stroke: rgba(255, 255, 255, .6); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .lbl b { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.stat { padding: 20px 20px 22px; }
.stat:first-child { padding-left: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-n { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: rgba(255, 255, 255, .08); }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar rect { fill: rgba(255, 255, 255, .85); transform-box: fill-box; transform-origin: 50% 100%; animation: grow .5s ease-out backwards; animation-delay: calc(var(--i) * 30ms); transition: fill .15s ease-out; }
.chart .bar.zero rect { fill: rgba(255, 255, 255, .2); }
.chart .bar.today rect { fill: var(--red); }
.chart .bar:hover rect { fill: var(--fg); }
@keyframes grow { from { transform: scaleY(0); } }
.legend { display: grid; gap: 8px; font-size: .92em; font-variant-numeric: tabular-nums; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; }
.legend .c1 { background: var(--red); }
.legend .c2 { background: rgba(255, 255, 255, .6); }
.legend .c3 { background: rgba(255, 255, 255, .1); }
.ubar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 6px; }
.ubar i { display: block; height: 100%; background: var(--fg); transform: scaleX(0); transform-origin: left; transition: transform .8s ease-out; }
.ubar.hot i { background: var(--red); }
.feed { display: grid; max-height: 420px; overflow-y: auto; }
.ev { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 9px; flex: none; background: var(--muted); }
.dot.bad { background: var(--red); }

/* ---------- tables, users ---------- */
.tbl-wrap { position: relative; padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .86em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .15s ease-out; }
tbody tr:hover { background: var(--hover); }
td.n { max-width: 320px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; }
td .row { flex-wrap: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.ucard { display: grid; gap: 16px; align-content: start; }
.ucard.dim { opacity: .55; }
.perms { display: flex; gap: 10px 18px; flex-wrap: wrap; }
.share-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.linkbox { font: inherit; font-size: .88em; padding: 8px 10px; border-radius: var(--r-ctl); background: transparent; border: 1px solid var(--line); color: var(--fg); width: 100%; }

/* ---------- dialog, toast, skeleton ---------- */
.modal {
  padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-panel); background: var(--bg); color: var(--fg);
  width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
}
.modal[open] { animation: pop .16s ease-out; }
.modal::backdrop { background: rgba(0, 0, 0, .75); }
.modal-in { padding: 24px; display: grid; gap: 18px; }
@keyframes pop { from { opacity: 0; transform: scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
#toasts {
  position: fixed; z-index: 100; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; justify-items: end; max-width: calc(100% - 32px);
}
.toast {
  padding: 11px 14px; border-radius: var(--r-ctl); background: var(--fg); color: #000; font-weight: 550; max-width: 380px;
  animation: rise .18s ease-out; transition: opacity .2s ease-out, transform .2s ease-out;
}
.toast.err { background: var(--red); color: #fff; }
.toast.gone { opacity: 0; transform: translateY(6px); }
.skel { height: 96px; border-radius: var(--r-panel); background: rgba(255, 255, 255, .05); animation: pulse 1s ease-in-out infinite alternate; list-style: none; }
@keyframes pulse { to { opacity: .45; } }

@media (max-width: 860px) {
  .hero, .two { grid-template-columns: minmax(0, 1fr); }
  .search { flex: 1; }
  .search input { min-width: 0; }
  .top { flex-wrap: wrap; gap: 0 16px; }
  .brand { min-height: 56px; }
  .nav { order: 3; flex-basis: 100%; min-height: 44px; }
  .who .uname { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .dz { padding: 24px; gap: 18px; min-height: 180px; flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
