/* 网关公共样式：主题、工作区、云盘列表与弹层；由 index.html 加载，无数据接口。 */
@import url('./photos/viewer.css');
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/rubik.woff2") format("woff2-variations");
}

:root {
  color-scheme: light;
  --primary: oklch(0.485 0.13 257);
  --primary-strong: oklch(0.4 0.13 255);
  --on-primary: oklch(1 0 0);
  --secondary-container: oklch(0.902 0.047 265.5);
  --on-secondary-container: oklch(0.394 0.054 261.9);
  --surface: oklch(0.984 0.008 286.25);
  --surface-low: oklch(1 0 0);
  --surface-container: oklch(0.948 0.009 286.22);
  --surface-container-high: oklch(0.932 0.008 278.63);
  --surface-container-highest: oklch(0.915 0.009 286.21);
  --surface-container-low: color-mix(in oklch, var(--surface-container) 70%, var(--surface));
  --outline: oklch(0.57 0.018 269.84);
  --outline-variant: oklch(0.827 0.017 271.2);
  --on-surface: oklch(0.225 0.009 255.61);
  --on-surface-variant: oklch(0.397 0.018 264.34);
  --error: oklch(0.56 0.19 25);
  --error-container: oklch(0.955 0.04 25);
  --shadow-1: 0 6px 18px rgb(30 42 62 / 7%);
  --shadow-2: 0 18px 48px rgb(30 42 62 / 13%);
}

:root.dark {
  color-scheme: dark;
  --primary: oklch(0.864 0.066 263.31);
  --primary-strong: oklch(0.827 0.086 262.68);
  --on-primary: oklch(0.313 0.102 254.72);
  --secondary-container: oklch(0.359 0.053 261.22);
  --on-secondary-container: oklch(0.859 0.052 264.78);
  --surface: oklch(0.187 0.011 268.11);
  --surface-low: oklch(0.164 0.011 268.01);
  --surface-container: oklch(0.242 0.009 255.59);
  --surface-container-high: oklch(0.285 0.01 268.34);
  --surface-container-highest: oklch(0.313 0.011 268.46);
  --outline: oklch(0.656 0.017 266.22);
  --outline-variant: oklch(0.397 0.018 264.34);
  --on-surface: oklch(0.915 0.009 286.21);
  --on-surface-variant: oklch(0.827 0.017 271.2);
  --error: oklch(0.78 0.14 25);
  --error-container: oklch(0.31 0.07 25);
  --shadow-1: 0 6px 18px rgb(0 0 0 / 22%);
  --shadow-2: 0 18px 48px rgb(0 0 0 / 38%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--surface-container);
  color: var(--on-surface);
  font-family: "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: geometricPrecision;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

:focus-visible {
  outline: 3px solid color-mix(in oklch, var(--primary) 50%, transparent);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.login-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--surface-container);
  color: var(--on-surface);
}

.login-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.login-brand,
.login-theme-button {
  border: 0;
  background: transparent;
  color: inherit;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 2rem;
}

.login-brand svg {
  width: 24px;
  height: 24px;
}

.login-theme-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 0;
  transition: color 150ms ease, opacity 150ms ease;
}

.login-theme-button:hover,
.login-theme-button.active {
  background: transparent;
  color: var(--primary);
}

.login-theme-button svg {
  width: 30px;
  height: 30px;
}

.login-main {
  width: min(100%, 1024px);
  flex: 1;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.login-panel {
  display: flex;
  width: min(100%, 448px);
  min-height: 522px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--surface);
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.login-form {
  display: flex;
  width: min(100%, 416px);
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.login-logo {
  display: inline-grid;
  width: 160px;
  height: 160px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: var(--on-surface);
}

.login-logo svg {
  width: 160px;
  height: 160px;
}

.login-logo-circle {
  fill: var(--primary);
}

.login-logo-plane {
  fill: var(--surface);
}

.td-field {
  display: flex;
  width: min(100%, 320px);
  height: 48px;
  flex-direction: column;
  justify-content: end;
  position: relative;
  margin-top: 26px;
}

.td-field label {
  position: absolute;
  left: 2px;
  top: -31px;
  color: var(--on-surface);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

.td-field label span {
  color: var(--error);
}

.input,
.search-field input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--on-surface);
  outline: none;
}

.td-input {
  width: 100%;
  height: 48px;
  border: 2px solid var(--outline-variant);
  border-radius: 16px;
  background: transparent;
  color: var(--on-surface);
  font-size: 1rem;
  outline: none;
  padding: 0 20px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.td-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.td-login-button {
  display: inline-flex;
  width: min(100%, 320px);
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 4px;
  padding: 0 24px;
  transition: background 150ms ease, transform 150ms ease;
}

.td-login-button:hover {
  background: color-mix(in oklch, var(--secondary-container) 86%, var(--on-secondary-container));
}

.td-login-button:active {
  transform: scale(0.99);
}

.login-note {
  width: min(100%, 420px);
  margin: -10px 0 0;
  color: var(--on-surface-variant);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

.error-text {
  min-height: 1.2em;
  margin: -12px 0 0 !important;
  color: var(--error) !important;
  font-weight: 650;
  text-align: center;
}

.button,
.round-button,
.avatar-button,
.icon-button,
.share-action-button,
.crumb,
.brand-link,
.file-main,
.side-nav-item,
.tool-button,
.menu-action,
.context-menu button {
  border: 0;
  color: inherit;
}

.td-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.brand-icon,
.side-nav-item .td-icon,
.round-button .td-icon,
.login-theme-button .td-icon,
.filter-icon .td-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface);
  font-weight: 650;
  padding: 0 14px;
  text-decoration: none;
  transition: background 180ms ease, box-shadow 180ms ease, transform 150ms ease;
}

.button:hover {
  background: var(--surface-container-high);
  box-shadow: var(--shadow-1);
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.button.primary:hover {
  background: var(--primary-strong);
}

.button.text {
  background: transparent;
  color: var(--primary);
}

.button.text:hover {
  background: color-mix(in oklch, var(--primary) 8%, transparent);
  box-shadow: none;
}

.button.danger {
  background: var(--error-container);
  color: var(--error);
}

.authed-shell {
  display: flex;
  flex-direction: row;
  height: 100dvh;
  overflow: hidden;
}

.public-share-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
}

.share-header {
  flex: 0 0 auto;
}

.share-main {
  width: min(100%, 1536px);
  flex: 1 1 auto;
}

.side-nav {
  width: 80px;
  flex: 0 0 auto;
  padding-top: 80px;
  background: transparent;
}

.side-nav ul {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-nav li {
  display: flex;
  width: 64px;
  flex-direction: column;
  align-items: center;
  justify-items: center;
  gap: 4px;
}

.side-nav li span {
  color: var(--on-surface-variant);
  font-size: 0.72rem;
  font-weight: 520;
}

.side-nav-item {
  position: relative;
  display: grid;
  width: 64px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: var(--on-surface-variant);
}

.side-nav-item .nav-indicator {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0;
  background: var(--secondary-container);
}

.side-nav-item.active {
  color: var(--on-secondary-container);
}

.side-nav-item.active .nav-indicator {
  opacity: 1;
}

.content-shell {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  overflow-x: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: transparent;
}

.brand-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  border-radius: 0;
  background: transparent;
  color: var(--on-surface);
  padding: 0;
}

.brand-link svg {
  color: var(--on-surface);
}

.brand-link span {
  font-size: 1.5rem;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-field {
  display: flex;
  width: min(22.6875rem, 36vw);
  min-height: 40px;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  background: var(--surface-container-highest);
  color: var(--on-surface-variant);
  padding: 0 12px;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.search-filter-button {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: 0;
}

.search-filter-button:hover {
  background: color-mix(in oklch, var(--primary) 8%, transparent);
}

.search-field:focus-within {
  background: var(--surface-low);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.filter-icon {
  display: inline-flex;
  align-items: center;
}

.search-filter-popover {
  position: fixed;
  z-index: 45;
  width: min(420px, calc(100vw - 16px));
  max-height: min(80vh, 640px);
  overflow: auto;
  border: 1px solid color-mix(in oklch, var(--outline-variant) 55%, transparent);
  border-radius: 16px;
  background: var(--surface-container-high);
  box-shadow: var(--shadow-2);
  color: var(--on-surface);
}

.search-filter-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 16px 0;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-section h3,
.filter-label {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-input {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--outline-variant);
  border-radius: 16px;
  background: transparent;
  color: var(--on-surface);
  font-size: 1rem;
  outline: none;
  padding: 0 14px;
}

.filter-input:focus {
  border-color: var(--primary);
}

.filter-radio-row,
.filter-chip-row,
.filter-location-row,
.filter-date-row,
.filter-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filter-radio-row.wrap,
.filter-chip-row {
  flex-wrap: wrap;
  gap: 8px;
}

.filter-radio-row label,
.filter-switch,
.filter-date-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface);
  font-size: 0.875rem;
}

.filter-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  color: var(--on-surface);
  cursor: pointer;
  padding: 3px 12px;
}

.filter-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-chip .td-icon {
  width: 20px;
  height: 20px;
}

.filter-chip.active,
.filter-chip:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 14%, transparent);
  color: var(--primary);
}

.filter-location-row {
  align-items: flex-start;
  justify-content: space-between;
}

.filter-path {
  min-height: 40px;
}

.filter-date-row {
  align-items: end;
}

.filter-date-row label {
  flex: 1 1 0;
  align-items: start;
  flex-direction: column;
}

.filter-actions {
  justify-content: flex-end;
  margin: 0 -16px;
  border-top: 1px solid color-mix(in oklch, var(--outline-variant) 45%, transparent);
  border-radius: 0 0 16px 16px;
  background: var(--surface-container-highest);
  padding: 12px 16px;
}

.round-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: var(--on-surface);
  transition: color 150ms ease, opacity 150ms ease;
}

.round-button:hover,
.round-button.active {
  background: transparent;
  color: var(--primary);
}

.avatar-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 760;
}

.avatar-button:hover {
  background: color-mix(in oklch, var(--secondary-container) 86%, var(--on-secondary-container));
}

.profile-wrap {
  position: relative;
}

.profile-menu {
  position: absolute;
  top: 39px;
  right: 0;
  display: flex;
  min-width: 160px;
  flex-direction: column;
  gap: 2px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-container-high);
  box-shadow: var(--shadow-2);
  color: var(--on-surface);
  padding: 6px;
}

.profile-identity {
  display: grid;
  min-height: 59px;
  align-items: center;
  border-radius: 12px;
  color: var(--on-surface);
  cursor: default;
  gap: 0;
  padding: 10px 16px;
}

.profile-identity span,
.profile-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-identity-action {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.profile-identity-action:hover {
  background: color-mix(in oklch, var(--on-surface) 8%, transparent);
}

.profile-identity-action:focus-visible,
.user-modal :focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.profile-identity span {
  color: var(--on-surface-variant);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
}

.profile-identity strong {
  color: var(--on-surface);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.profile-label {
  color: var(--on-surface-variant);
  font-size: 0.8rem;
}

.permission-chip {
  justify-self: start;
  border-radius: 999px;
  background: var(--surface);
  color: var(--on-surface-variant);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 9px;
}

.permission-chip.admin {
  background: color-mix(in oklch, var(--primary) 18%, white);
  color: var(--primary-strong);
}

.menu-action {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  background: transparent;
  color: var(--on-surface);
  font-size: 1rem;
  font-weight: 500;
  gap: 10px;
  padding: 10px 16px;
}

.menu-action:hover {
  background: color-mix(in oklch, var(--on-surface) 8%, transparent);
}

.drive-main {
  width: min(100%, 1536px);
  min-height: 0;
  flex: 1;
  overflow: auto;
  margin: 0 auto;
  padding: 16px 16px 8px;
}

.crumb-static {
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 12px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.breadcrumbs {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  font-weight: 500;
}

.crumb-separator {
  color: var(--on-surface-variant);
  padding-inline: 2px;
}

.crumb {
  border-radius: 999px;
  background: var(--surface-container-high);
  color: var(--on-surface);
  padding: 7px 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.crumb:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sort-button {
  min-width: 104px;
}

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: calc(100vw - 36px);
  border: 1px solid color-mix(in oklch, var(--outline-variant) 70%, transparent);
  border-radius: 999px;
  background: var(--surface-container-high);
  box-shadow: var(--shadow-2);
  color: var(--on-surface-variant);
  padding: 8px 10px 8px 14px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.selection-bar span {
  overflow: hidden;
  max-width: 140px;
  text-overflow: ellipsis;
}

.file-browser-shell {
  display: flex;
  min-height: 420px;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--surface-low);
}

.drive-toolbar {
  flex: 0 0 auto;
}

.path-row {
  display: flex;
  min-height: 53.625px;
  align-items: center;
  padding: 8px;
}

.action-row {
  display: flex;
  min-height: 40px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 8px;
}

.selection-count {
  color: var(--on-surface);
  transition: color 150ms ease;
}

.selection-count.empty {
  color: color-mix(in oklch, var(--on-surface) 42%, transparent);
}

.tool-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  min-width: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: transparent;
  color: var(--on-surface);
  padding: 0;
  transition: background 150ms ease, color 150ms ease;
}

.tool-button.small {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.tool-button:hover:not(:disabled),
.tool-button.active:not(:disabled) {
  background: color-mix(in oklch, var(--primary) 8%, transparent);
}

.tool-button:disabled {
  color: color-mix(in oklch, var(--on-surface) 38%, transparent);
  opacity: 1;
}

#file-actions-button {
  display: none;
}

.storage-panel {
  display: grid;
  gap: 18px;
}

.file-header-row,
.file-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}

.file-header-row {
  border-bottom: 1px solid color-mix(in oklch, var(--outline-variant) 80%, transparent);
  color: var(--on-surface-variant);
  font-size: 0.82rem;
  font-weight: 760;
  padding: 12px 18px;
}

.file-list {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  gap: 8px;
  padding: 8px 8px 8px 8px;
}

.file-row {
  min-height: 48px;
  border-bottom: 0;
  border-radius: 16px;
  background: transparent;
  padding: 8px;
  transition: background 150ms ease, color 150ms ease;
}

/* Same virtual scrollers as the original TelDrive FileList. */
.file-list.category-virtual-host {
  display: block;
  padding: 0;
  overflow: hidden;
  position: relative;
}
.category-virtual-scroller { height: 100%; width: 100%; }
.category-virtual-scroller [data-item-index] { padding: 0 8px 8px; }
.category-virtual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
  gap: 16px;
  padding: 8px 8px 8px 16px;
}
.category-virtual-cell { min-width: 0; }
.category-pagination-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}
.category-pagination-status button {
  border: 0;
  border-radius: 12px;
  padding: 8px 16px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.file-row:hover {
  background: color-mix(in oklch, var(--primary) 8%, transparent);
}

.file-row.selected {
  background: color-mix(in oklch, var(--secondary-container) 60%, transparent);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-main {
  display: flex;
  grid-column: span 3;
  min-width: 0;
  align-items: center;
  gap: 8px;
  background: transparent;
  padding: 0;
  text-align: left;
}

.file-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: rgb(92 194 214 / 12%);
  color: rgb(92 194 214);
}

.file-icon.folder {
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  color: var(--primary);
}

.file-icon.video {
  background: rgb(133 92 214 / 12%);
  color: rgb(133 92 214);
}

.file-icon.image {
  background: rgb(214 92 112 / 12%);
  color: rgb(214 92 112);
}

.file-icon.archive {
  background: rgb(92 92 214 / 12%);
  color: rgb(92 92 214);
}

.file-icon.text {
  background: rgb(92 194 214 / 12%);
  color: rgb(92 194 214);
}

.file-icon .td-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.file-thumbnail {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgb(214 92 112 / 12%);
  color: rgb(214 92 112);
}

.file-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 160ms ease;
}

.file-thumbnail.loaded img {
  opacity: 1;
}

.file-thumbnail-fallback {
  display: inline-grid;
  place-items: center;
}

.file-thumbnail-fallback .td-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.file-name-wrap {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.file-label {
  min-width: 0;
  overflow: hidden;
  color: var(--on-surface);
  font-size: 1rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-subtitle,
.file-meta,
.file-date {
  color: var(--on-surface);
  font-size: 1rem;
}

.file-meta {
  grid-column: span 1;
}

.file-date {
  grid-column: span 2;
}

.grid-view,
.tile-view {
  align-content: start;
  gap: 16px;
  padding: 8px 8px 8px 16px;
}

.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
}

.tile-view {
  grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
}

.grid-view .file-row,
.tile-view .file-row {
  grid-template-columns: minmax(0, 1fr);
}

.grid-view .file-row {
  min-height: 225px;
  grid-template-rows: auto 1fr auto auto;
  align-content: stretch;
  justify-items: stretch;
  text-align: left;
}

.tile-view .file-row {
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 92px;
  align-content: start;
  column-gap: 12px;
  row-gap: 4px;
}

.grid-view .file-main,
.tile-view .file-main {
  grid-column: auto;
  order: 1;
}

.grid-view .file-main,
.tile-view .file-main {
  display: contents;
}

.grid-view .file-icon {
  order: 2;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
}

.grid-view .file-thumbnail {
  order: 2;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
}

.tile-view .file-icon {
  grid-row: 1 / 4;
}

.tile-view .file-thumbnail {
  grid-row: 1 / 4;
}

.grid-view .file-icon .td-icon {
  width: 3rem;
  height: 3rem;
}

.grid-view .file-thumbnail-fallback .td-icon {
  width: 3rem;
  height: 3rem;
}

.grid-view .file-label {
  order: 1;
  max-width: 100%;
  text-align: left;
}

.tile-view .file-label {
  grid-column: 2;
}

.grid-view .file-meta,
.tile-view .file-meta {
  display: block;
  grid-column: auto;
  order: 4;
  overflow: hidden;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-view .file-date,
.tile-view .file-date {
  display: block;
  grid-column: auto;
  order: 3;
  overflow: hidden;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-view .file-meta {
  grid-column: 2;
  padding-left: 0;
}

.tile-view .file-date {
  grid-column: 2;
  padding-left: 0;
}

@media (min-width: 1280px) {
  .list-view .file-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }

  .list-view .file-main {
    grid-column: span 4;
  }

  .list-view .file-meta {
    grid-column: span 1;
  }

  .list-view .file-date {
    grid-column: span 1;
  }

  .list-view .file-meta,
  .list-view .file-date {
    justify-self: start;
    text-align: left;
  }
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: var(--on-surface);
}

.icon-button:hover {
  background: var(--surface-container-high);
}

.icon-button.danger {
  color: var(--error);
}

.icon-button.danger:hover {
  background: var(--error-container);
}

.empty-state,
.loading-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 32px;
  color: var(--on-surface-variant);
  text-align: center;
}

.empty-state strong,
.loading-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--on-surface);
  font-size: 1.08rem;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  width: min(420px, calc(100vw - 36px));
  gap: 10px;
}

.toast {
  border: 1px solid color-mix(in oklch, var(--outline-variant) 70%, transparent);
  border-radius: 18px;
  background: var(--surface-low);
  box-shadow: var(--shadow-2);
  padding: 13px 14px;
}

.context-menu {
  position: fixed;
  z-index: 40;
  display: flex;
  min-width: 120px;
  max-width: min(260px, calc(100vw - 16px));
  flex-direction: column;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-container);
  box-shadow: 0 1px 3px 1px rgb(0 0 0 / 15%), 0 1px 2px 0 rgb(0 0 0 / 30%);
  color: var(--on-surface);
  padding: 4px;
}

.context-menu button {
  display: flex;
  height: 32px;
  min-height: 32px;
  width: 100%;
  align-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--on-surface);
  font-size: 1rem;
  font-weight: 400;
  gap: 8px;
  text-align: left;
  padding: 4px 8px;
}

.context-menu button:hover {
  background: color-mix(in oklch, var(--on-surface) 8%, transparent);
}

.context-menu button:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.context-menu button.danger {
  color: var(--error);
}

.context-menu button.checked {
  color: var(--primary);
}

.context-menu-icon {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
}

.context-menu-icon .td-icon {
  width: 16px;
  height: 16px;
}

.context-menu button span:last-child {
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-menu.create-menu {
  min-width: 151px;
}

.toolbar-menu.open-menu {
  min-width: 120px;
}

.toolbar-menu.fileActions-menu,
.toolbar-menu.layout-menu,
.toolbar-menu.sort-menu,
.toolbar-menu.storage-days-menu,
.toolbar-menu.options-menu {
  min-width: 160px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgb(15 23 42 / 42%);
  padding: 22px;
}

.modal-card {
  display: grid;
  width: min(920px, 100%);
  max-height: min(86vh, 860px);
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--outline-variant) 72%, transparent);
  border-radius: 24px;
  background: var(--surface-low);
  box-shadow: var(--shadow-2);
}

.form-modal,
.confirm-modal {
  width: min(448px, 100%);
  border: 0;
  border-radius: 16px;
  background: var(--surface);
}

.form-modal form {
  display: grid;
  min-width: 0;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 18px 16px 20px;
}

.form-modal .modal-body {
  padding: 8px 24px;
}

.modal-field {
  display: grid;
  gap: 8px;
  color: var(--on-surface);
}

.modal-field span {
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}

.modal-field .td-input {
  width: 100%;
  font-weight: 400;
}

.form-modal .td-input {
  padding-inline: 14px;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid color-mix(in oklch, var(--outline-variant) 68%, transparent);
  padding: 14px 16px;
}

.modal-header > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.modal-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-modal .modal-header strong,
.confirm-modal .modal-header strong {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.55;
}

.form-modal .modal-header,
.form-modal .modal-footer,
.confirm-modal .modal-header,
.confirm-modal .modal-footer {
  border: 0;
  padding: 16px 24px;
}

.delete-confirm-modal {
  position: relative;
  width: min(500px, 100%);
  border-radius: 16px;
}

.user-modal {
  width: min(640px, 100%);
  max-height: calc(100dvh - 44px);
  grid-template-rows: auto minmax(0, 1fr);
}

.user-modal form {
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.user-modal .user-modal-body {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--outline-variant) var(--surface);
  padding: 8px 24px 16px;
}

.user-modal #user-fields {
  display: grid;
  min-width: 0;
  gap: 16px;
  margin: 0;
  border: 0;
  padding: 0;
}

.user-modal .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.user-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.user-modal .td-input {
  min-width: 0;
  caret-color: var(--primary);
}

.user-modal .td-input:focus {
  box-shadow: none;
}

.user-modal .td-input::placeholder {
  color: var(--on-surface-variant);
  opacity: 1;
}

.user-modal textarea {
  height: auto;
  min-height: 72px;
  resize: vertical;
  font: inherit;
}

.user-modal .td-input:read-only {
  color: var(--on-surface-variant);
}

.user-modal .td-input:disabled,
.user-modal fieldset:disabled {
  opacity: 0.65;
}

.user-help {
  margin: -8px 0 0;
  color: var(--on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.user-check {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.user-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--primary-strong);
}

.user-permissions {
  margin: 0;
  border: 0;
  padding: 0;
}

.user-permissions legend {
  margin-bottom: 8px;
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}

.user-permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 12px;
}

.user-feedback {
  margin: 0;
  max-height: 96px;
  overflow-y: auto;
  padding: 8px 24px 0;
  color: var(--on-surface);
  font-size: 0.875rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.user-feedback.error-text {
  color: var(--error);
}

@media (max-width: 540px) {
  .user-field-grid { grid-template-columns: minmax(0, 1fr); }
  .user-permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-modal .modal-header,
  .user-modal .modal-footer { padding: 16px; }
  .user-modal .user-modal-body { padding: 8px 16px 16px; }
  .user-modal .user-feedback { padding-inline: 16px; }
}

.delete-confirm-modal .modal-header,
.delete-confirm-modal .modal-footer {
  min-height: 52px;
}

.delete-confirm-body {
  padding: 22px 24px 28px;
}

.delete-confirm-body p {
  margin: 0;
  color: var(--on-surface);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

.modal-header span,
.details-list dt {
  color: var(--on-surface-variant);
  font-size: 0.86rem;
}

.modal-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid color-mix(in oklch, var(--outline-variant) 68%, transparent);
  border-bottom: 0;
}

.modal-footer .button {
  min-height: 40px;
  min-width: 80px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.43;
  padding-inline: 24px;
}

.modal-footer .button.primary {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.modal-footer .button.primary:hover {
  background: color-mix(in oklch, var(--secondary-container) 92%, var(--on-secondary-container));
}

.modal-footer .button.primary:disabled {
  background: color-mix(in oklch, var(--on-surface) 12%, transparent);
  color: color-mix(in oklch, var(--on-surface) 38%, transparent);
  opacity: 1;
}

.delete-confirm-modal .modal-header strong {
  font-size: 1rem;
  font-weight: 500;
}

.delete-confirm-modal .modal-footer {
  gap: 8px;
  padding: 8px;
}

.delete-confirm-modal .button {
  min-height: 40px;
  min-width: 80px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 400;
  padding-inline: 24px;
}


@media (max-width: 560px) {
  .photo-heading { flex-direction: column; align-items: stretch; gap: 4px; }
  .photo-toolbar { padding: 8px 12px; gap: 8px; }
  .photo-footer { padding: 10px 12px; }
}

.preview-modal {
  width: min(1120px, 100%);
  height: min(86vh, 860px);
  grid-template-rows: auto minmax(0, 1fr);
}

.preview-shell {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  min-height: 0;
  overflow: hidden;
}

.preview-content {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.preview-nav-button {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  border: 0;
  background: var(--surface-low);
  color: var(--on-surface-variant);
  transition: background 150ms ease, color 150ms ease;
}

.preview-nav-button:hover:not(:disabled) {
  background: var(--surface-container);
  color: var(--on-surface);
}

.preview-nav-button:disabled {
  color: color-mix(in oklch, var(--on-surface) 24%, transparent);
  opacity: 1;
}

.preview-nav-button .td-icon {
  width: 32px;
  height: 32px;
}

.preview-stage,
.preview-frame,
.preview-text,
.details-list {
  min-height: 360px;
}

.preview-stage {
  display: grid;
  place-items: center;
  overflow: auto;
  background: var(--surface-container-high);
  padding: 16px;
}

.preview-stage.image {
  background-color: color-mix(in oklch, var(--surface-container-highest) 72%, transparent);
  background-image:
    linear-gradient(45deg, rgb(127 127 127 / 18%) 25%, transparent 25%),
    linear-gradient(-45deg, rgb(127 127 127 / 18%) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgb(127 127 127 / 18%) 75%),
    linear-gradient(-45deg, transparent 75%, rgb(127 127 127 / 18%) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage img,
.preview-stage video {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 14px;
}

.preview-stage audio {
  width: min(560px, 100%);
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface);
}

.preview-text {
  width: 100%;
  height: 100%;
  overflow: auto;
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.65;
  overscroll-behavior: contain;
  padding: 18px;
  white-space: pre-wrap;
}

.preview-empty {
  min-height: 360px;
}

.details-list {
  display: grid;
  align-content: start;
  gap: 0;
  overflow: auto;
  margin: 0;
  padding: 8px 16px;
}

.details-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
  border-bottom: 1px solid color-mix(in oklch, var(--outline-variant) 55%, transparent);
  padding: 12px 0;
}

.details-list div:last-child {
  border-bottom: 0;
}

.details-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
}

.share-grid {
  display: grid;
  gap: 12px;
}

.share-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid color-mix(in oklch, var(--outline-variant) 70%, transparent);
  border-radius: 24px;
  background: var(--surface-low);
  padding: 14px;
}

.share-body {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.share-body span {
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-link {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  padding: 0 12px;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.share-action-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface);
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.share-action-button:hover {
  background: var(--surface-container-high);
}

.share-action-button:active {
  transform: translateY(1px);
}

.share-action-button.danger {
  background: var(--error-container);
  color: var(--error);
}

.storage-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.storage-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid color-mix(in oklch, var(--outline-variant) 50%, transparent);
  border-radius: 32px;
  background: var(--surface-container-low);
  padding: 32px;
}

.storage-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.storage-overview-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 24px;
  background: var(--primary);
  color: var(--on-primary);
}

.storage-overview-icon .td-icon {
  width: 32px;
  height: 32px;
}

.storage-title h2,
.storage-title p,
.storage-stat span,
.storage-stat strong,
.category-count span,
.category-count strong,
.category-size strong,
.upload-activity-card h3 {
  margin: 0;
}

.storage-title h2 {
  color: var(--on-surface);
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
}

.storage-title p,
.storage-stat span,
.category-count span,
.chart-y-tick text,
.chart-x-label {
  color: var(--on-surface-variant);
}

.storage-title p {
  font-weight: 500;
}

.storage-metrics {
  display: flex;
  gap: 48px;
}

.storage-stat {
  display: flex;
  flex-direction: column;
}

.storage-stat span {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

.storage-stat strong {
  color: var(--primary);
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.category-card {
  display: flex;
  min-height: 165px;
  flex-direction: column;
  gap: 16px;
  border: 1px solid color-mix(in oklch, var(--outline-variant) 50%, transparent);
  border-radius: 28px;
  background: var(--surface-container-low);
  color: var(--on-surface);
  padding: 20px;
  text-decoration: none;
  transition: background 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover {
  background: var(--surface-container);
}

.category-card:focus-visible {
  outline: 3px solid color-mix(in oklch, var(--primary) 50%, transparent);
  outline-offset: 3px;
}

.category-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.category-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover .category-icon,
.category-card:focus-visible .category-icon {
  transform: scale(1.1);
}

.category-icon .td-icon {
  width: 24px;
  height: 24px;
}

.category-count {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.category-count span {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

.category-count strong {
  color: var(--on-surface);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.55;
}

.category-size {
  margin-top: 8px;
}

.category-size strong {
  color: var(--on-surface);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
}

.category-size span {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-container-high);
  margin-top: 12px;
}

.category-size i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.upload-activity-card {
  display: block;
  border: 1px solid color-mix(in oklch, var(--outline-variant) 50%, transparent);
  border-radius: 32px;
  background: var(--surface-container-low);
  padding: 24px;
}

.upload-activity-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.upload-activity-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.upload-chart-controls { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.upload-chart-container { position: relative; min-height: 250px; }

.upload-activity-card h3 {
  color: var(--on-surface);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
}

.storage-days-button {
  min-height: 32px;
  border: 0;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0 16px;
}

.storage-days-button:hover {
  background: var(--surface-container-highest);
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

.toast p {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 0.9rem;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-container-high);
  margin-top: 10px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

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

@media (max-width: 900px) {
  .authed-shell {
    flex-direction: column-reverse;
  }

  .side-nav {
    width: 100%;
    height: 64px;
    padding-top: 0;
    border-top: 1px solid var(--outline-variant);
  }

  .side-nav ul {
    flex-direction: row;
    justify-content: space-evenly;
    gap: 4px;
    padding: 8px;
  }

  .app-header {
    min-height: 58px;
  }

  .brand-link span {
    display: none;
  }

  .search-field {
    width: min(54vw, 26rem);
  }

  .toolbar-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .storage-summary {
    align-items: start;
    flex-direction: column;
    padding: 24px;
  }

  .storage-metrics {
    width: 100%;
    gap: 24px;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-header-row {
    display: none;
  }

  .file-browser-shell {
    min-height: 0;
  }

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

  #rename-button,
  #cut-button,
  #delete-selected,
  #download-selected {
    display: none;
  }

  #file-actions-button {
    display: inline-flex;
  }

  .grid-view .file-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .tile-view .file-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .file-main,
  .file-meta,
  .file-date {
    grid-column: auto;
  }

  .file-meta,
  .file-date {
    display: none;
  }

  .tile-view .file-label {
    grid-column: 2;
  }

  .tile-view .file-icon {
    grid-row: 1 / 4;
  }

  .row-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 560px) {
  .login-header {
    min-height: 58px;
    padding-inline: 16px;
  }

  .login-brand {
    font-size: 1.5rem;
  }

  .login-brand svg {
    width: 24px;
    height: 24px;
  }

  .login-main {
    padding-top: 12px;
  }

  .login-panel {
    padding: 28px 16px 56px;
  }

  .login-logo {
    width: 140px;
    height: 140px;
  }

  .login-logo svg {
    width: 140px;
    height: 140px;
  }

  .td-field label {
    font-size: 1rem;
  }

  .td-input {
    height: 48px;
  }

  .header-actions {
    gap: 8px;
  }

  .search-field {
    width: 48vw;
  }

  .button {
    min-height: 36px;
    padding-inline: 11px;
  }

  .share-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .share-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .share-link {
    min-width: 0;
  }

  .storage-summary,
  .upload-activity-card {
    border-radius: 24px;
    padding: 18px;
  }

  .preview-modal {
    height: min(88vh, 760px);
  }

  .preview-shell {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .preview-nav-button .td-icon {
    width: 24px;
    height: 24px;
  }

  .storage-title {
    align-items: flex-start;
  }

  .storage-title h2 {
    font-size: 1.45rem;
  }

  .storage-metrics {
    flex-direction: column;
    gap: 14px;
  }

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

  .category-card {
    min-height: 148px;
  }

  .file-row {
    padding-inline: 12px;
  }
}
