
:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #15111d;
  --sidebar: #1a1423;
  --surface: #211a2c;
  --raised: #2a2137;
  --line: #42364f;
  --text: #f6f0ff;
  --muted: #c0b3ce;
  --accent: #c5a5ff;
  --accent-bg: #392951;
  --on-accent: #24143a;
  --ok: #a4e6c1;
  --danger: #ffc0cd;
  --radius: .9rem;
  background: var(--canvas);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; min-height: 100vh; }
[hidden], .hidden { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.55rem); line-height: 1.15; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.08rem; line-height: 1.4; }
h3 { font-size: 1rem; overflow-wrap: anywhere; }
p { line-height: 1.55; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:where(a, button, summary) { -webkit-tap-highlight-color: transparent; }
svg { flex: 0 0 auto; }
code { color: var(--accent); font-size: .92em; overflow-wrap: anywhere; }

.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; z-index: 20; inset: .75rem auto auto .75rem; padding: .7rem 1rem;
  background: var(--accent); color: var(--on-accent); border-radius: .55rem;
}

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 2.65rem; padding: .55rem .85rem; border: 1px solid transparent;
  border-radius: .6rem; font: inherit; font-size: .92rem; font-weight: 700;
  line-height: 1.25; text-decoration: none; color: var(--on-accent);
  background: var(--accent); cursor: pointer;
}
button:hover, .button:hover { background: #dcc8ff; color: var(--on-accent); }
button:disabled { cursor: default; opacity: .48; }
button.secondary, .button.secondary {
  border-color: var(--line); background: var(--raised); color: var(--text);
}
button.secondary:hover, .button.secondary:hover { border-color: var(--accent); background: var(--accent-bg); }
button.danger { color: var(--danger); }
button.small, .button.small { min-height: 2.35rem; padding: .42rem .7rem; font-size: .84rem; }
.icon-button { min-width: 2.4rem; padding: .3rem .6rem; font-size: 1.25rem; }

label { display: grid; gap: .32rem; min-width: 0; color: var(--muted); font-weight: 600; font-size: .875rem; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 2.65rem; padding: .56rem .65rem;
  border: 1px solid var(--line); border-radius: .6rem;
  background: var(--canvas); color: var(--text); font: inherit; font-size: 1rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .78; }
input[readonly] { background: var(--raised); }
input[type="checkbox"] { width: 1.05rem; min-height: 1.05rem; flex: 0 0 auto; accent-color: var(--accent); }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: .48rem; }
.stack { display: grid; gap: .85rem; align-content: start; min-width: 0; }
.stack > :is(button, .button) { justify-self: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; min-width: 0; }
.card { min-width: 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card + .card { margin-top: .75rem; }
.columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: .9rem; }
.share-columns { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.account-grid { margin-top: .9rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .45rem .75rem; min-width: 0; }
.section-head h2 { display: inline-flex; align-items: center; gap: .45rem; }
.section-head + .sub { margin: .4rem 0 .55rem; }
.sub { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: .77rem; }
.pill, .connection {
  display: inline-flex; align-items: center; gap: .38rem; padding: .22rem .53rem;
  border-radius: 999px; background: var(--raised); color: var(--muted);
  font-weight: 650; font-size: .74rem; line-height: 1.3;
}
.pill.good, .connection[data-state="online"] { color: var(--ok); background: #203b31; }
.pill.warn, .connection[data-state="offline"], .connection[data-state="medion"] { color: var(--danger); background: #432735; }
.connection::before { content: ""; width: .44rem; height: .44rem; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.notice {
  margin: 0 0 .9rem; padding: .65rem .85rem; border-radius: .65rem; border: 1px solid var(--line);
  background: var(--accent-bg); color: var(--text); overflow-wrap: anywhere;
}
.notice.error { color: var(--danger); background: #3d2431; border-color: #714653; }

.app-shell { display: grid; grid-template-columns: 13rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; align-self: start;
  display: grid; align-content: start; gap: 1.35rem; padding: 1.05rem .75rem;
  background: var(--sidebar); border-right: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .62rem; min-width: 0;
  color: var(--text); font-size: .97rem; line-height: 1.2; font-weight: 750; text-decoration: none;
}
.brand > span:last-child { overflow-wrap: anywhere; }
.brand-mark {
  width: 2.18rem; height: 2.18rem; border-radius: .7rem; display: grid; place-items: center;
  flex: 0 0 auto; background: var(--accent-bg); color: var(--accent);
}
.brand-mark svg { width: 1.25rem; height: 1.25rem; }
.side-nav { display: grid; gap: .24rem; min-width: 0; }
.nav-link {
  display: flex; align-items: center; gap: .55rem; min-width: 0; min-height: 2.7rem;
  padding: .55rem .7rem; color: var(--muted); border: 1px solid transparent; border-radius: .62rem;
  font-weight: 650; font-size: .9rem; text-decoration: none;
}
.nav-link svg { width: 1.12rem; height: 1.12rem; }
.nav-link:hover { background: var(--raised); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-bg); border-color: #6a5290; color: var(--text); }
.nav-link[aria-current="page"] svg { color: var(--accent); }
.workspace, .shared-workspace { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; min-height: 3.95rem; padding: .55rem clamp(.8rem, 2.8vw, 2rem);
  border-bottom: 1px solid var(--line); background: var(--sidebar);
}
.mobile-brand { display: none; }
.content { width: 100%; max-width: 83rem; margin-inline: auto; padding: 1.45rem clamp(.85rem, 2.8vw, 2rem) 2rem; min-width: 0; }
.page-head { display: grid; gap: .35rem; margin: 0 0 1.1rem; }
.page-head p { color: var(--muted); max-width: 72ch; }
.command-search, .file-search { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.command-search { max-width: 26rem; width: 100%; }
.command-search svg { color: var(--muted); width: 1.1rem; height: 1.1rem; }
.command-search input { flex: 1 1 0; }
.account-menu { margin-left: auto; position: relative; flex: 0 0 auto; }
.account-menu summary {
  display: flex; align-items: center; gap: .48rem; border-radius: .6rem; padding: .2rem .35rem;
  max-width: min(14rem, 42vw); cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
.account-menu summary:hover, .account-menu[open] summary { background: var(--raised); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; }
.chevron { color: var(--muted); font-size: 1rem; flex: 0 0 auto; }
.account-popover {
  position: absolute; z-index: 2; top: calc(100% + .45rem); right: 0; width: 11rem;
  display: grid; gap: .4rem; padding: .65rem; border: 1px solid var(--line);
  background: var(--surface); border-radius: .75rem; box-shadow: 0 .5rem 1.5rem #0c0814aa;
}
.account-popover p { padding: .2rem .35rem; }
.account-popover form button { width: 100%; justify-content: flex-start; }
.avatar {
  width: 2.05rem; height: 2.05rem; flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: .68rem; background: #453264; color: #efe3ff; font-size: .78rem; font-weight: 800;
}
.avatar-large { width: 3.25rem; height: 3.25rem; font-size: 1.05rem; }
.avatar-ocean { background: #30465d; color: #ddf1ff; }
.avatar-forest { background: #25483b; color: #dbffed; }
.avatar-rose { background: #583348; color: #ffe4f0; }
.avatar-amber { background: #554327; color: #ffedc5; }
.identity { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.identity strong, .identity small { display: block; overflow-wrap: anywhere; }
.identity small { color: var(--muted); font-size: .8rem; margin-top: .16rem; }
.shared-workspace { max-width: 83rem; margin-inline: auto; }

.storage-overview {
  display: grid; justify-items: start; gap: .7rem; margin-bottom: 1rem;
  background: linear-gradient(115deg, #322343, var(--surface) 72%);
}
.storage-overview .section-head { width: 100%; }
.storage-overview p { color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .65rem; }
.quick {
  display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; gap: .6rem;
  min-width: 0; padding: .72rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none;
}
.quick:hover { border-color: var(--accent); background: var(--raised); }
.quick strong, .quick small { display: block; }
.quick strong { overflow-wrap: anywhere; }
.quick small { margin-top: .12rem; color: var(--muted); font-size: .76rem; }
.tile-icon { width: 2.35rem; height: 2.35rem; display: grid; place-items: center; border-radius: .7rem; color: var(--accent); background: var(--accent-bg); }
.tile-icon svg { width: 1.2rem; height: 1.2rem; }
.quick-arrow { color: var(--accent); font-size: 1.35rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; padding: .27rem; margin: 0 0 .9rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--sidebar); }
.tabs .nav-link { min-height: 2.32rem; padding: .35rem .58rem; font-size: .83rem; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.stat { display: grid; gap: .12rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); }
.stat strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .78rem; }
.search { display: flex; align-items: end; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 .9rem; }
.search label:first-child { flex: 1 1 11rem; }
.search label { flex: 1 1 8rem; }
.search > a { align-self: center; font-size: .85rem; }
.user-list { display: grid; gap: .45rem; }
.user-item { border: 1px solid var(--line); border-radius: .65rem; min-width: 0; }
.user-item summary { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; padding: .55rem; cursor: pointer; list-style: none; }
.user-item summary::after { content: "›"; color: var(--accent); margin-left: auto; font-size: 1.3rem; }
.user-item[open] summary::after { transform: rotate(90deg); }
.user-item summary:hover { background: var(--raised); border-radius: .64rem; }
.user-item .identity { flex: 1 1 8.5rem; }
.user-body { border-top: 1px solid var(--line); padding: .7rem; }
.rights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .8rem; margin-top: .8rem; }
.rights-grid .card { margin-top: 0; }
.settings-form { max-width: 45rem; }
[data-copy-feedback]:empty { display: none; }

.auth-wrap {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: stretch;
  width: min(55rem, calc(100% - 1.8rem)); margin: clamp(1.5rem, 7vh, 4.5rem) auto;
  border: 1px solid var(--line); border-radius: 1.1rem; overflow: hidden;
}
.auth-brand {
  display: grid; align-content: space-between; gap: 1rem; padding: clamp(1rem, 4vw, 2rem);
  background: linear-gradient(155deg, #2a1e3b, #21182e);
}
.auth-brand .hero-art { display: grid; place-items: center; min-height: 7rem; color: var(--accent); }
.auth-brand .hero-art svg { width: min(36%, 6rem); height: auto; }
.auth-brand-copy strong { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.035em; line-height: 1.2; }
.auth-brand-copy p { color: var(--muted); margin-top: .6rem; }
.auth-main { min-width: 0; padding: clamp(1rem, 3.8vw, 2rem); background: var(--surface); }
.auth-main .card { padding: 0; border: 0; }
.auth-main > form + form { margin-top: .85rem; }
.password-field { display: flex; align-items: center; gap: .4rem; }
.password-field input { flex: 1 1 0; }

.file-workspace { min-width: 0; }
.file-tools { display: grid; gap: .7rem; padding: .72rem; }
.file-toolbar, .file-options { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem .65rem; }
.file-search { flex: 1 1 14rem; }
.file-search input { flex: 1 1 0; }
.file-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.file-actions { flex: 0 1 auto; }
.file-options { padding-top: .62rem; border-top: 1px solid var(--line); }
.file-filters, .file-view-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .28rem; min-width: 0; }
.file-view-controls select { width: auto; max-width: 100%; min-height: 2.15rem; padding: .3rem .45rem; font-size: .88rem; }
.filter-button, .segmented button {
  padding: .34rem .52rem; min-height: 2.05rem; border: 1px solid transparent;
  color: var(--muted); background: transparent; font-size: .81rem; font-weight: 650;
}
.filter-button:hover, .segmented button:hover { color: var(--text); background: var(--raised); }
.filter-button[aria-pressed="true"], .segmented button[aria-pressed="true"] { background: var(--accent-bg); color: var(--text); border-color: #6a5290; }
.segmented { display: inline-flex; align-items: center; gap: .12rem; padding: .12rem; border: 1px solid var(--line); border-radius: .65rem; }
.file-location { display: grid; gap: .4rem; margin: .75rem 0 .5rem; }
.breadcrumbs, .file-state { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; gap: .25rem .45rem; }
.breadcrumbs { color: var(--muted); font-size: .84rem; }
.breadcrumbs button { min-height: 2rem; padding: .24rem .36rem; background: none; color: var(--accent); }
.breadcrumbs button:hover { background: var(--accent-bg); color: var(--text); }
.breadcrumbs [aria-current="location"] { overflow-wrap: anywhere; }
.file-state { justify-content: space-between; }
.file-state p { color: var(--muted); font-size: .83rem; }
.file-area { display: grid; gap: .55rem; min-width: 0; }
.file-area.grid-view { grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.3rem), 1fr)); }
.file-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: .72rem; background: var(--surface); }
.file-card:hover { background: var(--raised); }
.file-open {
  display: grid; justify-content: stretch; align-items: center; justify-items: start; gap: .22rem;
  width: 100%; min-width: 0; height: 100%; border: 0; padding: .6rem; background: transparent; color: var(--text);
  text-align: start; font-weight: 600;
}
.file-open:hover { background: transparent; color: var(--text); }
.file-open:focus-visible { outline-offset: -3px; }
.file-thumb {
  width: 100%; display: grid; place-items: center; aspect-ratio: 2.15;
  border-radius: .5rem; background: var(--accent-bg); color: var(--accent); overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.type-icon { font-size: 1.3rem; font-weight: 750; line-height: 1; }
.file-name { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .91rem; }
.file-meta, .file-date { color: var(--muted); font-size: .75rem; font-weight: 500; }
.grid-view .file-date { display: none; }
.more-button {
  position: absolute; top: .85rem; right: .85rem; min-width: 2rem; min-height: 2rem; padding: .25rem;
  background: var(--surface); border-color: var(--line); color: var(--text); font-size: 1.02rem;
}
.more-button:hover, .more-button[aria-expanded="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--text); }
.list-view .file-card { display: flex; align-items: stretch; }
.list-view .file-open { grid-template-columns: 2.35rem minmax(0, 1fr) minmax(3.9rem, 6rem) minmax(6rem, 10rem); gap: .55rem; min-height: 3.25rem; }
.list-view .file-thumb { aspect-ratio: 1; }
.list-view .more-button { position: static; align-self: center; flex: 0 0 auto; margin: .35rem .55rem .35rem 0; }
.file-message { display: grid; gap: .36rem; justify-items: start; margin: .65rem 0 0; }

dialog {
  padding: 0; border: 1px solid var(--line); border-radius: .95rem; background: var(--surface); color: var(--text);
  width: min(28rem, calc(100% - 1.2rem)); max-width: none;
}
dialog::backdrop { background: #0c0817c9; }
dialog > .card { border: 0; }
.dialog-head, .preview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .55rem; }
.dialog-actions { justify-content: flex-end; }
.preview-dialog { width: min(61rem, calc(100% - 1rem)); max-height: calc(100dvh - 1rem); }
.preview-header { padding: .65rem .8rem; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.preview-info { display: grid; gap: .15rem; min-width: 0; overflow-wrap: anywhere; }
#previewMeta { color: var(--muted); font-size: .79rem; }
.preview-content { display: grid; place-items: center; min-height: 7rem; background: var(--canvas); padding: .45rem; }
.preview-content :is(img, video) { display: block; max-width: 100%; max-height: 72dvh; }
.preview-content audio { width: min(100%, 32rem); }
.preview-content iframe { width: 100%; min-height: 62dvh; border: 0; background: #eee; }
.preview-unknown { display: grid; justify-items: center; text-align: center; gap: .4rem; padding: 1rem; }
.context-menu {
  position: fixed; z-index: 11; display: grid; min-width: 10rem; max-width: calc(100vw - 1rem);
  max-height: calc(100dvh - 1rem); overflow: auto; padding: .32rem; border: 1px solid var(--line);
  border-radius: .68rem; background: var(--surface); box-shadow: 0 .45rem 1.15rem #0c081499;
}
.context-menu button { justify-content: flex-start; color: var(--text); background: transparent; min-height: 2.3rem; font-weight: 600; }
.context-menu button.danger { color: var(--danger); }
.context-menu button:hover { background: var(--accent-bg); }
.drop-overlay { position: fixed; inset: 0; z-index: 13; display: grid; place-items: center; background: #0d0815bf; pointer-events: none; }
.drop-card { display: grid; gap: .35rem; text-align: center; border-color: var(--accent); }
.drop-card span { color: var(--muted); overflow-wrap: anywhere; }
.upload-panel, .toast-stack { position: fixed; right: .7rem; z-index: 12; width: min(22rem, calc(100vw - 1.4rem)); }
.upload-panel { bottom: .75rem; max-height: min(55dvh, 24rem); overflow: auto; box-shadow: 0 .5rem 1.5rem #0c0814aa; }
.upload-item { margin-top: .6rem; }
.upload-item-head { display: flex; justify-content: space-between; gap: .4rem; font-size: .84rem; }
.upload-item-head span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress { width: 100%; height: .5rem; accent-color: var(--accent); }
.toast-stack { top: 4.4rem; display: grid; gap: .3rem; pointer-events: none; }
.toast { border: 1px solid var(--line); border-radius: .65rem; padding: .55rem .75rem; background: var(--raised); color: var(--text); overflow-wrap: anywhere; }
.toast.error { color: var(--danger); background: #432735; }

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed; z-index: 8; top: auto; bottom: 0; left: 0; right: 0; height: auto;
    padding: .28rem .45rem calc(.28rem + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line);
  }
  .sidebar > .brand { display: none; }
  .side-nav { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .18rem; }
  .side-nav .nav-link { flex-direction: column; justify-content: center; gap: .16rem; padding: .25rem .12rem; min-height: 2.85rem; font-size: .73rem; }
  .side-nav .nav-link svg { width: 1rem; height: 1rem; }
  .mobile-brand { display: inline-flex; }
  .workspace > .content { padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  .upload-panel { bottom: calc(3.8rem + env(safe-area-inset-bottom)); }
  .topbar { gap: .45rem; }
  .topbar .command-search { max-width: 21rem; }
}
@media (max-width: 610px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .content { padding-top: .95rem; }
  .topbar .command-search { display: none; }
  .topbar .brand { max-width: 57vw; font-size: .86rem; }
  .account-name { max-width: 24vw; }
  .account-menu summary { gap: .28rem; }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: .75rem 1rem; }
  .auth-brand :is(.hero-art, .auth-brand-copy) { display: none; }
  .list-view .file-open { grid-template-columns: 2.15rem minmax(0, 1fr) minmax(2.9rem, 4.2rem); gap: .37rem; }
  .list-view .file-date { display: none; }
  .file-area.grid-view { grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.1rem), 1fr)); }
  .stat { padding: .48rem .55rem; }
  .file-actions { width: 100%; }
  .file-actions button { flex: 1 1 auto; min-height: 2.65rem; }
}
