:root {
  color-scheme: light;
  --surface: #fff;
  --canvas: #f4f6fa;
  --ink: #1c2333;
  --muted: #596579;
  --line: #e3e8f0;
  --accent: #bd263b;
  --accent-dark: #9d1c30;
  --nav: #182130;
  --nav-active: #30394a;
  --radius: 14px;
  --shadow: 0 1px 2px #17203208, 0 8px 24px #17203206;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
a { color: inherit; }
a, button, input, select { -webkit-tap-highlight-color: #bd263b23; }
:focus-visible { outline: 3px solid #507ad8; outline-offset: 3px; }
button, input, select { font: inherit; }
form { margin: 0; }
p { color: var(--muted); line-height: 1.55; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar {
  height: 4.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .65rem clamp(1rem, 3vw, 2.6rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  white-space: nowrap;
}
.brand strong { display: block; font-size: .91rem; letter-spacing: -.025em; line-height: 1.2; }
.brand strong + span { display: block; font-size: .86rem; color: var(--muted); }
.brandmark {
  width: 2.45rem;
  height: 2.45rem;
  display: inline-grid;
  place-items: center;
  border-radius: .73rem;
  background: linear-gradient(150deg, #d43b50, #b42036);
  box-shadow: 0 3px 7px #92192c36;
}
.brandmark::before {
  content: "";
  width: 1.23rem;
  height: 1.11rem;
  border: 1.6px solid #fff;
  border-radius: .24rem;
  background: linear-gradient(to bottom, transparent 43%, white 43%, white 52%, transparent 52%);
}
.account, .toolbar, .folder-tools, .search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
}
.identity {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .88rem;
  color: var(--muted);
  margin-right: .4rem;
  white-space: nowrap;
}

.layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: calc(100dvh - 4.6rem); }
.sidebar { background: var(--nav); padding: 2rem 1rem; }
.sidebar h2 { color: #b8c4d5; font-weight: 630; font-size: .9rem; letter-spacing: .025em; margin: 0 .8rem .8rem; }
.owner {
  position: relative;
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  min-height: 2.75rem;
  padding: .55rem .8rem;
  margin: .22rem 0;
  border-radius: .55rem;
  color: #e6ecf6;
  font-size: .95rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.owner:hover, .owner.selected { background: var(--nav-active); color: #fff; }
.owner.selected { font-weight: 650; }
.owner.selected::after {
  content: "";
  position: absolute;
  right: .55rem;
  top: calc(50% - .55rem);
  height: 1.1rem;
  width: .2rem;
  border-radius: 3px;
  background: #f16574;
}
.owner .icon { color: #c0ccde; }
.content { min-width: 0; width: 100%; max-width: 95rem; padding: clamp(1.15rem, 3vw, 2.7rem); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .45rem; font-size: .88rem; color: var(--muted); margin-bottom: .55rem; overflow-wrap: anywhere; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current] { font-weight: 650; color: var(--ink); }
.breadcrumb-separator { color: #748096; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 1.18rem; letter-spacing: -.02em; line-height: 1.2; }

.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metrics { display: grid; grid-template-columns: 1.3fr 1fr 1fr; margin-bottom: 1.25rem; }
.metric { display: flex; align-items: flex-start; gap: .8rem; min-width: 0; padding: 1.15rem; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric > div { min-width: 0; width: 100%; }
.metric > div > span { display: block; color: var(--muted); font-size: .88rem; margin-bottom: .27rem; }
.metric strong { display: block; font-size: 1.35rem; font-weight: 670; letter-spacing: -.035em; line-height: 1.22; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-size: .88rem; font-weight: 500; letter-spacing: 0; }
progress {
  display: block;
  width: 100%;
  max-width: 13rem;
  height: .36rem;
  margin-top: .63rem;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: #e6eaf2;
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: #e6eaf2; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.explorer-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .9rem; padding: 1.15rem 1.25rem .8rem; }
.entry-count { display: block; margin-top: .27rem; color: var(--muted); font-size: .875rem; }
.folder-tools { padding: 0 1.25rem .9rem; }
.search { gap: .4rem; }
.search label { position: relative; display: block; }
.search label .icon { position: absolute; top: 50%; left: .72rem; transform: translateY(-55%); color: #66758c; pointer-events: none; }
.search input { width: min(15rem, 68vw); padding-left: 2.18rem; }
.clear-search { color: var(--accent-dark); text-underline-offset: 3px; font-size: .875rem; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.35rem;
  padding: .48rem .72rem;
  border: 1px solid transparent;
  border-radius: .48rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 610;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary { border-color: #ccd5e2; }
.secondary:hover, .subtle:hover { background: #eef2f8; }
.subtle { color: #36455e; }
.action-dialog {
  width: min(29rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 65px #17203242;
}
.action-dialog::backdrop { background: #121b2c75; }
.dialog-content { padding: 1.45rem; }
.dialog-content > p { margin-top: .4rem; overflow-wrap: anywhere; }
.preview-dialog { width: min(68rem, calc(100vw - 2rem)); }
.preview-header, .preview-actions { display: flex; align-items: center; gap: .65rem; }
.preview-header { justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.preview-header h2 { overflow-wrap: anywhere; }
.preview-header p { margin-top: .18rem; font-size: .875rem; }
.preview-actions { flex-wrap: wrap; }
.preview-content {
  display: grid;
  place-items: center;
  min-height: 5.5rem;
  overflow: hidden;
  background: #f4f6fa;
  border: 1px solid var(--line);
  border-radius: .55rem;
}
.preview-content iframe { display: block; width: 100%; height: min(65dvh, 46rem); border: 0; background: white; }
.preview-content img, .preview-content video { max-width: 100%; max-height: 65dvh; object-fit: contain; }
.preview-content audio { width: min(32rem, 90%); margin: 1rem 0; }
.preview-content p { padding: .8rem; text-align: center; }
.dialog-form, .action-menu { margin-top: 1.1rem; }
.dialog-form label { display: grid; gap: .4rem; color: var(--muted); font-size: .9rem; }
.dialog-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; margin-top: 1.25rem; }
.action-menu { display: grid; gap: .44rem; }
.action-menu .button { justify-content: flex-start; }
.dialog-form .drop-zone {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding: 1.2rem .8rem;
  border: 1.5px dashed #98a8c2;
  border-radius: .65rem;
  color: var(--muted);
  background: #f6f9fd;
  cursor: pointer;
  text-align: center;
}
.drop-zone strong { color: var(--ink); font-size: .96rem; }
.drop-zone:hover, .drop-zone.dragging, .drop-zone:focus-within {
  border-color: var(--accent);
  background: #fdf1f4;
}
.dialog-form .upload-overwrite {
  display: flex;
  align-items: flex-start;
  gap: .52rem;
  margin-top: .68rem;
  color: var(--ink);
}
.upload-overwrite input {
  min-height: 0;
  width: 1rem;
  height: 1rem;
  margin: .12rem 0 0;
  accent-color: var(--accent);
}
.upload-summary:empty, .upload-queue:empty { display: none; }
.upload-summary { margin-top: .6rem; font-size: .86rem; }
.upload-queue { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 12rem; overflow: auto; }
.upload-queue li { display: flex; justify-content: space-between; gap: .7rem; padding: .42rem 0; border-top: 1px solid var(--line); }
.upload-queue li > span { min-width: 0; overflow-wrap: anywhere; font-size: .88rem; font-weight: 610; }
.upload-queue small { color: var(--muted); text-align: right; max-width: 60%; font-size: .82rem; }
.upload-queue .uploaded small { color: #205e3b; }
.upload-queue .upload-failed small { color: var(--accent-dark); }
.button:disabled { opacity: .52; cursor: not-allowed; }
.search label { color: var(--muted); font-size: .88rem; }
input, select {
  min-height: 2.35rem;
  min-width: 0;
  width: 100%;
  border: 1px solid #cbd5e3;
  border-radius: .46rem;
  padding: .43rem .63rem;
  font-size: .9rem;
  color: var(--ink);
  background: var(--surface);
}
input::placeholder { color: #627086; }
.tablewrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; vertical-align: middle; padding: .67rem 1rem; border-top: 1px solid var(--line); }
th { background: #f5f7fb; color: #48566e; font-size: .875rem; font-weight: 650; }
th:first-child, td:first-child { padding-left: 1.25rem; }
th:last-child, td:last-child { padding-right: 1.25rem; }
.actions-head, .row-actions { text-align: right; }
.row-actions > .button { margin-right: .2rem; }
tr:hover td { background: #fafcff; }
.entry { display: flex; align-items: center; gap: .72rem; text-decoration: none; min-width: 0; }
.entry:hover .filename { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.preview-trigger {
  width: 100%;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.filename { display: block; font-weight: 650; overflow-wrap: anywhere; }
.entry-meta { display: block; margin-top: .16rem; color: var(--muted); font-size: .85rem; }
.metadata { color: #4f5d73; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { display: grid; justify-items: center; gap: .62rem; padding: 2.55rem 1rem; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.empty strong { font-weight: 600; }
.success { margin-bottom: 1rem; padding: .65rem .85rem; border: 1px solid #c5e6d3; border-radius: .5rem; background: #edf8f1; color: #205e3b; }

.login { width: min(30rem, calc(100% - 2rem)); margin: clamp(2.5rem, 12vh, 7rem) auto; }
.login .card, .welcome { padding: clamp(1.4rem, 4vw, 2.25rem); }
.login .card { border-top: 3px solid var(--accent); }
.login h1, .welcome h1 { margin: .9rem 0 .55rem; }
.login .button { margin-top: 1.1rem; }
.login-card > .file-icon, .welcome > .file-icon { width: 3.1rem; height: 3.1rem; }

.icon { display: inline-block; position: relative; width: .9rem; height: .9rem; flex: 0 0 auto; color: inherit; }
.file-icon { width: 2.22rem; height: 2.22rem; display: inline-grid; flex: 0 0 auto; place-items: center; border-radius: .57rem; background: #edf1fa; color: #455b88; }
.file-icon.folder { background: #fef1d9; color: #886119; }
.file-icon.archive, .file-icon.storage { background: #fbe9ed; color: #a12239; }
.file-icon.shield { background: #fbe9ed; color: #a12239; }
.icon-folder::before, .icon-file::before, .icon-archive::before, .icon-storage::before {
  content: ""; position: absolute; inset: .1rem 0 0; border: 1.5px solid currentColor; border-radius: .14rem;
}
.icon-file::before { inset: 0 .1rem; }
.icon-file::after { content: ""; position: absolute; top: .4rem; left: .3rem; width: .3rem; height: 1px; background: currentColor; box-shadow: 0 .18rem 0 currentColor; }
.icon-folder::before { inset: .24rem 0 .06rem; }
.icon-folder::after { content: ""; position: absolute; top: .11rem; left: 0; width: .35rem; height: .16rem; border: solid currentColor; border-width: 1.5px 1.5px 0; border-radius: .12rem .12rem 0 0; }
.icon-archive::after, .icon-storage::after { content: ""; position: absolute; top: .37rem; left: .13rem; right: .13rem; height: 1px; background: currentColor; }
.icon-storage::after { box-shadow: 0 .24rem 0 currentColor; }
.icon-download { border: solid currentColor; border-width: 0 1.5px 1.5px; border-radius: 0 0 .13rem .13rem; height: .44rem; margin-top: .34rem; }
.icon-download::before { content: ""; position: absolute; width: 1.5px; height: .61rem; bottom: .19rem; left: calc(50% - .75px); background: currentColor; }
.icon-download::after { content: ""; position: absolute; left: calc(50% - .18rem); bottom: .25rem; width: .36rem; height: .36rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.icon-upload { border: solid currentColor; border-width: 0 1.5px 1.5px; border-radius: 0 0 .13rem .13rem; height: .44rem; margin-top: .34rem; }
.icon-upload::before { content: ""; position: absolute; width: 1.5px; height: .66rem; bottom: .18rem; left: calc(50% - .75px); background: currentColor; }
.icon-upload::after { content: ""; position: absolute; left: calc(50% - .18rem); bottom: .42rem; width: .36rem; height: .36rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(225deg); }
.icon-plus::before, .icon-plus::after { content: ""; position: absolute; background: currentColor; border-radius: 1px; }
.icon-plus::before { width: .76rem; height: 1.5px; inset: calc(50% - .75px) auto auto .07rem; }
.icon-plus::after { width: 1.5px; height: .76rem; inset: .07rem auto auto calc(50% - .75px); }
.icon-search { width: .67rem; height: .67rem; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-search::after { content: ""; position: absolute; width: .32rem; height: 1.5px; background: currentColor; top: .53rem; left: .46rem; transform: rotate(45deg); }
.icon-shield { background: currentColor; clip-path: polygon(50% 0, 92% 18%, 88% 64%, 68% 86%, 50% 100%, 32% 86%, 12% 64%, 8% 18%); }
.icon-account::before { content: ""; position: absolute; top: 0; left: .28rem; width: .34rem; height: .34rem; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-account::after { content: ""; position: absolute; bottom: 0; left: .08rem; right: .08rem; height: .36rem; border: 1.5px solid currentColor; border-radius: .4rem .4rem .17rem .17rem; }

@media (max-width: 67rem) {
  .layout { grid-template-columns: 12rem minmax(0, 1fr); }
  .content { padding: 1.4rem; }
}
@media (max-width: 48rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: .63rem .85rem; }
  .sidebar nav { display: flex; align-items: center; gap: .5rem; overflow-x: auto; padding: .15rem; }
  .sidebar h2 { flex: 0 0 auto; font-size: .86rem; margin: 0 .2rem 0 0; }
  .owner { width: auto; padding: .35rem .68rem .35rem .55rem; margin: 0; min-height: 2.1rem; white-space: nowrap; font-size: .88rem; }
  .owner.selected { padding-right: 1rem; }
  .owner.selected::after { right: .38rem; }
  .content { padding: 1.15rem .9rem; }
  .metric { padding: .82rem .7rem; gap: .52rem; }
  .metric .file-icon { display: none; }
  .metric > div > span { font-size: .81rem; line-height: 1.25; }
  .metric strong { font-size: 1.14rem; }
  .metric small { font-size: .78rem; }
  .tablewrap { overflow-x: visible; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .4rem .55rem; padding: .67rem .8rem; border-top: 1px solid var(--line); }
  td, td:first-child, td:last-child { padding: 0; border: 0; }
  td.metadata { grid-row: 2; font-size: .83rem; }
  td.metadata:nth-child(2) { justify-self: start; }
  td.metadata:nth-child(3) { justify-self: end; }
  tr:has(.entry .folder) td.metadata { display: none; }
  td.row-actions { grid-column: 2; grid-row: 1; }
  .row-actions .button { min-height: 2rem; padding: .35rem .42rem; gap: .25rem; }
  .explorer-head { padding: .9rem .8rem .7rem; }
  .folder-tools { padding: 0 .8rem .6rem; }
}
@media (max-width: 25rem) {
  .topbar { padding-inline: .85rem; gap: .5rem; }
  .identity { display: none; }
  .row-actions .icon { display: none; }
  .file-icon { width: 1.85rem; height: 1.85rem; }
  .entry { gap: .48rem; }
}
