/*
 * Personal Drive — design system.
 *
 * Ported from the CMS Dashboard Kit (shadcn "zinc"). Every colour, radius and spacing
 * value is a custom property so re-skinning is a one-line change and dark mode is a
 * single class on <html>. Borders separate surfaces; shadows are reserved for popovers
 * and dialogs.
 */

/* ---------------------------------------------------------------- tokens */
:root {
    --bg: #ffffff;
    --fg: #09090b;
    --card: #ffffff;
    --muted: #f4f4f5;
    --muted-fg: #71717a;
    --border: #e7e7ea;
    --input: #e4e4e7;
    --ring: #18181b;
    --primary: #18181b;
    --primary-fg: #fafafa;
    --secondary: #f4f4f5;
    --accent-bg: #f4f4f5;
    --sidebar-bg: #fafafa;
    --topbar-bg: rgba(255, 255, 255, 0.78);
    --popover: #ffffff;
    --ok: #16a34a;
    --ok-bg: #dcfce7;
    --warn: #d97706;
    --warn-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #2563eb;
    --info-bg: #dbeafe;
    --grid: #eeeef0;
    --shadow: 0 4px 16px rgba(9, 9, 11, 0.08), 0 1px 2px rgba(9, 9, 11, 0.04);
    --pad: 20px;
    --radius: 10px;
    --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

.dark {
    --bg: #09090b;
    --fg: #fafafa;
    --card: #101013;
    --muted: #1b1b1f;
    --muted-fg: #a1a1aa;
    --border: #26262b;
    --input: #26262b;
    --ring: #d4d4d8;
    --primary: #fafafa;
    --primary-fg: #18181b;
    --secondary: #27272a;
    --accent-bg: #1c1c20;
    --sidebar-bg: #0b0b0d;
    --topbar-bg: rgba(9, 9, 11, 0.7);
    --popover: #161619;
    --ok: #4ade80;
    --ok-bg: #0b2818;
    --warn: #fbbf24;
    --warn-bg: #2b2006;
    --danger: #f87171;
    --danger-bg: #300f0f;
    --info: #60a5fa;
    --info-bg: #0b1e3a;
    --grid: #222227;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0 0 10px; }

code,
kbd,
.mono {
    font-family: var(--mono);
    font-size: 0.92em;
}

.num {
    font-variant-numeric: tabular-nums;
}

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- layout */
.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px var(--pad);
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary);
    color: var(--primary-fg);
    display: grid;
    place-items: center;
    flex: 0 0 28px;
}

.brand-name {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav {
    padding: 12px 12px 20px;
    overflow-y: auto;
    flex: 1;
}

.nav-group + .nav-group {
    margin-top: 18px;
}

.nav-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-fg);
    padding: 0 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--muted-fg);
    font-weight: 500;
    min-height: 34px;
}

.nav-item:hover {
    background: var(--accent-bg);
    color: var(--fg);
}

.nav-item.is-active {
    background: var(--accent-bg);
    color: var(--fg);
}

.nav-item .count {
    margin-left: auto;
    font-size: 11px;
    color: var(--muted-fg);
    font-variant-numeric: tabular-nums;
}

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding: 12px;
}

/* Identity and sign-out sit side by side: one is a link to your account, the other is a
   destructive action. Merging them — which this used to do — meant clicking your own
   name logged you out. */
.user-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    flex: 1;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.user-card:hover,
.user-card.is-active {
    background: var(--accent-bg);
}

.user-card .meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-card .name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card .sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--muted-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A role, not a button. It reads as a label because it looks like one. */
.role-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted-fg);
}

/* Sign out is the one control in the sidebar that throws away state, so it turns red on
   approach rather than looking like every other ghost button. */
.sign-out:hover {
    background: var(--danger-bg, #fef2f2);
    color: var(--danger-fg, #dc2626);
}

.dark .sign-out:hover {
    background: #2a1416;
    color: #f87171;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--pad);
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar .spacer {
    flex: 1;
}

.content {
    padding: var(--pad);
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-header .sub {
    color: var(--muted-fg);
    margin: 2px 0 0;
}

.page-header .actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted-fg);
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.breadcrumb a:hover {
    color: var(--fg);
}

/* ---------------------------------------------------------------- surfaces */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--pad);
}

.card.flush {
    padding: 0;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px var(--pad);
    border-bottom: 1px solid var(--border);
}

.card-head .actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

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

.stat-card .label {
    font-size: 12px;
    color: var(--muted-fg);
}

.stat-card .value {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.stat-card .caption {
    font-size: 12px;
    color: var(--muted-fg);
    margin-top: 4px;
}

.icon-chip {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--muted);
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    color: var(--muted-fg);
}

/* ---------------------------------------------------------------- controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--primary);
    color: var(--primary-fg);
    font: inherit;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover { opacity: 0.9; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--fg);
}

.btn-outline {
    background: transparent;
    color: var(--fg);
    border-color: var(--input);
}

.btn-outline:hover { background: var(--accent-bg); }

.btn-ghost {
    background: transparent;
    color: var(--muted-fg);
}

.btn-ghost:hover {
    background: var(--accent-bg);
    color: var(--fg);
}

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

.btn-icon {
    width: 34px;
    padding: 0;
    flex: 0 0 34px;
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.btn-block { width: 100%; }

.input,
.select,
.textarea {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    border-radius: 8px;
    border: 1px solid var(--input);
    background: var(--bg);
    color: var(--fg);
    font: inherit;
    font-size: 13px;
}

.textarea {
    height: auto;
    min-height: 120px;
    padding: 9px 11px;
    line-height: 1.6;
    resize: vertical;
}

.input::placeholder,
.textarea::placeholder { color: var(--muted-fg); }

.field {
    margin-bottom: 14px;
}

.field > label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
}

.field .hint {
    font-size: 11.5px;
    color: var(--muted-fg);
    margin-top: 5px;
}

.field .err {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.check input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

/* ---------------------------------------------------------------- badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 21px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--muted);
    color: var(--muted-fg);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

.badge-outline {
    background: transparent;
    border: 1px solid var(--border);
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    text-align: left;
    font-weight: 500;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-fg);
    padding: 9px var(--pad);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td {
    padding: 11px var(--pad);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--accent-bg); }

table.data td.num,
table.data th.num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.cell-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    min-width: 0;
}

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

.row-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* ---------------------------------------------------------------- progress */
.progress {
    height: 6px;
    border-radius: 999px;
    background: var(--muted);
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.progress.is-warn > span { background: var(--warn); }
.progress.is-danger > span { background: var(--danger); }

/* ---------------------------------------------------------------- feedback */
.alert {
    display: flex;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--muted);
    font-size: 13px;
    margin-bottom: 14px;
}

.alert-ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.alert-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: transparent; color: var(--info); }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted-fg);
}

.empty-state .icon-chip {
    margin: 0 auto 12px;
    width: 42px;
    height: 42px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 11px 14px;
    font-size: 13px;
    max-width: 340px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------------------------------------------------------------- dialog */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.45);
    display: none;
    place-items: center;
    z-index: 80;
    padding: 20px;
}

.dialog-backdrop.is-open { display: grid; }

.dialog {
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: min(460px, 100%);
    padding: var(--pad);
    max-height: 90vh;
    overflow-y: auto;
}

.dialog h3 { margin-bottom: 4px; }

.dialog .dialog-sub {
    color: var(--muted-fg);
    font-size: 13px;
    margin-bottom: 16px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* ---------------------------------------------------------------- auth pages */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--muted);
}

.auth-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
}

.auth-card.wide { width: min(620px, 100%); }

.auth-head {
    text-align: center;
    margin-bottom: 22px;
}

.auth-head .brand-mark {
    margin: 0 auto 12px;
    width: 38px;
    height: 38px;
}

.auth-head .sub {
    color: var(--muted-fg);
    font-size: 13px;
    margin-top: 4px;
}

.steps {
    display: flex;
    gap: 6px;
    margin-bottom: 22px;
}

.steps > span {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: var(--muted);
}

.steps > span.is-done { background: var(--primary); }

.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.code-grid code {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 11px;
    text-align: center;
    letter-spacing: 0.08em;
    font-size: 13px;
}

/* ---------------------------------------------------------------- uploader */
.dropzone {
    border: 1.5px dashed var(--input);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    color: var(--muted-fg);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-hot {
    border-color: var(--ring);
    background: var(--accent-bg);
}

.upload-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.upload-item {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 10px 12px;
}

.upload-item .top {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 7px;
}

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

.upload-item .top .state {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--muted-fg);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- public share */
.share-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--muted);
}

.share-card {
    width: min(520px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    text-align: center;
}

.share-card .file-icon {
    width: 52px;
    height: 52px;
    border-radius: 13px;
    margin: 0 auto 14px;
}

.share-card .filename {
    font-size: 17px;
    font-weight: 600;
    word-break: break-word;
}

.share-card .filesize {
    color: var(--muted-fg);
    font-size: 13px;
    margin-top: 3px;
}

.note-body {
    white-space: pre-wrap;
    text-align: left;
    background: var(--muted);
    border-radius: 9px;
    padding: 14px;
    margin-top: 16px;
    font-size: 13.5px;
    line-height: 1.65;
}

/* ---------------------------------------------------------------- search */
.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 420px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--input);
    border-radius: 8px;
    background: var(--bg);
    color: var(--muted-fg);
}

.topbar-search:focus-within {
    border-color: var(--ring);
}

.topbar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: none;
    color: var(--fg);
    font: inherit;
    font-size: 13px;
}

.topbar-search input::placeholder { color: var(--muted-fg); }

/* Safari draws its own clear button on type=search; it does not fit the kit. */
.topbar-search input::-webkit-search-decoration,
.topbar-search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-excerpt {
    margin-top: 4px;
    padding-left: 38px;
    max-width: 72ch;
}

/* ---------------------------------------------------------------- markdown */
/*
 * Rendered note bodies. The HTML here comes from CommonMark with raw HTML escaped,
 * so the tag set is small and known — no need for a defensive reset.
 */
.markdown {
    white-space: normal;
    font-size: 13.5px;
    line-height: 1.7;
}

.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
    margin: 22px 0 8px;
    line-height: 1.3;
    font-weight: 600;
}

.markdown h1 { font-size: 20px; }
.markdown h2 { font-size: 17px; }
.markdown h3 { font-size: 15px; }
.markdown h4 { font-size: 13.5px; }

.markdown p { margin: 0 0 12px; }

.markdown ul,
.markdown ol {
    margin: 0 0 12px;
    padding-left: 22px;
}

.markdown li { margin-bottom: 4px; }

.markdown a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.markdown code {
    font-family: var(--mono);
    font-size: 12.5px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 5px;
}

.markdown pre {
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 0 0 12px;
}

.markdown pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 12.5px;
}

.markdown blockquote {
    margin: 0 0 12px;
    padding: 2px 0 2px 14px;
    border-left: 3px solid var(--border);
    color: var(--muted-fg);
}

.markdown hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

.markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 12px;
    font-size: 12.5px;
}

.markdown th,
.markdown td {
    border: 1px solid var(--border);
    padding: 6px 9px;
    text-align: left;
}

.markdown th {
    background: var(--muted);
    font-weight: 600;
}

.markdown img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ---------------------------------------------------------------- utility */
.muted { color: var(--muted-fg); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- responsive */
.sidebar-toggle { display: none; }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.45);
    z-index: 35;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-102%);
        transition: transform 0.2s ease;
    }

    .sidebar.is-open { transform: translateX(0); }
    .sidebar-backdrop.is-open { display: block; }
    .sidebar-toggle { display: inline-flex; }
    :root { --pad: 14px; }
}

/* ---------------------------------------------------------------- file grid */

/* Thumbnails are generated on demand and cached, so a grid of photos costs one small
   JPEG each after the first visit. The list view stays the default: it carries the
   checkboxes, sizes and per-row actions, and most folders are not photo albums. */
.view-toggle {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.view-toggle .btn.is-active {
    background: var(--accent-bg);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: var(--pad);
}

.grid-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    background: var(--card);
    transition: border-color .12s ease;
}

.grid-item:hover {
    border-color: var(--muted-fg);
}

.grid-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    background: var(--accent-bg);
}

.grid-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Shown for non-images, and swapped in by the img onerror handler when a thumbnail
   could not be built — a file too large to decode, or a host without GD. */
.grid-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--muted-fg);
}

.grid-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.grid-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-size {
    font-size: 11px;
    color: var(--muted-fg);
}
