/* ============================================================================
   Maya Drive — Apple-style UI
   Design references:
     - emilkowalski/skills  -> apple-design, emil-design-eng, animate
     - iOS / macOS Files, iCloud Drive, System Settings
   Tokens, surfaces, springs, hairlines, translucency, reduced motion.
   ============================================================================ */

:root {
  /* Surfaces (light) */
  --bg:           #f5f5f7;
  --bg-elev:      #ffffff;
  --bg-elev-2:    #ffffff;
  --bg-glass:     rgba(255, 255, 255, 0.72);
  --bg-glass-2:   rgba(255, 255, 255, 0.88);
  --bg-tint:      rgba(10, 132, 255, 0.06);

  /* Text */
  --text:         #1d1d1f;
  --text-2:       #51525a;
  --text-3:       #86868b;

  /* Lines + fills */
  --hairline:     rgba(0, 0, 0, 0.08);
  --hairline-2:   rgba(0, 0, 0, 0.05);
  --fill-1:       rgba(0, 0, 0, 0.04);
  --fill-2:       rgba(0, 0, 0, 0.08);
  --fill-3:       rgba(0, 0, 0, 0.12);

  /* Accent */
  --accent:       #0a84ff;
  --accent-press: #0066d6;
  --accent-soft:  rgba(10, 132, 255, 0.18);
  --danger:       #ff3b30;
  --danger-press: #d70015;
  --success:      #30d158;
  --warn:         #ff9f0a;

  /* Shadows */
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  --shadow-md:    0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
  --shadow-lg:    0 20px 50px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --shadow-pop:   0 12px 32px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.08);

  /* Radii */
  --r-xs:  6px;
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  18px;
  --r-xl:  22px;

  /* Easing (per emil-design-eng, "always custom curves") */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* Durations */
  --t-fast: 160ms;
  --t:      240ms;
  --t-slow: 360ms;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h:  56px;
  --selbar-h:  48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #000000;
    --bg-elev:    #1c1c1e;
    --bg-elev-2:  #2c2c2e;
    --bg-glass:   rgba(28, 28, 30, 0.72);
    --bg-glass-2: rgba(28, 28, 30, 0.88);
    --bg-tint:    rgba(10, 132, 255, 0.18);
    --text:       #f5f5f7;
    --text-2:     #c7c7cc;
    --text-3:     #8e8e93;
    --hairline:   rgba(255, 255, 255, 0.08);
    --hairline-2: rgba(255, 255, 255, 0.05);
    --fill-1:     rgba(255, 255, 255, 0.05);
    --fill-2:     rgba(255, 255, 255, 0.10);
    --fill-3:     rgba(255, 255, 255, 0.15);
    --accent:     #0a84ff;
    --accent-press: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.28);
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
    --shadow-lg:  0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
input, textarea, select { -webkit-appearance: none; appearance: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-soft); color: var(--text); }

kbd {
  font: 11px/1 -apple-system, "SF Pro Text", monospace;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--fill-1);
  color: var(--text-3);
  border: 0.5px solid var(--hairline);
}

code { font: 12px/1 ui-monospace, "SF Mono", Menlo, monospace; padding: 1px 5px; border-radius: 4px; background: var(--fill-1); color: var(--text-2); }


/* ============================================================================
   LOGIN
   ============================================================================ */

.login {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}
.login__pane { position: absolute; inset: 0; overflow: hidden; z-index: -1; }
.login__halo {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float 22s ease-in-out infinite;
}
.login__halo--1 {
  width: 520px; height: 520px;
  top: -120px; left: -120px;
  background: radial-gradient(circle, #0a84ff, transparent 60%);
}
.login__halo--2 {
  width: 480px; height: 480px;
  bottom: -120px; right: -100px;
  background: radial-gradient(circle, #585df6, transparent 60%);
  animation-delay: -7s;
}
.login__halo--3 {
  width: 380px; height: 380px;
  top: 40%; left: 60%;
  background: radial-gradient(circle, #ff375f, transparent 60%);
  opacity: 0.35;
  animation-delay: -14s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(30px, -20px) scale(1.05); }
  66%      { transform: translate(-20px, 20px) scale(0.97); }
}

.login__card {
  width: min(420px, 100%);
  background: var(--bg-glass-2);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 0.5px solid var(--hairline);
  border-radius: 24px;
  padding: 40px 36px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: cardIn 700ms var(--ease-out) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.login__logo {
  display: inline-grid; place-items: center;
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, #0a84ff, #585df6);
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.2) inset;
  color: white;
}
.login__title {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.login__sub {
  margin: 0 0 28px;
  color: var(--text-2);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.login__form { display: grid; gap: 14px; text-align: left; }
.login__error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  animation: shake 320ms var(--ease-out);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
.login__hint {
  margin: 18px 0 0;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: -0.005em;
}


/* ============================================================================
   FIELDS & BUTTONS
   ============================================================================ */

.field { display: grid; gap: 6px; min-width: 0; }
.field > label,
.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.005em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--r-sm);
  outline: 0;
  transition:
    border-color var(--t-fast) var(--ease-out),
    box-shadow   var(--t-fast) var(--ease-out),
    background   var(--t-fast) var(--ease-out);
}
.field input::placeholder { color: var(--text-3); }
.field input:hover { border-color: var(--fill-3); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  border: 0.5px solid var(--hairline);
  background: var(--fill-1);
  color: var(--text);
  transition:
    transform var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out);
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover  { background: var(--fill-2); border-color: var(--fill-3); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--accent);
  color: white;
  border-color: transparent;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 1px 2px rgba(0, 0, 0, 0.12);
}
.btn--primary:hover  { background: var(--accent-press); }
.btn--primary:active { transform: scale(0.97); }

.btn--ghost   { background: transparent; border-color: var(--hairline); }
.btn--ghost:hover { background: var(--fill-1); }

.btn--danger  { background: var(--danger); color: white; border-color: transparent; }
.btn--danger:hover { background: var(--danger-press); }

.btn--lg   { padding: 12px 20px; font-size: 15px; }
.btn--full { width: 100%; }

.iconbtn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  color: var(--text-2);
  transition:
    background var(--t-fast) var(--ease-out),
    color      var(--t-fast) var(--ease-out),
    transform  var(--t-fast) var(--ease-out);
  cursor: pointer;
}
.iconbtn:hover  { background: var(--fill-1); color: var(--text); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iconbtn--ghost { background: transparent; }


/* ============================================================================
   APP SHELL
   ============================================================================ */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
  height: 100dvh;
  animation: appIn 400ms var(--ease-out) both;
}
@keyframes appIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ----- Sidebar ----- */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 12px 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-right: 0.5px solid var(--hairline);
  position: relative;
  min-height: 0;
}

.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
}
.sidebar__logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0a84ff, #585df6);
  color: white;
  box-shadow: 0 2px 6px rgba(10, 132, 255, 0.35);
}
.sidebar__title {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 14.5px;
}

.sidebar__primary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 1px 2px rgba(0, 0, 0, 0.12);
  transition:
    background var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
  cursor: pointer;
}
.sidebar__primary:hover  { background: var(--accent-press); }
.sidebar__primary:active { transform: scale(0.97); }

.sidebar__nav { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; }
.sidebar__section { display: flex; flex-direction: column; gap: 2px; }
.sidebar__section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 6px 10px 4px;
}

.navbtn {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  text-align: left;
  letter-spacing: -0.01em;
  transition:
    background var(--t-fast) var(--ease-out),
    color      var(--t-fast) var(--ease-out),
    transform  var(--t-fast) var(--ease-out);
  cursor: pointer;
}
.navbtn:hover { background: var(--fill-1); color: var(--text); }
.navbtn:active { transform: scale(0.99); }
.navbtn.is-active {
  background: var(--fill-2);
  color: var(--text);
  font-weight: 600;
}
.navbtn__icon {
  width: 22px; height: 22px;
  display: inline-grid; place-items: center;
  color: var(--text-2);
}
.navbtn.is-active .navbtn__icon { color: var(--accent); }

.sidebar__spacer { flex: 1; min-height: 12px; }

.sidebar__quota { padding: 8px 8px 0; }
.quota__label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.quota__pct { color: var(--text-3); font-variant-numeric: tabular-nums; }
.quota__bar {
  height: 4px;
  background: var(--fill-2);
  border-radius: 999px;
  overflow: hidden;
}
.quota__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0a84ff, #585df6);
  border-radius: 999px;
  transition: width var(--t-slow) var(--ease-out);
}

.sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px 6px;
  border-top: 0.5px solid var(--hairline-2);
  margin-top: 4px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0a84ff, #585df6);
  color: white;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(10, 132, 255, 0.35);
  flex-shrink: 0;
}
.sidebar__userinfo { flex: 1; min-width: 0; line-height: 1.2; }
.sidebar__username {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.sidebar__useremail {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}


/* ----- Main column ----- */

.main {
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--bg);
}


/* Floating topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 0.5px solid var(--hairline);
}
.topbar__left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.topbar__right { display: flex; align-items: center; gap: 8px; }

.crumbs {
  display: flex; align-items: center; gap: 4px;
  min-width: 0; overflow: hidden;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.crumbs .crumb {
  padding: 4px 8px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.crumbs .crumb:hover { background: var(--fill-1); color: var(--text); }
.crumbs .crumb.is-current { color: var(--text); font-weight: 600; cursor: default; }
.crumbs .crumb.is-current:hover { background: transparent; }
.crumbs .sep { color: var(--text-3); user-select: none; padding: 0 2px; }

.search {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 10px;
  background: var(--fill-1);
  border-radius: 8px;
  border: 0.5px solid transparent;
  transition:
    background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
  min-width: 220px;
  color: var(--text-2);
}
.search:hover { background: var(--fill-2); }
.search:focus-within {
  background: var(--bg-elev);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}
.search__icon { color: var(--text-3); flex-shrink: 0; }
.search:focus-within .search__icon { color: var(--accent); }
.search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  font-size: 13px;
  color: var(--text);
}
.search input::placeholder { color: var(--text-3); }
.search__kbd { font-size: 11px; }


/* Selection toolbar — floating capsule that animates in */
.selbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 80px);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  background: var(--bg-glass-2);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--hairline);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t) var(--ease-drawer), opacity var(--t) var(--ease-out);
}
.selbar[hidden] { display: none !important; }
.selbar:not([hidden]) {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.selbar__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.selbar__sep {
  width: 1px; height: 20px;
  background: var(--hairline);
  margin: 0 2px;
}


/* ----- Content ----- */

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}

/* Empty state */
.empty {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 60px 24px;
  color: var(--text-2);
  gap: 8px;
  pointer-events: none;
  animation: emptyIn 500ms var(--ease-out) both;
}
@keyframes emptyIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.empty__art { margin-bottom: 8px; opacity: 0.95; }
.empty__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.empty__sub {
  margin: 0;
  font-size: 14px;
  color: var(--text-3);
  letter-spacing: -0.005em;
  max-width: 360px;
}
.empty__sub strong { color: var(--text-2); font-weight: 600; }


/* ----- File list (iCloud-style rows) ----- */

.list {
  display: flex; flex-direction: column;
  padding: 8px 0;
}
.list__head {
  display: grid;
  grid-template-columns: 36px 28px 1fr 140px 110px 160px 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom: 0.5px solid var(--hairline-2);
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 2;
}

.row {
  display: grid;
  grid-template-columns: 36px 28px 1fr 140px 110px 160px 40px;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 20px;
  border-radius: 0;
  cursor: default;
  user-select: none;
  position: relative;
  transition:
    background var(--t-fast) var(--ease-out);
  animation: rowIn 360ms var(--ease-out) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.row + .row::before {
  content: '';
  position: absolute; left: 64px; right: 16px; top: 0;
  height: 0.5px;
  background: var(--hairline-2);
}
.row:hover { background: var(--fill-1); }
.row.is-selected { background: var(--accent-soft); }
.row.is-selected + .row::before,
.row.is-selected::before { background: transparent; }
.row.is-trash { opacity: 0.7; }

/* Row check bubble */
.row__check {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--text-3);
  background: var(--bg-elev);
  margin: 0 auto;
  display: grid; place-items: center;
  transition: all var(--t-fast) var(--ease-out);
  flex-shrink: 0;
}
.row:hover .row__check { border-color: var(--text-2); }
.row.is-selected .row__check {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}
.row.is-selected .row__check::after {
  content: '';
  width: 8px; height: 4.5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(0.5px, -0.5px);
}

/* Row icon */
.row__icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.18), rgba(88, 93, 246, 0.18));
  color: var(--accent);
  flex-shrink: 0;
}
.row__icon svg { width: 18px; height: 18px; }
.row[data-kind="folder"] .row__icon {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.22), rgba(88, 93, 246, 0.28));
}
.row[data-kind="file"] .row__icon { background: var(--fill-1); color: var(--text-2); }

/* Row name + meta */
.row__name {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.row__name input {
  width: 100%;
  background: var(--bg-elev);
  border: 0;
  border-bottom: 1.5px solid var(--accent);
  border-radius: 0;
  padding: 2px 0;
  font: inherit; font-weight: 500;
  color: var(--text);
  outline: 0;
}
.row__meta {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: -0.005em;
}
.row__size, .row__date {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.row__menu {
  opacity: 0;
}
.row:hover .row__menu,
.row.is-selected .row__menu { opacity: 1; }


/* ----- Admin view ----- */

.admin {
  padding: 24px 28px 48px;
  max-width: 1100px;
  margin: 0 auto;
  animation: rowIn 380ms var(--ease-out) both;
}
.admin__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.admin__title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.admin__sub { margin: 0; color: var(--text-2); font-size: 14px; }
.admin__stats {
  display: flex; gap: 8px;
}
.stat {
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r);
  padding: 10px 14px;
  min-width: 110px;
  box-shadow: var(--shadow-sm);
}
.stat__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.stat__value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat__sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.admin__form {
  display: grid;
  grid-template-columns: 1.4fr 1.8fr 1.4fr 0.8fr auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.admin__form .field { gap: 4px; }
.admin__form > .btn { height: 38px; padding: 0 18px; }

.admin__list {
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin__list-head,
.admin__list .urow {
  display: grid;
  grid-template-columns: 1.6fr 2fr 1fr 1fr 1fr 80px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.admin__list-head {
  background: var(--fill-1);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  border-bottom: 0.5px solid var(--hairline);
}
.urow {
  border-bottom: 0.5px solid var(--hairline-2);
  transition: background var(--t-fast) var(--ease-out);
  animation: rowIn 360ms var(--ease-out) both;
}
.urow:last-child { border-bottom: 0; }
.urow:hover { background: var(--fill-1); }
.urow__name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.urow__name .avatar { width: 28px; height: 28px; font-size: 11px; }
.urow__nametext {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}
.urow__nametext strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.urow__nametext small { font-size: 11px; color: var(--text-3); }

.urow__cell { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.urow__cell--mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.urow__cell--right { text-align: right; }

.bar {
  height: 4px;
  background: var(--fill-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #0a84ff, #585df6);
  border-radius: 999px;
  transition: width var(--t-slow) var(--ease-out);
}

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: -0.005em;
}
.pill--muted { background: var(--fill-2); color: var(--text-2); }
.pill--warn  { background: rgba(255, 159, 10, 0.18); color: var(--warn); }
.pill--danger{ background: rgba(255, 59, 48, 0.18); color: var(--danger); }


/* ============================================================================
   SHEETS (modals) — spring, origin-aware
   ============================================================================ */

.scrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.34);
  display: grid; place-items: center;
  z-index: 50;
  padding: 24px;
  animation: scrimIn var(--t) var(--ease-out) both;
}
.scrim[hidden] { display: none !important; }
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: min(480px, 100%);
  max-height: 80dvh;
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform-origin: var(--transform-origin, 50% 50%);
  animation: sheetIn 360ms var(--ease-out) both;
}
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
.sheet--wide { width: min(640px, 100%); }

.sheet__head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--hairline);
}
.sheet__head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  letter-spacing: -0.01em;
}
.sheet__body { padding: 8px; overflow: auto; flex: 1; min-height: 0; }
.sheet__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px;
  border-top: 0.5px solid var(--hairline);
}


/* Tree in move sheet */
.tree { list-style: none; margin: 0; padding: 0; }
.tree li > .row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  transition: background var(--t-fast) var(--ease-out);
  margin: 0;
}
.tree li > .row::before { display: none; }
.tree li > .row:hover { background: var(--fill-1); }
.tree li > .row.is-active { background: var(--accent-soft); color: var(--text); }
.tree li > .row.is-active .tree__icon { color: var(--accent); }
.tree ul {
  list-style: none; margin: 0;
  padding-left: 18px;
  margin-left: 14px;
  border-left: 0.5px dashed var(--hairline);
}
.tree__icon { color: var(--text-2); display: inline-grid; place-items: center; }
.tree__label { flex: 1; font-size: 13.5px; }
.tree__count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }


/* ============================================================================
   CONTEXT MENU — origin-aware popover
   ============================================================================ */

.ctx {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  background: var(--bg-glass-2);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 5px;
  transform-origin: var(--transform-origin, top left);
  animation: popIn 180ms var(--ease-out) both;
}
.ctx[hidden] { display: none !important; }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.ctx__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.ctx__item:hover { background: var(--accent); color: white; }
.ctx__item:hover .ctx__icon { color: white; }
.ctx__item--danger { color: var(--danger); }
.ctx__item--danger:hover { background: var(--danger); color: white; }
.ctx__icon { width: 16px; height: 16px; display: inline-grid; place-items: center; color: var(--text-2); }
.ctx__kbd { margin-left: auto; font-size: 11px; color: var(--text-3); }
.ctx__sep { height: 0.5px; background: var(--hairline); margin: 4px 6px; }


/* ============================================================================
   POPOVERS (inline dialogs)
   ============================================================================ */

.popover {
  position: absolute;
  z-index: 55;
  width: 280px;
  background: var(--bg-glass-2);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  transform-origin: var(--transform-origin, top center);
  animation: popIn 200ms var(--ease-out) both;
  overflow: hidden;
}
.popover[hidden] { display: none !important; }
.popover__head {
  padding: 10px 14px 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.popover__body { padding: 10px 14px 14px; display: grid; gap: 10px; }
.popover__body input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  background: var(--bg-elev);
  border-radius: 8px;
  outline: 0;
  font-size: 14px;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.popover__body input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.popover__row { display: flex; justify-content: flex-end; gap: 6px; }


/* ============================================================================
   CONFIRM
   ============================================================================ */

.confirm {
  width: min(360px, 100%);
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: 14px;
  padding: 22px 22px 16px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform-origin: var(--transform-origin, 50% 50%);
  animation: sheetIn 280ms var(--ease-out) both;
}
.confirm__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.confirm__body {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.confirm__row { display: flex; justify-content: center; gap: 8px; }


/* ============================================================================
   TOASTS
   ============================================================================ */

.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 100;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--bg-glass-2);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--hairline);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  pointer-events: auto;
  min-width: 200px;
  max-width: 360px;
  animation: toastIn 280ms var(--ease-out) both;
}
.toast--error   { color: white; background: var(--danger); border-color: transparent; }
.toast--success { color: white; background: var(--success); border-color: transparent; }
.toast--warn    { color: white; background: var(--warn); border-color: transparent; }
.toast__icon { display: inline-grid; place-items: center; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.98); }
}
.toast.is-leaving { animation: toastOut 200ms var(--ease-in-out) forwards; }


/* ============================================================================
   DROPZONE
   ============================================================================ */

.dropzone {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  animation: dzIn 220ms var(--ease-out) both;
}
.dropzone[hidden] { display: none !important; }
@keyframes dzIn { from { opacity: 0; } to { opacity: 1; } }
.dropzone__inner {
  display: grid; place-items: center;
  gap: 12px;
  padding: 32px 48px;
  background: var(--bg-glass-2);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 2px dashed var(--accent);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  color: var(--text);
  text-align: center;
}
.dropzone__icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid; place-items: center;
  animation: dzPulse 1.4s ease-in-out infinite;
}
@keyframes dzPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
.dropzone__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.dropzone__sub { color: var(--text-2); font-size: 14px; }


/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 30;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
  }
  .sidebar__brand { flex: 1; }
  .sidebar__primary { display: none; }
  .sidebar__nav { flex-direction: row; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
  .sidebar__section { flex-direction: row; align-items: center; gap: 4px; }
  .sidebar__section-title, .sidebar__quota, .sidebar__spacer { display: none; }
  .sidebar__user { border: 0; padding: 0; margin: 0; }
  .navbtn span:not(.navbtn__icon) { display: none; }
  .topbar { padding: 0 12px; }
  .topbar__right .btn span { display: none; }
  .topbar__right .btn { padding: 8px; }
  .search { min-width: 0; flex: 1; }
  .search__kbd { display: none; }
  .list__head { display: none; }
  .row { grid-template-columns: 28px 1fr 40px; gap: 8px; padding: 8px 12px; }
  .row__meta, .row__size, .row__date { display: none; }
  .admin__form { grid-template-columns: 1fr 1fr; }
  .admin__list-head, .admin__list .urow { grid-template-columns: 1.4fr 1fr 80px; }
  .admin__list .urow__cell--hide-mobile { display: none; }
}

@media (max-width: 520px) {
  .admin__form { grid-template-columns: 1fr; }
}


/* ============================================================================
   REDUCED MOTION
   ============================================================================ */

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