/*
 * Copyright (c) 2026 Zion Nursery & Primary School, Kovaipudur
 * SPDX-License-Identifier: MIT
 * Date: 06-Nov-2026
 */
:root {
    --bg: #f6f7f9;
    --panel: #fff;
    --text: #1d2433;
    --muted: #6b7280;
    --line: #e4e7ec;
    --hover: #f0f2f5;
    --accent: #2563eb;
    --accent-text: #fff;
    --soft: #e8f0fe;
    --danger: #d92d20;
    --danger-soft: #fdecea;
    --shadow: 0 8px 30px rgba(16, 24, 40, .12);
    --r: 10px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121418;
        --panel: #1b1e24;
        --text: #e6e8ec;
        --muted: #9aa1ad;
        --line: #2c313a;
        --hover: #252a32;
        --accent: #5b8def;
        --soft: #22314d;
        --danger: #f97066;
        --danger-soft: #3a2020;
        --shadow: 0 8px 30px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

small,
.muted {
    color: var(--muted);
}

.grow {
    flex: 1;
}

[hidden] {
    display: none !important;
}

.i {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Buttons & inputs */
.btn,
.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: inherit;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.btn {
    height: 36px;
    padding: 0 14px;
}

.btn.sm,
.icon-btn.sm {
    height: 28px;
    padding: 0 8px;
    font-size: 13px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    justify-content: center;
    color: var(--muted);
}

.icon-btn.sm {
    width: 28px;
}

.btn.primary {
    background: var(--accent);
    color: var(--accent-text);
}

.btn.primary:hover {
    filter: brightness(1.08);
}

.btn.ghost {
    border-color: var(--line);
    background: var(--panel);
}

.btn.ghost:hover,
.icon-btn:hover {
    background: var(--hover);
    color: var(--text);
}

.btn.danger {
    background: var(--danger);
    color: #fff;
}

.btn.danger-ghost {
    color: var(--danger);
    border-color: var(--line);
    background: var(--panel);
}

.btn.danger-ghost:hover {
    background: var(--danger-soft);
}

input,
textarea,
select {
    font: inherit;
    color: inherit;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: transparent;
}

input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    margin: 0;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
}

a.brand {
    color: inherit;
}

.logo {
    width: 28px;
    height: 28px;
    display: block;
}

/* Login */
body.login {
    display: grid;
    place-items: center;
    padding: 16px;
}

.card {
    width: 100%;
    max-width: 360px;
    background: var(--panel);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
}

.card label {
    display: grid;
    gap: 6px;
    font-weight: 500;
}

.card .btn {
    justify-content: center;
}

.card>a {
    text-align: center;
    font-size: 13px;
}

.error {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
}

/* App layout */
body:not(.login) {
    display: grid;
    grid-template-columns: 240px 1fr;
}

#side {
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    height: 100vh;
    position: sticky;
    top: 0;
}

#side .brand {
    padding: 0 8px;
}

#side nav {
    display: grid;
    gap: 2px;
}

#side nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
}

#side nav a:hover {
    background: var(--hover);
}

#side nav a.on {
    background: var(--soft);
    color: var(--accent);
}

#quota {
    margin-top: auto;
    padding: 0 8px;
    display: grid;
    gap: 6px;
}

.qbar {
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.qbar i {
    display: block;
    height: 100%;
    background: var(--accent);
}

.qbar i.warn {
    background: #f79009;
}

.qbar i.crit {
    background: var(--danger);
}

#scrim {
    display: none;
}

main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
}

#top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

#menuBtn {
    display: none;
}

#search {
    flex: 1;
    max-width: 560px;
}

#search input {
    background: var(--bg);
    border-color: transparent;
    padding: 9px 14px;
    border-radius: 20px;
}

.user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--soft);
    color: var(--accent);
    font-weight: 700;
}

/* Toolbar / selection bar */
#bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    min-height: 58px;
    flex-wrap: wrap;
}

.crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 16px;
    font-weight: 600;
    min-width: 0;
    flex: 1;
}

.crumbs a {
    color: var(--muted);
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.crumbs a:hover {
    background: var(--hover);
    color: var(--text);
}

.crumbs span {
    padding: 2px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sep {
    color: var(--muted);
    font-style: normal;
    opacity: .6;
}

.tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sort {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--muted);
}

.sort select {
    width: auto;
    border: 0;
    background: none;
    padding: 6px 4px;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
}

.sort option {
    background: var(--panel);
    color: var(--text);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 12px;
    border-radius: 20px;
    background: var(--soft);
    color: var(--accent);
    font-weight: 500;
}

.selbar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    background: var(--soft);
    border-radius: 12px;
    padding: 4px 10px;
}

.selbar b {
    margin-left: 4px;
}

.selbar .icon-btn {
    color: var(--text);
}

.selbar .icon-btn.danger {
    color: var(--danger);
}

/* File area */
#files {
    flex: 1;
    overflow: auto;
    padding: 0 20px 80px;
    outline: none;
}

#files.drop-target {
    box-shadow: inset 0 0 0 2px var(--accent);
    background: var(--soft);
    border-radius: 12px;
}

.it {
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.it.drop-target {
    outline: 2px solid var(--accent);
    background: var(--soft) !important;
}

.name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    color: var(--accent);
    margin-left: 6px;
    vertical-align: -3px;
}

.badge .i {
    width: 14px;
    height: 14px;
}

.empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 80px 20px;
    color: var(--muted);
    text-align: center;
}

.empty .i {
    width: 48px;
    height: 48px;
    stroke-width: 1.4;
    opacity: .5;
}

.empty p {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}

.ficon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    flex: none;
    color: #fff;
    background: var(--c, #98a2b3);
}

.ficon b {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.ficon.c-folder,
.ficon.c-person {
    background: none;
    color: var(--c);
}

.ficon.c-folder .i,
.ficon.c-person .i {
    width: 28px;
    height: 28px;
    fill: currentColor;
    fill-opacity: .25;
}

.c-folder {
    --c: #e0a100;
}

.c-person {
    --c: var(--accent);
}

.c-image {
    --c: #12b76a;
}

.c-video {
    --c: #f04438;
}

.c-audio {
    --c: #9e77ed;
}

.c-pdf {
    --c: #d92d20;
}

.c-text {
    --c: #667085;
}

.c-code {
    --c: #0ba5ec;
}

.c-archive {
    --c: #b54708;
}

.c-doc {
    --c: #2e90fa;
}

.c-sheet {
    --c: #16b364;
}

.c-slides {
    --c: #ef6820;
}

.c-model {
    --c: #0e9384;
}

/* List layout */
.list .hdr,
.list .it {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 110px 190px;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
}

.list.extra .hdr,
.list.extra .it {
    grid-template-columns: 28px minmax(0, 1fr) minmax(0, 200px) 110px 190px;
}

.list .hdr {
    height: 38px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 1;
}

.list .hdr [data-sort] {
    cursor: pointer;
}

.list .hdr .on {
    color: var(--text);
}

.list .it {
    height: 52px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}

.list .it:hover {
    background: var(--hover);
}

.list .it.sel {
    background: var(--soft);
}

.list .nm {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.list .tx {
    display: grid;
    min-width: 0;
}

.list .tx .sub {
    display: none;
}

.list .ex,
.list .sz,
.list .dt {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grid layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    align-content: start;
    padding-top: 4px;
}

.grid .it {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 8px 8px 10px;
    display: grid;
    gap: 2px;
    transition: box-shadow .15s;
}

.grid .it:hover {
    box-shadow: var(--shadow);
}

.grid .it.sel {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    background: var(--soft);
}

.grid .th {
    position: relative;
    height: 120px;
    border-radius: 7px;
    background: var(--bg);
    display: grid;
    place-items: center;
    overflow: hidden;
    margin-bottom: 6px;
}

.grid .th .ficon {
    width: 48px;
    height: 58px;
    border-radius: 6px 16px 6px 6px;
}

.grid .th .ficon b {
    font-size: 11px;
}

.grid .th .ficon.c-folder .i,
.grid .th .ficon.c-person .i {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
}

.grid .th img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg);
}

.grid .snip {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 30px 10px 8px;
    font: 10px/1.35 ui-monospace, monospace;
    color: var(--muted);
    white-space: pre-wrap;
    overflow: hidden;
    background: var(--panel);
}

.grid .play {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    padding-left: 2px;
}

.grid .name {
    font-weight: 500;
    padding: 0 2px;
}

.grid .sub {
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grid .ck {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    opacity: 0;
    transition: opacity .1s;
}

.grid .it:hover .ck,
.grid .it.sel .ck,
.grid:has(.sel) .ck {
    opacity: 1;
}

@media (hover: none) {
    .grid .ck {
        opacity: 1;
    }
}

/* Floating UI */
#menu {
    position: fixed;
    z-index: 50;
    min-width: 200px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 6px;
}

#menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
}

#menu button:hover {
    background: var(--hover);
}

#menu button.danger {
    color: var(--danger);
}

#toasts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    z-index: 100;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.toast {
    background: #1d2433;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    white-space: pre-line;
    animation: pop .15s;
}

.toast.bad {
    background: var(--danger);
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

#uploads {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 14px;
    z-index: 40;
    display: grid;
    gap: 10px;
}

#uploads .row {
    display: flex;
    align-items: center;
    gap: 10px;
}

#uploads .row b {
    flex: 1;
}

.prog {
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.prog i {
    display: block;
    height: 100%;
    background: var(--accent);
    transition: width .2s;
}

/* Dialogs */
dialog {
    border: 0;
    border-radius: 14px;
    padding: 0;
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
    width: min(420px, calc(100vw - 32px));
}

dialog::backdrop {
    background: rgba(16, 24, 40, .45);
}

#dlg.wide {
    width: min(600px, calc(100vw - 32px));
}

#dlg form {
    padding: 22px;
    display: grid;
    gap: 12px;
}

#dlg h3 {
    margin: 0 0 4px;
    font-size: 17px;
}

#dlg p {
    margin: 0;
}

#dlg .acts {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

#dlg label {
    font-weight: 500;
}

#dlg .check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.publink {
    display: flex;
    gap: 8px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px 3px 10px;
    border-radius: 14px;
    background: var(--soft);
    color: var(--accent);
    font-weight: 500;
}

.tag button {
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
}

.picker .crumbs {
    font-size: 14px;
    margin-bottom: 8px;
}

.plist {
    border: 1px solid var(--line);
    border-radius: 8px;
    height: 280px;
    overflow: auto;
    padding: 4px;
}

.plist a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
}

.plist a:hover {
    background: var(--hover);
}

.plist .i {
    color: #e0a100;
}

.plist p {
    padding: 10px;
    margin: 0;
}

pre.errors {
    margin: 0;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    font-size: 12px;
}

/* Pinned to the edges rather than sized in vh: on mobile 100vh is taller than the visible area
   (browser toolbars), and a centred modal then overflows top and bottom, clipping the header. */
#viewer {
    inset: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: #0f1115;
    color: #e6e8ec;
    display: none;
    flex-direction: column;
}

#viewer[open] {
    display: flex;
}

#viewer header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #181b21;
}

#viewer header .btn.ghost {
    background: transparent;
    border-color: #333a45;
}

#viewer header .btn.ghost:hover,
#viewer .icon-btn:hover {
    background: #262b33;
    color: #fff;
}

#viewer .ttl {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#viewer .ttl b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#viewer .ttl .ficon {
    width: 26px;
    height: 26px;
}

.stage {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
}

.stage .content {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 16px 64px;
    min-height: 0;
    overflow: auto;
}

.stage img,
.stage video {
    max-width: 100%;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    object-fit: contain;
}

.stage audio {
    width: min(600px, 100%);
}

.stage iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    border-radius: 6px;
}

.stage .code {
    place-self: stretch;
    margin: 0;
    padding: 16px;
    background: #181b21;
    color: #e6e8ec;
    border: 1px solid #2c313a;
    border-radius: 8px;
    font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
    tab-size: 4;
    resize: none;
    outline: none;
}

.stage .none {
    display: grid;
    place-items: center;
    gap: 14px;
    color: #9aa1ad;
}

.stage .none .ficon {
    width: 64px;
    height: 76px;
    border-radius: 8px 18px 8px 8px;
}

.nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.nav:hover {
    background: rgba(255, 255, 255, .2);
}

.nav.prev {
    left: 12px;
}

.nav.next {
    right: 12px;
}

/* Info panel (i): the file's details beside the preview; a bottom sheet on small screens */
#viewer .icon-btn.on {
    background: #2d3540;
    color: #fff;
}

.vinfo {
    width: 320px;
    flex: none;
    overflow: auto;
    background: #181b21;
    border-left: 1px solid #2c313a;
    font-size: 13px;
}

#viewer .vinfo header {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 8px 8px 16px;
    justify-content: space-between;
}

.vinfo section {
    padding: 4px 16px 12px;
}

.vinfo h3 {
    margin: 8px 0 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9aa1ad;
}

.vinfo dl {
    display: grid;
    grid-template-columns: minmax(80px, max-content) minmax(0, 1fr);
    gap: 6px 12px;
    margin: 0;
}

.vinfo dt {
    color: #9aa1ad;
}

.vinfo dd {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.vinfo > p {
    padding: 0 16px;
}

.stage:has(.vinfo:not([hidden])) .nav.next {
    right: 332px;
}

/* Plugin previews: a notice bar, then a scrolling body (document page or spreadsheet grid) */
.stage .pview {
    place-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    min-width: 0;
}

.notice {
    padding: 8px 12px;
    border-radius: 8px;
    background: #3a3220;
    color: #f5d48a;
    font-size: 13px;
}

.pbody {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-radius: 6px;
}

.doc {
    max-width: 850px;
    min-height: 100%;
    margin: 0 auto;
    padding: 48px 56px;
    background: #fff;
    color: #1d2433;
    font: 15px/1.5 Calibri, Carlito, "Segoe UI", system-ui, sans-serif;
    overflow-wrap: break-word;
}

.doc p {
    margin: 0 0 .6em;
    min-height: 1em;
}

.doc h1,
.doc h2,
.doc h3 {
    margin: .8em 0 .4em;
    line-height: 1.25;
}

.doc table {
    border-collapse: collapse;
    margin: 0 0 .8em;
    max-width: 100%;
}

.doc td,
.doc th {
    border: 1px solid #c8ccd4;
    padding: 4px 8px;
    vertical-align: top;
}

.doc td p,
.doc li > p {
    margin: 0;
}

.doc img {
    max-width: 100%;
    height: auto;
}

.doc a {
    color: #1a56db;
    text-decoration: underline;
}

.doc .ph {
    display: inline-block;
    padding: 1px 8px;
    border: 1px dashed #b0b6c0;
    border-radius: 4px;
    color: #6b7280;
    font-size: 12px;
}

.doc hr {
    border: 0;
    border-top: 1px dashed #c8ccd4;
    margin: 1.2em 0;
}

.sheets {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.sheets .tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: none;
    padding-bottom: 6px;
}

.sheets .tabs button {
    flex: none;
    padding: 6px 12px;
    border: 1px solid #333a45;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.sheets .tabs button.on {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.sheet {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #fff;
    border-radius: 6px;
}

.sheet > p {
    padding: 12px;
    margin: 0;
}

.grid-table {
    border-collapse: collapse;
    color: #1d2433;
    font-size: 13px;
    background: #fff;
}

.grid-table td,
.grid-table th {
    border: 1px solid #dde1e7;
    padding: 3px 8px;
    min-width: 60px;
    max-width: 360px;
    height: 24px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    vertical-align: top;
    text-align: left;
}

.grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.grid-table th {
    background: #f1f3f6;
    color: #6b7280;
    font-weight: 500;
    text-align: center;
}

.grid-table tbody th {
    position: sticky;
    left: 0;
    min-width: 44px;
}

/* Small screens */
@media (max-width: 800px) {
    body:not(.login) {
        grid-template-columns: 1fr;
    }

    #side {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 60;
        width: 260px;
        transform: translateX(-100%);
        transition: transform .2s;
        box-shadow: var(--shadow);
    }

    .nav-open #side {
        transform: none;
    }

    .nav-open #scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(0, 0, 0, .35);
    }

    #menuBtn {
        display: inline-flex;
    }

    #top,
    #bar {
        padding-left: 12px;
        padding-right: 12px;
    }

    #files {
        padding: 0 12px 80px;
    }

    .uname,
    .btn span,
    .sort select+.icon-btn {
        display: none;
    }

    .btn {
        padding: 0 10px;
    }

    .crumbs {
        flex-basis: 100%;
    }

    .tools {
        margin-left: auto;
    }

    .list .hdr {
        display: none;
    }

    .list .it,
    .list.extra .it {
        grid-template-columns: 28px minmax(0, 1fr);
        height: 60px;
    }

    .list .ex,
    .list .sz,
    .list .dt {
        display: none;
    }

    .list .tx .sub {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .grid .th {
        height: 100px;
    }

    .stage .content {
        padding: 8px;
    }

    .doc {
        padding: 20px 16px;
    }

    .nav {
        top: auto;
        bottom: 16px;
        transform: none;
    }

    .vinfo {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 3;
        width: auto;
        max-height: 55%;
        border-left: 0;
        border-top: 1px solid #2c313a;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
    }

    .stage:has(.vinfo:not([hidden])) .nav.next {
        right: 12px;
    }
}