:root {
  --mist: #f4f5f2;
  --paper: #fbfcfa;
  --paper-solid: #ffffff;
  --ink: #171b1f;
  --ink-soft: #343a40;
  --muted: #70777d;
  --muted-light: #969da2;
  --line: #dfe2de;
  --line-strong: #cbd0cc;
  --cobalt: #2859d8;
  --cobalt-deep: #1f49b8;
  --cobalt-soft: #e9eefc;
  --shadow-dialog: 0 30px 90px rgba(23, 27, 31, 0.2);
  --sidebar-width: 15.5rem;
  --content-width: 88rem;
  --file-action-column-width: 9.65rem;
  --radius-small: 0.5rem;
  --radius-medium: 0.75rem;
  --radius-large: 1rem;
  --transition-fast: 150ms ease;
  --transition-normal: 220ms ease;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--mist);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

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

html {
  min-width: 20rem;
  min-height: 100%;
  background: var(--mist);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--mist);
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}

body:has(dialog[open]) {
  overflow: hidden;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-small);
  color: var(--paper-solid);
  background: var(--ink);
  transform: translateY(-150%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

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

::selection {
  color: var(--paper-solid);
  background: var(--cobalt);
}

.boot-screen {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  color: var(--muted);
  background: var(--mist);
}

.brand-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.65rem;
  color: var(--paper-solid);
  background: var(--cobalt);
}

.brand-mark svg {
  width: 1.45rem;
  height: 1.45rem;
}

.brand-mark--large {
  width: 3rem;
  height: 3rem;
  border-radius: 0.85rem;
}

.brand-mark--large svg {
  width: 1.9rem;
  height: 1.9rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--cobalt);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-weight: 680;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

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

.button--primary {
  color: var(--paper-solid);
  background: var(--cobalt);
}

.button--primary:hover:not(:disabled) {
  background: var(--cobalt-deep);
}

.button--secondary {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--paper-solid);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--ink-soft);
  background: var(--paper);
}

.button--quiet {
  color: var(--ink-soft);
  background: transparent;
}

.button--quiet:hover:not(:disabled) {
  background: var(--mist);
}

.button--dark {
  color: var(--paper-solid);
  background: var(--ink);
}

.button--dark:hover:not(:disabled) {
  background: var(--ink-soft);
}

.button--light {
  color: var(--ink);
  background: var(--paper-solid);
}

.button--wide {
  width: 100%;
  min-height: 3rem;
}

.icon-button,
.input-action,
.text-button,
.nav-item,
.file-name-button,
.row-action {
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-small);
  color: var(--muted);
  background: transparent;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.icon-button:hover {
  color: var(--ink);
  background: rgba(23, 27, 31, 0.06);
}

.text-button {
  padding: 0.2rem;
  color: var(--cobalt);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 680;
}

.text-button:hover {
  color: var(--cobalt-deep);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Authentication */

.login-view {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(24rem, 1.05fr) minmax(28rem, 0.95fr);
  animation: page-enter 360ms ease both;
}

.login-intro {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 5.5rem);
  overflow: hidden;
  color: var(--paper-solid);
  background-color: var(--ink);
  isolation: isolate;
}

.login-intro::before,
.login-intro::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.login-intro::before {
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
  background-size: 4rem 4rem;
  mask-image: linear-gradient(to bottom right, black, transparent 72%);
}

.login-intro::after {
  right: -15rem;
  bottom: -16rem;
  width: 36rem;
  height: 36rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 4rem rgba(255, 255, 255, 0.02),
    0 0 0 8rem rgba(255, 255, 255, 0.018);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 1.15rem;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.login-statement {
  max-width: 38rem;
  padding: 8vh 0;
}

.login-statement .eyebrow {
  color: #aebff1;
}

.login-statement h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.75rem, 5vw, 5.4rem);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.login-statement > p:last-child {
  margin: 1.6rem 0 0;
  color: #c5c9cc;
  font-size: 1.05rem;
}

.login-host {
  margin: 0;
  color: #91979c;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.login-panel {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: clamp(2rem, 7vw, 7rem);
  background: var(--paper);
}

.login-form {
  display: grid;
  width: min(100%, 25rem);
  gap: 1.35rem;
}

.login-form h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.65rem);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.form-intro {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label,
.permission-fieldset legend {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 680;
}

.field input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--paper-solid);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.field input:hover {
  border-color: var(--muted-light);
}

.field input:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(40, 89, 216, 0.12);
}

.field input:disabled {
  color: var(--muted);
  background: var(--mist);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 3rem;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: var(--radius-small);
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}

.input-action:hover {
  color: var(--ink);
  background: var(--mist);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.form-error {
  margin: -0.25rem 0 0;
  padding-left: 0.7rem;
  border-left: 2px solid var(--ink);
  color: var(--ink-soft);
  font-size: 0.83rem;
}

/* Main workspace */

.workspace {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  animation: page-enter 300ms ease both;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  padding: 1.5rem 1.05rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.55rem 1.8rem;
}

.sidebar-brand > div:last-child {
  display: grid;
  line-height: 1.2;
}

.sidebar-brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.side-nav {
  display: grid;
  gap: 0.22rem;
}

.nav-item {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.7rem;
  padding: 0.68rem 0.75rem;
  border-radius: var(--radius-small);
  color: var(--muted);
  background: transparent;
  font-weight: 620;
  text-align: left;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(23, 27, 31, 0.045);
}

.nav-item.is-active {
  color: var(--cobalt);
  background: var(--cobalt-soft);
}

.storage-meter {
  display: grid;
  gap: 0.55rem;
  margin-top: auto;
  padding: 0.9rem 0.55rem 0;
  border-top: 1px solid var(--line);
}

.storage-capacity {
  display: grid;
  gap: 0.18rem;
}

.storage-capacity span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.storage-capacity strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 690;
  letter-spacing: -0.02em;
}

.storage-progress {
  height: 0.22rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.storage-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--cobalt);
}

.storage-details {
  margin: 0;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.4;
}

.storage-meter:not([hidden]) + .account {
  margin-top: 0.75rem;
  border-top: 0;
}

.account {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: auto;
  padding: 1rem 0.4rem 0;
  border-top: 1px solid var(--line);
}

.account-avatar {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-solid);
  background: var(--ink);
  font-size: 0.8rem;
  font-weight: 740;
  text-transform: uppercase;
}

.account-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.account-copy strong {
  overflow: hidden;
  font-size: 0.83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy small {
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.69rem;
}

.main-content {
  min-width: 0;
}

.view {
  width: min(100%, var(--content-width));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 4.5rem) clamp(1.5rem, 4vw, 4.5rem);
}

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.view-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3.2vw, 3.4rem);
  font-weight: 690;
  letter-spacing: -0.05em;
  line-height: 1;
}

.view-description {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.breadcrumbs {
  display: flex;
  min-height: 2.2rem;
  align-items: center;
  gap: 0.18rem;
  margin-bottom: 0.9rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.breadcrumb-button {
  display: inline-flex;
  min-height: 2rem;
  max-width: 16rem;
  align-items: center;
  padding: 0.3rem 0.38rem;
  border-radius: 0.35rem;
  overflow: hidden;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 610;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.breadcrumb-button:hover {
  color: var(--ink);
  background: rgba(23, 27, 31, 0.05);
}

.breadcrumb-button[aria-current="page"] {
  color: var(--ink);
  cursor: default;
}

.breadcrumb-separator {
  flex: 0 0 auto;
  color: var(--muted-light);
}

.breadcrumb-separator .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* Upload queue */

.upload-panel {
  margin: 0 0 1.1rem;
  padding: 1rem 0;
  border-block: 1px solid var(--line);
}

.upload-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.upload-panel > header > div {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.upload-panel h2 {
  margin: 0;
  font-size: 0.85rem;
}

#upload-summary {
  color: var(--muted);
  font-size: 0.77rem;
}

.upload-list {
  display: grid;
  max-height: 13.5rem;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.upload-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7rem, 13rem) auto;
  align-items: center;
  gap: 1rem;
  min-height: 2.8rem;
  border-top: 1px solid var(--line);
}

.upload-item:first-child {
  border-top: 0;
}

.upload-item-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
}

.upload-item-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 610;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upload-state-speed {
  color: var(--ink-soft);
}

.progress-track {
  height: 0.22rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--cobalt);
  transition: width var(--transition-normal);
}

.upload-item.is-error .progress-bar,
.upload-item.is-cancelled .progress-bar {
  background: var(--ink-soft);
}

.upload-item-action {
  min-width: 3rem;
  padding: 0.2rem;
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
  cursor: pointer;
}

.upload-item-action:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Files */

.batch-toolbar {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.35rem;
  border-block: 1px solid var(--line);
}

.batch-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.batch-summary strong {
  font-size: 0.8rem;
  white-space: nowrap;
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.batch-actions .button {
  min-height: 2.25rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.74rem;
}

.file-surface {
  position: relative;
  min-height: 19rem;
  border-top: 1px solid var(--ink);
}

.drop-overlay {
  position: absolute;
  z-index: 10;
  inset: -1px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 2px dashed var(--cobalt);
  color: var(--ink);
  background: rgba(244, 245, 242, 0.96);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.995);
  transition:
    opacity var(--transition-normal),
    transform var(--transition-normal);
}

.file-surface.is-dragging .drop-overlay {
  opacity: 1;
  transform: scale(1);
}

.drop-symbol {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-solid);
  background: var(--cobalt);
}

.drop-symbol .icon {
  width: 1.45rem;
  height: 1.45rem;
}

.drop-overlay strong {
  font-size: 1.05rem;
}

.drop-overlay span {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th {
  height: 2.65rem;
  padding: 0 0.85rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 690;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  height: 4.1rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.82rem;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.6);
}

.data-table tbody tr.is-selected {
  background: var(--cobalt-soft);
}

.file-table .file-select-column {
  width: 2.75rem;
  padding-inline: 0.35rem 0.2rem;
  text-align: center;
}

.selection-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--cobalt);
  cursor: pointer;
}

.selection-checkbox:disabled {
  cursor: wait;
}

.file-table th:nth-child(2),
.file-table td:nth-child(2) {
  width: auto;
  padding-left: 0.35rem;
}

.file-table th:nth-child(3),
.file-table td:nth-child(3) {
  width: 8rem;
}

.file-table th:nth-child(4),
.file-table td:nth-child(4) {
  width: 12rem;
}

.file-table th:last-child,
.file-table td:last-child {
  width: var(--file-action-column-width);
  padding-right: 0.35rem;
}

.file-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.85rem;
}

.file-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  color: var(--muted);
  background: var(--paper-solid);
}

.file-icon .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.file-icon--folder {
  border-color: #cbd6f1;
  color: var(--cobalt);
  background: var(--cobalt-soft);
}

.file-name-button {
  display: grid;
  min-width: 0;
  padding: 0.2rem 0;
  overflow: hidden;
  background: transparent;
  text-align: left;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name-button:hover .file-name {
  color: var(--cobalt);
}

.file-kind {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.69rem;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.1rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

tr:hover .row-actions,
tr:focus-within .row-actions {
  opacity: 1;
}

.row-action {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 2.75rem;
  place-items: center;
  border-radius: var(--radius-small);
  color: var(--muted);
  background: transparent;
}

.row-action:hover:not(:disabled) {
  color: var(--ink);
  background: var(--mist);
}

.row-action:disabled {
  cursor: wait;
  opacity: 0.42;
}

.row-action .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.table-loading {
  display: flex;
  min-height: 15rem;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.spinner {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  border: 2px solid var(--line-strong);
  border-top-color: var(--cobalt);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.spinner--light {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--paper-solid);
}

.state-view {
  display: flex;
  min-height: 19rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 3rem 1.5rem;
  text-align: center;
}

.state-view--compact {
  min-height: 18rem;
  border-top: 1px solid var(--ink);
}

.state-icon {
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--paper-solid);
}

.state-icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.state-view h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.state-view p {
  max-width: 28rem;
  margin: 0.45rem 0 1.15rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.drop-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0 0;
  color: var(--muted-light);
  font-size: 0.72rem;
}

.drop-hint .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* Admin */

.admin-table-wrap {
  border-top: 1px solid var(--ink);
}

.admin-table th:first-child,
.admin-table td:first-child {
  width: 17%;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  width: 33%;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  width: 12%;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
  width: 18%;
}

.admin-table th:last-child,
.admin-table td:last-child {
  width: 8rem;
}

.user-name-cell {
  display: grid;
}

.user-name-cell strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.user-name-cell small {
  margin-top: 0.1rem;
  color: var(--muted);
}

.path-list {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.permission-dot {
  width: 0.42rem;
  height: 0.42rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--line-strong);
}

.permission-status.is-enabled .permission-dot {
  background: var(--cobalt);
}

.audit-table {
  min-width: 54rem;
}

.audit-table th:first-child,
.audit-table td:first-child {
  width: 11rem;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 9rem;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 10rem;
}

.audit-table th:nth-child(5),
.audit-table td:nth-child(5) {
  width: 7rem;
}

.audit-table th:last-child,
.audit-table td:last-child {
  width: 9rem;
}

.audit-path {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-outcome {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.audit-outcome::before {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.audit-outcome.is-success::before {
  background: var(--cobalt);
}

/* Dialogs */

.dialog {
  width: min(calc(100% - 2rem), 36rem);
  max-height: min(88vh, 50rem);
  max-height: min(88dvh, 50rem);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-dialog);
}

.dialog[open] {
  animation: dialog-enter 200ms ease both;
}

.dialog::backdrop {
  background: rgba(23, 27, 31, 0.54);
  backdrop-filter: blur(3px);
  animation: backdrop-enter 180ms ease both;
}

.dialog--small {
  width: min(calc(100% - 2rem), 29rem);
}

.dialog--user {
  width: min(calc(100% - 2rem), 58rem);
}

.dialog--move {
  width: min(calc(100% - 2rem), 34rem);
}

.dialog-form {
  display: grid;
  max-height: inherit;
  gap: 1.25rem;
  padding: 1.5rem;
  overflow-y: auto;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-header h2,
.dialog h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.dialog-header .eyebrow {
  margin-bottom: 0.35rem;
}

.dialog-context {
  margin: -0.6rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-symbol {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--line);
}

.dialog-symbol .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.dialog-form > div > p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.dialog-form > div > p strong {
  color: var(--ink);
  word-break: break-word;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.dialog-actions--conflict {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.user-form-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 0.8fr) minmax(19rem, 1.2fr);
  gap: 1.5rem;
  min-height: 18rem;
}

.user-form-fields {
  display: grid;
  align-content: start;
  gap: 1.1rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-block: 1px solid var(--line);
  cursor: pointer;
}

.switch-row > span:first-child {
  display: grid;
}

.switch-row strong {
  font-size: 0.86rem;
}

.switch-row small {
  max-width: 17rem;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 2.55rem;
  height: 1.45rem;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--line);
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.switch span::after {
  position: absolute;
  top: 0.23rem;
  left: 0.23rem;
  width: 0.98rem;
  height: 0.98rem;
  border-radius: 50%;
  background: var(--paper-solid);
  box-shadow: 0 1px 3px rgba(23, 27, 31, 0.24);
  content: "";
  transition: transform var(--transition-fast);
}

.switch input:checked + span {
  border-color: var(--cobalt);
  background: var(--cobalt);
}

.switch input:checked + span::after {
  transform: translateX(1.08rem);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}

.permission-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0 0 0 1.5rem;
  border: 0;
  border-left: 1px solid var(--line);
}

.permission-fieldset > p {
  margin: 0.35rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.inline-loading,
.inline-error,
.inline-empty {
  display: flex;
  min-height: 11rem;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.directory-tree {
  max-height: 18rem;
  padding: 0.35rem 0.3rem 0.35rem 0;
  overflow: auto;
  scrollbar-width: thin;
}

.move-tree {
  max-height: 22rem;
  padding: 0.35rem 0.3rem 0.35rem 0;
  overflow: auto;
  scrollbar-width: thin;
}

.move-tree .tree-label:has(input:checked) {
  color: var(--cobalt-deep);
  background: var(--cobalt-soft);
}

.move-tree .tree-label:has(input:disabled) {
  color: var(--muted-light);
  cursor: not-allowed;
}

.move-tree .tree-label:has(input:disabled) .icon {
  color: var(--muted-light);
}

.tree-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-list .tree-list {
  margin-left: 0.75rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

.tree-node {
  min-width: 0;
}

.tree-label {
  display: flex;
  min-height: 2.25rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.tree-label:hover {
  background: var(--mist);
}

.tree-label input {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  accent-color: var(--cobalt);
}

.tree-label .icon {
  width: 1rem;
  height: 1rem;
  color: var(--cobalt);
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-path {
  margin-left: auto;
  overflow: hidden;
  color: var(--muted-light);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Preview */

.dialog--preview {
  width: min(calc(100% - 2rem), 78rem);
  height: min(88vh, 52rem);
  height: min(88dvh, 52rem);
  max-height: none;
  border-color: #3a3f44;
  color: var(--paper-solid);
  background: var(--ink);
}

.preview-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.preview-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #3a3f44;
  background: var(--ink);
}

.preview-title-wrap,
.preview-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
}

.preview-title-wrap .file-icon {
  border-color: #484e53;
  color: #c9ced1;
  background: #292e32;
}

.preview-title-wrap > div {
  min-width: 0;
}

.preview-header h2 {
  overflow: hidden;
  color: var(--paper-solid);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-header p {
  margin: 0.1rem 0 0;
  color: #9da3a7;
  font-size: 0.7rem;
}

.preview-header .button--secondary {
  border-color: #555b60;
  color: var(--paper-solid);
  background: #292e32;
}

.preview-header .button--secondary:hover {
  border-color: #7c8388;
  background: #343a3f;
}

.preview-header .icon-button {
  color: #c9ced1;
}

.preview-header .icon-button:hover {
  color: var(--paper-solid);
  background: #343a3f;
}

.preview-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  background:
    linear-gradient(45deg, #202428 25%, transparent 25%),
    linear-gradient(-45deg, #202428 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #202428 75%),
    linear-gradient(-45deg, transparent 75%, #202428 75%),
    #1b1f22;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}

.preview-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-stage video {
  display: block;
  width: 100%;
  max-width: 72rem;
  max-height: 100%;
  background: #000;
}

.preview-loading,
.preview-error {
  display: flex;
  position: absolute;
  z-index: 2;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: #c9ced1;
  background: rgba(23, 27, 31, 0.85);
}

.preview-error {
  flex-direction: column;
}

.preview-error p {
  margin: 0 0 0.5rem;
}

/* Toasts */

.toast-region {
  position: fixed;
  z-index: 100;
  right: 1.25rem;
  bottom: 1.25rem;
  display: grid;
  width: min(calc(100% - 2.5rem), 23rem);
  gap: 0.55rem;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.65rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid #33383d;
  border-radius: var(--radius-medium);
  color: var(--paper-solid);
  background: var(--ink);
  box-shadow: 0 12px 35px rgba(23, 27, 31, 0.18);
  pointer-events: auto;
  animation: toast-enter 240ms ease both;
}

.toast.is-leaving {
  animation: toast-leave 160ms ease both;
}

.toast > .icon {
  margin-top: 0.08rem;
  color: #aebff1;
}

.toast-copy {
  min-width: 0;
}

.toast-copy strong {
  display: block;
  font-size: 0.81rem;
}

.toast-copy p {
  margin: 0.14rem 0 0;
  color: #b9bec2;
  font-size: 0.74rem;
}

.toast button {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  border-radius: 0.35rem;
  color: #b9bec2;
  background: transparent;
  cursor: pointer;
}

.toast button:hover {
  color: var(--paper-solid);
  background: #343a3f;
}

.toast button .icon {
  width: 0.9rem;
  height: 0.9rem;
}

@keyframes page-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-leave {
  to {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}

@media (max-width: 64rem) {
  :root {
    --sidebar-width: 13.5rem;
  }

  .view {
    padding-inline: 2rem;
  }

  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) {
    display: none;
  }

  .admin-table th:first-child,
  .admin-table td:first-child {
    width: 22%;
  }

  .admin-table th:nth-child(2),
  .admin-table td:nth-child(2) {
    width: 40%;
  }
}

@media (max-width: 48rem) {
  .login-view {
    grid-template-columns: 1fr;
    background: var(--paper);
  }

  .login-intro {
    min-height: auto;
    padding: 1.25rem;
    background: var(--ink);
  }

  .login-statement {
    padding: 3.5rem 0 2rem;
  }

  .login-statement h1 {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }

  .login-statement > p:last-child,
  .login-host {
    display: none;
  }

  .login-panel {
    min-height: 28rem;
    padding: 2.5rem 1.25rem;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    display: grid;
    height: auto;
    min-height: 4rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 0.65rem 0.85rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-brand {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
  }

  .sidebar-brand > div:last-child span {
    display: none;
  }

  .side-nav {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    justify-content: center;
    gap: 0.15rem;
  }

  .nav-item {
    min-height: 2.5rem;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem;
  }

  .nav-item .icon {
    width: 1.05rem;
    height: 1.05rem;
  }

  .storage-meter {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: auto minmax(4rem, 1fr);
    align-items: center;
    gap: 0.3rem 0.75rem;
    margin: 0.25rem 0 0;
    padding: 0.5rem 0.25rem 0;
  }

  .storage-capacity {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
  }

  .storage-capacity strong {
    font-size: 0.8rem;
  }

  .storage-details {
    grid-column: 1 / -1;
    text-align: right;
  }

  .account {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .storage-meter:not([hidden]) + .account {
    margin: 0;
  }

  .account-avatar,
  .account-copy {
    display: none;
  }

  .view {
    min-height: calc(100vh - 4rem);
    min-height: calc(100dvh - 4rem);
    padding: 2rem 1rem 3rem;
  }

  .view-header {
    align-items: flex-start;
    margin-bottom: 1.6rem;
  }

  .view-header h1 {
    font-size: 2.25rem;
  }

  .view-description {
    max-width: 26rem;
  }

  .header-actions .button span {
    display: none;
  }

  .header-actions .button {
    width: 2.65rem;
    padding-inline: 0;
  }

  .file-table th:nth-child(3),
  .file-table td:nth-child(3),
  .file-table th:nth-child(4),
  .file-table td:nth-child(4) {
    display: none;
  }

  .file-table th:last-child,
  .file-table td:last-child {
    width: var(--file-action-column-width);
  }

  .row-actions {
    opacity: 1;
  }

  .upload-item {
    grid-template-columns: minmax(0, 1fr) 5rem auto;
    gap: 0.55rem;
  }

  .dialog--preview {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .preview-header .button span {
    display: none;
  }

  .preview-header .button {
    width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .permission-fieldset {
    min-height: 14rem;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .directory-tree {
    max-height: 15rem;
  }

  .admin-table {
    min-width: 42rem;
  }

  .toast-region {
    right: 0.75rem;
    bottom: 0.75rem;
    width: calc(100% - 1.5rem);
  }
}

@media (max-width: 34rem) {
  .sidebar {
    grid-template-columns: auto 1fr auto;
  }

  .sidebar-brand > div:last-child {
    display: none;
  }

  .side-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .nav-item {
    width: 2.5rem;
    justify-content: center;
    padding-inline: 0;
  }

  .nav-item span {
    display: none;
  }

  .view-header {
    gap: 0.75rem;
  }

  .view-header h1 {
    font-size: 2rem;
  }

  .view-description {
    font-size: 0.8rem;
  }

  .view--files:has(.batch-toolbar:not([hidden])) {
    padding-bottom: 10rem;
  }

  .batch-toolbar {
    position: fixed;
    z-index: 80;
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    left: 0.75rem;
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-medium);
    background: var(--paper-solid);
    box-shadow: var(--shadow-dialog);
  }

  body:has(.view--files:not([hidden]) .batch-toolbar:not([hidden])) .toast-region {
    bottom: calc(10rem + env(safe-area-inset-bottom));
  }

  .batch-summary {
    justify-content: space-between;
  }

  .batch-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
  }

  .batch-actions .button {
    justify-content: center;
  }

  .file-table td {
    padding-inline: 0.3rem;
  }

  .file-icon {
    width: 2rem;
    height: 2rem;
  }

  .file-cell {
    gap: 0.65rem;
  }

  .upload-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .upload-item.is-uploading .upload-state.has-speed .upload-state-label,
  .upload-item.is-uploading .upload-state.has-speed .upload-state-separator {
    display: none;
  }

  .upload-item .progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dialog {
    width: calc(100% - 1rem);
  }

  .dialog--move {
    width: 100%;
    max-height: calc(100dvh - 1rem);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: var(--radius-large) var(--radius-large) 0 0;
  }

  .dialog--move .dialog-actions {
    position: sticky;
    bottom: calc(-1.15rem - env(safe-area-inset-bottom));
    padding: 0.8rem 0 calc(1.15rem + env(safe-area-inset-bottom));
    background: var(--paper);
  }

  .dialog-form {
    padding: 1.15rem;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions--conflict {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions--conflict .button:first-child {
    grid-column: 1 / -1;
  }

  .dialog-actions .button {
    width: 100%;
  }

  .tree-path {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .button,
  .file-icon,
  .state-icon,
  .dialog,
  .toast {
    border: 1px solid CanvasText;
  }

  .permission-dot,
  .audit-outcome::before,
  .progress-bar {
    background: Highlight;
  }
}
