:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --bg-hover: #eef1f5;
  --bg-sunken: #e8edf3;
  --line: #e2e7ee;
  --line-strong: #d4dbe4;
  --text: #161a20;
  --muted: #6b7380;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eef4ff;
  --accent-2: #0f9d73;
  --danger: #d64545;
  --danger-text: #9b1c1c;
  --warn: #c99212;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px rgba(16, 24, 40, 0.06);
  --shadow-inset: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  --radius: 14px;
  --sidebar: 272px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --input: #ffffff;
  --thumb: #f3f6fa;
  --overlay: rgba(18, 21, 26, 0.32);
  --icon: #7b8494;
  --btn: #ffffff;
  --btn-border: #d7dee8;
  --on-accent: #ffffff;
  --paper: #ffffff;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12151b;
  --bg-elev: #1b2028;
  --bg-hover: #252b35;
  --bg-sunken: #0e1116;
  --line: #2c3340;
  --line-strong: #3c4555;
  --text: #e8eaee;
  --muted: #8d95a3;
  --accent: #6b93f0;
  --accent-hover: #5b84e4;
  --accent-soft: rgba(107, 147, 240, 0.16);
  --accent-2: #3dba8f;
  --danger: #e06262;
  --danger-text: #f0a0a0;
  --warn: #d4a017;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 12px 28px rgba(0, 0, 0, 0.32);
  --shadow-inset: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --input: #1b2028;
  --thumb: #222833;
  --overlay: rgba(0, 0, 0, 0.55);
  --icon: #8d95a3;
  --btn: #252b35;
  --btn-border: #3a4352;
  --on-accent: #ffffff;
  --paper: #1b2028;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
input,
select,
textarea,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
a,
.card,
.icon-btn,
.toolbar-btn {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px 28px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-theme {
  position: absolute;
  top: 12px;
  right: 12px;
}

.gate-theme:hover {
  background: var(--bg-hover);
}

.gate-mark {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1.2rem;
}

.gate-card h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.gate-card #gate-copy {
  margin: 0 auto 22px;
  max-width: 32ch;
  color: var(--muted);
  line-height: 1.5;
}

.gate-card #gate-form {
  margin-top: 8px;
}

.gate-card .field {
  text-align: left;
}

.field-control {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.field-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}

.field-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.gate-foot {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 13px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  font-weight: 600;
  font-size: 0.86rem;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--input);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

.field .field-control input {
  padding: 11px 44px 11px 42px;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--line-strong);
}

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 600;
}

.btn.primary:hover {
  filter: none;
  background: var(--accent-hover);
}

.btn.wide {
  width: 100%;
  padding: 11px 14px;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.btn.danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--bg-hover));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger-text);
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px 14px;
  background: var(--bg-sunken);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 4px 10px;
}

.sidebar-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.sidebar-head strong i {
  color: var(--accent);
}

.sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  color: var(--icon);
}

.storage {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px 12px;
  margin: 0 4px 12px;
}

.storage-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.storage-top span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.storage-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
}

.storage-bar > div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease, background 0.4s ease;
}

.storage-bar.warn > div {
  background: var(--warn);
}

.storage-bar.danger > div {
  background: var(--danger);
}

.storage-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.storage-meta div {
  min-width: 0;
}

.storage-meta small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.storage-meta strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.tree-head {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree {
  flex: 1;
  overflow: auto;
  padding-right: 4px;
}

.tree-home,
.tree .tree-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 500;
  font-size: 0.88rem;
  min-width: 0;
}

.tree-home {
  margin-bottom: 4px;
}

.tree .tree-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-home i,
.tree .tree-link i {
  width: 1.1rem;
  flex-shrink: 0;
  text-align: center;
  color: var(--icon);
}

.tree-home:hover,
.tree .tree-link:hover {
  background: var(--bg-hover);
}

.tree-home.active,
.tree .tree-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tree-home.active i,
.tree .tree-link.active i {
  color: var(--accent);
}

.tree-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.tree-toggle {
  width: 22px;
  height: 28px;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 6px;
  padding: 0;
}

.tree-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tree-toggle i {
  font-size: 0.62rem;
  width: auto;
  transition: transform 0.15s ease;
}

.tree-toggle.is-spacer {
  pointer-events: none;
}

.tree-node.is-open > .tree-row .tree-toggle i {
  transform: rotate(90deg);
}

.tree-node:not(.is-open) > .nested {
  display: none;
}

.tree .nested {
  margin-left: 11px;
  border-left: 1px solid var(--line);
  padding-left: 2px;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 4px;
}

.sidebar-trash,
.sidebar-photos,
.sidebar-logout {
  margin-top: 0;
  width: calc(100% - 8px);
  margin-left: 4px;
  color: var(--muted);
  justify-content: flex-start;
}

.sidebar-trash.active,
.sidebar-photos.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar-logout {
  margin-top: 0;
}

.sidebar-logout:hover,
.sidebar-photos:hover,
.sidebar-trash:hover {
  color: var(--text);
  background: var(--bg-hover);
}

body.is-share #mobile-search-btn,
body.is-share #mobile-search-wrap,
body.is-share #preview-save {
  display: none !important;
}

.share-expiry {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

#share-revoke {
  margin-top: 12px;
}

.share-perms {
  display: grid;
  gap: 8px;
  margin: 4px 0 14px;
}

.share-perm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: var(--input);
}

.share-perm:hover {
  border-color: var(--line-strong);
  background: var(--bg-hover);
}

.share-perm.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.share-perm input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.share-perm-box {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: transparent;
  background: var(--bg-elev);
}

.share-perm-box i {
  font-size: 0.68rem;
}

.share-perm input:checked + .share-perm-box {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.share-perm-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.share-perm-copy strong {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
}

.share-perm-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

#share-link {
  width: 100%;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  margin: 16px 18px 0;
  flex: 0 0 auto;
  flex-wrap: wrap;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-inset), var(--shadow);
  position: sticky;
  top: 12px;
  z-index: 20;
}

.toolbar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 280px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 280px;
  background: var(--input);
  border: 1px solid var(--btn-border);
  border-radius: 10px;
  padding: 0 10px;
  color: var(--icon);
}

.search-wrap i {
  flex-shrink: 0;
  font-size: 0.78rem;
}

.search-wrap input {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  font: inherit;
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
}

.search-wrap input::placeholder {
  color: var(--muted);
}

.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.pretty-select {
  position: relative;
  width: 100%;
}

.pretty-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--btn-border);
  background: var(--input);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.pretty-select-btn:hover {
  border-color: var(--line-strong);
  background: var(--bg-hover);
}

.pretty-select.is-open .pretty-select-btn {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.pretty-select-btn > i:first-child {
  color: var(--icon);
  font-size: 0.8rem;
  width: 1rem;
  text-align: center;
}

.pretty-select-label {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.pretty-select-caret {
  margin-left: auto;
  font-size: 0.62rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.pretty-select.is-open .pretty-select-caret {
  transform: rotate(180deg);
}

.pretty-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.pretty-select-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 0;
  background: none;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.pretty-select-menu button strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 650;
}

.pretty-select-menu button small {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
}

.pretty-select-menu button .fa-check {
  opacity: 0;
  color: var(--accent);
  font-size: 0.78rem;
}

.pretty-select-menu button:hover {
  background: var(--bg-hover);
}

.pretty-select-menu button.is-active {
  background: var(--accent-soft);
}

.pretty-select-menu button.is-active .fa-check {
  opacity: 1;
}

.pretty-select-toolbar {
  width: auto;
  min-width: 148px;
}

.pretty-select-toolbar .pretty-select-btn {
  min-height: 34px;
  font-size: 0.82rem;
  border-radius: 10px;
}

.pretty-select-toolbar .pretty-select-menu {
  min-width: 168px;
  right: 0;
  left: auto;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  min-width: 0;
  padding: 4px;
  background: var(--bg-sunken);
  border-radius: 11px;
  border: 1px solid var(--line);
}

.breadcrumb .sep {
  color: var(--icon);
  font-size: 0.62rem;
  padding: 0 2px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 1 auto;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--line-strong);
  margin: 0 2px;
}

.breadcrumb button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.84rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb button:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.breadcrumb button.current {
  color: var(--text);
  background: var(--bg-elev);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.selection-bar.hidden,
.selection-bar[hidden] {
  display: none !important;
}

.selection-bar #selection-count {
  font-weight: 650;
  font-size: 0.82rem;
  white-space: nowrap;
  padding: 0 10px 0 4px;
  border-radius: 0;
  background: none;
  color: var(--muted);
}

.selection-bar .toolbar-btn,
.toolbar .selection-bar .toolbar-btn,
.toolbar .selection-bar .btn.primary.toolbar-btn {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  min-height: 34px;
}

.selection-bar .toolbar-btn:hover,
.toolbar .selection-bar .toolbar-btn:hover,
.toolbar .selection-bar .btn.primary.toolbar-btn:hover {
  background: var(--bg-hover);
  border: 0;
  color: var(--text);
  filter: none;
}

.toolbar .selection-bar .btn.primary.toolbar-btn {
  color: var(--accent);
}

.toolbar .selection-bar .btn.primary.toolbar-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.selection-bar #selection-delete {
  color: var(--danger);
}

.selection-bar #selection-delete:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.toolbar.has-selection .toolbar-divider,
.toolbar.has-selection .toolbar-actions > .toolbar-btn {
  display: none;
}

body.is-trash #new-folder-btn,
body.is-trash #new-file-btn,
body.is-trash #remote-download-btn,
body.is-trash #upload-folder-btn,
body.is-trash #upload-btn,
body.is-trash .toolbar-divider,
body.is-trash .compose,
body.is-photos .compose,
body.is-share:not(.is-share-upload) .compose,
body.is-share:not(.is-share-upload) #share-upload-btn {
  display: none !important;
}

body.is-share-upload .compose {
  position: fixed;
  right: 22px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0));
  z-index: 26;
}

body.is-share .compose-menu [data-act="new-file"],
body.is-share .compose-menu [data-act="remote"] {
  display: none !important;
}

body.is-share .storage,
body.is-share .tree-head,
body.is-share .tree,
body.is-share .sidebar-foot,
body.is-share .search-wrap,
body.is-share .pretty-select-toolbar,
body.is-share .sort-wrap {
  display: none !important;
}

.month-head {
  grid-column: 1 / -1;
  margin: 8px 2px 2px;
  padding: 10px 4px 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  color: var(--muted);
}

.listing.list .month-head {
  display: block;
  padding: 12px 12px 4px;
}

.card.is-offline .name::after {
  content: "\f0c2";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.68rem;
  margin-left: 6px;
  color: var(--accent);
  opacity: 0.85;
}

.view-toggle {
  display: flex;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 3px;
  gap: 2px;
}

.icon-btn {
  background: transparent;
  border: 0;
  color: var(--icon);
  width: 34px;
  height: 30px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn.active,
.icon-btn:hover {
  background: var(--bg-elev);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.toolbar .toolbar-btn {
  background: var(--btn);
  border: 1px solid var(--btn-border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: none;
}

.toolbar .toolbar-btn:hover {
  background: var(--bg-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.toolbar .toolbar-btn-upload,
.toolbar .btn.primary.toolbar-btn {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: none;
}

.toolbar .toolbar-btn-upload:hover,
.toolbar .btn.primary.toolbar-btn:hover {
  background: var(--accent-hover);
  filter: none;
}

.listing {
  flex: 1;
  overflow: auto;
  padding: 14px 20px 108px;
  outline: none;
}

.listing.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
  align-content: start;
}

.listing.list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-head {
  display: none;
}

.card .col {
  display: none;
}

.listing.grid .list-head,
.listing.grid .col {
  display: none;
}

.listing.list .list-head {
  display: grid;
  grid-template-columns: 44px minmax(120px, 1.6fr) 92px 72px 138px 138px;
  align-items: center;
  gap: 12px;
  padding: 4px 12px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

.list-head button {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.list-head button:hover,
.list-head button.active {
  color: var(--accent);
}

.listing.list .card-main {
  min-width: 0;
}

.listing.list .meta {
  display: none;
}

.listing.list .col {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing.list .col-size,
.listing.list .col-type {
  font-variant-numeric: tabular-nums;
}

.listing.list .col-date {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}

@media (max-width: 1100px) {
  .listing.list .list-head,
  .listing.list .card {
    grid-template-columns: 44px minmax(120px, 1fr) 88px 138px 138px;
  }
  .listing.list .col-type,
  .listing.list .list-head > span:nth-child(4) {
    display: none;
  }
}

@media (max-width: 860px) {
  .listing.list .list-head,
  .listing.list .card {
    grid-template-columns: 44px minmax(100px, 1fr) 138px;
  }
  .listing.list .col-size,
  .listing.list .col-type,
  .listing.list .col-created,
  .listing.list .list-head > span:nth-child(3),
  .listing.list .list-head > span:nth-child(4),
  .listing.list .list-head > span:nth-child(5) {
    display: none;
  }
}

.listing.list .card {
  display: grid;
  grid-template-columns: 44px minmax(120px, 1.6fr) 92px 72px 138px 138px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 14px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  background: var(--bg-elev);
}

.card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
  transform: none;
}

.card .thumb {
  width: 100%;
  aspect-ratio: 1.2;
  border-radius: 12px;
  background: var(--thumb);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 10px;
  color: var(--accent);
  position: relative;
}

.thumb-ph {
  position: absolute;
  font-size: 1.35rem;
  color: var(--icon);
  pointer-events: none;
}

.thumb-lazy {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.16s ease;
  position: relative;
  z-index: 1;
}

.thumb-lazy.is-on {
  opacity: 1;
}

.card .thumb:has(.thumb-lazy.is-on) .thumb-ph {
  display: none;
}

.file-icon.folder {
  color: #3b82f6;
}

.listing.list .card:hover {
  transform: none;
}

.file-icon {
  font-size: 1.65rem;
}

.file-icon.image {
  color: #2563eb;
}

.file-icon.video {
  color: #7c3aed;
}

.file-icon.audio {
  color: #e07a2f;
}

.file-icon.pdf {
  color: #d64545;
}

.file-icon.archive {
  color: #c9a227;
}

.file-icon.text {
  color: #3d7a5a;
}

.listing.list .file-icon {
  font-size: 1.2rem;
}

.listing.list .card .thumb {
  width: 42px;
  height: 42px;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 11px;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card .name {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .path {
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .meta {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 3px;
}

.card.drop-target,
.tree-link.drop-target,
.tree-home.drop-target,
.breadcrumb button.drop-target {
  outline: 2px solid var(--accent);
  background: var(--accent-soft);
}

.card.is-dragging,
.tree-link.is-dragging {
  opacity: 0.45;
}

.empty {
  grid-column: 1 / -1;
  margin: 48px auto;
  text-align: center;
  color: var(--muted);
  max-width: 360px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
}

.progress {
  position: sticky;
  bottom: 16px;
  align-self: flex-start;
  width: min(420px, calc(100% - 96px));
  margin: 0 22px 16px;
  padding: 12px 14px 11px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 24;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.progress-copy {
  min-width: 0;
}

.progress-copy strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.progress.has-files .progress-copy strong {
  font-size: 0.86rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.progress-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.progress-cancel {
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 8px;
}

.progress-top-right span {
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.progress-bar {
  height: 6px;
  margin-top: 10px;
  border-radius: 99px;
  background: var(--bg-sunken);
  overflow: hidden;
}

.progress-bar > div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.08s linear;
}

.progress.is-done .progress-bar > div {
  background: var(--accent-2);
}

.progress.is-error .progress-bar > div {
  background: var(--danger);
}

.progress.is-indeterminate .progress-bar > div {
  width: 32% !important;
  animation: progress-slide 1.1s ease-in-out infinite;
}

.progress-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.progress-stats span:not(:last-child)::after {
  content: "·";
  margin: 0 8px;
  color: var(--icon);
  font-weight: 500;
}

#progress-speed {
  color: var(--text);
}

.progress-file {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress.has-files .progress-file {
  display: none;
}

.progress-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  max-height: 220px;
  overflow: auto;
}

.progress-files.hidden {
  display: none;
}

.progress-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.progress-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
}

.progress-item-pct {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.progress-item-bar {
  height: 4px;
  margin-top: 4px;
  border-radius: 99px;
  background: var(--bg-sunken);
  overflow: hidden;
}

.progress-item-bar > div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}

.progress-item-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@keyframes progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}

.compose-src {
  display: none !important;
}

.compose {
  position: absolute;
  right: 22px;
  bottom: 20px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.compose-fab {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.12rem;
  transition: background 0.14s ease;
  -webkit-user-select: none;
  user-select: none;
}

.compose-fab i {
  transition: transform 0.16s ease;
}

.compose-fab:hover {
  background: var(--accent-hover);
}

.compose.is-open .compose-fab i {
  transform: rotate(45deg);
}

.compose-menu {
  width: 232px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.compose-label {
  margin: 8px 10px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.compose-label:first-child {
  margin-top: 4px;
}

.compose-menu button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.86rem;
}

.compose-menu button i {
  width: 1.1rem;
  text-align: center;
  color: var(--icon);
}

.compose-menu button:hover {
  background: var(--bg-hover);
}

.compose-menu button.compose-primary {
  color: var(--accent);
}

.compose-menu button.compose-primary i {
  color: var(--accent);
}

body:has(#progress:not(.hidden)) .compose {
  bottom: 96px;
}

.context-backdrop {
  display: none;
}

.menu {
  position: fixed;
  z-index: 20;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow);
}

.menu button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu button i {
  width: 1.1rem;
  text-align: center;
  color: var(--muted);
}

.menu button:hover {
  background: var(--bg-hover);
}

.menu button.warn {
  color: var(--danger);
}

.menu button.warn i {
  color: var(--danger);
}

.menu-meta {
  margin-top: 6px;
  padding: 8px 10px 6px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.menu-meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.75rem;
}

.menu-meta span {
  color: var(--muted);
}

.menu-meta strong {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(440px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  overflow: visible;
}

.create-kinds {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.create-kinds .btn {
  flex-direction: column;
  padding: 12px 8px;
  min-height: 74px;
}

.create-kinds .picked {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.modal-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
}

.modal-card .pretty-select-menu {
  z-index: 50;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.move-tree {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
}

.move-tree button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.move-tree button i {
  color: var(--accent);
  width: 1.1rem;
  text-align: center;
}

.move-tree button.picked,
.move-tree button:hover {
  background: var(--bg-hover);
}

.preview {
  position: fixed;
  inset: 0;
  background: var(--bg-sunken);
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg-elev) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.preview-title {
  min-width: 0;
}

.preview-bar strong,
.preview-title strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-title small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.preview-close {
  position: static;
  width: 40px;
  height: 40px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  box-shadow: none;
}

.preview-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.gallery-nav:hover {
  background: var(--bg-elev);
  color: var(--accent);
}

.gallery-nav.hidden {
  display: none;
}

.gallery-nav#gallery-prev {
  left: 16px;
}

.gallery-nav#gallery-next {
  right: 16px;
}

.gallery-count {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(18, 21, 26, 0.72);
  color: var(--on-accent);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.gallery-count.hidden {
  display: none;
}

.preview-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.preview.is-gallery .preview-body {
  padding: 16px 72px 56px;
}

.preview-body img,
.preview-body video {
  max-width: min(1200px, 96vw);
  max-height: calc(100vh - 110px);
  border-radius: 12px;
  background: #000;
  box-shadow: var(--shadow);
}

.preview-photo.is-lq {
  filter: blur(12px);
  transform: scale(1.06);
  transition: filter 0.18s ease, transform 0.18s ease;
}

.preview-photo.is-hq {
  filter: none;
  transform: none;
}

.preview.is-gallery .preview-body img {
  user-select: none;
  -webkit-user-drag: none;
}

.preview-body img {
  background: var(--paper);
}

.preview-body audio {
  width: min(560px, 92vw);
}

.preview-body iframe,
.preview-frame {
  width: min(1100px, 96vw);
  height: calc(100vh - 110px);
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.preview-doc,
.preview-sheet {
  width: min(1100px, 96vw);
  max-height: calc(100vh - 110px);
  overflow: auto;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px 32px;
}

.preview-sheet {
  padding: 0;
}

.preview-sheet table {
  border-collapse: collapse;
  min-width: 100%;
  font-size: 0.85rem;
}

.preview-sheet th,
.preview-sheet td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  min-width: 88px;
}

.preview-sheet td[contenteditable="true"] {
  outline: none;
  background: var(--paper);
}

.preview-sheet td[contenteditable="true"]:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.editor-wrap {
  width: min(1100px, 96vw);
  height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
}

.editor-text {
  flex: 1;
  width: 100%;
  border: 0;
  resize: none;
  padding: 20px 22px;
  font: 0.95rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  outline: none;
  background: var(--paper);
  color: var(--text);
}

.word-editor {
  flex: 1;
  overflow: auto;
  padding: 28px 36px;
  outline: none;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
}

.preview-body:has(.excel-wrap) {
  align-items: stretch;
  justify-content: stretch;
  padding: 10px 12px 12px;
  overflow: hidden;
}

.excel-wrap.editor-wrap {
  width: min(1600px, 100%);
  height: 100%;
  max-width: none;
  border-radius: 10px;
}

.excel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--paper);
  outline: none;
}

.excel-fxbar {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
  flex-shrink: 0;
}

.excel-addr {
  width: 72px;
  flex-shrink: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  padding: 8px 6px;
  border-right: 1px solid var(--line);
}

.excel-fx {
  width: 36px;
  text-align: center;
  font: italic 0.92rem/1 Georgia, serif;
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.excel-formula {
  flex: 1;
  min-width: 0;
  border: 0;
  background: var(--paper);
  padding: 8px 12px;
  font: 0.88rem/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
  outline: none;
  color: var(--text);
}

.excel-formula:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.excel-funcs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.excel-fn {
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  color: var(--text);
  border-radius: 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 7px;
  cursor: pointer;
}

.excel-fn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.excel-grid-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-sunken);
}

.excel-grid {
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--paper);
}

.excel-grid th,
.excel-grid td {
  border: 1px solid var(--line);
  height: 24px;
  box-sizing: border-box;
}

.excel-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  width: 88px;
  min-width: 88px;
  background: var(--bg-sunken);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.excel-grid .excel-corner,
.excel-grid .excel-rowhd {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  background: var(--bg-sunken);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  position: sticky;
  left: 0;
  z-index: 2;
}

.excel-grid thead .excel-corner {
  z-index: 4;
  left: 0;
  top: 0;
}

.excel-grid td {
  width: 88px;
  min-width: 88px;
  max-width: 160px;
  padding: 0 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--paper);
  position: relative;
}

.excel-grid td.is-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.excel-grid td.is-error {
  color: var(--danger-text);
  text-align: center;
  font-weight: 700;
}

.excel-grid td.is-sel {
  background: var(--accent-soft);
}

.excel-grid td.is-active {
  background: var(--paper);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

.excel-grid th.is-hi,
.excel-grid .excel-rowhd.is-hi {
  background: var(--accent-soft);
  color: var(--accent);
}

.excel-cell-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 2px solid var(--accent);
  padding: 0 6px;
  font: 0.8rem/24px ui-monospace, Consolas, monospace;
  background: var(--paper);
  z-index: 5;
}

.excel-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
  color: var(--muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.excel-status-actions {
  display: flex;
  gap: 6px;
}

.sheet-editor {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.preview-sheet th {
  background: var(--bg-sunken);
  position: sticky;
  top: 0;
}

.preview-text {
  width: min(960px, 96vw);
  max-height: calc(100vh - 110px);
  overflow: auto;
  margin: 0;
  padding: 20px 22px;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
}

.preview-empty {
  text-align: center;
  color: var(--muted);
  max-width: 420px;
}

.preview-empty i {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 10px;
}

body.dragging .listing {
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.mobile-bar,
.mobile-search-field,
.sidebar-backdrop,
.mobile-only {
  display: none;
}

@media (max-width: 820px) {
  html,
  body {
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    overscroll-behavior: none;
  }

  body:has(.app:not([hidden]):not(.hidden)) {
    overflow: hidden;
  }

  html.is-standalone body:has(.app:not([hidden]):not(.hidden)) {
    background: var(--accent);
  }

  html.is-standalone .app {
    background: var(--bg);
  }

  .app {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-bar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    align-self: stretch;
    gap: 6px;
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px));
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: var(--accent);
    color: var(--on-accent);
    position: relative;
    top: auto;
    z-index: 35;
    box-shadow: none;
  }

  .mobile-bar-title {
    min-width: 0;
    flex: 1;
  }

  .mobile-bar-title strong {
    display: block;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
  }

  .mobile-bar-title small {
    display: block;
    opacity: 0.85;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-bar-btn {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 12px;
    color: var(--on-accent);
    background: rgba(255, 255, 255, 0.14);
  }

  .mobile-bar-btn:hover,
  .mobile-bar-btn.active {
    background: rgba(255, 255, 255, 0.24);
    color: var(--on-accent);
    box-shadow: none;
  }

  .mobile-bar-btn.accent {
    background: var(--on-accent);
    color: var(--accent-hover);
  }

  .mobile-bar-btn.accent:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
  }

  body.mobile-search-open #mobile-search-btn {
    background: var(--on-accent);
    color: var(--accent-hover);
  }

  .mobile-search-field {
    display: none;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    color: var(--on-accent);
  }

  body.mobile-search-open .mobile-search-field:not([hidden]) {
    display: flex;
  }

  body.mobile-search-open .mobile-bar-title {
    display: none;
  }

  .mobile-search-field i {
    font-size: 0.78rem;
    opacity: 0.8;
  }

  .mobile-search-field input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
  }

  .mobile-search-field input::placeholder {
    color: rgba(255, 255, 255, 0.72);
  }

  .mobile-search-field input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
  }

  body.is-trash .compose {
    display: none !important;
  }

  .sidebar-backdrop,
  .context-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 45;
  }

  .context-backdrop {
    z-index: 55;
  }

  .sidebar-backdrop[hidden],
  .context-backdrop[hidden],
  .context-backdrop.hidden {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 340px);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    z-index: 50;
    flex: none;
    margin: 0;
    padding:
      calc(16px + env(safe-area-inset-top, 0))
      14px
      calc(16px + env(safe-area-inset-bottom, 0));
    border-right: 0;
    box-shadow: 16px 0 40px rgba(15, 23, 42, 0.2);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    background: var(--bg-elev);
  }

  .sidebar-backdrop {
    flex: none;
    margin: 0;
  }

  body.sidebar-open,
  body.sheet-open,
  body:has(.menu.is-sheet:not(.hidden)) {
    overflow: hidden;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 4px 12px;
  }

  .sidebar-head strong {
    font-size: 0.95rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
  }

  .mobile-only {
    display: grid;
  }

  .tree {
    max-height: none;
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .tree-home,
  .tree .tree-link {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .tree-toggle {
    width: 36px;
    height: 44px;
  }

  .sidebar-trash,
  .sidebar-photos,
  .sidebar-logout {
    min-height: 46px;
    justify-content: flex-start;
  }

  .main {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .toolbar {
    margin: 8px 8px 0;
    padding: 8px;
    position: relative;
    top: auto;
    flex: 0 0 auto;
    gap: 8px;
    border-radius: 14px;
    z-index: 20;
  }

  .toolbar-nav {
    flex: 1 1 100%;
    flex-wrap: nowrap;
  }

  .search-wrap {
    display: none !important;
  }

  .search-wrap input,
  .modal-card input,
  .modal-card select,
  .field input {
    font-size: 16px;
  }

  .breadcrumb {
    flex: 1;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .breadcrumb::-webkit-scrollbar {
    display: none;
  }

  .breadcrumb button {
    flex: 0 0 auto;
    max-width: 160px;
    min-height: 40px;
    font-size: 0.84rem;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .toolbar .toolbar-btn {
    display: none;
  }

  .toolbar-divider {
    display: none;
  }

  .view-toggle,
  .pretty-select-toolbar,
  .sort-wrap {
    min-height: 40px;
  }

  .pretty-select-toolbar,
  .sort-wrap {
    flex: 1;
    min-width: 0;
  }

  .pretty-select-toolbar .pretty-select-btn {
    min-height: 44px;
    font-size: 16px;
  }

  .pretty-select.is-open .pretty-select-menu {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    min-width: 100%;
    width: 100%;
    max-height: min(70dvh, 480px);
    border-radius: 18px 18px 0 0;
    padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.22);
    animation: sheet-up 0.26s ease;
  }

  .pretty-select.is-open .pretty-select-menu::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    margin: 4px auto 10px;
    border-radius: 99px;
    background: var(--line-strong);
  }

  .pretty-select-menu button {
    min-height: 48px;
  }

  .listing {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px max(8px, env(safe-area-inset-right, 0px)) calc(88px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }

  body.sheet-open .listing {
    overflow: hidden;
    touch-action: none;
  }

  body.has-selection .listing {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .compose {
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0));
    z-index: 33;
  }

  .compose-fab {
    width: 56px;
    height: 56px;
    font-size: 1.28rem;
  }

  .compose-menu {
    display: none !important;
  }

  body.has-selection .compose {
    display: none;
  }

  body:has(#progress:not(.hidden)) .compose {
    bottom: calc(96px + env(safe-area-inset-bottom, 0));
  }

  .selection-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 34;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-around;
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 22px max(4px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
    background: var(--bg-elev);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.12);
  }

  .selection-bar.hidden,
  .selection-bar[hidden] {
    display: none !important;
  }

  .toolbar.has-selection .view-toggle,
  .toolbar.has-selection .pretty-select-toolbar,
  .toolbar.has-selection .sort-wrap {
    display: none;
  }

  .selection-bar #selection-count {
    position: absolute;
    left: 12px;
    top: 6px;
    flex: none;
    width: auto;
    text-align: left;
    padding: 0;
    font-size: 0.7rem;
  }

  .selection-bar .toolbar-btn,
  .toolbar .selection-bar .toolbar-btn,
  .toolbar .selection-bar .btn.primary.toolbar-btn {
    display: inline-flex !important;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    justify-content: center;
    gap: 4px;
    padding: 6px 2px;
    background: transparent;
    border: 0;
  }

  .selection-bar .toolbar-btn i,
  .toolbar .selection-bar .toolbar-btn i {
    font-size: 1.05rem;
  }

  .selection-bar .toolbar-btn span,
  .toolbar .selection-bar .toolbar-btn span {
    display: block;
    font-size: 0.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .listing.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card {
    border-radius: 14px;
    padding: 10px;
  }

  .card:hover {
    transform: none;
    box-shadow: none;
  }

  .card.is-pressed,
  .card.selected {
    transform: none;
    background: var(--accent-soft);
  }

  .card .thumb {
    aspect-ratio: 1;
    margin-bottom: 8px;
  }

  .card .name {
    font-size: 0.82rem;
  }

  .card .meta {
    font-size: 0.68rem;
  }

  .listing.list .list-head {
    display: none;
  }

  .listing.list .card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 12px;
  }

  .listing.list .card .thumb {
    width: 48px;
    aspect-ratio: 1;
    margin: 0;
    flex: 0 0 48px;
  }

  .listing.list .card-main {
    flex: 1;
    min-width: 0;
  }

  .listing.list .meta {
    display: block;
  }

  .listing.list .col {
    display: none;
  }

  .file-icon {
    font-size: 1.4rem;
  }

  .empty {
    padding: 12px;
  }

  .progress {
    position: fixed;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    align-self: stretch;
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    margin: 0;
    z-index: 32;
  }

  body.has-selection .progress {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .progress-files {
    max-height: 28vh;
  }

  .context-backdrop:not([hidden]) {
    display: block;
  }

  .menu,
  .menu.is-sheet {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100%;
    max-width: 100%;
    max-height: min(78dvh, 560px);
    overflow: auto;
    border-radius: 18px 18px 0 0;
    padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: sheet-up 0.26s ease;
  }

  .menu.is-sheet::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    margin: 4px auto 10px;
    border-radius: 99px;
    background: var(--line-strong);
  }

  .menu button {
    min-height: 48px;
    font-size: 1rem;
    padding: 10px 14px;
    border-radius: 12px;
  }

  .modal {
    align-items: end;
    padding: 0;
    place-items: end center;
    z-index: 80;
  }

  .modal-card {
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    max-height: min(92dvh, 720px);
    overflow: auto;
    overscroll-behavior: contain;
    animation: sheet-up 0.28s ease;
  }

  .modal-card::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 99px;
    background: var(--line-strong);
  }

  .create-kinds {
    grid-template-columns: 1fr;
  }

  .create-kinds .btn {
    flex-direction: row;
    min-height: 48px;
    justify-content: flex-start;
    padding: 12px 14px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .move-tree button {
    min-height: 44px;
  }

  .preview {
    background: #0b1220;
    z-index: 90;
  }

  .preview-bar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top, 0));
    background: rgba(11, 18, 32, 0.88);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .preview-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .preview-title small,
  .preview-meta {
    color: rgba(255, 255, 255, 0.7);
  }

  .preview-bar-actions {
    width: auto;
    margin-left: auto;
  }

  .preview-bar-actions .btn {
    min-height: 44px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: transparent;
  }

  .preview-bar-actions .btn.primary {
    background: var(--accent);
  }

  .preview-bar-actions .btn span {
    display: none;
  }

  .preview-bar-actions .btn.primary span {
    display: inline;
  }

  .preview-close {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border-color: transparent;
    color: #fff;
  }

  .preview-text,
  .editor-wrap,
  .preview-doc,
  .preview-sheet,
  .preview-frame,
  .preview-body iframe {
    width: 100%;
    max-width: 100%;
    max-height: none;
    height: auto;
    border-radius: 0;
    box-shadow: none;
  }

  .editor-wrap,
  .preview-body iframe,
  .preview-frame {
    height: calc(100dvh - 118px);
  }

  .preview-text {
    padding: 16px;
    min-height: calc(100dvh - 118px);
  }

  .preview-body {
    padding: 0;
    width: 100%;
  }

  .preview-body img,
  .preview-body video {
    max-width: 100vw;
    max-height: calc(100dvh - 118px);
    border-radius: 0;
    box-shadow: none;
  }

  .preview-photo.is-lq {
    filter: blur(8px);
  }

  .preview.is-gallery .preview-body {
    padding: 0 0 52px;
    align-items: center;
    justify-content: center;
  }

  .gallery-nav {
    width: 44px;
    height: 44px;
    background: rgba(11, 18, 32, 0.45);
    color: #fff;
  }

  .gallery-nav#gallery-prev {
    left: max(8px, env(safe-area-inset-left, 0px));
  }

  .gallery-nav#gallery-next {
    right: max(8px, env(safe-area-inset-right, 0px));
  }

  .gallery-count {
    bottom: calc(10px + env(safe-area-inset-bottom, 0));
  }

  .gate {
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    min-height: 100dvh;
  }

  .gate-card {
    padding: 28px 20px 22px;
    border-radius: 18px;
  }

  .gate-card .btn.wide {
    min-height: 48px;
  }

  .excel-status {
    flex-wrap: wrap;
  }

  @keyframes sheet-up {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .sidebar,
    .menu,
    .menu.is-sheet,
    .modal-card,
    .pretty-select.is-open .pretty-select-menu {
      transition: none;
      animation: none;
    }
  }
}

@media (max-width: 820px) and (orientation: landscape) {
  .listing.grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-bar {
    padding-top: max(6px, env(safe-area-inset-top, 0px));
  }

  .preview-bar-actions .btn span {
    display: inline;
  }
}

@media (max-width: 420px) {
  .listing.grid {
    gap: 8px;
  }

  .mobile-bar-title strong {
    font-size: 0.88rem;
  }
}

@media (min-width: 821px) {
  .main {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .toolbar {
    margin: 18px 22px 0;
    padding: 8px 12px;
    gap: 12px;
  }

  .toolbar .toolbar-btn {
    min-height: 36px;
    padding: 7px 12px;
  }

  .listing {
    padding: 16px 22px 108px;
  }

  .listing.grid {
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  }

  .listing.list {
    gap: 2px;
  }

  .theme-toggle:hover {
    color: var(--accent);
  }

  .progress {
    margin: 0 22px 18px;
  }

  body:has(#progress:not(.hidden)) .compose {
    bottom: 20px;
  }
}

