/* =========================================================================
   EVN-EC Cloud Drive — Personal Computer File Explorer Stylesheet (v4)
   Supports Light & Dark Mode + Responsive Desktop / Laptop / Tablet / Mobile
   ========================================================================= */

:root {
  color-scheme: light dark;

  --bg-canvas-l: #F1F5F9;
  --bg-canvas-d: #0B1120;
  --bg-surface-l: #FFFFFF;
  --bg-surface-d: #111827;
  --bg-subtle-l: #F8FAFC;
  --bg-subtle-d: #1E293B;
  --bg-sidebar-l: #FAFCFF;
  --bg-sidebar-d: #0F172A;
  --bg-hover-l: #F1F5F9;
  --bg-hover-d: #1E293B;
  --bg-selected-l: #EFF6FF;
  --bg-selected-d: #1E3A8A;
  --border-light-l: #E2E8F0;
  --border-light-d: #1F2937;
  --border-strong-l: #CBD5E1;
  --border-strong-d: #334155;
  --text-main-l: #0F172A;
  --text-main-d: #F8FAFC;
  --text-sec-l: #475569;
  --text-sec-d: #CBD5E1;
  --text-muted-l: #64748B;
  --text-muted-d: #94A3B8;

  --bg-canvas: var(--bg-canvas-l);
  --bg-surface: var(--bg-surface-l);
  --bg-subtle: var(--bg-subtle-l);
  --bg-sidebar: var(--bg-sidebar-l);
  --bg-hover: var(--bg-hover-l);
  --bg-selected: var(--bg-selected-l);
  --border-light: var(--border-light-l);
  --border-strong: var(--border-strong-l);
  --text-main: var(--text-main-l);
  --text-secondary: var(--text-sec-l);
  --text-muted: var(--text-muted-l);

  --brand-emerald: #059669;
  --brand-emerald-light: #10B981;
  --brand-blue: #0284C7;
  --danger: #DC2626;
  --radius-win: 12px;
  --shadow-win: 0 10px 30px -8px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
  --bg-canvas: var(--bg-canvas-d);
  --bg-surface: var(--bg-surface-d);
  --bg-subtle: var(--bg-subtle-d);
  --bg-sidebar: var(--bg-sidebar-d);
  --bg-hover: var(--bg-hover-d);
  --bg-selected: var(--bg-selected-d);
  --border-light: var(--border-light-d);
  --border-strong: var(--border-strong-d);
  --text-main: var(--text-main-d);
  --text-secondary: var(--text-sec-d);
  --text-muted: var(--text-muted-d);
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
  --bg-canvas: var(--bg-canvas-l);
  --bg-surface: var(--bg-surface-l);
  --bg-subtle: var(--bg-subtle-l);
  --bg-sidebar: var(--bg-sidebar-l);
  --bg-hover: var(--bg-hover-l);
  --bg-selected: var(--bg-selected-l);
  --border-light: var(--border-light-l);
  --border-strong: var(--border-strong-l);
  --text-main: var(--text-main-l);
  --text-secondary: var(--text-sec-l);
  --text-muted: var(--text-muted-l);
}

@supports (color: light-dark(white, black)) {
  :root {
    --bg-canvas: light-dark(var(--bg-canvas-l), var(--bg-canvas-d));
    --bg-surface: light-dark(var(--bg-surface-l), var(--bg-surface-d));
    --bg-subtle: light-dark(var(--bg-subtle-l), var(--bg-subtle-d));
    --bg-sidebar: light-dark(var(--bg-sidebar-l), var(--bg-sidebar-d));
    --bg-hover: light-dark(var(--bg-hover-l), var(--bg-hover-d));
    --bg-selected: light-dark(var(--bg-selected-l), var(--bg-selected-d));
    --border-light: light-dark(var(--border-light-l), var(--border-light-d));
    --border-strong: light-dark(var(--border-strong-l), var(--border-strong-d));
    --text-main: light-dark(var(--text-main-l), var(--text-main-d));
    --text-secondary: light-dark(var(--text-sec-l), var(--text-sec-d));
    --text-muted: light-dark(var(--text-muted-l), var(--text-muted-d));
  }
}

/* Theme button state icons (Default is Light Mode) */
.theme-opt-light { display: none; }
.theme-opt-dark { display: inline-flex; align-items: center; gap: 0.32rem; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-opt-dark { display: none; }
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-opt-light { display: inline-flex; align-items: center; gap: 0.32rem; }

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

html {
  scroll-padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Inter', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-canvas);
  color: var(--text-main);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

:where(a, code) { overflow-wrap: anywhere; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

.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;
}

/* ── TOP SYSTEM HEADER BAR ──────────────────────────────────────────────── */
.sys-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0.45rem 0.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 50px;
}

.sys-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-inline-size: 0;
  flex: 1 1 auto;
}

.sys-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.94rem;
  white-space: nowrap;
  min-inline-size: 0;
  overflow: hidden;
}

.sys-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-short {
  display: none;
  user-select: none;
}

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 5px;
  border-radius: 7px;
  background: light-dark(transparent, #FFFFFF);
}

.brand-logo-img {
  display: block;
  height: 24px;
  width: auto;
  aspect-ratio: 96 / 61;
  object-fit: contain;
}

.win-title-logo {
  display: block;
  height: 18px;
  width: auto;
  aspect-ratio: 96 / 61;
  object-fit: contain;
  flex-shrink: 0;
  padding: 1px 3px;
  border-radius: 4px;
  background: light-dark(transparent, #FFFFFF);
}

.drawer-brand-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-inline-size: 0;
}

.drawer-logo-img {
  display: block;
  height: 22px;
  width: auto;
  aspect-ratio: 96 / 61;
  object-fit: contain;
  flex-shrink: 0;
  padding: 1px 4px;
  border-radius: 5px;
  background: light-dark(transparent, #FFFFFF);
}

.sys-brand-icon { font-size: 1.18rem; flex-shrink: 0; }

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.sys-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.lang-switch-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 2px 4px;
  gap: 2px;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  font-family: inherit;
  padding: 0.24rem 0.48rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.1;
  min-inline-size: 28px;
  min-block-size: 24px;
  transition: background 0.14s, color 0.14s;
}

.lang-btn:hover:not(.active) {
  color: var(--text-main);
}

.lang-btn.active {
  background: var(--brand-emerald);
  color: #FFFFFF;
}

.lang-sep {
  font-size: 0.68rem;
  color: var(--border-strong);
  user-select: none;
}

.sys-global-search {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.3rem 0.6rem 0.3rem 0.75rem;
  width: clamp(225px, 23vw, 315px);
}

.sys-global-search:focus-within {
  background: var(--bg-surface);
  border-color: var(--brand-emerald-light);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.sys-global-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.8rem;
  flex: 1 1 auto;
  min-inline-size: 0;
  width: 100%;
  color: var(--text-main);
}

.sys-kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.sys-clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.34rem 0.8rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sys-clock-pill strong {
  color: var(--brand-emerald-light);
  font-variant-numeric: tabular-nums;
}

.clock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-emerald-light);
}

.sys-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.38rem 0.82rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  transition: filter 0.14s, background 0.14s;
}

.sys-pill-btn:hover { filter: brightness(0.96); }

.sys-pill-ai {
  background: light-dark(#ECFDF5, #064E3B);
  color: light-dark(#047857, #A7F3D0);
  border-color: light-dark(#A7F3D0, #059669);
}

.sys-pill-ai.active {
  background: var(--brand-emerald);
  color: #FFF;
  border-color: var(--brand-emerald);
}

.sys-pill-admin {
  background: light-dark(#EFF6FF, #1E3A8A);
  color: light-dark(#1D4ED8, #BFDBFE);
  border-color: light-dark(#BFDBFE, #3B82F6);
}

.sys-pill-admin-active {
  background: light-dark(#FEF3C7, #78350F);
  color: light-dark(#B45309, #FDE68A);
  border-color: light-dark(#FCD34D, #D97706);
}

.sys-announcement {
  background: light-dark(#EFF6FF, #1E3A8A);
  border-bottom: 1px solid light-dark(#BFDBFE, #2563EB);
  color: light-dark(#1E40AF, #DBEAFE);
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── EXPLORER STAGE & WINDOW SHELL ──────────────────────────────────────── */
.explorer-stage {
  padding: 0.45rem 0.55rem 0.35rem;
  max-width: 100%;
  margin: 0 auto;
}

.win-explorer-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-win);
  box-shadow: var(--shadow-win);
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 110px);
  overflow: hidden;
}

.win-explorer-window.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  border-radius: 0;
  min-height: 100svh;
  height: 100svh;
}

/* 1. Title Bar */
.win-title-bar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.win-title-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.win-title-heading {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  min-inline-size: 0;
}

.win-cloud-badge {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.win-window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.win-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
}

.win-dot.yellow { background: #F59E0B; }
.win-dot.green { background: #10B981; }
.win-dot.red { background: #EF4444; }

/* 2. Ribbon Toolbar + Horizontal Scrollability Fade Hints */
@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.h-scroll-fade {
  --fade-size: 2.25rem;
  --fade-dir: right;
  --fade-start-pos: 0;
  --fade-end-pos: 100%;
  scroll-padding-inline: 2.25rem;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
  transition: --fade-start 0.2s, --fade-end 0.2s;
}

.h-scroll-fade.more-start { --fade-start: var(--fade-size); }
.h-scroll-fade.more-end { --fade-end: var(--fade-size); }

@supports (animation-timeline: scroll()) {
  .h-scroll-fade {
    animation: reveal-fade-start linear both, hide-fade-end linear both;
    animation-timeline: scroll(self inline);
    animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
  }
}

@keyframes reveal-fade-start {
  to { --fade-start: var(--fade-size); }
}

@keyframes hide-fade-end {
  from { --fade-end: var(--fade-size); }
}

.win-toolbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0.4rem 0.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.28rem;
  column-gap: 0.3rem;
  overflow-x: visible;
  scrollbar-width: none;
}

.win-toolbar.h-scroll-fade {
  mask: none;
  animation: none;
}

.win-toolbar::-webkit-scrollbar { display: none; }

.win-tool-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.35rem 0.62rem;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.win-tool-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text-main);
}

.win-tool-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.win-tool-btn.primary {
  background: var(--brand-emerald-light);
  color: #FFF;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.win-tool-btn.primary:hover:not(:disabled) {
  background: var(--brand-emerald);
  color: #FFF;
  border-color: transparent;
}

.win-tool-btn.admin-accent {
  background: light-dark(#FFFBEB, #451A03);
  color: light-dark(#B45309, #FCD34D);
  border-color: light-dark(#FDE68A, #92400E);
}

.win-tool-btn.paste-ready:not(:disabled) {
  background: light-dark(#ECFDF5, #064E3B);
  color: light-dark(#047857, #A7F3D0);
  border-color: light-dark(#6EE7B7, #059669);
  font-weight: 700;
}

.win-tool-btn.paste-ready:hover:not(:disabled) {
  background: light-dark(#D1FAE5, #065F46);
  border-color: var(--brand-emerald);
}

/* Clipboard Banner & Cut Pending Visual Cue */
.clipboard-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.9rem;
  background: light-dark(#ECFDF5, rgba(6, 78, 59, 0.32));
  border-bottom: 1px solid light-dark(#A7F3D0, #065F46);
  font-size: 0.8rem;
}

.clipboard-banner.is-cut {
  background: light-dark(#FFFBEB, rgba(120, 53, 15, 0.34));
  border-bottom-color: light-dark(#FDE68A, #92400E);
}

.clipboard-banner-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-inline-size: 0;
  flex: 1 1 220px;
}

.clipboard-banner-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: light-dark(#D1FAE5, rgba(16, 185, 129, 0.22));
  font-size: 0.86rem;
  flex-shrink: 0;
}

.clipboard-banner.is-cut .clipboard-banner-badge {
  background: light-dark(#FEF3C7, rgba(245, 158, 11, 0.24));
}

.clipboard-banner-text {
  color: var(--text-main);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clipboard-banner-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.clipboard-banner-actions .btn-sm {
  padding: 0.32rem 0.68rem;
  font-size: 0.76rem;
  min-height: 30px;
}

.win-folder-card.is-cut-pending,
.win-file-card.is-cut-pending {
  opacity: 0.54;
  border-style: dashed;
  border-color: light-dark(#D97706, #F59E0B);
}

.win-table tbody tr.is-cut-pending td,
.win-table tbody tr.is-cut-pending th {
  opacity: 0.56;
}

@media (max-width: 640px) {
  .clipboard-banner {
    padding: 0.46rem 0.62rem;
    gap: 0.45rem;
  }
  .clipboard-banner-text {
    white-space: normal;
    line-height: 1.3;
    font-size: 0.76rem;
  }
  .clipboard-banner-actions {
    width: 100%;
  }
  .clipboard-banner-actions .btn-sm {
    flex: 1 1 auto;
    min-height: 34px;
  }
}

.win-tool-btn.danger-accent {
  background: light-dark(#FEF2F2, #450A0A);
  color: light-dark(#DC2626, #FCA5A5);
  border-color: light-dark(#FECACA, #991B1B);
}

.win-tool-separator {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  flex-shrink: 0;
  margin: 0 0.1rem;
}

/* 3. Navigation & Breadcrumb Bar */
.win-nav-bar {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  padding: 0.42rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.win-nav-arrows {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.win-nav-arrow-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.72rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.win-nav-arrow-btn:hover:not(:disabled) { background: var(--bg-hover); }
.win-nav-arrow-btn:disabled { opacity: 0.38; cursor: default; }

.win-address-box {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 7px;
  padding: 0.34rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.win-address-box::-webkit-scrollbar { display: none; }

.win-address-crumb {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
}

.win-address-crumb:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.win-address-crumb.active {
  font-weight: 800;
  color: var(--text-main);
  cursor: default;
}

.win-address-sep { color: var(--text-muted); font-size: 0.85rem; }

.win-search-box {
  width: clamp(180px, 22vw, 270px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 7px;
  padding: 0.32rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.win-search-box:focus-within { border-color: var(--brand-emerald-light); }

.win-search-box input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-main);
}

/* 4. Explorer Split Body */
.win-explorer-body {
  flex: 1;
  display: grid;
  grid-template-columns: clamp(328px, 23.2vw, 352px) minmax(0, 1fr);
  min-height: 480px;
}

/* Left Sidebar Tree (Google Drive Style + Expandable Folder Tree) */
.win-sidebar-tree {
  --scrollbar-thumb: light-dark(#64748B, #94A3B8);
  --scrollbar-track: light-dark(#E2E8F0, #1E293B);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  padding: 0.48rem 0.3rem 0.55rem 0.3rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-inline-size: 0;
  min-block-size: 0;
}

.gdrive-new-wrap {
  padding: 0.04rem 0.1rem 0.36rem;
}

.gdrive-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  padding: 0.48rem 1rem 0.48rem 0.74rem;
  border-radius: 13px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.06);
  transition: background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.gdrive-new-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.16), 0 6px 14px rgba(15, 23, 42, 0.08);
}

.gdrive-new-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gdrive-new-plus {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 500;
  color: var(--brand-emerald);
}

.gdrive-nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 0.28rem;
  min-inline-size: 0;
  max-inline-size: 100%;
}

.gdrive-nav-sep {
  border: 0;
  border-top: 1px solid var(--border-light);
  margin: 0.22rem 0.32rem 0.3rem;
}

@property --truncated {
  syntax: "<integer>";
  inherits: false;
  initial-value: 0;
}

@keyframes truncated {
  from, to {
    --truncated: 1;
  }
}

.gdrive-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.28rem;
  padding: 0.31rem 0.4rem 0.31rem 0.82rem;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  border: 1px solid transparent;
  user-select: none;
  min-inline-size: 0;
  max-inline-size: 100%;
  transition: background 0.12s, color 0.12s;
}

.gdrive-nav-item.has-caret {
  padding-left: 0.16rem;
}

.gdrive-nav-item:hover {
  background: var(--bg-hover);
}

.gdrive-nav-item.active {
  background: light-dark(#C2E7FF, #0C4A6E);
  color: light-dark(#004A77, #E0F2FE);
  font-weight: 700;
}

.gdrive-nav-item.open-parent {
  background: light-dark(#EEF2F7, #1E293B);
  color: var(--text-main);
  font-weight: 700;
}

.gdrive-nav-item:focus-visible,
.gdrive-tree-row:focus-visible {
  outline: 2px solid var(--brand-emerald);
  outline-offset: -2px;
}

.gdrive-nav-left {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-inline-size: 0;
  flex: 1 1 0%;
  overflow: hidden;
}

.gdrive-caret-spacer {
  width: 16px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gdrive-caret-btn {
  width: 16px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.14s, background 0.12s;
}

.gdrive-caret-btn:hover {
  background: rgba(100, 116, 139, 0.18);
  color: var(--text-main);
}

.gdrive-caret-btn.expanded {
  transform: rotate(90deg);
}

.gdrive-nav-ico {
  width: 16px;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
}

.gdrive-nav-label {
  display: block;
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: truncated linear both;
  animation-timeline: scroll(self inline);
}

.gdrive-nav-label.truncated {
  --truncated: 1;
}

@media (prefers-reduced-motion: no-preference) {
  :is(.gdrive-nav-item, .gdrive-tree-row):is(:hover, :focus-visible) .gdrive-nav-label {
    text-overflow: clip;
  }

  @container style(--truncated: 1) {
    :is(.gdrive-nav-item, .gdrive-tree-row):is(:hover, :focus-visible) .gdrive-nav-label > span {
      display: inline-block;
      margin-inline-start: 100%;
      translate: calc(1px - 100%);
      transition: margin-inline-start 2s ease-in, translate 2s ease-in;
    }
  }

  :is(.gdrive-nav-item, .gdrive-tree-row):is(:hover, :focus-visible) .gdrive-nav-label.truncated > span {
    display: inline-block;
    margin-inline-start: 100%;
    translate: calc(1px - 100%);
    transition: margin-inline-start 2s ease-in, translate 2s ease-in;
  }
}

.gdrive-nav-badge {
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 0.63rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}

.gdrive-nav-item.active .gdrive-nav-badge {
  background: light-dark(#0284C7, #0369A1);
  border-color: transparent;
  color: #FFF;
}

.gdrive-sub-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 2px 0;
  padding-left: 0;
  position: relative;
  min-inline-size: 0;
  max-inline-size: 100%;
}

.gdrive-sub-tree::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 4px;
  left: calc(13px + var(--tree-depth, 0) * 18px);
  width: 1.5px;
  background: var(--border-light);
  border-radius: 2px;
  pointer-events: none;
}

.gdrive-tree-branch {
  min-inline-size: 0;
  max-inline-size: 100%;
}

.gdrive-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.22rem;
  padding: 0.29rem 0.34rem 0.29rem calc(18px + var(--tree-depth, 0) * 18px);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
  min-inline-size: 0;
  max-inline-size: 100%;
  transition: background 0.12s, color 0.12s;
}

.gdrive-tree-row:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.gdrive-tree-row.open-parent {
  background: light-dark(#EEF2F7, #1E293B);
  color: var(--text-main);
  font-weight: 700;
}

.gdrive-tree-row.active {
  background: light-dark(#C2E7FF, #0C4A6E);
  color: light-dark(#004A77, #E0F2FE);
  font-weight: 700;
}

.gdrive-storage-box {
  padding: 0.25rem 0.38rem 0.18rem 0.38rem;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.gdrive-storage-track {
  background: var(--border-light);
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.18rem 0 0.4rem;
}

.gdrive-storage-fill {
  height: 100%;
  background: linear-gradient(90deg, #0B57D0, #10B981);
  border-radius: 999px;
  min-width: 3%;
  transition: width 0.3s ease;
}

.gdrive-storage-caption {
  font-size: 0.74rem;
  line-height: 1.38;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}

.gdrive-storage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.36rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: light-dark(#0B57D0, #93C5FD);
  font-size: 0.76rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.gdrive-storage-btn:hover {
  background: light-dark(#EFF6FF, #1E293B);
  border-color: light-dark(#93C5FD, #3B82F6);
}

/* Right Main Content Area */
.win-content-area {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  min-width: 0;
}

.dropzone-overlay {
  position: absolute;
  inset: 10px;
  z-index: 25;
  background: light-dark(rgba(236, 253, 245, 0.95), rgba(6, 78, 59, 0.92));
  border: 2.5px dashed var(--brand-emerald-light);
  border-radius: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.win-content-area.drag-over .dropzone-overlay { display: flex; }

.dropzone-box h3 {
  margin: 0.4rem 0 0.2rem;
  color: light-dark(#065F46, #A7F3D0);
  font-size: 1.1rem;
}

.dropzone-box p {
  margin: 0;
  color: light-dark(#047857, #D1FAE5);
  font-size: 0.85rem;
}

.dropzone-icon { font-size: 2.5rem; }

.win-content-header {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.win-current-folder-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-inline-size: 0;
  flex: 1 1 240px;
}

.win-cur-folder-texts {
  min-inline-size: 0;
}

.win-cur-icon { font-size: 1.5rem; flex-shrink: 0; }

.win-current-folder-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
}

.win-current-folder-desc {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.win-header-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.win-sort-wrap {
  display: inline-flex;
  align-items: center;
}

.win-sort-select {
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.34rem 0.62rem;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  max-inline-size: 190px;
}

.win-sort-select:focus-visible {
  outline: 2px solid var(--brand-emerald);
  outline-offset: 1px;
}

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

.folder-size-toggle {
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0.36rem 0.68rem;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.folder-size-toggle.active {
  background: light-dark(#ECFDF5, #064E3B);
  border-color: light-dark(#A7F3D0, #059669);
  color: light-dark(#059669, #A7F3D0);
}

.win-view-mode-toggle {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.win-view-btn {
  border: none;
  background: transparent;
  padding: 0.32rem 0.68rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.win-view-btn.active {
  background: light-dark(#ECFDF5, #064E3B);
  color: light-dark(#059669, #A7F3D0);
}

.win-items-scroll {
  --scrollbar-thumb: light-dark(#64748B, #94A3B8);
  --scrollbar-track: light-dark(#E2E8F0, #1E293B);
  flex: 1;
  min-height: 0;
  padding: 0.8rem 0.75rem 1.15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

@supports not (scrollbar-color: auto) {
  .win-sidebar-tree,
  .win-items-scroll {
    scrollbar-width: auto;
  }
  .win-sidebar-tree::-webkit-scrollbar,
  .win-items-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  .win-sidebar-tree::-webkit-scrollbar-thumb,
  .win-items-scroll::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
  .win-sidebar-tree::-webkit-scrollbar-track,
  .win-items-scroll::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
}

/* Desktop & Landscape Tablet: Lock Explorer cleanly to 1 viewport screen with independent left/right scrollbars */
@media (min-width: 861px) {
  body:has(#explorer-main) {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body:has(#explorer-main) .sys-topbar,
  body:has(#explorer-main) .sys-announcement,
  body:has(#explorer-main) .site-credit-footer {
    flex-shrink: 0;
  }
  body:has(#explorer-main) .explorer-stage {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body:has(#explorer-main) .win-explorer-window {
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    max-height: 100%;
  }
  body:has(#explorer-main) .win-title-bar,
  body:has(#explorer-main) .win-toolbar,
  body:has(#explorer-main) .win-nav-bar,
  body:has(#explorer-main) .win-status-bar {
    flex-shrink: 0;
  }
  body:has(#explorer-main) .win-explorer-body {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }
  body:has(#explorer-main) .win-sidebar-tree {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
  body:has(#explorer-main) .win-content-area {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  body:has(#explorer-main) .win-content-header,
  body:has(#explorer-main) .clipboard-banner {
    flex-shrink: 0;
  }
  body:has(#explorer-main) .win-items-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
  }
  body:has(#explorer-main) .site-credit-footer {
    padding-top: 0.28rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom, 0px));
  }
}

/* ── GRID ICONS VIEW ────────────────────────────────────────────────────── */
.win-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
  gap: 0.8rem;
  align-items: stretch;
}

.win-folder-card,
.win-file-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.55rem 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  min-inline-size: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s, transform 0.12s;
}

.win-folder-card:hover,
.win-file-card:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.win-folder-card.selected,
.win-file-card.selected {
  background: var(--bg-selected);
  border-color: #3B82F6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22);
}

.card-top-bar {
  width: 100%;
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 0.28rem;
}

.card-top-left {
  display: flex;
  align-items: center;
  min-inline-size: 0;
}

.card-top-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.card-more-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.12s, background 0.12s;
}

.win-folder-card:hover .card-more-btn,
.win-file-card:hover .card-more-btn,
.win-folder-card.selected .card-more-btn,
.win-file-card.selected .card-more-btn,
.card-more-btn:focus-visible {
  opacity: 1;
}

.card-more-btn:hover {
  background: var(--border-light);
  color: var(--text-main);
}

.card-star-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.12s, transform 0.12s, background 0.12s;
}

.card-star-btn.is-starred {
  opacity: 1;
  color: #F59E0B;
}

.win-folder-card:hover .card-star-btn,
.win-file-card:hover .card-star-btn,
.win-folder-card.selected .card-star-btn,
.win-file-card.selected .card-star-btn,
.card-star-btn:focus-visible {
  opacity: 1;
}

.card-star-btn:hover {
  background: var(--border-light);
  transform: scale(1.08);
}

.card-lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.64rem;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  background: light-dark(#FEF3C7, #78350F);
  color: light-dark(#B45309, #FDE68A);
  border: 1px solid light-dark(#FDE68A, #B45309);
}

.card-lock-pill.unlocked {
  background: light-dark(#ECFDF5, #064E3B);
  color: light-dark(#047857, #A7F3D0);
  border-color: light-dark(#A7F3D0, #059669);
}

.folder-svg-wrap {
  width: 60px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.45rem;
}

.win-folder-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.win-folder-meta {
  font-size: 0.71rem;
  color: var(--text-muted);
}

.win-folder-size-badge {
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--brand-emerald-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.win-file-icon-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.4rem;
}

.win-file-icon { font-size: 2.35rem; line-height: 1; }

.win-file-ext-badge {
  position: absolute;
  bottom: 0;
  right: -4px;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  color: #FFF;
  background: #64748B;
}

.win-file-ext-badge.pdf { background: #DC2626; }
.win-file-ext-badge.docx { background: #2563EB; }
.win-file-ext-badge.xlsx { background: #059669; }
.win-file-ext-badge.dwg { background: #7C3AED; }
.win-file-ext-badge.zip { background: #D97706; }
.win-file-ext-badge.media { background: #DB2777; }
.win-file-ext-badge.text { background: #334155; }

.win-file-name {
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.win-file-code {
  font-size: 0.67rem;
  color: var(--brand-emerald-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  margin-top: 2px;
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-file-meta {
  font-size: 0.69rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-quick-actions {
  margin-top: 0.48rem;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  max-inline-size: 100%;
}

.mini-btn {
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.mini-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.mini-btn.primary {
  background: var(--brand-emerald);
  border-color: var(--brand-emerald);
  color: #FFF;
}

/* ── RESPONSIVE DETAILS TABLE (@container) ──────────────────────────────── */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  container-type: inline-size;
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.win-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}

.win-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.win-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--bg-subtle);
}

.win-table th,
.win-table td {
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: middle;
}

.win-table thead th {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.win-table thead th:has(> button.win-sort-th-btn) {
  padding: 0;
}

.win-sort-th-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-block-size: 36px;
  padding: 0.58rem 0.75rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.win-sort-th-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.win-sort-th-btn:focus-visible {
  outline: 2px solid var(--brand-emerald);
  outline-offset: -2px;
}

.win-sort-th-btn .sort-dir-ico {
  font-size: 0.74rem;
  opacity: 0.35;
  color: currentColor;
  transition: opacity 0.12s, transform 0.12s;
}

.win-sort-th-btn .sort-dir-ico::before {
  content: "⇅";
}

.win-table thead th[aria-sort="ascending"] .win-sort-th-btn,
.win-table thead th[aria-sort="descending"] .win-sort-th-btn {
  color: var(--brand-emerald);
}

.win-table thead th[aria-sort="ascending"] .sort-dir-ico {
  opacity: 1;
}

.win-table thead th[aria-sort="ascending"] .sort-dir-ico::before {
  content: "▲";
}

.win-table thead th[aria-sort="descending"] .sort-dir-ico {
  opacity: 1;
}

.win-table thead th[aria-sort="descending"] .sort-dir-ico::before {
  content: "▼";
}

.win-table tbody tr,
.win-grid-container > [data-item-type] {
  view-transition-name: match-element;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Drag-and-Drop Move Feedback */
[data-item-type].is-dragging {
  opacity: 0.48;
  transform: scale(0.97);
}

.drop-target-hover {
  outline: 2px dashed var(--brand-emerald) !important;
  outline-offset: -2px;
  background: light-dark(#ECFDF5, #064E3B) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.win-table tbody tr.drop-target-hover td,
.win-table tbody tr.drop-target-hover th {
  background: light-dark(#ECFDF5, #064E3B) !important;
}

/* Move Item Folder Tree Picker Dialog */
.move-target-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  margin-bottom: 0.75rem;
  font-size: 0.83rem;
}

.move-dest-tree {
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.move-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.44rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.move-tree-item:hover:not(:disabled) {
  background: var(--bg-hover);
}

.move-tree-item.is-selected {
  background: light-dark(#ECFDF5, #064E3B);
  border-color: var(--brand-emerald);
  color: light-dark(#047857, #A7F3D0);
}

.move-tree-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.move-tree-name {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-tree-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.move-dest-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-emerald);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-inline-size: 260px;
}

.win-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--bg-surface);
  font-weight: 700;
  color: var(--text-main);
  max-width: 340px;
}

.win-table tbody tr { cursor: pointer; }

.win-table tbody tr:hover td,
.win-table tbody tr:hover th {
  background: var(--bg-subtle);
}

.win-table tbody tr.selected td,
.win-table tbody tr.selected th {
  background: var(--bg-selected);
}

@container (min-width: 680px) and (max-width: 920px) {
  .win-table th,
  .win-table td {
    padding: 0.5rem 0.52rem;
    font-size: 0.76rem;
  }
  .win-sort-th-btn {
    padding: 0.48rem 0.52rem;
  }
  .win-table thead th:nth-child(2),
  .win-table tbody td:nth-child(2),
  .win-table thead th:nth-child(6),
  .win-table tbody td:nth-child(6) {
    display: none;
  }
}

@container (width < 680px) {
  .win-table, .win-table thead, .win-table tbody, .win-table tr, .win-table th, .win-table td {
    display: block;
  }
  .win-table thead { display: none; }
  .win-table tbody tr {
    margin-block-end: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
  }
  .win-table tbody th {
    position: sticky;
    inset-block-start: 0;
    max-width: none;
    background: var(--bg-subtle);
  }
  .win-table {
    --label-2: "Mã hiệu";
    --label-3: "Cập nhật";
    --label-4: "Loại";
    --label-5: "Dung lượng";
    --label-6: "Tác giả";
    --label-7: "Thao tác";
  }
  :root[lang="en"] .win-table {
    --label-2: "Code";
    --label-3: "Updated";
    --label-4: "Type";
    --label-5: "Size";
    --label-6: "Author";
    --label-7: "Actions";
  }
  .win-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
  }
  .win-table td:nth-child(2)::before { content: var(--label-2) ": "; font-weight: 700; color: var(--text-muted); }
  .win-table td:nth-child(3)::before { content: var(--label-3) ": "; font-weight: 700; color: var(--text-muted); }
  .win-table td:nth-child(4)::before { content: var(--label-4) ": "; font-weight: 700; color: var(--text-muted); }
  .win-table td:nth-child(5)::before { content: var(--label-5) ": "; font-weight: 700; color: var(--text-muted); }
  .win-table td:nth-child(6)::before { content: var(--label-6) ": "; font-weight: 700; color: var(--text-muted); }
  .win-table td:nth-child(7)::before { content: var(--label-7) ": "; font-weight: 700; color: var(--text-muted); }
}

/* ── LOCKED FOLDER & EMPTY STATES ───────────────────────────────────────── */
.locked-pane-card,
.empty-pane-card {
  max-width: 440px;
  margin: 2.5rem auto;
  text-align: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 2rem 1.5rem;
}

.locked-pane-card h3, .empty-pane-card h3 { margin: 0.5rem 0 0.35rem; font-size: 1.05rem; }
.locked-pane-card p, .empty-pane-card p { margin: 0 0 1.15rem; font-size: 0.83rem; color: var(--text-secondary); }

/* ── STATUS BAR ─────────────────────────────────────────────────────────── */
.win-status-bar {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  padding: 0.45rem 11.6rem 0.45rem 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.74rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.win-status-left, .win-status-right { display: flex; align-items: center; gap: 0.5rem; }

.status-selected-pill {
  background: var(--bg-selected);
  color: light-dark(#1D4ED8, #BFDBFE);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.status-online-dot { width: 8px; height: 8px; border-radius: 50%; background: #10B981; }

/* ── PC RIGHT-CLICK CONTEXT MENU ────────────────────────────────────────── */
.pc-context-menu {
  position: fixed;
  z-index: 90;
  min-width: 235px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
  padding: 0.35rem;
}

.ctx-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.46rem 0.68rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-family: inherit;
}

.ctx-item:hover { background: var(--bg-hover); }
.ctx-item.danger { color: #EF4444; }
.ctx-item.danger:hover { background: light-dark(#FEF2F2, #450A0A); }
.ctx-sep,
.ctx-hr {
  border: 0;
  border-top: 1px solid var(--border-light);
  height: 0;
  margin: 0.28rem 0;
}

/* ── NATIVE <dialog> MODALS ─────────────────────────────────────────────── */
dialog:modal { overscroll-behavior: contain; }

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(2px);
}

.evn-dialog {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 0;
  max-width: min(540px, 94vw);
  width: 100%;
  overflow: hidden;
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.evn-dialog:has(.dlg-sm) { max-width: min(430px, 94vw); }
.evn-dialog:has(.dlg-wide) { max-width: min(650px, 95vw); }
.evn-dialog:has(.dlg-xl) { max-width: min(920px, 96vw); }

.dlg-card { display: flex; flex-direction: column; max-height: 90dvh; overflow: hidden; }

.dlg-header {
  flex-shrink: 0;
  padding: 0.95rem 1.2rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dlg-header h2 { margin: 0; font-size: 0.98rem; font-weight: 800; }

.dlg-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
}

.dlg-body { flex: 1 1 auto; min-height: 0; padding: 1.1rem 1.2rem; overflow-y: auto; }

.dlg-footer {
  flex-shrink: 0;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* Forms & Controls */
.form-group { margin-bottom: 0.85rem; }
.form-group label { display: block; font-size: 0.79rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.35rem; }
.req { color: #EF4444; }

.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-main);
  background: var(--bg-surface);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-emerald-light);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.code-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  line-height: 1.55;
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  padding: 0.52rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.83rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  min-inline-size: 28px;
  min-block-size: 28px;
}

.btn-primary { background: var(--brand-emerald); color: #FFF; }
.btn-primary:hover { background: #047857; }
.btn-secondary { background: var(--bg-surface); border-color: var(--border-strong); color: var(--text-main); }
.btn-outline { background: var(--bg-selected); border-color: #3B82F6; color: light-dark(#1D4ED8, #BFDBFE); }

/* Copy button + accessible live bubble (Modern Web Guidance) */
.copy-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.copy-input-group .form-control { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }

.copy {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.copy .tip {
  position: absolute;
  inset-block-end: calc(100% + 6px);
  inset-inline-end: 0;
  background: #059669;
  color: #FFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s;
}

.copy .copy-button[data-copied] + .tip,
.copy .copy-button[data-failed] + .tip {
  opacity: 1;
}

.copy .copy-button[data-failed] + .tip { background: #DC2626; }

.share-item-banner {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  margin-bottom: 1rem;
  font-size: 0.83rem;
}

/* Properties / Item Info Grid */
.info-props-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.info-props-table th,
.info-props-table td {
  padding: 0.55rem 0.4rem;
  border-bottom: 1px dashed var(--border-light);
  text-align: left;
  vertical-align: top;
}

.info-props-table th {
  width: 36%;
  color: var(--text-muted);
  font-weight: 700;
}

.info-props-table td {
  color: var(--text-main);
  font-weight: 600;
  word-break: break-word;
}

.upload-picker-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--bg-subtle);
  padding: 1.25rem 1rem;
  text-align: center;
  margin-bottom: 0.85rem;
}

.upload-picker-zone.drag-active {
  border-color: var(--brand-emerald-light);
  background: light-dark(#ECFDF5, #064E3B);
}

.picker-ico { font-size: 2rem; }
.picker-lead { margin: 0.3rem 0 0.2rem; font-size: 0.86rem; font-weight: 600; }
.picker-link { color: var(--brand-emerald-light); font-weight: 800; text-decoration: underline; cursor: pointer; }
.picker-sub { margin: 0; font-size: 0.74rem; color: var(--text-muted); }

.upload-queue-list { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.8rem; max-height: 150px; overflow-y: auto; }
.upload-queue-item { display: flex; justify-content: space-between; align-items: center; background: var(--bg-subtle); padding: 0.4rem 0.65rem; border-radius: 7px; font-size: 0.78rem; }

.upload-progress-wrap { background: var(--bg-subtle); border: 1px solid var(--border-light); border-radius: 8px; padding: 0.65rem 0.8rem; }
.upload-progress-labels { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 0.35rem; }
.upload-progress-wrap progress { width: 100%; height: 10px; accent-color: var(--brand-emerald); }

.replace-file-callout {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.replace-file-callout p { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-muted); }

.unlock-target-banner {
  background: light-dark(#FFFBEB, #451A03);
  border: 1px solid light-dark(#FDE68A, #92400E);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.unlock-lock-ico { font-size: 1.6rem; }
.unlock-hint { margin: 2px 0 0; font-size: 0.75rem; color: light-dark(#92400E, #FDE68A); }
.form-error { color: #EF4444; font-size: 0.8rem; font-weight: 600; margin: 0.35rem 0 0; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; }

.preview-frame { width: 100%; height: min(68svh, 620px); border: 1px solid var(--border-light); border-radius: 8px; background: #0F172A; }

/* ── PROGRESSIVE BYTE-RANGE PDF VIEWER ─────────────────────────────────── */
.pdfv-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(70svh, 660px);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  background: #1E293B;
}

.pdfv-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.6rem;
  padding: 0.45rem 0.65rem;
  background: #0F172A;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  color: #F8FAFC;
}

.pdfv-group {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.pdfv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-inline-size: 30px;
  min-block-size: 30px;
  padding: 0 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.pdfv-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.65);
  color: #FFFFFF;
}

.pdfv-btn:focus-visible {
  outline: 2px solid #10B981;
  outline-offset: 2px;
}

.pdfv-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pdfv-zoom-label {
  min-inline-size: 68px;
}

.pdfv-page-box {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #E2E8F0;
}

.pdfv-page-input {
  width: 52px;
  min-block-size: 28px;
  padding: 0.15rem 0.3rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  appearance: textfield;
}

.pdfv-page-input::-webkit-inner-spin-button,
.pdfv-page-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pdfv-page-sep,
.pdfv-page-total {
  color: #CBD5E1;
}

.pdfv-progress-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.42rem 0.7rem;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.pdfv-progress-wrap.hidden {
  display: none;
}

.pdfv-progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  position: relative;
}

.pdfv-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10B981 0%, #38BDF8 100%);
  transition: width 0.2s ease;
}

.pdfv-progress-bar.is-indeterminate {
  width: 40%;
  animation: pdfvSlide 1.15s infinite ease-in-out;
}

@keyframes pdfvSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(270%); }
}

.pdfv-status-text {
  font-size: 0.74rem;
  font-weight: 600;
  color: #CBD5E1;
}

.pdfv-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 0.75rem;
  background: #1E293B;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.65) rgba(15, 23, 42, 0.45);
}

.pdfv-pages {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: max-content;
  width: 100%;
}

.pdfv-page-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  flex-shrink: 0;
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45);
  overflow: hidden;
}

.pdfv-page-slot.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(16, 185, 129, 0.08) 50%, transparent 70%);
  animation: pdfvSlide 1.4s infinite linear;
  pointer-events: none;
}

.pdfv-page-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #F1F5F9;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 1;
}

.pdfv-canvas {
  display: block;
  position: relative;
  z-index: 2;
  background: #FFFFFF;
}

@media (max-width: 680px) {
  .pdfv-root {
    height: min(64dvh, 540px);
  }
  .pdfv-toolbar {
    padding: 0.38rem 0.48rem;
    gap: 0.32rem;
  }
  .pdfv-btn {
    min-inline-size: 32px;
    min-block-size: 34px;
    padding: 0 0.42rem;
    font-size: 0.74rem;
  }
  .pdfv-zoom-label {
    min-inline-size: 58px;
  }
  .pdfv-page-input {
    width: 48px;
    min-block-size: 34px;
    font-size: 16px;
  }
  .pdfv-viewport {
    padding: 0.55rem 0.4rem;
  }
}
.preview-img-wrap { text-align: center; background: #0F172A; border-radius: 8px; padding: 0.75rem; }
.preview-img-wrap img { max-width: 100%; max-height: 64svh; object-fit: contain; border-radius: 4px; }
.preview-text-pre { background: #0F172A; color: #E2E8F0; padding: 1rem; border-radius: 8px; max-height: 60svh; overflow: auto; font-size: 0.81rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

/* ── MOBILE NAVIGATION DRAWER ───────────────────────────────────────────── */
.Drawer {
  --drawer-width: min(21.5rem, 88dvw, 100dvw - 38px);
  --drawer-backdrop: 0;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.Drawer::backdrop { background: #020617; opacity: calc(var(--drawer-backdrop) * 0.58); backdrop-filter: none; }

.Drawer-scroller {
  position: relative;
  display: grid;
  grid-template-columns: var(--drawer-width) 100%;
  overflow-x: scroll;
  overscroll-behavior: none;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.Drawer-scroller::-webkit-scrollbar { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .Drawer-scroller { scroll-behavior: smooth; }
}

.Drawer-scroller::after { content: ''; scroll-snap-align: end; scroll-initial-target: nearest; }

.Drawer-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  width: var(--drawer-width);
  max-width: var(--drawer-width);
  height: 100svh;
  background: var(--bg-surface);
  color: var(--text-main);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  scroll-snap-align: start;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.3);
}
.Drawer-sheet::-webkit-scrollbar { display: none; }

.drawer-sheet-header {
  padding: 0.78rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-inline-size: 0;
  width: 100%;
}
.drawer-sheet-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-inline-size: 0;
}
.drawer-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drawer-tree-body {
  padding: 0.55rem 0.35rem max(1.25rem, env(safe-area-inset-bottom, 0px));
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow-x: hidden;
}

@supports (animation-timeline: scroll()) {
  .Drawer { timeline-scope: --drawer-fade; animation: fade-drawer-backdrop linear both; animation-timeline: --drawer-fade; }
  .Drawer-scroller { scroll-timeline: --drawer-fade x; }
  @property --drawer-backdrop { syntax: '<number>'; inherits: true; initial-value: 0; }
  @keyframes fade-drawer-backdrop { 0% { --drawer-backdrop: 1; } 100% { --drawer-backdrop: 0; } }
}

/* ── RICH DOCUMENT & TEXT EDITOR STUDIO ─────────────────────────────────── */
.editor-studio-body {
  padding: 0.85rem 1.15rem;
}

.editor-studio-body .form-group {
  margin-bottom: 0.65rem;
}

.editor-name-ext-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.ext-quick-select {
  width: 84px;
  flex-shrink: 0;
  padding-inline: 0.45rem;
  font-weight: 700;
}

.editor-toolbar-shell {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 0.42rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.editor-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.26rem;
  flex-wrap: wrap;
}

.editor-toolbar-row.secondary {
  padding-top: 0.32rem;
  border-top: 1px dashed var(--border-light);
}

.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 28px;
  height: 28px;
  padding: 0 0.48rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: background 0.12s, border-color 0.12s;
}

.ed-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.ed-sep {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 0.12rem;
  flex-shrink: 0;
}

.ed-select {
  height: 28px;
  padding: 0 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  max-width: 225px;
}

.ed-mode-switch {
  margin-left: auto;
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.ed-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.ed-mode-btn.active {
  background: light-dark(#ECFDF5, #064E3B);
  color: light-dark(#059669, #A7F3D0);
}

.editor-find-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border-light);
  flex-wrap: wrap;
}

.editor-find-bar .form-control {
  flex: 1;
  min-width: 130px;
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 0.32rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.editor-panes {
  border: 1px solid var(--border-strong);
  border-radius: 0 0 10px 10px;
  background: var(--bg-surface);
  overflow: hidden;
  min-height: 290px;
  display: grid;
  grid-template-columns: 1fr;
}

.editor-panes.mode-write .editor-live-preview { display: none; }
.editor-panes.mode-preview .editor-textarea { display: none; }
.editor-panes.mode-split {
  grid-template-columns: 1fr 1fr;
}
.editor-panes.mode-split .editor-textarea {
  border-right: 1px solid var(--border-light);
}

.editor-textarea {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 290px;
  max-height: 48svh;
  resize: vertical;
  padding: 0.85rem 0.95rem;
}

.editor-live-preview {
  padding: 0.85rem 1.05rem;
  min-height: 290px;
  max-height: 48svh;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.62;
  color: var(--text-main);
  background: var(--bg-surface);
}

.editor-live-preview h1,
.editor-live-preview h2,
.editor-live-preview h3 {
  margin: 0.6rem 0 0.35rem;
  line-height: 1.3;
}
.editor-live-preview h1 { font-size: 1.25rem; border-bottom: 1px solid var(--border-light); padding-bottom: 0.25rem; }
.editor-live-preview h2 { font-size: 1.06rem; }
.editor-live-preview h3 { font-size: 0.94rem; }
.editor-live-preview p { margin: 0.4rem 0; }
.editor-live-preview blockquote {
  margin: 0.5rem 0;
  padding: 0.45rem 0.75rem;
  border-left: 3px solid var(--brand-emerald);
  background: var(--bg-subtle);
  border-radius: 0 6px 6px 0;
}
.editor-live-preview pre {
  background: #0F172A;
  color: #E2E8F0;
  padding: 0.65rem 0.8rem;
  border-radius: 7px;
  overflow-x: auto;
  font-size: 0.78rem;
}
.editor-live-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.55rem 0;
  font-size: 0.8rem;
}
.editor-live-preview th,
.editor-live-preview td {
  border: 1px solid var(--border-strong);
  padding: 0.38rem 0.55rem;
  text-align: left;
}
.editor-live-preview th {
  background: var(--bg-subtle);
  font-weight: 700;
}

.editor-footer-bar {
  justify-content: space-between;
  align-items: center;
}

.editor-stats-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ── FLOATING POPUP CHAT AI FILE ASSISTANT ──────────────────────────────── */
.ai-fab-btn {
  position: fixed;
  right: 1rem;
  bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  z-index: 75;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, #059669 0%, #0284C7 100%);
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.34), 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: transform 0.16s, box-shadow 0.16s;
}

.ai-fab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(2, 132, 199, 0.4);
}

.ai-fab-icon {
  font-size: 1.08rem;
  line-height: 1;
}

.ai-chat-popup {
  position: fixed;
  right: 1rem;
  bottom: calc(3.65rem + env(safe-area-inset-bottom, 0px));
  z-index: 82;
  width: min(395px, calc(100vw - 1.5rem));
  height: min(540px, calc(100svh - 5.4rem));
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 22px 48px rgba(2, 6, 23, 0.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-header {
  padding: 0.75rem 0.95rem;
  background: linear-gradient(135deg, #059669 0%, #0369A1 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-chat-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.ai-chat-brand strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.25;
}

.ai-online-sub {
  display: block;
  font-size: 0.69rem;
  opacity: 0.88;
}

.ai-chat-head-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  cursor: pointer;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-msg {
  max-width: 92%;
  padding: 0.6rem 0.78rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.48;
  word-break: break-word;
}

.ai-msg.bot {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  border-top-left-radius: 4px;
}

.ai-msg.user {
  align-self: flex-end;
  background: var(--brand-emerald);
  color: #FFFFFF;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

.ai-result-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin-top: 0.55rem;
}

.ai-result-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 9px;
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.ai-result-top {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.ai-result-ico {
  font-size: 1.15rem;
  line-height: 1.1;
  flex-shrink: 0;
}

.ai-result-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.ai-result-sub {
  font-size: 0.69rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.ai-result-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ai-chat-suggestions {
  padding: 0.45rem 0.65rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.34rem;
  max-height: 112px;
  overflow-y: auto;
  overflow-x: hidden;
}

.ai-chat-suggestions::-webkit-scrollbar { display: none; }

.ai-chip {
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.24rem 0.62rem;
  min-block-size: 28px;
  font-size: 0.71rem;
  font-weight: 700;
  font-family: inherit;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.ai-chip.ai-chip-folder {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.3);
  color: var(--text-main);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .ai-chip.ai-chip-folder {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.36);
}

.ai-chip:hover {
  border-color: var(--brand-emerald-light);
  color: var(--brand-emerald);
}

.ai-chip.ai-chip-folder:hover {
  background: rgba(5, 150, 105, 0.16);
  border-color: var(--brand-emerald);
  color: var(--brand-emerald);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .ai-chip.ai-chip-folder:hover {
  background: rgba(16, 185, 129, 0.24);
  color: #6EE7B7;
}

.ai-chip:focus-visible {
  outline: 2px solid var(--brand-emerald);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .ai-chat-suggestions {
    max-height: 140px;
  }
  .ai-chip {
    min-block-size: 36px;
    padding: 0.32rem 0.72rem;
    font-size: 0.74rem;
  }
}

.ai-chat-input-bar {
  padding: 0.55rem 0.65rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.ai-chat-input-bar input {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.48rem 0.85rem;
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
}

.ai-chat-input-bar input:focus {
  border-color: var(--brand-emerald-light);
  background: var(--bg-surface);
}

.ai-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--brand-emerald);
  color: #FFFFFF;
  font-size: 0.86rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-send-btn:hover { background: #047857; }

/* ── TOASTS & LOADING ───────────────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: 4.4rem; right: 1.15rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(380px, 92vw); }
.toast-item { background: #0F172A; color: #FFF; padding: 0.7rem 1rem; border-radius: 10px; font-size: 0.82rem; font-weight: 600; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3); border-left: 4px solid var(--brand-emerald-light); }
.toast-item.error { border-left-color: #EF4444; }
.explorer-loading { text-align: center; padding: 3.5rem 1rem; color: var(--text-muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-light); border-top-color: var(--brand-emerald); border-radius: 50%; margin: 0 auto 0.75rem; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SITE ATTRIBUTION FOOTER ────────────────────────────────────────────── */
.site-credit-footer {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0.4rem 5rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.credit-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-emerald-light);
  flex-shrink: 0;
}

/* ── RESPONSIVE BREAKPOINTS (PC / Laptop / Tablet / Mobile) ─────────────── */
@media (max-width: 1280px) {
  .sys-clock-pill { display: none; }
  .explorer-stage { padding: 0.4rem 0.45rem 0.35rem; }
}

@media (max-width: 1024px) {
  .win-explorer-body { grid-template-columns: 266px minmax(0, 1fr); }
  .win-grid-container { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 0.78rem; }
  .hide-md { display: none; }
  .sys-global-search { width: clamp(195px, 24vw, 255px); }
}

@media (max-width: 860px) {
  .mobile-menu-btn { display: inline-flex; }
  .win-sidebar-tree { display: none; }
  .win-explorer-body { grid-template-columns: 1fr; min-height: 420px; }
  .hide-sm { display: none; }
  .sys-global-search { display: none; }
  .sys-kbd { display: none; }
  .win-items-scroll { padding: 0.85rem 0.9rem 1.25rem; }
}

@media (max-width: 640px) {
  .explorer-stage { padding: 0; }
  .win-explorer-window {
    min-height: calc(100dvh - 108px);
    border-radius: 0;
    border-inline: none;
    border-top: none;
    box-shadow: none;
  }
  .win-explorer-body { min-height: 280px; }
  .win-title-bar { display: none; }
  .hide-mobile { display: none !important; }
  .win-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.42rem 0.6rem;
    gap: 0.34rem;
    scroll-snap-type: x proximity;
  }
  .win-toolbar.h-scroll-fade {
    mask:
      linear-gradient(black, black) no-clip subtract,
      linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
      linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
  }
  .win-tool-btn {
    padding: 0.36rem 0.62rem;
    font-size: 0.75rem;
    min-height: 34px;
    scroll-snap-align: start;
  }
  .win-nav-bar {
    flex-wrap: wrap;
    padding: 0.42rem 0.6rem;
    gap: 0.38rem;
  }
  .win-nav-arrow-btn {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }
  .win-address-box {
    min-height: 30px;
    padding: 0.26rem 0.55rem;
    font-size: 0.78rem;
  }
  .win-search-box {
    width: 100%;
    border-radius: 999px;
    padding: 0.3rem 0.68rem;
  }
  .win-search-box input {
    font-size: 16px;
    line-height: 1.25;
  }
  .win-content-header {
    padding: 0.56rem 0.65rem;
    gap: 0.46rem;
  }
  .win-current-folder-info { gap: 0.48rem; }
  .win-cur-icon { font-size: 1.35rem; }
  .win-current-folder-title { font-size: 0.88rem; }
  .win-current-folder-desc { font-size: 0.71rem; line-height: 1.3; }
  .win-header-controls {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.32rem;
  }
  .win-sort-wrap { flex: 1 1 0%; min-width: 0; }
  .win-sort-select {
    width: 100%;
    max-inline-size: none;
    min-height: 34px;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
  .folder-size-toggle {
    min-height: 34px;
    padding: 0.3rem 0.54rem;
    font-size: 0.72rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .win-view-mode-toggle { flex-shrink: 0; }
  .win-view-btn {
    min-height: 30px;
    padding: 0.28rem 0.5rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .win-items-scroll { padding: 0.62rem 0.6rem 0.9rem; }
  .win-grid-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
  .win-folder-card,
  .win-file-card {
    padding: 0.42rem 0.48rem 0.64rem;
    border-radius: 11px;
  }
  .card-top-bar { min-height: 22px; margin-bottom: 0.08rem; }
  .folder-svg-wrap { width: 48px; height: 40px; margin-bottom: 0.28rem; }
  .folder-svg-wrap svg { width: 46px; height: 38px; }
  .win-file-icon-wrap { width: 46px; height: 44px; margin-bottom: 0.26rem; }
  .win-file-icon { font-size: 2rem; }
  .win-folder-name,
  .win-file-name { font-size: 0.78rem; line-height: 1.28; margin-bottom: 0.16rem; }
  .win-folder-meta,
  .win-file-meta { font-size: 0.69rem; }
  .card-more-btn,
  .card-star-btn {
    width: 28px;
    height: 28px;
    opacity: 0.92;
  }
  .table-wrapper { border: none; border-radius: 0; }
  .win-table tbody tr {
    margin-block-end: 0.58rem;
    background: var(--bg-surface);
  }
  .win-table td {
    padding: 0.38rem 0.68rem;
    font-size: 0.76rem;
  }
  .win-table td:last-child > div {
    flex-wrap: wrap !important;
    justify-content: flex-end;
    gap: 5px;
  }
  .mini-btn { min-height: 30px; padding: 4px 8px; }
  .win-status-bar {
    padding: 0.48rem 4.1rem 0.48rem 0.68rem;
    gap: 0.3rem;
    font-size: 0.71rem;
  }
  .site-credit-footer {
    padding: 0.55rem 0.85rem calc(4.5rem + env(safe-area-inset-bottom, 0px));
    font-size: 0.74rem;
  }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .form-control { font-size: 16px; }
  .evn-dialog {
    max-width: calc(100vw - 14px);
    max-height: 92dvh;
    border-radius: 14px;
  }
  .dlg-header { padding: 0.75rem 0.9rem; }
  .dlg-body { padding: 0.82rem 0.9rem; }
  .dlg-footer { padding: 0.65rem 0.9rem; }
  .dlg-footer .btn { flex: 1 1 auto; min-height: 38px; }
  .mobile-drawer { width: min(86vw, 316px); }
  .mobile-drawer .gdrive-nav-item,
  .mobile-drawer .gdrive-tree-row { min-height: 38px; }
  .pc-context-menu,
  .gdrive-new-menu {
    max-width: calc(100vw - 20px);
    max-height: 75dvh;
    overflow-y: auto;
  }
  .copy-input-group { flex-direction: column; align-items: stretch; }
  .editor-panes.mode-split { grid-template-columns: 1fr; }
  .editor-panes.mode-split .editor-textarea { border-right: none; border-bottom: 1px solid var(--border-light); }
  .ed-mode-switch { margin-left: 0; }
  .ai-fab-label { display: none; }
  .ai-fab-btn {
    width: 46px;
    height: 46px;
    padding: 0;
    justify-content: center;
    right: 0.85rem;
    bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
  }
  .ai-chat-popup {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: calc(4.1rem + env(safe-area-inset-bottom, 0px));
    height: min(500px, calc(100dvh - 5.2rem));
  }
  .ai-chat-input-bar input { font-size: 16px; }
}

@media (max-width: 540px) {
  .brand-long {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .brand-short { display: inline; }
  .hide-xs { display: none; }
  .sys-pill-ai { display: none; }
  .sys-topbar { padding: 0.38rem 0.48rem; gap: 0.3rem; }
  .sys-topbar-left { gap: 0.34rem; }
  .mobile-menu-btn { width: 32px; height: 32px; font-size: 1rem; }
  .brand-logo-wrap { padding: 1px 2px; }
  .brand-logo-img { height: 20px; }
  .sys-brand { font-size: 0.86rem; gap: 0.3rem; }
  .sys-topbar-right { gap: 0.22rem; }
  .sys-pill-btn { padding: 0.28rem 0.44rem; font-size: 0.73rem; min-block-size: 32px; }
  .sys-pill-lang { min-inline-size: 46px; }
  .sys-pill-theme,
  .sys-pill-admin-active,
  .sys-pill-logout { min-inline-size: 32px; padding: 0.28rem 0.42rem; justify-content: center; }
  .lang-btn { padding: 0.2rem 0.4rem; font-size: 0.7rem; }
}

@media (max-width: 480px) {
  .hide-xxs { display: none; }
  .folder-size-toggle { padding: 0.32rem 0.54rem; }
  .win-view-btn { padding: 0.28rem 0.5rem; }
}

@media (max-width: 390px) {
  .sys-topbar { padding: 0.36rem 0.42rem; gap: 0.24rem; }
  .sys-topbar-left { gap: 0.28rem; }
  .sys-topbar-right { gap: 0.18rem; }
  .brand-logo-img { height: 18px; }
  .sys-brand { font-size: 0.82rem; gap: 0.24rem; }
  .sys-pill-btn { padding: 0.26rem 0.38rem; }
  .sys-pill-lang { min-inline-size: 44px; }
}

@media (max-width: 340px) {
  .win-grid-container { grid-template-columns: 1fr; }
}

/* =========================================================================
   EVN-EC DRIVE LOGIN GATE & USER ACCOUNT / FOLDER ACL PILLS (v31)
   ========================================================================= */
.drive-login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  background: radial-gradient(circle at 18% 15%, rgba(16, 185, 129, 0.14), transparent 46%),
              radial-gradient(circle at 82% 85%, rgba(14, 165, 233, 0.14), transparent 46%),
              var(--bg-body);
}

.drive-login-stack {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.drive-login-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 1.5rem 1.65rem 1.4rem;
  box-shadow: 0 22px 48px -18px rgba(15, 23, 42, 0.22);
}

.drive-login-top-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.drive-login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.drive-login-logo-box {
  width: 62px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
}

.drive-login-logo-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.drive-login-brand-texts h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.drive-login-brand-texts p {
  margin: 0.18rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.drive-login-policy-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.09);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 500;
  margin-bottom: 1.05rem;
}

.pass-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pass-input-wrap .form-control {
  padding-right: 2.75rem;
}

.pass-eye-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: background 0.15s;
}

.pass-eye-btn:hover {
  background: var(--bg-subtle);
}

.drive-login-submit-btn {
  width: 100%;
  min-height: 44px;
  font-size: 0.92rem;
  font-weight: 700;
  justify-content: center;
  margin-top: 0.25rem;
}

.drive-login-help {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.sys-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 175px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sys-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sys-pill-logout {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.26);
  color: #dc2626;
}

.sys-pill-logout:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
}

.acl-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 0.35rem;
  white-space: nowrap;
}

.acl-pill.acl-full {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.acl-pill.acl-write {
  background: rgba(14, 165, 233, 0.13);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.32);
}

.acl-pill.acl-read {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.acl-pill.acl-traverse {
  background: rgba(100, 116, 139, 0.13);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

@media (max-width: 640px) {
  .drive-login-screen {
    padding: 0.9rem 0.75rem;
    align-items: flex-start;
    padding-top: max(1.5rem, 6dvh);
  }
  .drive-login-card {
    padding: 1.2rem 1.1rem 1.15rem;
    border-radius: 16px;
  }
  .drive-login-brand-texts h1 {
    font-size: 1.12rem;
  }
  .drive-login-card .form-control {
    font-size: 16px;
  }
}

/* ── CONTEXT MENU ACCENT & DIRECT FOLDER PERMISSIONS MODAL (v32) ─────────── */
.ctx-item.ctx-accent {
  color: light-dark(#047857, #34D399);
  font-weight: 700;
}
.ctx-item.ctx-accent:hover {
  background: light-dark(#ECFDF5, rgba(16, 185, 129, 0.16));
}

.fap-folder-banner {
  background: light-dark(#ECFDF5, rgba(16, 185, 129, 0.12));
  border: 1px solid light-dark(#A7F3D0, rgba(16, 185, 129, 0.34));
  border-radius: 10px;
  padding: 0.72rem 0.9rem;
  margin-bottom: 0.85rem;
}

.fap-banner-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.fap-banner-ico {
  font-size: 1.65rem;
  line-height: 1;
  flex-shrink: 0;
}

.fap-banner-name {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-main);
  word-break: break-word;
}

.fap-banner-path {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-word;
}

.fap-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.fap-tab-switch {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.fap-tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.72rem;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.16s, color 0.16s;
}

.fap-tab-btn.active {
  background: var(--bg-surface);
  color: light-dark(#047857, #34D399);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.fap-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  background: light-dark(#E2E8F0, #334155);
  color: var(--text-main);
}

.fap-tab-btn.active .fap-tab-count {
  background: light-dark(#D1FAE5, rgba(16, 185, 129, 0.25));
  color: light-dark(#047857, #6EE7B7);
}

.fap-search-wrap {
  flex: 1 1 210px;
  min-width: 180px;
}

.fap-search-wrap .form-control {
  padding: 0.42rem 0.7rem;
  font-size: 0.82rem;
}

.fap-list-panel {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-subtle);
  max-height: min(46svh, 360px);
  overflow-y: auto;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.fap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.56rem 0.7rem;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  transition: border-color 0.15s, background 0.15s;
}

.fap-row.is-explicit {
  border-color: light-dark(#6EE7B7, #059669);
  background: light-dark(#F0FDF4, rgba(6, 78, 59, 0.24));
}

.fap-row.is-disabled {
  opacity: 0.68;
}

.fap-row-info {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  min-width: 0;
  flex: 1;
}

.fap-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: light-dark(#E0F2FE, #0C4A6E);
  color: light-dark(#0369A1, #7DD3FC);
  font-size: 0.74rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fap-group-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px light-dark(rgba(0,0,0,0.06), rgba(255,255,255,0.08));
}

.fap-row-texts {
  min-width: 0;
  flex: 1;
}

.fap-row-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--text-main);
}

.fap-username {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 600;
}

.fap-role-pill,
.fap-lock-pill {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.fap-role-pill {
  background: light-dark(#EDE9FE, rgba(139, 92, 246, 0.2));
  color: light-dark(#6D28D9, #C4B5FD);
}

.fap-lock-pill {
  background: light-dark(#FEE2E2, rgba(239, 68, 68, 0.22));
  color: light-dark(#B91C1C, #FCA5A5);
}

.fap-row-sub {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  flex-wrap: wrap;
  margin-top: 0.22rem;
}

.fap-eff-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.69rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.fap-badge-none {
  background: light-dark(#F1F5F9, #334155);
  color: light-dark(#64748B, #94A3B8);
}

.fap-badge-read {
  background: light-dark(#FEF3C7, rgba(245, 158, 11, 0.2));
  color: light-dark(#B45309, #FCD34D);
}

.fap-badge-write {
  background: light-dark(#E0F2FE, rgba(14, 165, 233, 0.2));
  color: light-dark(#0369A1, #7DD3FC);
}

.fap-badge-full {
  background: light-dark(#D1FAE5, rgba(16, 185, 129, 0.22));
  color: light-dark(#047857, #6EE7B7);
}

.fap-group-chip {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gcol, #059669) 35%, transparent);
  background: color-mix(in srgb, var(--gcol, #059669) 12%, transparent);
  color: var(--text-main);
}

.fap-desc-snip {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.fap-row-control {
  flex: 0 0 218px;
}

.fap-level-select {
  width: 100%;
  padding: 0.42rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.fap-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.fap-legend-note {
  margin: 0.68rem 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.48;
}

#dlg-folder-access .dlg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.fap-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
}

.sys-pill-lang {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text-main);
  padding: 0.32rem 0.62rem;
  min-inline-size: 56px;
  justify-content: center;
  gap: 0.28rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.sys-pill-lang:hover {
  border-color: var(--brand-emerald-light);
  background: light-dark(#ECFDF5, rgba(16, 185, 129, 0.16));
  color: light-dark(#047857, #6EE7B7);
}
.sys-pill-lang .lang-toggle-code {
  font-size: 0.74rem;
  font-weight: 800;
}

.fap-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: light-dark(#ECFDF5, rgba(16, 185, 129, 0.16));
  border: 1px solid light-dark(#A7F3D0, rgba(52, 211, 153, 0.35));
  color: light-dark(#047857, #6EE7B7);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .fap-controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .fap-count-pill {
    align-self: flex-start;
  }
  .fap-search-wrap {
    flex: none;
    width: 100%;
    min-width: 0;
  }
  .fap-tab-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .fap-tab-btn {
    justify-content: center;
  }
  .fap-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .fap-row-control {
    flex: none;
    width: 100%;
  }
  .fap-level-select,
  .fap-search-wrap .form-control {
    font-size: 16px;
  }
  .fap-cpanel-link {
    width: 100%;
    justify-content: center;
  }
  .fap-footer-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── EXPLORER RECYCLE BIN RESTORE & PERMANENT DELETE CONTROLS (v34) ──────── */
.win-tool-btn.trash-restore-accent {
  background: light-dark(#ECFDF5, rgba(16, 185, 129, 0.16));
  border-color: light-dark(#6EE7B7, rgba(52, 211, 153, 0.42));
  color: light-dark(#047857, #6EE7B7);
}
.win-tool-btn.trash-restore-accent:hover:not(:disabled) {
  background: light-dark(#D1FAE5, rgba(16, 185, 129, 0.28));
}

.win-tool-btn.danger-solid {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}
.win-tool-btn.danger-solid:hover:not(:disabled) {
  background: #B91C1C;
  border-color: #B91C1C;
}

.trash-days-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: light-dark(#F1F5F9, rgba(148, 163, 184, 0.18));
  color: light-dark(#475569, #CBD5E1);
  border: 1px solid var(--border-light);
  white-space: nowrap;
}
.trash-days-pill.is-warn {
  background: light-dark(#FFFBEB, rgba(245, 158, 11, 0.2));
  color: light-dark(#B45309, #FCD34D);
  border-color: light-dark(#FDE68A, rgba(251, 191, 36, 0.35));
}
.trash-days-pill.is-urgent {
  background: light-dark(#FEF2F2, rgba(239, 68, 68, 0.22));
  color: light-dark(#B91C1C, #FCA5A5);
  border-color: light-dark(#FECACA, rgba(248, 113, 113, 0.4));
}

.card-quick-actions.trash-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 0.55rem;
  width: 100%;
}

.card-quick-actions.trash-card-actions .mini-btn {
  width: 100%;
  justify-content: center;
  padding: 0.34rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.mini-btn.restore {
  background: light-dark(#ECFDF5, rgba(16, 185, 129, 0.18));
  border-color: light-dark(#6EE7B7, rgba(52, 211, 153, 0.4));
  color: light-dark(#047857, #6EE7B7);
}
.mini-btn.restore:hover {
  background: light-dark(#D1FAE5, rgba(16, 185, 129, 0.3));
}

.mini-btn.danger {
  background: light-dark(#FEF2F2, rgba(239, 68, 68, 0.18));
  border-color: light-dark(#FECACA, rgba(248, 113, 113, 0.4));
  color: light-dark(#DC2626, #FCA5A5);
}
.mini-btn.danger:hover {
  background: light-dark(#FEE2E2, rgba(239, 68, 68, 0.3));
}

@media (max-width: 480px) {
  .card-quick-actions.trash-card-actions {
    grid-template-columns: 1fr;
  }
}
