/* ------------------------------------------------------------------ */
/* 主题与基础                                                          */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;

  --bg: #e9eff7;
  --glow-1: rgba(96, 165, 250, 0.23);
  --glow-2: rgba(168, 125, 255, 0.14);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-soft: #f4f7fb;
  --surface-raised: #ffffff;
  --titlebar: rgba(247, 250, 254, 0.72);
  --border: rgba(28, 62, 108, 0.12);
  --border-strong: rgba(28, 62, 108, 0.19);
  --text: #17202c;
  --text-2: #5a6677;
  --text-3: #8793a3;
  --accent: #0067c0;
  --accent-solid: #0067c0;
  --accent-solid-hover: #00559e;
  --accent-soft: rgba(0, 103, 192, 0.1);
  --accent-border: rgba(0, 103, 192, 0.26);
  --row-hover: rgba(24, 74, 133, 0.055);
  --selected: rgba(0, 103, 192, 0.12);
  --danger: #c42b1c;
  --danger-soft: rgba(196, 43, 28, 0.1);
  --success: #0d7a3b;
  --success-soft: rgba(13, 122, 59, 0.1);
  --shadow-soft: 0 1px 2px rgba(20, 40, 75, 0.04), 0 8px 26px rgba(20, 40, 75, 0.055);
  --shadow-pop: 0 14px 44px rgba(18, 38, 72, 0.17), 0 2px 8px rgba(18, 38, 72, 0.08);
  --scroll-thumb: #bcc7d7;
  --toast-bg: #222b38;
  --toast-text: #f5f8fc;
  --file-shadow: 0 1px 2px rgba(25, 42, 70, 0.18);
  --mica-blur: saturate(150%) blur(24px);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1015;
  --glow-1: rgba(30, 100, 170, 0.2);
  --glow-2: rgba(108, 62, 160, 0.13);
  --surface: rgba(27, 32, 40, 0.7);
  --surface-solid: #191d24;
  --surface-soft: #20252e;
  --surface-raised: #222831;
  --titlebar: rgba(19, 23, 30, 0.74);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f1f4f8;
  --text-2: #a9b3c1;
  --text-3: #788391;
  --accent: #4cc2ff;
  --accent-solid: #2d8ceb;
  --accent-solid-hover: #4c9ff4;
  --accent-soft: rgba(76, 194, 255, 0.12);
  --accent-border: rgba(76, 194, 255, 0.3);
  --row-hover: rgba(255, 255, 255, 0.05);
  --selected: rgba(76, 194, 255, 0.13);
  --danger: #ff9ba2;
  --danger-soft: rgba(255, 99, 99, 0.12);
  --success: #5fd58e;
  --success-soft: rgba(95, 213, 142, 0.12);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 10px rgba(0, 0, 0, 0.3);
  --scroll-thumb: #3a434f;
  --toast-bg: #29313c;
  --toast-text: #f5f8fc;
  --file-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1015;
    --glow-1: rgba(30, 100, 170, 0.2);
    --glow-2: rgba(108, 62, 160, 0.13);
    --surface: rgba(27, 32, 40, 0.7);
    --surface-solid: #191d24;
    --surface-soft: #20252e;
    --surface-raised: #222831;
    --titlebar: rgba(19, 23, 30, 0.74);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text: #f1f4f8;
    --text-2: #a9b3c1;
    --text-3: #788391;
    --accent: #4cc2ff;
    --accent-solid: #2d8ceb;
    --accent-solid-hover: #4c9ff4;
    --accent-soft: rgba(76, 194, 255, 0.12);
    --accent-border: rgba(76, 194, 255, 0.3);
    --row-hover: rgba(255, 255, 255, 0.05);
    --selected: rgba(76, 194, 255, 0.13);
    --danger: #ff9ba2;
    --danger-soft: rgba(255, 99, 99, 0.12);
    --success: #5fd58e;
    --success-soft: rgba(95, 213, 142, 0.12);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.22);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 10px rgba(0, 0, 0, 0.3);
    --scroll-thumb: #3a434f;
    --toast-bg: #29313c;
    --toast-text: #f5f8fc;
    --file-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 4% -8%, var(--glow-1), transparent 62%),
    radial-gradient(900px 520px at 104% 4%, var(--glow-2), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--accent);
}

svg {
  display: block;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon-button svg,
.nav-button svg,
.cmd svg,
.address-action svg,
.search-icon,
.search-clear svg,
.tab-icon svg,
.app-logo svg,
.address-home svg,
.side-icon svg,
.drive-icon svg,
.view-button svg,
.state-art svg,
.modal-icon svg,
.toast-icon svg,
.row-action svg,
.grid-action svg,
.context-menu svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

::selection {
  background: var(--accent-border);
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------------------------------------------ */
/* 窗口结构                                                            */
/* ------------------------------------------------------------------ */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
}

.titlebar {
  flex: none;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: var(--titlebar);
  -webkit-backdrop-filter: var(--mica-blur);
  backdrop-filter: var(--mica-blur);
}

.app-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-logo {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 1px 1px rgba(120, 75, 0, 0.16));
}

.app-logo svg {
  width: 22px;
  height: 22px;
  stroke: none;
}

.app-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-2);
  white-space: nowrap;
}

.titlebar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.limit-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.icon-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-2);
}

.icon-button:hover:not(:disabled) {
  background: var(--row-hover);
  color: var(--text);
}

.icon-button:active:not(:disabled) {
  background: var(--accent-soft);
}

.theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: block;
}

/* 标签栏 */
.tabstrip {
  flex: none;
  height: 38px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 10px;
  position: relative;
}

.tabstrip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border);
}

.tab {
  position: relative;
  z-index: 1;
  width: 220px;
  max-width: 36vw;
  height: 33px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-bottom-color: transparent;
  border-radius: 9px 9px 0 0;
  background: var(--surface-solid);
  color: var(--text-2);
  box-shadow: 0 -2px 8px rgba(20, 40, 75, 0.025);
}

.tab.active {
  color: var(--text);
  font-weight: 500;
}

.tab-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.tab-icon svg {
  width: 16px;
  height: 16px;
  stroke: none;
}

.tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.tabstrip-fill {
  flex: 1;
}

.tab-spinner,
.spinner {
  display: inline-block;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

.tab-spinner {
  width: 13px;
  height: 13px;
  border-width: 1.5px;
}

.spinner.large {
  width: 28px;
  height: 28px;
  border-width: 2.5px;
}

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

/* 工具栏 */
.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-width: 0;
}

.nav-group {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1px;
}

.nav-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-2);
}

.nav-button:hover:not(:disabled) {
  background: var(--row-hover);
  color: var(--text);
}

.nav-button:active:not(:disabled) {
  background: var(--accent-soft);
}

.nav-button:disabled {
  color: var(--text-3);
  opacity: 0.42;
}

.nav-button svg {
  width: 17px;
  height: 17px;
}

.addressbar {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-solid);
  box-shadow: inset 0 1px 1px rgba(20, 45, 80, 0.025);
}

.addressbar:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.address-home {
  flex: none;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  margin-right: 2px;
}

.address-home svg {
  width: 17px;
  height: 17px;
  stroke: none;
}

.breadcrumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  height: 100%;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.crumb {
  flex: none;
  height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.crumb:hover {
  background: var(--row-hover);
  color: var(--text);
}

.crumb.current {
  color: var(--text);
  font-weight: 600;
}

.crumb-sep {
  flex: none;
  width: 10px;
  height: 10px;
  color: var(--text-3);
  opacity: 0.8;
}

.crumb-sep svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.address-action {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--text-3);
  opacity: 0;
}

.addressbar:hover .address-action,
.address-action:focus-visible {
  opacity: 1;
}

.address-action:hover {
  background: var(--row-hover);
  color: var(--text);
}

.address-action svg {
  width: 15px;
  height: 15px;
}

.searchbox {
  flex: none;
  width: clamp(170px, 22vw, 280px);
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-solid);
}

.searchbox:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.search-icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.searchbox input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.searchbox input::placeholder {
  color: var(--text-3);
}

.searchbox input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--text-3);
}

.search-clear:hover {
  background: var(--row-hover);
  color: var(--text);
}

.search-clear svg {
  width: 13px;
  height: 13px;
}

/* 命令栏 */
.commandbar {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 12px;
  min-width: 0;
}

.cmd {
  height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.cmd svg {
  width: 16px;
  height: 16px;
}

.cmd:hover:not(:disabled) {
  background: var(--row-hover);
  color: var(--text);
}

.cmd:active:not(:disabled) {
  background: var(--accent-soft);
}

.cmd:disabled {
  opacity: 0.42;
}

.cmd.primary {
  background: var(--accent-solid);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 60, 120, 0.15);
}

.cmd.primary:hover:not(:disabled) {
  background: var(--accent-solid-hover);
  color: #fff;
}

.cmd.primary:disabled {
  background: var(--accent-solid);
  color: #fff;
  opacity: 0.4;
}

.cmd-divider {
  flex: none;
  width: 1px;
  height: 19px;
  margin: 0 6px;
  background: var(--border);
}

.view-switch {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.view-button {
  width: 27px;
  height: 25px;
  border-radius: 5px;
  color: var(--text-3);
}

.view-button svg {
  width: 15px;
  height: 15px;
}

.view-button.active {
  background: var(--surface-solid);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(20, 40, 75, 0.12);
}

.view-button:hover:not(.active) {
  color: var(--text);
}

.hidden-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.hidden-toggle:hover {
  background: var(--row-hover);
}

.hidden-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.checkbox-ui {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-solid);
  color: #fff;
}

.checkbox-ui svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.hidden-toggle input:checked + .checkbox-ui {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
}

.hidden-toggle input:checked + .checkbox-ui svg {
  opacity: 1;
}

.hidden-toggle input:focus-visible + .checkbox-ui {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cmd-spacer {
  flex: 1;
}

.current-stats {
  flex: none;
  max-width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-3);
}

/* ------------------------------------------------------------------ */
/* 工作区                                                              */
/* ------------------------------------------------------------------ */

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  min-width: 0;
}

.sidebar {
  flex: none;
  width: 232px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 6px 12px;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.side-heading {
  margin: 7px 8px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  user-select: none;
}

.side-heading-spaced {
  margin-top: 20px;
}

.side-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 7px;
  text-align: left;
  color: var(--text-2);
}

.side-item:hover {
  background: var(--row-hover);
  color: var(--text);
}

.side-item.active {
  background: var(--selected);
  color: var(--text);
}

.side-icon {
  flex: none;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.side-icon svg {
  width: 18px;
  height: 18px;
}

.side-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.side-label {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-sub {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-folders {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.quick-folder {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 11px;
  border-radius: 7px;
  color: var(--text-2);
  text-align: left;
}

.quick-folder:hover {
  background: var(--row-hover);
  color: var(--text);
}

.quick-folder.active {
  background: var(--selected);
  color: var(--text);
}

.quick-folder svg {
  flex: none;
  width: 19px;
  height: 19px;
  stroke: none;
}

.quick-folder span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.quick-empty {
  margin: 2px 8px 4px 11px;
  font-size: 11px;
  color: var(--text-3);
}

.drive-card {
  margin: 2px 3px 10px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.drive-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.drive-icon {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--accent);
  background: var(--accent-soft);
}

.drive-icon svg {
  width: 19px;
  height: 19px;
}

.drive-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.drive-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.drive-sub {
  font-size: 10px;
  color: var(--text-3);
}

.drive-bar {
  height: 4px;
  margin: 10px 0 6px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.drive-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-solid), var(--accent));
  transition: width 0.35s ease;
}

.drive-meta {
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.45;
}

.side-footer {
  flex: none;
  margin-top: 8px;
  padding: 8px 5px 2px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 内容区域 */
.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  padding: 8px 0 8px 6px;
}

.list-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
}

/* 详细信息表头 */
.details-head,
.row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 158px 148px 92px 38px;
  align-items: center;
}

.details-head {
  flex: none;
  height: 35px;
  margin: 0 4px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  user-select: none;
}

.details-head .col {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  border-radius: 4px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.details-head .col:hover {
  color: var(--text);
  background: var(--row-hover);
}

.details-head .col-size {
  justify-content: flex-end;
}

.details-head .col-actions {
  display: block;
}

.sort-arrow {
  width: 10px;
  font-size: 8px;
  color: var(--accent);
}

/* 文件列表 */
.file-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 5px 0 8px;
  outline: none;
}

.row {
  position: relative;
  min-height: 38px;
  margin: 0 4px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--text);
  cursor: default;
  user-select: none;
}

.row:hover {
  background: var(--row-hover);
}

.row.selected {
  background: var(--selected);
  box-shadow: inset 2.5px 0 0 var(--accent);
}

.row.selected:hover {
  background: var(--selected);
}

.row.keyboard-focus {
  outline: 1.5px solid var(--accent-border);
  outline-offset: -1.5px;
}

.cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-name {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.row .col-mtime,
.row .col-type {
  padding: 0 8px;
  color: var(--text-2);
  font-size: 11.5px;
}

.row .col-size {
  padding: 0 12px 0 8px;
  text-align: right;
  color: var(--text-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.col-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-action,
.grid-action {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--text-2);
  opacity: 0;
}

.row-action svg,
.grid-action svg {
  width: 15px;
  height: 15px;
}

.row:hover .row-action,
.row.selected .row-action,
.row:focus-within .row-action,
.grid-card:hover .grid-action,
.grid-card.selected .grid-action,
.grid-card:focus-within .grid-action {
  opacity: 1;
}

.row-action:hover,
.grid-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.row-action:disabled,
.grid-action:disabled {
  opacity: 0.3;
}

/* 文件类型图标 */
.entry-icon {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.entry-icon > svg {
  width: 23px;
  height: 23px;
  stroke: none;
}

.link-icon {
  color: var(--text-3);
}

.link-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-badge {
  --badge: #64748b;
  position: relative;
  flex: none;
  width: 23px;
  height: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
  border-radius: 3px;
  background: var(--badge);
  background-image: linear-gradient(150deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 58%);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  box-shadow: var(--file-shadow);
  color: #fff;
  overflow: hidden;
}

.file-badge::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 7px;
  background: linear-gradient(225deg, rgba(255, 255, 255, 0.58) 0 48%, transparent 50%);
}

.file-badge .badge-text {
  position: relative;
  z-index: 1;
  max-width: 21px;
  font-family: var(--font);
  font-size: 6.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.kind-image { --badge: #7b61d8; }
.kind-video { --badge: #d84f93; }
.kind-audio { --badge: #e2832e; }
.kind-archive { --badge: #b98a20; }
.kind-pdf { --badge: #cf3f3f; }
.kind-word { --badge: #2f6bcf; }
.kind-sheet { --badge: #217a4b; }
.kind-slide { --badge: #cc4a2a; }
.kind-code { --badge: #218a70; }
.kind-text { --badge: #55738f; }
.kind-exe { --badge: #64748b; }
.kind-font { --badge: #8a5fc7; }
.kind-file { --badge: #64748b; }

/* 大图标视图 */
.grid-view {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  align-content: start;
  gap: 8px;
  padding: 14px;
  overflow-y: auto;
  outline: none;
}

.grid-card {
  position: relative;
  height: 138px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: default;
  user-select: none;
}

.grid-card:hover {
  background: var(--row-hover);
  border-color: var(--border);
}

.grid-card.selected {
  background: var(--selected);
  border-color: var(--accent-border);
}

.grid-card.keyboard-focus {
  outline: 1.5px solid var(--accent-border);
  outline-offset: -1.5px;
}

.grid-card .entry-icon {
  width: 46px;
  height: 52px;
}

.grid-card .entry-icon > svg {
  width: 48px;
  height: 48px;
}

.grid-card .file-badge {
  width: 38px;
  height: 46px;
  padding-bottom: 5px;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%);
}

.grid-card .file-badge::after {
  width: 11px;
  height: 11px;
}

.grid-card .file-badge .badge-text {
  max-width: 35px;
  font-size: 9px;
}

.grid-card .link-icon svg {
  width: 38px;
  height: 38px;
}

.grid-name {
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-all;
}

.grid-meta {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--text-3);
}

.grid-action {
  position: absolute;
  top: 5px;
  right: 5px;
}

/* 空状态 / 加载 / 错误 */
.state-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-2);
}

.state-panel[hidden] {
  display: none;
}

.state-panel h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.state-panel p {
  max-width: 460px;
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-3);
}

.state-panel .cmd {
  margin-top: 8px;
}

.state-art {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  opacity: 0.55;
}

.state-art svg {
  width: 68px;
  height: 68px;
  stroke: none;
}

.error-art {
  color: var(--danger);
  opacity: 1;
}

.error-art svg {
  width: 54px;
  height: 54px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ */
/* 状态栏                                                              */
/* ------------------------------------------------------------------ */

.statusbar {
  flex: none;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--text-3);
  font-size: 10.5px;
  background: var(--titlebar);
  border-top: 1px solid var(--border);
  user-select: none;
}

.status-sep {
  width: 1px;
  height: 11px;
  background: var(--border-strong);
}

#status-selected {
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-spacer {
  flex: 1;
}

.status-path {
  max-width: 36%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-zip {
  flex: none;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* 右键菜单                                                            */
/* ------------------------------------------------------------------ */

.context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 208px;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: var(--mica-blur);
  backdrop-filter: var(--mica-blur);
  animation: menuIn 0.1s ease-out;
}

.context-menu[hidden] {
  display: none;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-3px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.menu-item {
  width: 100%;
  height: 31px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.menu-item:hover:not(:disabled) {
  background: var(--row-hover);
}

.menu-item:disabled {
  opacity: 0.4;
}

.menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

.menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

.menu-shortcut {
  margin-left: auto;
  padding-left: 20px;
  color: var(--text-3);
  font-size: 10px;
}

/* ------------------------------------------------------------------ */
/* 对话框                                                              */
/* ------------------------------------------------------------------ */

.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 25px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow-y: auto;
}

.modal::backdrop {
  background: rgba(12, 20, 32, 0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.modal[open] {
  animation: modalIn 0.16s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 12px;
}

.modal-icon svg {
  width: 23px;
  height: 23px;
}

.modal-icon.warn {
  color: var(--danger);
  background: var(--danger-soft);
}

.modal-icon.info {
  color: var(--accent);
  background: var(--accent-soft);
}

.modal h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.modal p {
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 16px;
  padding: 12px 14px;
  margin: 2px 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 12px;
}

.stat-grid span {
  color: var(--text-3);
}

.stat-grid strong {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.modal .modal-hint {
  margin: 0 0 18px;
  color: var(--text-3);
  font-size: 11.5px;
}

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

.modal-actions .cmd {
  height: 33px;
}

.properties {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 4px 0 22px;
  font-size: 12px;
}

.properties dt {
  color: var(--text-3);
}

.properties dd {
  margin: 0;
  color: var(--text);
  min-width: 0;
}

.properties dd.break {
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 42px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 230px;
  max-width: min(390px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toastIn 0.18s ease-out;
}

.toast.leaving {
  animation: toastOut 0.16s ease-in forwards;
}

.toast-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 0.5px;
  display: grid;
  place-items: center;
  color: #8cc8ff;
}

.toast.success .toast-icon { color: #63dd93; }
.toast.error .toast-icon { color: #ff9a9a; }

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

.toast-message {
  overflow-wrap: anywhere;
}

.toast-detail {
  margin-top: 2px;
  color: rgba(245, 248, 252, 0.66);
  font-size: 10.5px;
}

.toast .spinner {
  width: 15px;
  height: 15px;
  border-color: rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(4px); }
}

/* ------------------------------------------------------------------ */
/* 响应式                                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 1120px) {
  .details-head,
  .row {
    grid-template-columns: minmax(190px, 1fr) 150px 90px 38px;
  }

  .col-type,
  .row .col-type {
    display: none;
  }
}

@media (max-width: 920px) {
  .sidebar {
    width: 205px;
  }

  .current-stats {
    display: none;
  }

  .details-head,
  .row {
    grid-template-columns: minmax(170px, 1fr) 92px 38px;
  }

  .col-mtime,
  .row .col-mtime {
    display: none;
  }

  .searchbox {
    width: 190px;
  }
}

@media (max-width: 760px) {
  .sidebar {
    display: none;
  }

  .content {
    padding: 6px 8px 8px;
  }

  .limit-badge {
    display: none;
  }

  .grid-view {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 6px;
    padding: 10px;
  }

  .grid-card {
    height: 126px;
  }

  .status-path {
    display: none;
  }
}

@media (max-width: 640px) {
  .toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    padding: 6px 8px;
  }

  .nav-group {
    grid-column: 1;
  }

  .addressbar {
    grid-column: 2;
  }

  .searchbox {
    grid-column: 1 / -1;
    width: 100%;
    height: 33px;
  }

  .commandbar {
    overflow-x: auto;
    padding: 0 8px;
    scrollbar-width: none;
  }

  .commandbar::-webkit-scrollbar {
    display: none;
  }

  .hidden-toggle {
    display: none;
  }

  .app-title {
    display: none;
  }

  .tabstrip {
    padding: 0 8px;
  }

  .tab {
    width: 180px;
    max-width: 52vw;
  }

  .details-head,
  .row {
    grid-template-columns: minmax(150px, 1fr) 78px 36px;
  }

  .row .col-size {
    padding-right: 8px;
  }

  .status-zip {
    display: none;
  }

  .toast-container {
    right: 12px;
    left: 12px;
    bottom: 38px;
    align-items: stretch;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .details-head,
  .row {
    grid-template-columns: minmax(120px, 1fr) 36px;
  }

  .col-size,
  .row .col-size {
    display: none;
  }

  .cmd span {
    display: none;
  }

  .cmd {
    padding: 0 8px;
  }

  .commandbar {
    gap: 2px;
  }

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

@media (hover: none) {
  .row-action,
  .grid-action {
    opacity: 0.75;
  }
}

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