:root {
  color-scheme: light;
  --canvas: #f8f9fa;
  --paper: #fff;
  --sidebar: #f0f2f4;
  --ink: #071d2b;
  --muted: #535d68;
  --line: #dce1e6;
  --outline: #76818c;
  --surface-hover: #e9edf0;
  --media-surface: #eceff2;
  --brand: #00b98d;
  --brand-hover: #00ac83;
  --brand-dark: #061b29;
  --brand-bright: #21efc0;
  --accent: #006654;
  --accent-dark: #004b3d;
  --active: #d9f3eb;
  --shadow: #19253236;
  --danger: #8b292e;
  --danger-bg: #f8e9e8;
  --sans: "Aptos", "Segoe UI", sans-serif;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: var(--accent); text-underline-offset: .16em; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5.5vw, 3rem); line-height: 1.12; letter-spacing: -.05em; font-weight: 675; overflow-wrap: anywhere; }
h2 { font-size: 1.23rem; line-height: 1.3; letter-spacing: -.02em; overflow-wrap: anywhere; }
h3 { font-size: .98rem; line-height: 1.4; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.icon { inline-size: 1.2rem; block-size: 1.2rem; flex: none; vertical-align: middle; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 10; inset: .8rem auto auto .8rem; transform: translateY(-200%); background: var(--paper); padding: .5rem .85rem; border-radius: .3rem; }
.skip-link:focus { transform: none; }
.loading { padding: 2rem; color: var(--muted); }
.muted, .hint { color: var(--muted); }
.hint { font-size: .875rem; }
.wrap { overflow-wrap: anywhere; }
.preserve { white-space: pre-wrap; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; }

.brand { display: flex; align-items: center; gap: .7rem; font-size: 1rem; color: var(--ink); font-weight: 680; text-decoration: none; letter-spacing: -.025em; white-space: nowrap; }
.brand img { display: block; width: 2.25rem; height: 2.25rem; }
.brand small { color: var(--muted); margin-inline-start: .2rem; font-size: .75rem; letter-spacing: .03em; }
.auth { min-block-size: 100svh; display: grid; grid-template-columns: minmax(17rem, 1fr) minmax(24rem, 1.3fr); }
.auth-side { background: var(--sidebar); padding: clamp(1.4rem, 5vw, 4rem); display: grid; grid-template-rows: auto 1fr; }
.auth-mark { color: var(--accent); width: min(100%, 24rem); align-self: center; justify-self: center; }
.auth-mark svg { display: block; width: 100%; height: auto; }
.auth-main { display: grid; align-items: center; padding: clamp(1.4rem, 6vw, 6rem); }
.auth-form { width: min(100%, 23rem); margin: 2.8rem auto; }
.auth-form .heading { margin-block-end: 1.8rem; }
.auth-switch { margin-block-start: 1.5rem; font-size: .9rem; }
.auth-form .button { min-width: 8rem; }

.shell { min-height: 100svh; display: grid; grid-template-rows: auto 1fr; }
.app-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; min-height: 4.25rem; gap: .7rem; padding: .52rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.app-header.with-tabs { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.app-header > .brand { justify-self: start; }
.app-tabs { position: relative; display: flex; align-items: center; gap: .18rem; width: max-content; max-width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #5b8291 var(--brand-dark); border-radius: .65rem; padding: .22rem; background: var(--brand-dark); }
.app-tab { display: flex; flex: none; align-items: center; gap: .45rem; min-height: 2.24rem; padding: .36rem .68rem; border-radius: .46rem; font-size: .86rem; font-weight: 645; text-decoration: none; color: var(--paper); white-space: nowrap; }
.app-tab .icon { width: 1.02rem; height: 1.02rem; }
.app-tab:hover { background: #183241; }
.app-tab:focus-visible { outline-color: var(--brand-bright); outline-offset: -2px; }
.app-tab[aria-current="page"] { background: var(--brand-bright); color: var(--ink); }
.app-tab[aria-current="page"]:focus-visible { outline-color: var(--ink); }
.app-tools { display: flex; align-items: center; justify-content: flex-end; gap: .14rem; }
.app-tools .nav-link { width: auto; white-space: nowrap; }
.app-tools .account { padding-inline: .37rem; }
.workspace-shell { min-width: 0; }
.workspace-shell.with-folders { display: grid; grid-template-columns: minmax(11.25rem, 15rem) minmax(0, 1fr); }
.file-sidebar { background: var(--paper); border-right: 1px solid var(--line); padding: 1.25rem .82rem; min-width: 0; }
.file-sidebar .nav-label { margin: 0 0 .43rem .62rem; font-size: .8rem; color: var(--muted); }
.folder-tree { list-style: none; padding: 0; margin: .18rem 0 0; }
.folder-tree .folder-tree { border-inline-start: 1px solid var(--line); margin-inline-start: .8rem; padding-inline-start: .4rem; }
.gallery-shell { height: 100svh; height: 100dvh; grid-template-rows: auto minmax(0, 1fr); }
.gallery-mount { display: flex; min-width: 0; min-height: 0; }
.gallery-mount:focus-visible { outline-offset: -2px; }
.gallery-frame { display: block; border: 0; width: 100%; height: 100%; min-width: 0; background: var(--paper); }
.nav-link { min-height: 2.55rem; width: 100%; padding: .5rem .64rem; display: flex; gap: .62rem; align-items: center; min-width: 0; background: transparent; color: var(--ink); border: 0; border-radius: .4rem; text-decoration: none; text-align: start; font-size: .9rem; font-weight: 560; }
.nav-link:hover { background: var(--surface-hover); }
.nav-link[aria-current] { background: var(--active); color: var(--accent-dark); font-weight: 690; }
.nav-link[aria-current] .icon { color: var(--accent); }
.nav-link span { overflow-wrap: anywhere; min-width: 0; }
.account { min-width: 0; display: flex; align-items: center; gap: .55rem; padding: .3rem .55rem; font-size: .875rem; font-weight: 640; }
.account span:last-child { min-width: 0; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--active); width: 1.7rem; height: 1.7rem; flex: none; font-weight: 690; font-size: .73rem; }
.workspace { min-width: 0; }
.topbar { min-height: 4.3rem; display: flex; gap: 1rem; justify-content: space-between; align-items: center; padding: .6rem clamp(1.25rem, 4.5vw, 4.25rem); border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .32rem .55rem; font-size: .87rem; min-width: 0; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .separator { font-weight: 400; color: var(--outline); }
.workspace-label { color: var(--muted); }
.main { width: min(100%, 82rem); margin: 0 auto; padding: clamp(1.6rem, 4.4vw, 4.1rem) clamp(1.25rem, 4.5vw, 4.25rem) 4.5rem; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.heading > div:first-child { min-width: 0; }
.heading p { color: var(--muted); margin-top: .45rem; overflow-wrap: anywhere; }
.actions, .button-row { display: flex; align-items: center; gap: .52rem; flex-wrap: wrap; }
.heading .actions { justify-content: flex-end; flex: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .48rem; min-height: 2.6rem; padding: .49rem .78rem; border: 1px solid var(--outline); border-radius: .4rem; color: var(--ink); background: var(--paper); text-decoration: none; text-align: center; line-height: 1.25; font-size: .875rem; font-weight: 640; }
.button:hover { background: var(--surface-hover); }
.button.primary { color: var(--ink); background: var(--brand); border-color: var(--accent); }
.button.primary:hover { background: var(--brand-hover); }
.button.quiet { background: transparent; border-color: transparent; }
.button.quiet:hover { background: var(--surface-hover); }
.button.danger { color: var(--danger); border-color: #a44a4a; }
.button.danger:hover { background: var(--danger-bg); }
.button.compact { min-height: 2.25rem; padding: .38rem .6rem; }
.button.icon-only { min-width: 2.6rem; padding: .44rem; }
.button .icon { width: 1.05rem; height: 1.05rem; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .65rem .78rem; border: 1px solid var(--line); border-bottom: 0; border-radius: .6rem .6rem 0 0; background: var(--paper); }
.search { display: flex; align-items: center; gap: .45rem; min-width: 0; flex: 1; }
.search .icon { color: var(--muted); width: 1rem; height: 1rem; }
.search input { min-width: 0; width: min(100%, 18rem); border: 0; padding: .33rem .32rem; color: var(--ink); background: transparent; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.count { font-size: .84rem; color: var(--muted); white-space: nowrap; }
.table-wrap { border: 1px solid var(--line); border-radius: 0 0 .6rem .6rem; overflow: hidden; background: var(--paper); }
.table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
.table .name-col { width: auto; }
.table .type-col { width: 14%; }
.table .size-col { width: 12%; }
.table .date-col { width: 15%; }
.table .action-col { width: 4rem; }
.table :is(td, th) { padding: .64rem .82rem; }
.table th { background: var(--sidebar); color: var(--muted); font-weight: 590; font-size: .78rem; }
.table tbody td { border-top: 1px solid var(--line); }
.table td { font-size: .86rem; vertical-align: middle; }
.table tbody tr:hover { background: var(--canvas); }
.table td:not(:first-child) { color: var(--muted); }
.table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions-cell { text-align: right; padding: .34rem .47rem .34rem 0; }
.file-name { color: var(--ink); text-decoration: none; font-weight: 645; display: flex; align-items: center; gap: .65rem; min-height: 2.45rem; }
.file-name:hover .file-filename { text-decoration: underline; }
.file-filename { overflow-wrap: anywhere; min-width: 0; display: block; }
.file-type { display: grid; place-items: center; background: var(--active); color: var(--accent); border-radius: .31rem; width: 2rem; height: 2.25rem; flex: none; }
.file-secondary { display: none; color: var(--muted); font-size: .78rem; font-weight: 400; }
.empty { background: var(--paper); border: 1px solid var(--line); border-radius: .58rem; padding: 2rem 1.15rem; display: grid; justify-items: center; gap: .36rem; text-align: center; }
.table-wrap .empty { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.empty > .icon { width: 2.25rem; height: 2.25rem; color: var(--accent); margin-bottom: .35rem; }
.empty .button { margin-top: .5rem; }

.section { margin-top: 1.55rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; margin-bottom: .62rem; }
.stack { display: grid; gap: .72rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: .58rem; padding: 1.05rem; min-width: 0; }
.panel > :is(h2,h3) + * { margin-top: .43rem; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(13rem,1fr); gap: 1rem; align-items: start; }
.detail-layout > .stack > .section:first-child { margin-top: 0; }
.properties { display: grid; gap: .48rem; margin: 0; }
.properties div { min-width: 0; }
.properties dt { color: var(--muted); font-size: .78rem; }
.properties dd { margin: 0; font-size: .92rem; overflow-wrap: anywhere; }
.lined-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: .58rem; }
.lined-list > li { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .68rem .88rem; }
.lined-list > li > :first-child { min-width: 0; }
.lined-list > li + li { border-top: 1px solid var(--line); }
.lined-list a { overflow-wrap: anywhere; }
.item-meta { max-width: min(45%, 18rem); text-align: right; }
.media-frame { display: grid; place-items: center; min-height: 7rem; border-radius: .45rem; background: var(--media-surface); overflow: hidden; }
.media-frame :is(img, video) { display: block; max-width: 100%; max-height: 27rem; object-fit: contain; }
.media-frame video { width: 100%; }
.thumbnail { margin-bottom: .58rem; min-height: 9rem; }
.inline-icon { text-decoration: none; display: inline-block; margin-inline-start: .15rem; }
.inline-icon .icon { width: .84rem; height: .84rem; }

.reference-anti-example { display: inline-block; border-radius: .21rem; color: var(--danger); background: var(--danger-bg); padding: .07rem .36rem; font-size: .78rem; font-weight: 645; }
.metadata-details { border: 1px solid var(--line); border-radius: .4rem; padding: .5rem .65rem; }
.metadata-details > summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; font-size: .88rem; font-weight: 650; }
.metadata-details > summary::-webkit-details-marker { display: none; }
.metadata-details[open] > summary .icon { transform: rotate(180deg); }
.metadata-details > .stack { margin-top: .65rem; }

.form { display: grid; gap: .85rem; }
.field { display: grid; gap: .25rem; min-width: 0; }
.field > span:first-child, legend { font-size: .88rem; font-weight: 650; }
.field :is(input,textarea) { width: 100%; min-width: 0; min-height: 2.65rem; color: var(--ink); background: var(--paper); border: 1px solid var(--outline); border-radius: .4rem; padding: .44rem .62rem; }
.field input[type="file"] { padding: .32rem .42rem; }
.field input[type="file"]::file-selector-button { margin-inline-end: .45rem; border: 1px solid var(--outline); border-radius: .25rem; padding: .26rem .48rem; background: var(--sidebar); color: var(--ink); font: inherit; cursor: pointer; }
.field textarea { resize: vertical; min-height: 5rem; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.check { display: flex; align-items: flex-start; gap: .55rem; color: var(--ink); }
.check input { inline-size: 1.12rem; block-size: 1.12rem; flex: none; margin: .17rem 0 0; accent-color: var(--accent); }
.choices { display: grid; gap: .3rem; margin: 0; padding: .5rem .65rem .65rem; min-width: 0; border: 1px solid var(--line); border-radius: .4rem; }
.choices-scroll { display: grid; gap: .3rem; max-height: 11rem; overflow-y: auto; padding: .22rem; }
.form .button-row { margin-top: .22rem; }
.search-form { border-bottom: 1px solid var(--line); padding-bottom: .65rem; }
.search-form .button { min-height: 2.15rem; padding-block: .34rem; border-color: var(--outline); background: var(--paper); color: var(--ink); }
.search-form .button:hover { background: var(--surface-hover); }
.form-error, .error-box { border: 1px solid #ac6464; background: var(--danger-bg); color: var(--danger); padding: .52rem .67rem; border-radius: .38rem; font-size: .9rem; }
.error-box p + .button { margin-top: .65rem; }
dialog { width: min(calc(100% - 2rem), 33rem); max-height: calc(100dvh - 2rem); background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: .72rem; padding: 1.3rem; box-shadow: 0 1rem 4rem var(--shadow); }
dialog::backdrop { background: #17232d99; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .85rem; }
.notice:empty { display: none; }
.notice { position: fixed; z-index: 9; inset: auto 1rem 1rem auto; width: max-content; max-width: calc(100vw - 2rem); color: var(--paper); background: var(--accent-dark); padding: .65rem .85rem; border-radius: .4rem; box-shadow: 0 .3rem 1.2rem var(--shadow); font-size: .88rem; }

@media (max-width: 61rem) {
  .workspace-shell.with-folders { grid-template-columns: minmax(10rem, 12rem) minmax(0,1fr); }
  .app-tools .nav-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .topbar, .main { padding-inline: 1.5rem; }
  .table .type-col { width: 12%; }
  .table .date-col { width: 17%; }
  .heading .actions { flex: 0 1 auto; }
  .app-header, .app-header.with-tabs { grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; min-height: 0; padding: .46rem .78rem .56rem; }
  .app-tabs { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
  .app-tools { grid-row: 1; grid-column: 2; }
}

@media (max-width: 46rem) {
  .app-tools .nav-link { min-height: 2.45rem; padding-inline: .46rem; }
  .workspace-shell.with-folders { display: block; }
  .file-sidebar { border: 0; border-bottom: 1px solid var(--line); padding: .36rem .67rem; }
  .file-sidebar nav { display: flex; gap: .24rem; align-items: center; max-height: 5.4rem; overflow: auto; }
  .file-sidebar .nav-label { display: none; }
  .file-sidebar .nav-link { flex: none; width: auto; white-space: nowrap; min-height: 2.35rem; }
  .folder-tree, .folder-tree li { display: flex; flex: none; align-items: center; gap: .24rem; margin: 0; }
  .folder-tree .folder-tree { margin-inline-start: 0; padding-inline-start: .2rem; }
  .nav-link .icon { width: 1.04rem; height: 1.04rem; }
  .topbar { min-height: 2.85rem; }
  .topbar, .main { padding-inline: .93rem; }
  .main { padding-top: 1.45rem; }
  .table :is(td, th) { padding-inline: .58rem; }
  .table .action-col { width: 3.25rem; }
  .table .type-col { width: 13%; }
  .table .size-col { width: 17%; }
  .table .date-col { width: 18%; }
  .heading { gap: .7rem; }
  .detail-layout { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-side { display: block; padding: 1rem; border-bottom: 1px solid var(--line); }
  .auth-mark { display: none; }
  .auth-main { align-items: start; padding: 1.25rem; }
}

@media (max-width: 31rem) {
  .heading { flex-wrap: wrap; align-items: start; margin-bottom: 1.08rem; }
  .heading .actions { justify-content: flex-start; }
  .table :is(.table-type, .table-date, .type-col, .date-col) { display: none; }
  .table .size-col { width: 23%; }
  .file-name { gap: .48rem; }
  .file-secondary { display: block; }
  .lined-list > li { align-items: flex-start; flex-wrap: wrap; }
  .notice { inset-block-end: .65rem; inset-inline-end: .65rem; }
}
